Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
488fa952
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
488fa952
编写于
11月 06, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add log messages for all language features (IntelliSense, formatting etc) fixes #43099
上级
97012b28
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
216 addition
and
183 deletion
+216
-183
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+21
-37
src/vs/workbench/api/node/extHostFileSystem.ts
src/vs/workbench/api/node/extHostFileSystem.ts
+15
-3
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+64
-45
src/vs/workbench/services/extensions/common/extensions.ts
src/vs/workbench/services/extensions/common/extensions.ts
+16
-0
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+24
-23
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+76
-75
未找到文件。
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
488fa952
...
...
@@ -59,7 +59,7 @@ import { ExtHostUrls } from 'vs/workbench/api/node/extHostUrls';
import
{
ExtHostWebviews
}
from
'
vs/workbench/api/node/extHostWebview
'
;
import
{
ExtHostWindow
}
from
'
vs/workbench/api/node/extHostWindow
'
;
import
{
ExtHostWorkspace
}
from
'
vs/workbench/api/node/extHostWorkspace
'
;
import
{
IExtensionDescription
,
throwProposedApiError
,
checkProposedApiEnabled
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
IExtensionDescription
,
throwProposedApiError
,
checkProposedApiEnabled
,
nullExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ProxyIdentifier
}
from
'
vs/workbench/services/extensions/node/proxyIdentifier
'
;
import
*
as
vscode
from
'
vscode
'
;
...
...
@@ -273,64 +273,64 @@ export function createApiFactory(
return
score
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
document
.
uri
,
document
.
languageId
,
true
);
},
registerCodeActionsProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CodeActionProvider
,
metadata
?:
vscode
.
CodeActionProviderMetadata
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerCodeActionProvider
(
checkSelector
(
selector
),
provider
,
extension
,
metadata
);
return
extHostLanguageFeatures
.
registerCodeActionProvider
(
extension
,
checkSelector
(
selector
),
provider
,
metadata
);
},
registerCodeLensProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CodeLensProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerCodeLensProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerCodeLensProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerDefinitionProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DefinitionProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerDefinitionProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerDefinitionProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerImplementationProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
ImplementationProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerImplementationProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerImplementationProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerTypeDefinitionProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
TypeDefinitionProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerTypeDefinitionProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerTypeDefinitionProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerHoverProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
HoverProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerHoverProvider
(
checkSelector
(
selector
),
provider
,
extension
.
id
);
return
extHostLanguageFeatures
.
registerHoverProvider
(
extension
,
checkSelector
(
selector
),
provider
,
extension
.
id
);
},
registerDocumentHighlightProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentHighlightProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerDocumentHighlightProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerDocumentHighlightProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerReferenceProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
ReferenceProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerReferenceProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerReferenceProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerRenameProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
RenameProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerRenameProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerRenameProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerDocumentSymbolProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentSymbolProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerDocumentSymbolProvider
(
checkSelector
(
selector
),
provider
,
extension
);
return
extHostLanguageFeatures
.
registerDocumentSymbolProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerWorkspaceSymbolProvider
(
provider
:
vscode
.
WorkspaceSymbolProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerWorkspaceSymbolProvider
(
provider
);
return
extHostLanguageFeatures
.
registerWorkspaceSymbolProvider
(
extension
,
provider
);
},
registerDocumentFormattingEditProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentFormattingEditProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerDocumentFormattingEditProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerDocumentFormattingEditProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerDocumentRangeFormattingEditProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentRangeFormattingEditProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerDocumentRangeFormattingEditProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerDocumentRangeFormattingEditProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerOnTypeFormattingEditProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
OnTypeFormattingEditProvider
,
firstTriggerCharacter
:
string
,
...
moreTriggerCharacters
:
string
[]):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerOnTypeFormattingEditProvider
(
checkSelector
(
selector
),
provider
,
[
firstTriggerCharacter
].
concat
(
moreTriggerCharacters
));
return
extHostLanguageFeatures
.
registerOnTypeFormattingEditProvider
(
extension
,
checkSelector
(
selector
),
provider
,
[
firstTriggerCharacter
].
concat
(
moreTriggerCharacters
));
},
registerSignatureHelpProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
SignatureHelpProvider
,
firstItem
?:
string
|
vscode
.
SignatureHelpProviderMetadata
,
...
remaining
:
string
[]):
vscode
.
Disposable
{
if
(
typeof
firstItem
===
'
object
'
)
{
return
extHostLanguageFeatures
.
registerSignatureHelpProvider
(
checkSelector
(
selector
),
provider
,
firstItem
);
return
extHostLanguageFeatures
.
registerSignatureHelpProvider
(
extension
,
checkSelector
(
selector
),
provider
,
firstItem
);
}
return
extHostLanguageFeatures
.
registerSignatureHelpProvider
(
checkSelector
(
selector
),
provider
,
typeof
firstItem
===
'
undefined
'
?
[]
:
[
firstItem
,
...
remaining
]);
return
extHostLanguageFeatures
.
registerSignatureHelpProvider
(
extension
,
checkSelector
(
selector
),
provider
,
typeof
firstItem
===
'
undefined
'
?
[]
:
[
firstItem
,
...
remaining
]);
},
registerCompletionItemProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CompletionItemProvider
,
...
triggerCharacters
:
string
[]):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerCompletionItemProvider
(
checkSelector
(
selector
),
provider
,
triggerCharacters
);
return
extHostLanguageFeatures
.
registerCompletionItemProvider
(
extension
,
checkSelector
(
selector
),
provider
,
triggerCharacters
);
},
registerDocumentLinkProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentLinkProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerDocumentLinkProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerDocumentLinkProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerColorProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentColorProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerColorProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerColorProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
registerFoldingRangeProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
FoldingRangeProvider
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerFoldingRangeProvider
(
checkSelector
(
selector
),
provider
);
return
extHostLanguageFeatures
.
registerFoldingRangeProvider
(
extension
,
checkSelector
(
selector
),
provider
);
},
setLanguageConfiguration
:
(
language
:
string
,
configuration
:
vscode
.
LanguageConfiguration
):
vscode
.
Disposable
=>
{
return
extHostLanguageFeatures
.
setLanguageConfiguration
(
language
,
configuration
);
...
...
@@ -872,19 +872,3 @@ function defineAPI(factory: IExtensionApiFactory, extensionPaths: TernarySearchT
return
defaultApiImpl
;
};
}
const
nullExtensionDescription
:
IExtensionDescription
=
{
id
:
'
nullExtensionDescription
'
,
name
:
'
Null Extension Description
'
,
publisher
:
'
vscode
'
,
activationEvents
:
undefined
,
contributes
:
undefined
,
enableProposedApi
:
false
,
engines
:
undefined
,
extensionDependencies
:
undefined
,
extensionLocation
:
undefined
,
isBuiltin
:
false
,
isUnderDevelopment
:
false
,
main
:
undefined
,
version
:
undefined
};
src/vs/workbench/api/node/extHostFileSystem.ts
浏览文件 @
488fa952
...
...
@@ -7,7 +7,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import
{
MainContext
,
IMainContext
,
ExtHostFileSystemShape
,
MainThreadFileSystemShape
,
IFileChangeDto
}
from
'
./extHost.protocol
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
files
from
'
vs/platform/files/common/files
'
;
import
{
IDisposable
,
toDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
toDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
values
}
from
'
vs/base/common/map
'
;
import
{
Range
,
FileChangeType
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
ExtHostLanguageFeatures
}
from
'
vs/workbench/api/node/extHostLanguageFeatures
'
;
...
...
@@ -64,9 +64,10 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
private
readonly
_usedSchemes
=
new
Set
<
string
>
();
private
readonly
_watches
=
new
Map
<
number
,
IDisposable
>
();
private
_linkProviderRegistration
:
IDisposable
;
private
_handlePool
:
number
=
0
;
constructor
(
mainContext
:
IMainContext
,
extHostLanguageFeatures
:
ExtHostLanguageFeatures
)
{
constructor
(
mainContext
:
IMainContext
,
private
_
extHostLanguageFeatures
:
ExtHostLanguageFeatures
)
{
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadFileSystem
);
this
.
_usedSchemes
.
add
(
Schemas
.
file
);
this
.
_usedSchemes
.
add
(
Schemas
.
untitled
);
...
...
@@ -77,8 +78,16 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
this
.
_usedSchemes
.
add
(
Schemas
.
https
);
this
.
_usedSchemes
.
add
(
Schemas
.
mailto
);
this
.
_usedSchemes
.
add
(
Schemas
.
data
);
}
extHostLanguageFeatures
.
registerDocumentLinkProvider
(
'
*
'
,
this
.
_linkProvider
);
dispose
():
void
{
dispose
(
this
.
_linkProviderRegistration
);
}
private
_registerLinkProviderIfNotYetRegistered
():
void
{
if
(
!
this
.
_linkProviderRegistration
)
{
this
.
_linkProviderRegistration
=
this
.
_extHostLanguageFeatures
.
registerDocumentLinkProvider
(
undefined
,
'
*
'
,
this
.
_linkProvider
);
}
}
registerFileSystemProvider
(
scheme
:
string
,
provider
:
vscode
.
FileSystemProvider
,
options
:
{
isCaseSensitive
?:
boolean
,
isReadonly
?:
boolean
}
=
{})
{
...
...
@@ -87,6 +96,9 @@ export class ExtHostFileSystem implements ExtHostFileSystemShape {
throw
new
Error
(
`a provider for the scheme '
${
scheme
}
' is already registered`
);
}
//
this
.
_registerLinkProviderIfNotYetRegistered
();
const
handle
=
this
.
_handlePool
++
;
this
.
_linkProvider
.
add
(
scheme
);
this
.
_usedSchemes
.
add
(
scheme
);
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
488fa952
...
...
@@ -842,6 +842,13 @@ type Adapter = OutlineAdapter | CodeLensAdapter | DefinitionAdapter | HoverAdapt
|
SuggestAdapter
|
SignatureHelpAdapter
|
LinkProviderAdapter
|
ImplementationAdapter
|
TypeDefinitionAdapter
|
ColorProviderAdapter
|
FoldingProviderAdapter
;
class
AdapterData
{
constructor
(
readonly
adapter
:
Adapter
,
readonly
extension
:
IExtensionDescription
|
undefined
)
{
}
}
export
interface
ISchemeTransformer
{
transformOutgoing
(
scheme
:
string
):
string
;
}
...
...
@@ -856,7 +863,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
private
_commands
:
ExtHostCommands
;
private
_heapService
:
ExtHostHeapService
;
private
_diagnostics
:
ExtHostDiagnostics
;
private
_adapter
=
new
Map
<
number
,
Adapter
>
();
private
_adapter
=
new
Map
<
number
,
Adapter
Data
>
();
private
readonly
_logService
:
ILogService
;
constructor
(
...
...
@@ -925,23 +932,35 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
}
private
_withAdapter
<
A
,
R
>
(
handle
:
number
,
ctor
:
{
new
(...
args
:
any
[]):
A
},
callback
:
(
adapter
:
A
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
let
adapter
=
this
.
_adapter
.
get
(
handle
);
if
(
!
(
adapter
instanceof
ctor
))
{
return
Promise
.
reject
(
new
Error
(
'
no adapter found
'
));
let
data
=
this
.
_adapter
.
get
(
handle
);
if
(
data
.
adapter
instanceof
ctor
)
{
let
t1
:
number
;
if
(
data
.
extension
)
{
t1
=
Date
.
now
();
this
.
_logService
.
trace
(
`[
${
data
.
extension
.
id
}
] INVOKE provider '
${(
ctor
as
any
).
name
}
'`
);
}
let
p
=
callback
(
data
.
adapter
);
if
(
data
.
extension
)
{
Promise
.
resolve
(
p
).
then
(
()
=>
this
.
_logService
.
trace
(
`[
${
data
.
extension
.
id
}
] provider DONE after
${
Date
.
now
()
-
t1
}
ms`
),
err
=>
this
.
_logService
.
trace
(
`[
${
data
.
extension
.
id
}
] provider FAILED`
,
err
)
);
}
return
p
;
}
return
callback
(
<
any
>
adapter
);
return
Promise
.
reject
(
new
Error
(
'
no adapter found
'
)
);
}
private
_addNewAdapter
(
adapter
:
Adapter
):
number
{
private
_addNewAdapter
(
adapter
:
Adapter
,
extension
:
IExtensionDescription
):
number
{
const
handle
=
this
.
_nextHandle
();
this
.
_adapter
.
set
(
handle
,
adapter
);
this
.
_adapter
.
set
(
handle
,
new
AdapterData
(
adapter
,
extension
)
);
return
handle
;
}
// --- outline
registerDocumentSymbolProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentSymbolProvider
,
extension
?:
IExtensionDescription
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
OutlineAdapter
(
this
.
_documents
,
provider
));
registerDocumentSymbolProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentSymbolProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
OutlineAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerOutlineSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
extension
?
extension
.
displayName
||
extension
.
name
:
undefined
);
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -952,11 +971,11 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- code lens
registerCodeLensProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CodeLensProvider
):
vscode
.
Disposable
{
registerCodeLensProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CodeLensProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_nextHandle
();
const
eventHandle
=
typeof
provider
.
onDidChangeCodeLenses
===
'
function
'
?
this
.
_nextHandle
()
:
undefined
;
this
.
_adapter
.
set
(
handle
,
new
CodeLensAdapter
(
this
.
_documents
,
this
.
_commands
.
converter
,
this
.
_heapService
,
provider
));
this
.
_adapter
.
set
(
handle
,
new
AdapterData
(
new
CodeLensAdapter
(
this
.
_documents
,
this
.
_commands
.
converter
,
this
.
_heapService
,
provider
),
extension
));
this
.
_proxy
.
$registerCodeLensSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
eventHandle
);
let
result
=
this
.
_createDisposable
(
handle
);
...
...
@@ -978,8 +997,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- declaration
registerDefinitionProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DefinitionProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
DefinitionAdapter
(
this
.
_documents
,
provider
));
registerDefinitionProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DefinitionProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
DefinitionAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerDeclaractionSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -988,8 +1007,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_withAdapter
(
handle
,
DefinitionAdapter
,
adapter
=>
adapter
.
provideDefinition
(
URI
.
revive
(
resource
),
position
,
token
));
}
registerImplementationProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
ImplementationProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
ImplementationAdapter
(
this
.
_documents
,
provider
));
registerImplementationProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
ImplementationProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
ImplementationAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerImplementationSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -998,8 +1017,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_withAdapter
(
handle
,
ImplementationAdapter
,
adapter
=>
adapter
.
provideImplementation
(
URI
.
revive
(
resource
),
position
,
token
));
}
registerTypeDefinitionProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
TypeDefinitionProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
TypeDefinitionAdapter
(
this
.
_documents
,
provider
));
registerTypeDefinitionProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
TypeDefinitionProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
TypeDefinitionAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerTypeDefinitionSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1010,8 +1029,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- extra info
registerHoverProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
HoverProvider
,
extensionId
?:
string
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
HoverAdapter
(
this
.
_documents
,
provider
));
registerHoverProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
HoverProvider
,
extensionId
?:
string
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
HoverAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerHoverProvider
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1022,8 +1041,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- occurrences
registerDocumentHighlightProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentHighlightProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
DocumentHighlightAdapter
(
this
.
_documents
,
provider
));
registerDocumentHighlightProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentHighlightProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
DocumentHighlightAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerDocumentHighlightProvider
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1034,8 +1053,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- references
registerReferenceProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
ReferenceProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
ReferenceAdapter
(
this
.
_documents
,
provider
));
registerReferenceProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
ReferenceProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
ReferenceAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerReferenceSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1046,8 +1065,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- quick fix
registerCodeActionProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CodeActionProvider
,
extension
?:
IExtensionDescription
,
metadata
?:
vscode
.
CodeActionProviderMetadata
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
CodeActionAdapter
(
this
.
_documents
,
this
.
_commands
.
converter
,
this
.
_diagnostics
,
provider
,
this
.
_logService
,
extension
?
extension
.
id
:
''
)
);
registerCodeActionProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CodeActionProvider
,
metadata
?:
vscode
.
CodeActionProviderMetadata
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
CodeActionAdapter
(
this
.
_documents
,
this
.
_commands
.
converter
,
this
.
_diagnostics
,
provider
,
this
.
_logService
,
extension
.
id
),
extension
);
this
.
_proxy
.
$registerQuickFixSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
metadata
&&
metadata
.
providedCodeActionKinds
?
metadata
.
providedCodeActionKinds
.
map
(
kind
=>
kind
.
value
)
:
undefined
);
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1059,8 +1078,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- formatting
registerDocumentFormattingEditProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentFormattingEditProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
DocumentFormattingAdapter
(
this
.
_documents
,
provider
));
registerDocumentFormattingEditProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentFormattingEditProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
DocumentFormattingAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerDocumentFormattingSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1069,8 +1088,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_withAdapter
(
handle
,
DocumentFormattingAdapter
,
adapter
=>
adapter
.
provideDocumentFormattingEdits
(
URI
.
revive
(
resource
),
options
,
token
));
}
registerDocumentRangeFormattingEditProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentRangeFormattingEditProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
RangeFormattingAdapter
(
this
.
_documents
,
provider
));
registerDocumentRangeFormattingEditProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentRangeFormattingEditProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
RangeFormattingAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerRangeFormattingSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1079,8 +1098,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_withAdapter
(
handle
,
RangeFormattingAdapter
,
adapter
=>
adapter
.
provideDocumentRangeFormattingEdits
(
URI
.
revive
(
resource
),
range
,
options
,
token
));
}
registerOnTypeFormattingEditProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
OnTypeFormattingEditProvider
,
triggerCharacters
:
string
[]):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
OnTypeFormattingAdapter
(
this
.
_documents
,
provider
));
registerOnTypeFormattingEditProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
OnTypeFormattingEditProvider
,
triggerCharacters
:
string
[]):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
OnTypeFormattingAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerOnTypeFormattingSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
triggerCharacters
);
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1091,8 +1110,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- navigate types
registerWorkspaceSymbolProvider
(
provider
:
vscode
.
WorkspaceSymbolProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
NavigateTypeAdapter
(
provider
));
registerWorkspaceSymbolProvider
(
extension
:
IExtensionDescription
,
provider
:
vscode
.
WorkspaceSymbolProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
NavigateTypeAdapter
(
provider
)
,
extension
);
this
.
_proxy
.
$registerNavigateTypeSupport
(
handle
);
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1111,8 +1130,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- rename
registerRenameProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
RenameProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
RenameAdapter
(
this
.
_documents
,
provider
));
registerRenameProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
RenameProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
RenameAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerRenameSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
RenameAdapter
.
supportsResolving
(
provider
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1127,8 +1146,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- suggestion
registerCompletionItemProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CompletionItemProvider
,
triggerCharacters
:
string
[]):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
SuggestAdapter
(
this
.
_documents
,
this
.
_commands
.
converter
,
provider
));
registerCompletionItemProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CompletionItemProvider
,
triggerCharacters
:
string
[]):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
SuggestAdapter
(
this
.
_documents
,
this
.
_commands
.
converter
,
provider
)
,
extension
);
this
.
_proxy
.
$registerSuggestSupport
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
triggerCharacters
,
SuggestAdapter
.
supportsResolving
(
provider
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1147,12 +1166,12 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- parameter hints
registerSignatureHelpProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
SignatureHelpProvider
,
metadataOrTriggerChars
?:
string
[]
|
vscode
.
SignatureHelpProviderMetadata
):
vscode
.
Disposable
{
registerSignatureHelpProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
SignatureHelpProvider
,
metadataOrTriggerChars
?:
string
[]
|
vscode
.
SignatureHelpProviderMetadata
):
vscode
.
Disposable
{
const
metadata
:
ISerializedSignatureHelpProviderMetadata
=
Array
.
isArray
(
metadataOrTriggerChars
)
?
{
triggerCharacters
:
metadataOrTriggerChars
,
retriggerCharacters
:
[]
}
:
metadataOrTriggerChars
;
const
handle
=
this
.
_addNewAdapter
(
new
SignatureHelpAdapter
(
this
.
_documents
,
provider
));
const
handle
=
this
.
_addNewAdapter
(
new
SignatureHelpAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerSignatureHelpProvider
(
handle
,
this
.
_transformDocumentSelector
(
selector
),
metadata
);
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1163,8 +1182,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
// --- links
registerDocumentLinkProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentLinkProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
LinkProviderAdapter
(
this
.
_documents
,
this
.
_heapService
,
provider
));
registerDocumentLinkProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentLinkProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
LinkProviderAdapter
(
this
.
_documents
,
this
.
_heapService
,
provider
)
,
extension
);
this
.
_proxy
.
$registerDocumentLinkProvider
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1177,8 +1196,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_withAdapter
(
handle
,
LinkProviderAdapter
,
adapter
=>
adapter
.
resolveLink
(
link
,
token
));
}
registerColorProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentColorProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
ColorProviderAdapter
(
this
.
_documents
,
provider
));
registerColorProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentColorProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
ColorProviderAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerDocumentColorProvider
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
@@ -1191,8 +1210,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_withAdapter
(
handle
,
ColorProviderAdapter
,
adapter
=>
adapter
.
provideColorPresentations
(
URI
.
revive
(
resource
),
colorInfo
,
token
));
}
registerFoldingRangeProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
FoldingRangeProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
FoldingProviderAdapter
(
this
.
_documents
,
provider
));
registerFoldingRangeProvider
(
extension
:
IExtensionDescription
,
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
FoldingRangeProvider
):
vscode
.
Disposable
{
const
handle
=
this
.
_addNewAdapter
(
new
FoldingProviderAdapter
(
this
.
_documents
,
provider
)
,
extension
);
this
.
_proxy
.
$registerFoldingRangeProvider
(
handle
,
this
.
_transformDocumentSelector
(
selector
));
return
this
.
_createDisposable
(
handle
);
}
...
...
src/vs/workbench/services/extensions/common/extensions.ts
浏览文件 @
488fa952
...
...
@@ -34,6 +34,22 @@ export interface IExtensionDescription {
enableProposedApi
?:
boolean
;
}
export
const
nullExtensionDescription
:
IExtensionDescription
=
Object
.
freeze
({
id
:
'
nullExtensionDescription
'
,
name
:
'
Null Extension Description
'
,
publisher
:
'
vscode
'
,
activationEvents
:
undefined
,
contributes
:
undefined
,
enableProposedApi
:
false
,
engines
:
undefined
,
extensionDependencies
:
undefined
,
extensionLocation
:
undefined
,
isBuiltin
:
false
,
isUnderDevelopment
:
false
,
main
:
undefined
,
version
:
undefined
});
export
const
IExtensionService
=
createDecorator
<
IExtensionService
>
(
'
extensionService
'
);
export
interface
IMessage
{
...
...
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
488fa952
...
...
@@ -30,6 +30,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import
'
vs/workbench/parts/search/electron-browser/search.contribution
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
nullExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
const
defaultSelector
=
{
scheme
:
'
far
'
};
const
model
:
ITextModel
=
EditorModel
.
createFromString
(
...
...
@@ -158,7 +159,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
WorkspaceSymbols, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerWorkspaceSymbolProvider
(
<
vscode
.
WorkspaceSymbolProvider
>
{
disposables
.
push
(
extHost
.
registerWorkspaceSymbolProvider
(
nullExtensionDescription
,
<
vscode
.
WorkspaceSymbolProvider
>
{
provideWorkspaceSymbols
(
query
):
any
{
return
[
new
types
.
SymbolInformation
(
query
,
types
.
SymbolKind
.
Array
,
new
types
.
Range
(
0
,
0
,
1
,
1
),
URI
.
parse
(
'
far://testing/first
'
)),
...
...
@@ -167,7 +168,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
}
}));
disposables
.
push
(
extHost
.
registerWorkspaceSymbolProvider
(
<
vscode
.
WorkspaceSymbolProvider
>
{
disposables
.
push
(
extHost
.
registerWorkspaceSymbolProvider
(
nullExtensionDescription
,
<
vscode
.
WorkspaceSymbolProvider
>
{
provideWorkspaceSymbols
(
query
):
any
{
return
[
new
types
.
SymbolInformation
(
query
,
types
.
SymbolKind
.
Array
,
new
types
.
Range
(
0
,
0
,
1
,
1
),
URI
.
parse
(
'
far://testing/first
'
))
...
...
@@ -190,7 +191,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
executeWorkspaceSymbolProvider should accept empty string, #39522
'
,
async
function
()
{
disposables
.
push
(
extHost
.
registerWorkspaceSymbolProvider
({
disposables
.
push
(
extHost
.
registerWorkspaceSymbolProvider
(
nullExtensionDescription
,
{
provideWorkspaceSymbols
(
query
)
{
return
[
new
types
.
SymbolInformation
(
'
hello
'
,
types
.
SymbolKind
.
Array
,
new
types
.
Range
(
0
,
0
,
0
,
0
),
URI
.
parse
(
'
foo:bar
'
))];
}
...
...
@@ -220,12 +221,12 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
Definition, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerDefinitionProvider
(
defaultSelector
,
<
vscode
.
DefinitionProvider
>
{
disposables
.
push
(
extHost
.
registerDefinitionProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
DefinitionProvider
>
{
provideDefinition
(
doc
:
any
):
any
{
return
new
types
.
Location
(
doc
.
uri
,
new
types
.
Range
(
0
,
0
,
0
,
0
));
}
}));
disposables
.
push
(
extHost
.
registerDefinitionProvider
(
defaultSelector
,
<
vscode
.
DefinitionProvider
>
{
disposables
.
push
(
extHost
.
registerDefinitionProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
DefinitionProvider
>
{
provideDefinition
(
doc
:
any
):
any
{
return
[
new
types
.
Location
(
doc
.
uri
,
new
types
.
Range
(
0
,
0
,
0
,
0
)),
...
...
@@ -261,12 +262,12 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
Type Definition, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerTypeDefinitionProvider
(
defaultSelector
,
<
vscode
.
TypeDefinitionProvider
>
{
disposables
.
push
(
extHost
.
registerTypeDefinitionProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
TypeDefinitionProvider
>
{
provideTypeDefinition
(
doc
:
any
):
any
{
return
new
types
.
Location
(
doc
.
uri
,
new
types
.
Range
(
0
,
0
,
0
,
0
));
}
}));
disposables
.
push
(
extHost
.
registerTypeDefinitionProvider
(
defaultSelector
,
<
vscode
.
TypeDefinitionProvider
>
{
disposables
.
push
(
extHost
.
registerTypeDefinitionProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
TypeDefinitionProvider
>
{
provideTypeDefinition
(
doc
:
any
):
any
{
return
[
new
types
.
Location
(
doc
.
uri
,
new
types
.
Range
(
0
,
0
,
0
,
0
)),
...
...
@@ -291,7 +292,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
reference search, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerReferenceProvider
(
defaultSelector
,
<
vscode
.
ReferenceProvider
>
{
disposables
.
push
(
extHost
.
registerReferenceProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
ReferenceProvider
>
{
provideReferences
(
doc
:
any
)
{
return
[
new
types
.
Location
(
URI
.
parse
(
'
some:uri/path
'
),
new
types
.
Range
(
0
,
1
,
0
,
5
))
...
...
@@ -313,7 +314,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
// --- outline
test
(
'
Outline, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerDocumentSymbolProvider
(
defaultSelector
,
<
vscode
.
DocumentSymbolProvider
>
{
disposables
.
push
(
extHost
.
registerDocumentSymbolProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
DocumentSymbolProvider
>
{
provideDocumentSymbols
():
any
{
return
[
new
types
.
SymbolInformation
(
'
testing1
'
,
types
.
SymbolKind
.
Enum
,
new
types
.
Range
(
1
,
0
,
1
,
0
)),
...
...
@@ -335,14 +336,14 @@ suite('ExtHostLanguageFeatureCommands', function () {
});
test
(
'
vscode.executeDocumentSymbolProvider command only returns SymbolInformation[] rather than DocumentSymbol[] #57984
'
,
function
()
{
disposables
.
push
(
extHost
.
registerDocumentSymbolProvider
(
defaultSelector
,
<
vscode
.
DocumentSymbolProvider
>
{
disposables
.
push
(
extHost
.
registerDocumentSymbolProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
DocumentSymbolProvider
>
{
provideDocumentSymbols
():
any
{
return
[
new
types
.
SymbolInformation
(
'
SymbolInformation
'
,
types
.
SymbolKind
.
Enum
,
new
types
.
Range
(
1
,
0
,
1
,
0
))
];
}
}));
disposables
.
push
(
extHost
.
registerDocumentSymbolProvider
(
defaultSelector
,
<
vscode
.
DocumentSymbolProvider
>
{
disposables
.
push
(
extHost
.
registerDocumentSymbolProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
DocumentSymbolProvider
>
{
provideDocumentSymbols
():
any
{
let
root
=
new
types
.
DocumentSymbol
(
'
DocumentSymbol
'
,
'
DocumentSymbol#detail
'
,
types
.
SymbolKind
.
Enum
,
new
types
.
Range
(
1
,
0
,
1
,
0
),
new
types
.
Range
(
1
,
0
,
1
,
0
));
root
.
children
=
[
new
types
.
DocumentSymbol
(
'
DocumentSymbol#child
'
,
'
DocumentSymbol#detail#child
'
,
types
.
SymbolKind
.
Enum
,
new
types
.
Range
(
1
,
0
,
1
,
0
),
new
types
.
Range
(
1
,
0
,
1
,
0
))];
...
...
@@ -367,7 +368,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
// --- suggest
test
(
'
Suggest, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
provideCompletionItems
(
doc
,
pos
):
any
{
let
a
=
new
types
.
CompletionItem
(
'
item1
'
);
let
b
=
new
types
.
CompletionItem
(
'
item2
'
);
...
...
@@ -425,7 +426,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
});
test
(
'
Suggest, return CompletionList !array
'
,
function
()
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
provideCompletionItems
():
any
{
let
a
=
new
types
.
CompletionItem
(
'
item1
'
);
let
b
=
new
types
.
CompletionItem
(
'
item2
'
);
...
...
@@ -445,7 +446,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
let
resolveCount
=
0
;
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
provideCompletionItems
():
any
{
let
a
=
new
types
.
CompletionItem
(
'
item1
'
);
let
b
=
new
types
.
CompletionItem
(
'
item2
'
);
...
...
@@ -475,7 +476,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
});
test
(
'
"vscode.executeCompletionItemProvider" doesnot return a preselect field #53749
'
,
async
function
()
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
provideCompletionItems
():
any
{
let
a
=
new
types
.
CompletionItem
(
'
item1
'
);
a
.
preselect
=
true
;
...
...
@@ -507,7 +508,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
});
test
(
'
executeCompletionItemProvider doesn
\'
t capture commitCharacters #58228
'
,
async
function
()
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
disposables
.
push
(
extHost
.
registerCompletionItemProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CompletionItemProvider
>
{
provideCompletionItems
():
any
{
let
a
=
new
types
.
CompletionItem
(
'
item1
'
);
a
.
commitCharacters
=
[
'
a
'
,
'
b
'
];
...
...
@@ -536,7 +537,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
// --- quickfix
test
(
'
QuickFix, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerCodeActionProvider
(
defaultSelector
,
{
disposables
.
push
(
extHost
.
registerCodeActionProvider
(
nullExtensionDescription
,
defaultSelector
,
{
provideCodeActions
():
vscode
.
Command
[]
{
return
[{
command
:
'
testing
'
,
title
:
'
Title
'
,
arguments
:
[
1
,
2
,
true
]
}];
}
...
...
@@ -554,7 +555,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
});
test
(
'
vscode.executeCodeActionProvider results seem to be missing their `command` property #45124
'
,
function
()
{
disposables
.
push
(
extHost
.
registerCodeActionProvider
(
defaultSelector
,
{
disposables
.
push
(
extHost
.
registerCodeActionProvider
(
nullExtensionDescription
,
defaultSelector
,
{
provideCodeActions
(
document
,
range
):
vscode
.
CodeAction
[]
{
return
[{
command
:
{
...
...
@@ -592,7 +593,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
big
:
extHost
};
disposables
.
push
(
extHost
.
registerCodeLensProvider
(
defaultSelector
,
<
vscode
.
CodeLensProvider
>
{
disposables
.
push
(
extHost
.
registerCodeLensProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CodeLensProvider
>
{
provideCodeLenses
():
any
{
return
[
new
types
.
CodeLens
(
new
types
.
Range
(
0
,
0
,
1
,
1
),
{
title
:
'
Title
'
,
command
:
'
cmd
'
,
arguments
:
[
1
,
true
,
complexArg
]
})];
}
...
...
@@ -616,7 +617,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
let
resolveCount
=
0
;
disposables
.
push
(
extHost
.
registerCodeLensProvider
(
defaultSelector
,
<
vscode
.
CodeLensProvider
>
{
disposables
.
push
(
extHost
.
registerCodeLensProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
CodeLensProvider
>
{
provideCodeLenses
():
any
{
return
[
new
types
.
CodeLens
(
new
types
.
Range
(
0
,
0
,
1
,
1
)),
...
...
@@ -648,7 +649,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
Links, back and forth
'
,
function
()
{
disposables
.
push
(
extHost
.
registerDocumentLinkProvider
(
defaultSelector
,
<
vscode
.
DocumentLinkProvider
>
{
disposables
.
push
(
extHost
.
registerDocumentLinkProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
DocumentLinkProvider
>
{
provideDocumentLinks
():
any
{
return
[
new
types
.
DocumentLink
(
new
types
.
Range
(
0
,
0
,
0
,
20
),
URI
.
parse
(
'
foo:bar
'
))];
}
...
...
@@ -671,7 +672,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
Color provider
'
,
function
()
{
disposables
.
push
(
extHost
.
registerColorProvider
(
defaultSelector
,
<
vscode
.
DocumentColorProvider
>
{
disposables
.
push
(
extHost
.
registerColorProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
DocumentColorProvider
>
{
provideDocumentColors
():
vscode
.
ColorInformation
[]
{
return
[
new
types
.
ColorInformation
(
new
types
.
Range
(
0
,
0
,
0
,
20
),
new
types
.
Color
(
0.1
,
0.2
,
0.3
,
0.4
))];
},
...
...
@@ -721,7 +722,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test
(
'
"TypeError: e.onCancellationRequested is not a function" calling hover provider in Insiders #54174
'
,
function
()
{
disposables
.
push
(
extHost
.
registerHoverProvider
(
defaultSelector
,
<
vscode
.
HoverProvider
>
{
disposables
.
push
(
extHost
.
registerHoverProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
HoverProvider
>
{
provideHover
():
any
{
return
new
types
.
Hover
(
'
fofofofo
'
);
}
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
488fa952
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录