Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
efd8f4a4
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,发现更多精彩内容 >>
提交
efd8f4a4
编写于
9月 04, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt CancellationToken in ExtHostLanguageFeaturesShape
上级
fa5922bd
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
164 addition
and
171 deletion
+164
-171
src/vs/base/common/async.ts
src/vs/base/common/async.ts
+11
-5
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
...kbench/api/electron-browser/mainThreadLanguageFeatures.ts
+25
-28
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+24
-24
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+104
-114
未找到文件。
src/vs/base/common/async.ts
浏览文件 @
efd8f4a4
...
...
@@ -87,11 +87,17 @@ export function asWinJsPromise<T>(callback: (token: CancellationToken) => T | TP
});
}
export
function
asThenable
<
T
>
(
item
:
T
|
TPromise
<
T
>
|
Thenable
<
T
>
):
Thenable
<
T
>
{
if
(
item
instanceof
TPromise
||
isThenable
<
T
>
(
item
))
{
return
item
;
export
function
asThenable
<
T
>
(
callback
:
()
=>
T
|
TPromise
<
T
>
|
Thenable
<
T
>
):
Thenable
<
T
>
{
return
new
TPromise
<
T
>
((
resolve
,
reject
)
=>
{
let
item
=
callback
();
if
(
item
instanceof
TPromise
)
{
item
.
then
(
resolve
,
reject
);
}
else
if
(
isThenable
<
T
>
(
item
))
{
item
.
then
(
resolve
,
reject
);
}
else
{
resolve
(
item
);
}
return
TPromise
.
wrap
(
item
);
},
()
=>
{
/* not supported */
}
);
}
/**
...
...
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
浏览文件 @
efd8f4a4
...
...
@@ -9,7 +9,6 @@ import { Emitter } from 'vs/base/common/event';
import
{
ITextModel
,
ISingleEditOperation
}
from
'
vs/editor/common/model
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
*
as
search
from
'
vs/workbench/parts/search/common/search
'
;
import
{
wireCancellationToken
}
from
'
vs/base/common/async
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
Position
as
EditorPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
Range
as
EditorRange
}
from
'
vs/editor/common/core/range
'
;
...
...
@@ -114,7 +113,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
this
.
_registrations
[
handle
]
=
modes
.
DocumentSymbolProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DocumentSymbolProvider
>
{
displayName
,
provideDocumentSymbols
:
(
model
:
ITextModel
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentSymbol
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentSymbols
(
handle
,
model
.
uri
)
);
return
this
.
_proxy
.
$provideDocumentSymbols
(
handle
,
model
.
uri
,
token
);
}
});
}
...
...
@@ -125,10 +124,10 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
const
provider
=
<
modes
.
CodeLensProvider
>
{
provideCodeLenses
:
(
model
:
ITextModel
,
token
:
CancellationToken
):
modes
.
ICodeLensSymbol
[]
|
Thenable
<
modes
.
ICodeLensSymbol
[]
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCodeLenses
(
handle
,
model
.
uri
)
));
return
this
.
_heapService
.
trackRecursive
(
this
.
_proxy
.
$provideCodeLenses
(
handle
,
model
.
uri
,
token
));
},
resolveCodeLens
:
(
model
:
ITextModel
,
codeLens
:
modes
.
ICodeLensSymbol
,
token
:
CancellationToken
):
modes
.
ICodeLensSymbol
|
Thenable
<
modes
.
ICodeLensSymbol
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$resolveCodeLens
(
handle
,
model
.
uri
,
codeLens
)
));
return
this
.
_heapService
.
trackRecursive
(
this
.
_proxy
.
$resolveCodeLens
(
handle
,
model
.
uri
,
codeLens
,
token
));
}
};
...
...
@@ -153,7 +152,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDeclaractionSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DefinitionProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DefinitionProvider
>
{
provideDefinition
:
(
model
,
position
,
token
):
Thenable
<
modes
.
DefinitionLink
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDefinition
(
handle
,
model
.
uri
,
position
)
).
then
(
MainThreadLanguageFeatures
.
_reviveDefinitionLinkDto
);
return
this
.
_proxy
.
$provideDefinition
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_reviveDefinitionLinkDto
);
}
});
}
...
...
@@ -161,7 +160,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerImplementationSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
ImplementationProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
ImplementationProvider
>
{
provideImplementation
:
(
model
,
position
,
token
):
Thenable
<
modes
.
Definition
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideImplementation
(
handle
,
model
.
uri
,
position
)
).
then
(
MainThreadLanguageFeatures
.
_reviveDefinitionLinkDto
);
return
this
.
_proxy
.
$provideImplementation
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_reviveDefinitionLinkDto
);
}
});
}
...
...
@@ -169,7 +168,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerTypeDefinitionSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
TypeDefinitionProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
TypeDefinitionProvider
>
{
provideTypeDefinition
:
(
model
,
position
,
token
):
Thenable
<
modes
.
Definition
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideTypeDefinition
(
handle
,
model
.
uri
,
position
)
).
then
(
MainThreadLanguageFeatures
.
_reviveDefinitionLinkDto
);
return
this
.
_proxy
.
$provideTypeDefinition
(
handle
,
model
.
uri
,
position
,
token
).
then
(
MainThreadLanguageFeatures
.
_reviveDefinitionLinkDto
);
}
});
}
...
...
@@ -189,7 +188,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDocumentHighlightProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentHighlightProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DocumentHighlightProvider
>
{
provideDocumentHighlights
:
(
model
:
ITextModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
DocumentHighlight
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentHighlights
(
handle
,
model
.
uri
,
position
)
);
return
this
.
_proxy
.
$provideDocumentHighlights
(
handle
,
model
.
uri
,
position
,
token
);
}
});
}
...
...
@@ -199,7 +198,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerReferenceSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
ReferenceProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
ReferenceProvider
>
{
provideReferences
:
(
model
:
ITextModel
,
position
:
EditorPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
Location
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideReferences
(
handle
,
model
.
uri
,
position
,
context
)
).
then
(
MainThreadLanguageFeatures
.
_reviveLocationDto
);
return
this
.
_proxy
.
$provideReferences
(
handle
,
model
.
uri
,
position
,
context
,
token
).
then
(
MainThreadLanguageFeatures
.
_reviveLocationDto
);
}
});
}
...
...
@@ -209,7 +208,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerQuickFixSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[],
providedCodeActionKinds
?:
string
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
CodeActionProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
CodeActionProvider
>
{
provideCodeActions
:
(
model
:
ITextModel
,
rangeOrSelection
:
EditorRange
|
Selection
,
context
:
modes
.
CodeActionContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
CodeAction
[]
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCodeActions
(
handle
,
model
.
uri
,
rangeOrSelection
,
context
)
)).
then
(
MainThreadLanguageFeatures
.
_reviveCodeActionDto
);
return
this
.
_heapService
.
trackRecursive
(
this
.
_proxy
.
$provideCodeActions
(
handle
,
model
.
uri
,
rangeOrSelection
,
context
,
token
)).
then
(
MainThreadLanguageFeatures
.
_reviveCodeActionDto
);
},
providedCodeActionKinds
});
...
...
@@ -220,7 +219,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDocumentFormattingSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentFormattingEditProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DocumentFormattingEditProvider
>
{
provideDocumentFormattingEdits
:
(
model
:
ITextModel
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentFormattingEdits
(
handle
,
model
.
uri
,
options
)
);
return
this
.
_proxy
.
$provideDocumentFormattingEdits
(
handle
,
model
.
uri
,
options
,
token
);
}
});
}
...
...
@@ -228,7 +227,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerRangeFormattingSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentRangeFormattingEditProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DocumentRangeFormattingEditProvider
>
{
provideDocumentRangeFormattingEdits
:
(
model
:
ITextModel
,
range
:
EditorRange
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentRangeFormattingEdits
(
handle
,
model
.
uri
,
range
,
options
)
);
return
this
.
_proxy
.
$provideDocumentRangeFormattingEdits
(
handle
,
model
.
uri
,
range
,
options
,
token
);
}
});
}
...
...
@@ -239,7 +238,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
autoFormatTriggerCharacters
,
provideOnTypeFormattingEdits
:
(
model
:
ITextModel
,
position
:
EditorPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenable
<
ISingleEditOperation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideOnTypeFormattingEdits
(
handle
,
model
.
uri
,
position
,
ch
,
options
)
);
return
this
.
_proxy
.
$provideOnTypeFormattingEdits
(
handle
,
model
.
uri
,
position
,
ch
,
options
,
token
);
}
});
}
...
...
@@ -250,18 +249,16 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
let
lastResultId
:
number
;
this
.
_registrations
[
handle
]
=
search
.
WorkspaceSymbolProviderRegistry
.
register
(
<
search
.
IWorkspaceSymbolProvider
>
{
provideWorkspaceSymbols
:
(
search
:
string
,
token
:
CancellationToken
):
Thenable
<
search
.
IWorkspaceSymbol
[]
>
=>
{
let
promise
=
this
.
_proxy
.
$provideWorkspaceSymbols
(
handle
,
search
).
then
(
result
=>
{
return
this
.
_proxy
.
$provideWorkspaceSymbols
(
handle
,
search
,
token
).
then
(
result
=>
{
if
(
lastResultId
!==
undefined
)
{
this
.
_proxy
.
$releaseWorkspaceSymbols
(
handle
,
lastResultId
);
}
lastResultId
=
result
.
_id
;
return
MainThreadLanguageFeatures
.
_reviveWorkspaceSymbolDto
(
result
.
symbols
);
});
return
wireCancellationToken
(
token
,
promise
);
},
resolveWorkspaceSymbol
:
(
item
:
search
.
IWorkspaceSymbol
,
token
:
CancellationToken
):
Thenable
<
search
.
IWorkspaceSymbol
>
=>
{
let
promise
=
this
.
_proxy
.
$resolveWorkspaceSymbol
(
handle
,
item
).
then
(
i
=>
MainThreadLanguageFeatures
.
_reviveWorkspaceSymbolDto
(
i
));
return
wireCancellationToken
(
token
,
promise
);
return
this
.
_proxy
.
$resolveWorkspaceSymbol
(
handle
,
item
,
token
).
then
(
i
=>
MainThreadLanguageFeatures
.
_reviveWorkspaceSymbolDto
(
i
));
}
});
}
...
...
@@ -272,10 +269,10 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
this
.
_registrations
[
handle
]
=
modes
.
RenameProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
RenameProvider
>
{
provideRenameEdits
:
(
model
:
ITextModel
,
position
:
EditorPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenable
<
modes
.
WorkspaceEdit
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideRenameEdits
(
handle
,
model
.
uri
,
position
,
newName
)
).
then
(
reviveWorkspaceEditDto
);
return
this
.
_proxy
.
$provideRenameEdits
(
handle
,
model
.
uri
,
position
,
newName
,
token
).
then
(
reviveWorkspaceEditDto
);
},
resolveRenameLocation
:
supportResolveLocation
?
(
model
:
ITextModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
RenameLocation
>
=>
wireCancellationToken
(
token
,
this
.
_proxy
.
$resolveRenameLocation
(
handle
,
model
.
uri
,
position
)
)
?
(
model
:
ITextModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
RenameLocation
>
=>
this
.
_proxy
.
$resolveRenameLocation
(
handle
,
model
.
uri
,
position
,
token
)
:
undefined
});
}
...
...
@@ -286,7 +283,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
this
.
_registrations
[
handle
]
=
modes
.
SuggestRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
ISuggestSupport
>
{
triggerCharacters
,
provideCompletionItems
:
(
model
:
ITextModel
,
position
:
EditorPosition
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
ISuggestResult
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCompletionItems
(
handle
,
model
.
uri
,
position
,
context
)
).
then
(
result
=>
{
return
this
.
_proxy
.
$provideCompletionItems
(
handle
,
model
.
uri
,
position
,
context
,
token
).
then
(
result
=>
{
if
(
!
result
)
{
return
result
;
}
...
...
@@ -298,7 +295,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
});
},
resolveCompletionItem
:
supportsResolveDetails
?
(
model
,
position
,
suggestion
,
token
)
=>
wireCancellationToken
(
token
,
this
.
_proxy
.
$resolveCompletionItem
(
handle
,
model
.
uri
,
position
,
suggestion
)
)
?
(
model
,
position
,
suggestion
,
token
)
=>
this
.
_proxy
.
$resolveCompletionItem
(
handle
,
model
.
uri
,
position
,
suggestion
,
token
)
:
undefined
});
}
...
...
@@ -311,7 +308,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
signatureHelpTriggerCharacters
:
triggerCharacter
,
provideSignatureHelp
:
(
model
:
ITextModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
SignatureHelp
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideSignatureHelp
(
handle
,
model
.
uri
,
position
)
);
return
this
.
_proxy
.
$provideSignatureHelp
(
handle
,
model
.
uri
,
position
,
token
);
}
});
...
...
@@ -322,10 +319,10 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDocumentLinkProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
LinkProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
LinkProvider
>
{
provideLinks
:
(
model
,
token
)
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentLinks
(
handle
,
model
.
uri
)
));
return
this
.
_heapService
.
trackRecursive
(
this
.
_proxy
.
$provideDocumentLinks
(
handle
,
model
.
uri
,
token
));
},
resolveLink
:
(
link
,
token
)
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$resolveDocumentLink
(
handle
,
link
)
);
return
this
.
_proxy
.
$resolveDocumentLink
(
handle
,
link
,
token
);
}
});
}
...
...
@@ -336,7 +333,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
const
proxy
=
this
.
_proxy
;
this
.
_registrations
[
handle
]
=
modes
.
ColorProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DocumentColorProvider
>
{
provideDocumentColors
:
(
model
,
token
)
=>
{
return
wireCancellationToken
(
token
,
proxy
.
$provideDocumentColors
(
handle
,
model
.
uri
)
)
return
proxy
.
$provideDocumentColors
(
handle
,
model
.
uri
,
token
)
.
then
(
documentColors
=>
{
return
documentColors
.
map
(
documentColor
=>
{
const
[
red
,
green
,
blue
,
alpha
]
=
documentColor
.
color
;
...
...
@@ -356,10 +353,10 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
},
provideColorPresentations
:
(
model
,
colorInfo
,
token
)
=>
{
return
wireCancellationToken
(
token
,
proxy
.
$provideColorPresentations
(
handle
,
model
.
uri
,
{
return
proxy
.
$provideColorPresentations
(
handle
,
model
.
uri
,
{
color
:
[
colorInfo
.
color
.
red
,
colorInfo
.
color
.
green
,
colorInfo
.
color
.
blue
,
colorInfo
.
color
.
alpha
],
range
:
colorInfo
.
range
}
)
);
}
,
token
);
}
});
}
...
...
@@ -370,7 +367,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
const
proxy
=
this
.
_proxy
;
this
.
_registrations
[
handle
]
=
modes
.
FoldingRangeProviderRegistry
.
register
(
typeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
FoldingRangeProvider
>
{
provideFoldingRanges
:
(
model
,
context
,
token
)
=>
{
return
wireCancellationToken
(
token
,
proxy
.
$provideFoldingRanges
(
handle
,
model
.
uri
,
context
)
);
return
proxy
.
$provideFoldingRanges
(
handle
,
model
.
uri
,
context
,
token
);
}
});
}
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
efd8f4a4
...
...
@@ -825,33 +825,33 @@ export interface CodeActionDto {
}
export
interface
ExtHostLanguageFeaturesShape
{
$provideDocumentSymbols
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
modes
.
DocumentSymbol
[]
>
;
$provideCodeLenses
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
modes
.
ICodeLensSymbol
[]
>
;
$resolveCodeLens
(
handle
:
number
,
resource
:
UriComponents
,
symbol
:
modes
.
ICodeLensSymbol
):
TPromis
e
<
modes
.
ICodeLensSymbol
>
;
$provideDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
DefinitionLinkDto
[]
>
;
$provideImplementation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
DefinitionLinkDto
[]
>
;
$provideTypeDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
DefinitionLinkDto
[]
>
;
$provideDocumentSymbols
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DocumentSymbol
[]
>
;
$provideCodeLenses
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ICodeLensSymbol
[]
>
;
$resolveCodeLens
(
handle
:
number
,
resource
:
UriComponents
,
symbol
:
modes
.
ICodeLensSymbol
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ICodeLensSymbol
>
;
$provideDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
DefinitionLinkDto
[]
>
;
$provideImplementation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
DefinitionLinkDto
[]
>
;
$provideTypeDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
DefinitionLinkDto
[]
>
;
$provideHover
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
;
$provideDocumentHighlights
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
DocumentHighlight
[]
>
;
$provideReferences
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
):
TPromis
e
<
LocationDto
[]
>
;
$provideCodeActions
(
handle
:
number
,
resource
:
UriComponents
,
rangeOrSelection
:
IRange
|
ISelection
,
context
:
modes
.
CodeActionContext
):
TPromis
e
<
CodeActionDto
[]
>
;
$provideDocumentFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
;
$provideDocumentRangeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
;
$provideOnTypeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
;
$provideWorkspaceSymbols
(
handle
:
number
,
search
:
string
):
TPromis
e
<
WorkspaceSymbolsDto
>
;
$resolveWorkspaceSymbol
(
handle
:
number
,
symbol
:
WorkspaceSymbolDto
):
TPromis
e
<
WorkspaceSymbolDto
>
;
$provideDocumentHighlights
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DocumentHighlight
[]
>
;
$provideReferences
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenabl
e
<
LocationDto
[]
>
;
$provideCodeActions
(
handle
:
number
,
resource
:
UriComponents
,
rangeOrSelection
:
IRange
|
ISelection
,
context
:
modes
.
CodeActionContext
,
token
:
CancellationToken
):
Thenabl
e
<
CodeActionDto
[]
>
;
$provideDocumentFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
;
$provideDocumentRangeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
;
$provideOnTypeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
;
$provideWorkspaceSymbols
(
handle
:
number
,
search
:
string
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceSymbolsDto
>
;
$resolveWorkspaceSymbol
(
handle
:
number
,
symbol
:
WorkspaceSymbolDto
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceSymbolDto
>
;
$releaseWorkspaceSymbols
(
handle
:
number
,
id
:
number
):
void
;
$provideRenameEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
newName
:
string
):
TPromis
e
<
WorkspaceEditDto
>
;
$resolveRenameLocation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
RenameLocation
>
;
$provideCompletionItems
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
SuggestContext
):
TPromis
e
<
SuggestResultDto
>
;
$resolveCompletionItem
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
suggestion
:
modes
.
ISuggestion
):
TPromis
e
<
modes
.
ISuggestion
>
;
$provideRenameEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceEditDto
>
;
$resolveRenameLocation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
RenameLocation
>
;
$provideCompletionItems
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenabl
e
<
SuggestResultDto
>
;
$resolveCompletionItem
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ISuggestion
>
;
$releaseCompletionItems
(
handle
:
number
,
id
:
number
):
void
;
$provideSignatureHelp
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
SignatureHelp
>
;
$provideDocumentLinks
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
modes
.
ILink
[]
>
;
$resolveDocumentLink
(
handle
:
number
,
link
:
modes
.
ILink
):
TPromis
e
<
modes
.
ILink
>
;
$provideDocumentColors
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
IRawColorInfo
[]
>
;
$provideColorPresentations
(
handle
:
number
,
resource
:
UriComponents
,
colorInfo
:
IRawColorInfo
):
TPromis
e
<
modes
.
IColorPresentation
[]
>
;
$provideFoldingRanges
(
handle
:
number
,
resource
:
UriComponents
,
context
:
modes
.
FoldingContext
):
TPromis
e
<
modes
.
FoldingRange
[]
>
;
$provideSignatureHelp
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
SignatureHelp
>
;
$provideDocumentLinks
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ILink
[]
>
;
$resolveDocumentLink
(
handle
:
number
,
link
:
modes
.
ILink
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ILink
>
;
$provideDocumentColors
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
IRawColorInfo
[]
>
;
$provideColorPresentations
(
handle
:
number
,
resource
:
UriComponents
,
colorInfo
:
IRawColorInfo
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
IColorPresentation
[]
>
;
$provideFoldingRanges
(
handle
:
number
,
resource
:
UriComponents
,
context
:
modes
.
FoldingContext
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
FoldingRange
[]
>
;
}
export
interface
ExtHostQuickOpenShape
{
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
efd8f4a4
...
...
@@ -16,7 +16,7 @@ import { ExtHostHeapService } from 'vs/workbench/api/node/extHostHeapService';
import
{
ExtHostDocuments
}
from
'
vs/workbench/api/node/extHostDocuments
'
;
import
{
ExtHostCommands
,
CommandsConverter
}
from
'
vs/workbench/api/node/extHostCommands
'
;
import
{
ExtHostDiagnostics
}
from
'
vs/workbench/api/node/extHostDiagnostics
'
;
import
{
as
WinJsPromise
,
as
Thenable
}
from
'
vs/base/common/async
'
;
import
{
asThenable
}
from
'
vs/base/common/async
'
;
import
{
MainContext
,
MainThreadLanguageFeaturesShape
,
ExtHostLanguageFeaturesShape
,
ObjectIdentifier
,
IRawColorInfo
,
IMainContext
,
IdObject
,
ISerializedRegExp
,
ISerializedIndentationRule
,
ISerializedOnEnterRule
,
ISerializedLanguageConfiguration
,
WorkspaceSymbolDto
,
SuggestResultDto
,
WorkspaceSymbolsDto
,
SuggestionDto
,
CodeActionDto
,
ISerializedDocumentFilter
,
WorkspaceEditDto
}
from
'
./extHost.protocol
'
;
import
{
regExpLeadsToEndlessLoop
}
from
'
vs/base/common/strings
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -40,9 +40,9 @@ class OutlineAdapter {
this
.
_provider
=
provider
;
}
provideDocumentSymbols
(
resource
:
URI
):
TPromis
e
<
modes
.
DocumentSymbol
[]
>
{
provideDocumentSymbols
(
resource
:
URI
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DocumentSymbol
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideDocumentSymbols
(
doc
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideDocumentSymbols
(
doc
,
token
)).
then
(
value
=>
{
if
(
isFalsyOrEmpty
(
value
))
{
return
undefined
;
}
...
...
@@ -106,10 +106,10 @@ class CodeLensAdapter {
private
readonly
_provider
:
vscode
.
CodeLensProvider
)
{
}
provideCodeLenses
(
resource
:
URI
):
TPromis
e
<
modes
.
ICodeLensSymbol
[]
>
{
provideCodeLenses
(
resource
:
URI
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ICodeLensSymbol
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideCodeLenses
(
doc
,
token
)).
then
(
lenses
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideCodeLenses
(
doc
,
token
)).
then
(
lenses
=>
{
if
(
Array
.
isArray
(
lenses
))
{
return
lenses
.
map
(
lens
=>
{
const
id
=
this
.
_heapService
.
keep
(
lens
);
...
...
@@ -123,18 +123,18 @@ class CodeLensAdapter {
});
}
resolveCodeLens
(
resource
:
URI
,
symbol
:
modes
.
ICodeLensSymbol
):
TPromis
e
<
modes
.
ICodeLensSymbol
>
{
resolveCodeLens
(
resource
:
URI
,
symbol
:
modes
.
ICodeLensSymbol
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ICodeLensSymbol
>
{
const
lens
=
this
.
_heapService
.
get
<
vscode
.
CodeLens
>
(
ObjectIdentifier
.
of
(
symbol
));
if
(
!
lens
)
{
return
undefined
;
}
let
resolve
:
T
Promis
e
<
vscode
.
CodeLens
>
;
let
resolve
:
T
henabl
e
<
vscode
.
CodeLens
>
;
if
(
typeof
this
.
_provider
.
resolveCodeLens
!==
'
function
'
||
lens
.
isResolved
)
{
resolve
=
TPromise
.
as
(
lens
);
}
else
{
resolve
=
as
WinJsPromise
(
token
=>
this
.
_provider
.
resolveCodeLens
(
lens
,
token
));
resolve
=
as
Thenable
(()
=>
this
.
_provider
.
resolveCodeLens
(
lens
,
token
));
}
return
resolve
.
then
(
newLens
=>
{
...
...
@@ -161,10 +161,10 @@ class DefinitionAdapter {
private
readonly
_provider
:
vscode
.
DefinitionProvider
)
{
}
provideDefinition
(
resource
:
URI
,
position
:
IPosition
):
TPromis
e
<
modes
.
DefinitionLink
[]
>
{
provideDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DefinitionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
return
as
Thenable
(()
=>
this
.
_provider
.
provideDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
}
}
...
...
@@ -175,10 +175,10 @@ class ImplementationAdapter {
private
readonly
_provider
:
vscode
.
ImplementationProvider
)
{
}
provideImplementation
(
resource
:
URI
,
position
:
IPosition
):
TPromis
e
<
modes
.
DefinitionLink
[]
>
{
provideImplementation
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DefinitionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideImplementation
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
return
as
Thenable
(()
=>
this
.
_provider
.
provideImplementation
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
}
}
...
...
@@ -189,10 +189,10 @@ class TypeDefinitionAdapter {
private
readonly
_provider
:
vscode
.
TypeDefinitionProvider
)
{
}
provideTypeDefinition
(
resource
:
URI
,
position
:
IPosition
):
TPromis
e
<
modes
.
DefinitionLink
[]
>
{
provideTypeDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DefinitionLink
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideTypeDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
return
as
Thenable
(()
=>
this
.
_provider
.
provideTypeDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
}
}
...
...
@@ -208,7 +208,7 @@ class HoverAdapter {
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
asThenable
(
this
.
_provider
.
provideHover
(
doc
,
pos
,
token
)).
then
(
value
=>
{
return
asThenable
(
()
=>
this
.
_provider
.
provideHover
(
doc
,
pos
,
token
)).
then
(
value
=>
{
if
(
!
value
||
isFalsyOrEmpty
(
value
.
contents
))
{
return
undefined
;
}
...
...
@@ -231,12 +231,12 @@ class DocumentHighlightAdapter {
private
readonly
_provider
:
vscode
.
DocumentHighlightProvider
)
{
}
provideDocumentHighlights
(
resource
:
URI
,
position
:
IPosition
):
TPromis
e
<
modes
.
DocumentHighlight
[]
>
{
provideDocumentHighlights
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DocumentHighlight
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideDocumentHighlights
(
doc
,
pos
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideDocumentHighlights
(
doc
,
pos
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
DocumentHighlight
.
from
);
}
...
...
@@ -252,11 +252,11 @@ class ReferenceAdapter {
private
readonly
_provider
:
vscode
.
ReferenceProvider
)
{
}
provideReferences
(
resource
:
URI
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
):
TPromis
e
<
modes
.
Location
[]
>
{
provideReferences
(
resource
:
URI
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
Location
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideReferences
(
doc
,
pos
,
context
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideReferences
(
doc
,
pos
,
context
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
location
.
from
);
}
...
...
@@ -280,7 +280,7 @@ class CodeActionAdapter {
private
readonly
_extensionId
:
string
)
{
}
provideCodeActions
(
resource
:
URI
,
rangeOrSelection
:
IRange
|
ISelection
,
context
:
modes
.
CodeActionContext
):
TPromis
e
<
CodeActionDto
[]
>
{
provideCodeActions
(
resource
:
URI
,
rangeOrSelection
:
IRange
|
ISelection
,
context
:
modes
.
CodeActionContext
,
token
:
CancellationToken
):
Thenabl
e
<
CodeActionDto
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
ran
=
Selection
.
isISelection
(
rangeOrSelection
)
...
...
@@ -299,9 +299,7 @@ class CodeActionAdapter {
only
:
context
.
only
?
new
CodeActionKind
(
context
.
only
)
:
undefined
};
return
asWinJsPromise
(
token
=>
this
.
_provider
.
provideCodeActions
(
doc
,
ran
,
codeActionContext
,
token
)
).
then
(
commandsOrActions
=>
{
return
asThenable
(()
=>
this
.
_provider
.
provideCodeActions
(
doc
,
ran
,
codeActionContext
,
token
)).
then
(
commandsOrActions
=>
{
if
(
isFalsyOrEmpty
(
commandsOrActions
))
{
return
undefined
;
}
...
...
@@ -353,11 +351,11 @@ class DocumentFormattingAdapter {
private
readonly
_provider
:
vscode
.
DocumentFormattingEditProvider
)
{
}
provideDocumentFormattingEdits
(
resource
:
URI
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
{
provideDocumentFormattingEdits
(
resource
:
URI
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
{
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideDocumentFormattingEdits
(
document
,
<
any
>
options
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideDocumentFormattingEdits
(
document
,
<
any
>
options
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
TextEdit
.
from
);
}
...
...
@@ -373,12 +371,12 @@ class RangeFormattingAdapter {
private
readonly
_provider
:
vscode
.
DocumentRangeFormattingEditProvider
)
{
}
provideDocumentRangeFormattingEdits
(
resource
:
URI
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
{
provideDocumentRangeFormattingEdits
(
resource
:
URI
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
{
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
const
ran
=
typeConvert
.
Range
.
to
(
range
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideDocumentRangeFormattingEdits
(
document
,
ran
,
<
any
>
options
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideDocumentRangeFormattingEdits
(
document
,
ran
,
<
any
>
options
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
TextEdit
.
from
);
}
...
...
@@ -396,12 +394,12 @@ class OnTypeFormattingAdapter {
autoFormatTriggerCharacters
:
string
[]
=
[];
// not here
provideOnTypeFormattingEdits
(
resource
:
URI
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
{
provideOnTypeFormattingEdits
(
resource
:
URI
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
{
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideOnTypeFormattingEdits
(
document
,
pos
,
ch
,
<
any
>
options
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideOnTypeFormattingEdits
(
document
,
pos
,
ch
,
<
any
>
options
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
TextEdit
.
from
);
}
...
...
@@ -420,9 +418,9 @@ class NavigateTypeAdapter {
this
.
_provider
=
provider
;
}
provideWorkspaceSymbols
(
search
:
string
):
TPromis
e
<
WorkspaceSymbolsDto
>
{
provideWorkspaceSymbols
(
search
:
string
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceSymbolsDto
>
{
const
result
:
WorkspaceSymbolsDto
=
IdObject
.
mixin
({
symbols
:
[]
});
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideWorkspaceSymbols
(
search
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideWorkspaceSymbols
(
search
,
token
)).
then
(
value
=>
{
if
(
!
isFalsyOrEmpty
(
value
))
{
for
(
const
item
of
value
)
{
if
(
!
item
)
{
...
...
@@ -446,7 +444,7 @@ class NavigateTypeAdapter {
});
}
resolveWorkspaceSymbol
(
symbol
:
WorkspaceSymbolDto
):
TPromis
e
<
WorkspaceSymbolDto
>
{
resolveWorkspaceSymbol
(
symbol
:
WorkspaceSymbolDto
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceSymbolDto
>
{
if
(
typeof
this
.
_provider
.
resolveWorkspaceSymbol
!==
'
function
'
)
{
return
TPromise
.
as
(
symbol
);
...
...
@@ -454,7 +452,7 @@ class NavigateTypeAdapter {
const
item
=
this
.
_symbolCache
[
symbol
.
_id
];
if
(
item
)
{
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
resolveWorkspaceSymbol
(
item
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
resolveWorkspaceSymbol
(
item
,
token
)).
then
(
value
=>
{
return
value
&&
mixin
(
symbol
,
typeConvert
.
WorkspaceSymbol
.
from
(
value
),
true
);
});
}
...
...
@@ -483,12 +481,12 @@ class RenameAdapter {
private
readonly
_provider
:
vscode
.
RenameProvider
)
{
}
provideRenameEdits
(
resource
:
URI
,
position
:
IPosition
,
newName
:
string
):
TPromis
e
<
WorkspaceEditDto
>
{
provideRenameEdits
(
resource
:
URI
,
position
:
IPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceEditDto
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideRenameEdits
(
doc
,
pos
,
newName
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideRenameEdits
(
doc
,
pos
,
newName
,
token
)).
then
(
value
=>
{
if
(
!
value
)
{
return
undefined
;
}
...
...
@@ -511,7 +509,7 @@ class RenameAdapter {
});
}
resolveRenameLocation
(
resource
:
URI
,
position
:
IPosition
):
TPromis
e
<
modes
.
RenameLocation
>
{
resolveRenameLocation
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
RenameLocation
>
{
if
(
typeof
this
.
_provider
.
prepareRename
!==
'
function
'
)
{
return
TPromise
.
as
(
undefined
);
}
...
...
@@ -519,7 +517,7 @@ class RenameAdapter {
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
prepareRename
(
doc
,
pos
,
token
)).
then
(
rangeOrLocation
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
prepareRename
(
doc
,
pos
,
token
)).
then
(
rangeOrLocation
=>
{
let
range
:
vscode
.
Range
;
let
text
:
string
;
...
...
@@ -564,14 +562,14 @@ class SuggestAdapter {
this
.
_provider
=
provider
;
}
provideCompletionItems
(
resource
:
URI
,
position
:
IPosition
,
context
:
modes
.
SuggestContext
):
TPromis
e
<
SuggestResultDto
>
{
provideCompletionItems
(
resource
:
URI
,
position
:
IPosition
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenabl
e
<
SuggestResultDto
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
<
vscode
.
CompletionItem
[]
|
vscode
.
CompletionList
>
(
token
=>
{
return
this
.
_provider
.
provideCompletionItems
(
doc
,
pos
,
token
,
typeConvert
.
CompletionContext
.
from
(
context
));
}
).
then
(
value
=>
{
return
as
Thenable
<
vscode
.
CompletionItem
[]
|
vscode
.
CompletionList
>
(
()
=>
this
.
_provider
.
provideCompletionItems
(
doc
,
pos
,
token
,
typeConvert
.
CompletionContext
.
from
(
context
))
).
then
(
value
=>
{
const
_id
=
this
.
_idPool
++
;
...
...
@@ -611,7 +609,7 @@ class SuggestAdapter {
});
}
resolveCompletionItem
(
resource
:
URI
,
position
:
IPosition
,
suggestion
:
modes
.
ISuggestion
):
TPromis
e
<
modes
.
ISuggestion
>
{
resolveCompletionItem
(
resource
:
URI
,
position
:
IPosition
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ISuggestion
>
{
if
(
typeof
this
.
_provider
.
resolveCompletionItem
!==
'
function
'
)
{
return
TPromise
.
as
(
suggestion
);
...
...
@@ -623,7 +621,7 @@ class SuggestAdapter {
return
TPromise
.
as
(
suggestion
);
}
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
resolveCompletionItem
(
item
,
token
)).
then
(
resolvedItem
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
resolveCompletionItem
(
item
,
token
)).
then
(
resolvedItem
=>
{
if
(
!
resolvedItem
)
{
return
suggestion
;
...
...
@@ -716,12 +714,12 @@ class SignatureHelpAdapter {
private
readonly
_provider
:
vscode
.
SignatureHelpProvider
)
{
}
provideSignatureHelp
(
resource
:
URI
,
position
:
IPosition
):
TPromis
e
<
modes
.
SignatureHelp
>
{
provideSignatureHelp
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
SignatureHelp
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideSignatureHelp
(
doc
,
pos
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideSignatureHelp
(
doc
,
pos
,
token
)).
then
(
value
=>
{
if
(
value
)
{
return
typeConvert
.
SignatureHelp
.
from
(
value
);
}
...
...
@@ -738,10 +736,10 @@ class LinkProviderAdapter {
private
readonly
_provider
:
vscode
.
DocumentLinkProvider
)
{
}
provideLinks
(
resource
:
URI
):
TPromis
e
<
modes
.
ILink
[]
>
{
provideLinks
(
resource
:
URI
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ILink
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideDocumentLinks
(
doc
,
token
)).
then
(
links
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideDocumentLinks
(
doc
,
token
)).
then
(
links
=>
{
if
(
!
Array
.
isArray
(
links
))
{
return
undefined
;
}
...
...
@@ -756,7 +754,7 @@ class LinkProviderAdapter {
});
}
resolveLink
(
link
:
modes
.
ILink
):
TPromis
e
<
modes
.
ILink
>
{
resolveLink
(
link
:
modes
.
ILink
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ILink
>
{
if
(
typeof
this
.
_provider
.
resolveDocumentLink
!==
'
function
'
)
{
return
undefined
;
}
...
...
@@ -767,7 +765,7 @@ class LinkProviderAdapter {
return
undefined
;
}
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
resolveDocumentLink
(
item
,
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
resolveDocumentLink
(
item
,
token
)).
then
(
value
=>
{
if
(
value
)
{
return
typeConvert
.
DocumentLink
.
from
(
value
);
}
...
...
@@ -783,9 +781,9 @@ class ColorProviderAdapter {
private
_provider
:
vscode
.
DocumentColorProvider
)
{
}
provideColors
(
resource
:
URI
):
TPromis
e
<
IRawColorInfo
[]
>
{
provideColors
(
resource
:
URI
,
token
:
CancellationToken
):
Thenabl
e
<
IRawColorInfo
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideDocumentColors
(
doc
,
token
)).
then
(
colors
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideDocumentColors
(
doc
,
token
)).
then
(
colors
=>
{
if
(
!
Array
.
isArray
(
colors
))
{
return
[];
}
...
...
@@ -801,11 +799,11 @@ class ColorProviderAdapter {
});
}
provideColorPresentations
(
resource
:
URI
,
raw
:
IRawColorInfo
):
TPromis
e
<
modes
.
IColorPresentation
[]
>
{
provideColorPresentations
(
resource
:
URI
,
raw
:
IRawColorInfo
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
IColorPresentation
[]
>
{
const
document
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
range
=
typeConvert
.
Range
.
to
(
raw
.
range
);
const
color
=
typeConvert
.
Color
.
to
(
raw
.
color
);
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideColorPresentations
(
color
,
{
document
,
range
},
token
)).
then
(
value
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideColorPresentations
(
color
,
{
document
,
range
},
token
)).
then
(
value
=>
{
return
value
.
map
(
typeConvert
.
ColorPresentation
.
from
);
});
}
...
...
@@ -818,9 +816,9 @@ class FoldingProviderAdapter {
private
_provider
:
vscode
.
FoldingRangeProvider
)
{
}
provideFoldingRanges
(
resource
:
URI
,
context
:
modes
.
FoldingContext
):
TPromis
e
<
modes
.
FoldingRange
[]
>
{
provideFoldingRanges
(
resource
:
URI
,
context
:
modes
.
FoldingContext
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
FoldingRange
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
WinJsPromise
(
token
=>
this
.
_provider
.
provideFoldingRanges
(
doc
,
context
,
token
)).
then
(
ranges
=>
{
return
as
Thenable
(()
=>
this
.
_provider
.
provideFoldingRanges
(
doc
,
context
,
token
)).
then
(
ranges
=>
{
if
(
!
Array
.
isArray
(
ranges
))
{
return
void
0
;
}
...
...
@@ -917,15 +915,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
ExtHostLanguageFeatures
.
_handlePool
++
;
}
private
_withAdapter
<
A
,
R
>
(
handle
:
number
,
ctor
:
{
new
(...
args
:
any
[]):
A
},
callback
:
(
adapter
:
A
)
=>
TPromise
<
R
>
):
TPromise
<
R
>
{
let
adapter
=
this
.
_adapter
.
get
(
handle
);
if
(
!
(
adapter
instanceof
ctor
))
{
return
TPromise
.
wrapError
<
R
>
(
new
Error
(
'
no adapter found
'
));
}
return
callback
(
<
any
>
adapter
);
}
private
_withAdapter2
<
A
,
R
>
(
handle
:
number
,
ctor
:
{
new
(...
args
:
any
[]):
A
},
callback
:
(
adapter
:
A
)
=>
Thenable
<
R
>
):
Thenable
<
R
>
{
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
TPromise
.
wrapError
<
R
>
(
new
Error
(
'
no adapter found
'
));
...
...
@@ -947,8 +937,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDocumentSymbols
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
modes
.
DocumentSymbol
[]
>
{
return
this
.
_withAdapter
(
handle
,
OutlineAdapter
,
adapter
=>
adapter
.
provideDocumentSymbols
(
URI
.
revive
(
resource
)));
$provideDocumentSymbols
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DocumentSymbol
[]
>
{
return
this
.
_withAdapter
(
handle
,
OutlineAdapter
,
adapter
=>
adapter
.
provideDocumentSymbols
(
URI
.
revive
(
resource
)
,
token
));
}
// --- code lens
...
...
@@ -969,12 +959,12 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
result
;
}
$provideCodeLenses
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
modes
.
ICodeLensSymbol
[]
>
{
return
this
.
_withAdapter
(
handle
,
CodeLensAdapter
,
adapter
=>
adapter
.
provideCodeLenses
(
URI
.
revive
(
resource
)));
$provideCodeLenses
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ICodeLensSymbol
[]
>
{
return
this
.
_withAdapter
(
handle
,
CodeLensAdapter
,
adapter
=>
adapter
.
provideCodeLenses
(
URI
.
revive
(
resource
)
,
token
));
}
$resolveCodeLens
(
handle
:
number
,
resource
:
UriComponents
,
symbol
:
modes
.
ICodeLensSymbol
):
TPromis
e
<
modes
.
ICodeLensSymbol
>
{
return
this
.
_withAdapter
(
handle
,
CodeLensAdapter
,
adapter
=>
adapter
.
resolveCodeLens
(
URI
.
revive
(
resource
),
symbol
));
$resolveCodeLens
(
handle
:
number
,
resource
:
UriComponents
,
symbol
:
modes
.
ICodeLensSymbol
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ICodeLensSymbol
>
{
return
this
.
_withAdapter
(
handle
,
CodeLensAdapter
,
adapter
=>
adapter
.
resolveCodeLens
(
URI
.
revive
(
resource
),
symbol
,
token
));
}
// --- declaration
...
...
@@ -985,8 +975,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
DefinitionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
DefinitionAdapter
,
adapter
=>
adapter
.
provideDefinition
(
URI
.
revive
(
resource
),
position
));
$provideDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DefinitionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
DefinitionAdapter
,
adapter
=>
adapter
.
provideDefinition
(
URI
.
revive
(
resource
),
position
,
token
));
}
registerImplementationProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
ImplementationProvider
):
vscode
.
Disposable
{
...
...
@@ -995,8 +985,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideImplementation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
DefinitionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
ImplementationAdapter
,
adapter
=>
adapter
.
provideImplementation
(
URI
.
revive
(
resource
),
position
));
$provideImplementation
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DefinitionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
ImplementationAdapter
,
adapter
=>
adapter
.
provideImplementation
(
URI
.
revive
(
resource
),
position
,
token
));
}
registerTypeDefinitionProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
TypeDefinitionProvider
):
vscode
.
Disposable
{
...
...
@@ -1005,8 +995,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideTypeDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
DefinitionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
TypeDefinitionAdapter
,
adapter
=>
adapter
.
provideTypeDefinition
(
URI
.
revive
(
resource
),
position
));
$provideTypeDefinition
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DefinitionLink
[]
>
{
return
this
.
_withAdapter
(
handle
,
TypeDefinitionAdapter
,
adapter
=>
adapter
.
provideTypeDefinition
(
URI
.
revive
(
resource
),
position
,
token
));
}
// --- extra info
...
...
@@ -1018,7 +1008,7 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
}
$provideHover
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
{
return
this
.
_withAdapter
2
(
handle
,
HoverAdapter
,
adapter
=>
adapter
.
provideHover
(
URI
.
revive
(
resource
),
position
,
token
));
return
this
.
_withAdapter
(
handle
,
HoverAdapter
,
adapter
=>
adapter
.
provideHover
(
URI
.
revive
(
resource
),
position
,
token
));
}
// --- occurrences
...
...
@@ -1029,8 +1019,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDocumentHighlights
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
DocumentHighlight
[]
>
{
return
this
.
_withAdapter
(
handle
,
DocumentHighlightAdapter
,
adapter
=>
adapter
.
provideDocumentHighlights
(
URI
.
revive
(
resource
),
position
));
$provideDocumentHighlights
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
DocumentHighlight
[]
>
{
return
this
.
_withAdapter
(
handle
,
DocumentHighlightAdapter
,
adapter
=>
adapter
.
provideDocumentHighlights
(
URI
.
revive
(
resource
),
position
,
token
));
}
// --- references
...
...
@@ -1041,8 +1031,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideReferences
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
):
TPromis
e
<
modes
.
Location
[]
>
{
return
this
.
_withAdapter
(
handle
,
ReferenceAdapter
,
adapter
=>
adapter
.
provideReferences
(
URI
.
revive
(
resource
),
position
,
context
));
$provideReferences
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
ReferenceContext
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
Location
[]
>
{
return
this
.
_withAdapter
(
handle
,
ReferenceAdapter
,
adapter
=>
adapter
.
provideReferences
(
URI
.
revive
(
resource
),
position
,
context
,
token
));
}
// --- quick fix
...
...
@@ -1054,8 +1044,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
}
$provideCodeActions
(
handle
:
number
,
resource
:
UriComponents
,
rangeOrSelection
:
IRange
|
ISelection
,
context
:
modes
.
CodeActionContext
):
TPromis
e
<
CodeActionDto
[]
>
{
return
this
.
_withAdapter
(
handle
,
CodeActionAdapter
,
adapter
=>
adapter
.
provideCodeActions
(
URI
.
revive
(
resource
),
rangeOrSelection
,
context
));
$provideCodeActions
(
handle
:
number
,
resource
:
UriComponents
,
rangeOrSelection
:
IRange
|
ISelection
,
context
:
modes
.
CodeActionContext
,
token
:
CancellationToken
):
Thenabl
e
<
CodeActionDto
[]
>
{
return
this
.
_withAdapter
(
handle
,
CodeActionAdapter
,
adapter
=>
adapter
.
provideCodeActions
(
URI
.
revive
(
resource
),
rangeOrSelection
,
context
,
token
));
}
// --- formatting
...
...
@@ -1066,8 +1056,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDocumentFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
{
return
this
.
_withAdapter
(
handle
,
DocumentFormattingAdapter
,
adapter
=>
adapter
.
provideDocumentFormattingEdits
(
URI
.
revive
(
resource
),
options
));
$provideDocumentFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
{
return
this
.
_withAdapter
(
handle
,
DocumentFormattingAdapter
,
adapter
=>
adapter
.
provideDocumentFormattingEdits
(
URI
.
revive
(
resource
),
options
,
token
));
}
registerDocumentRangeFormattingEditProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentRangeFormattingEditProvider
):
vscode
.
Disposable
{
...
...
@@ -1076,8 +1066,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDocumentRangeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
{
return
this
.
_withAdapter
(
handle
,
RangeFormattingAdapter
,
adapter
=>
adapter
.
provideDocumentRangeFormattingEdits
(
URI
.
revive
(
resource
),
range
,
options
));
$provideDocumentRangeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
range
:
IRange
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
{
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
{
...
...
@@ -1086,8 +1076,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideOnTypeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
):
TPromis
e
<
ISingleEditOperation
[]
>
{
return
this
.
_withAdapter
(
handle
,
OnTypeFormattingAdapter
,
adapter
=>
adapter
.
provideOnTypeFormattingEdits
(
URI
.
revive
(
resource
),
position
,
ch
,
options
));
$provideOnTypeFormattingEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
ch
:
string
,
options
:
modes
.
FormattingOptions
,
token
:
CancellationToken
):
Thenabl
e
<
ISingleEditOperation
[]
>
{
return
this
.
_withAdapter
(
handle
,
OnTypeFormattingAdapter
,
adapter
=>
adapter
.
provideOnTypeFormattingEdits
(
URI
.
revive
(
resource
),
position
,
ch
,
options
,
token
));
}
// --- navigate types
...
...
@@ -1098,15 +1088,15 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideWorkspaceSymbols
(
handle
:
number
,
search
:
string
):
TPromis
e
<
WorkspaceSymbolsDto
>
{
return
this
.
_withAdapter
(
handle
,
NavigateTypeAdapter
,
adapter
=>
adapter
.
provideWorkspaceSymbols
(
search
));
$provideWorkspaceSymbols
(
handle
:
number
,
search
:
string
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceSymbolsDto
>
{
return
this
.
_withAdapter
(
handle
,
NavigateTypeAdapter
,
adapter
=>
adapter
.
provideWorkspaceSymbols
(
search
,
token
));
}
$resolveWorkspaceSymbol
(
handle
:
number
,
symbol
:
WorkspaceSymbolDto
):
TPromis
e
<
WorkspaceSymbolDto
>
{
return
this
.
_withAdapter
(
handle
,
NavigateTypeAdapter
,
adapter
=>
adapter
.
resolveWorkspaceSymbol
(
symbol
));
$resolveWorkspaceSymbol
(
handle
:
number
,
symbol
:
WorkspaceSymbolDto
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceSymbolDto
>
{
return
this
.
_withAdapter
(
handle
,
NavigateTypeAdapter
,
adapter
=>
adapter
.
resolveWorkspaceSymbol
(
symbol
,
token
));
}
$releaseWorkspaceSymbols
(
handle
:
number
,
id
:
number
)
{
$releaseWorkspaceSymbols
(
handle
:
number
,
id
:
number
)
:
void
{
this
.
_withAdapter
(
handle
,
NavigateTypeAdapter
,
adapter
=>
adapter
.
releaseWorkspaceSymbols
(
id
));
}
...
...
@@ -1118,12 +1108,12 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideRenameEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
newName
:
string
):
TPromis
e
<
WorkspaceEditDto
>
{
return
this
.
_withAdapter
(
handle
,
RenameAdapter
,
adapter
=>
adapter
.
provideRenameEdits
(
URI
.
revive
(
resource
),
position
,
newName
));
$provideRenameEdits
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
newName
:
string
,
token
:
CancellationToken
):
Thenabl
e
<
WorkspaceEditDto
>
{
return
this
.
_withAdapter
(
handle
,
RenameAdapter
,
adapter
=>
adapter
.
provideRenameEdits
(
URI
.
revive
(
resource
),
position
,
newName
,
token
));
}
$resolveRenameLocation
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
):
TPromis
e
<
modes
.
RenameLocation
>
{
return
this
.
_withAdapter
(
handle
,
RenameAdapter
,
adapter
=>
adapter
.
resolveRenameLocation
(
URI
.
revive
(
resource
),
position
));
$resolveRenameLocation
(
handle
:
number
,
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
RenameLocation
>
{
return
this
.
_withAdapter
(
handle
,
RenameAdapter
,
adapter
=>
adapter
.
resolveRenameLocation
(
URI
.
revive
(
resource
),
position
,
token
));
}
// --- suggestion
...
...
@@ -1134,12 +1124,12 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideCompletionItems
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
SuggestContext
):
TPromis
e
<
SuggestResultDto
>
{
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
provideCompletionItems
(
URI
.
revive
(
resource
),
position
,
context
));
$provideCompletionItems
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
SuggestContext
,
token
:
CancellationToken
):
Thenabl
e
<
SuggestResultDto
>
{
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
provideCompletionItems
(
URI
.
revive
(
resource
),
position
,
context
,
token
));
}
$resolveCompletionItem
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
suggestion
:
modes
.
ISuggestion
):
TPromis
e
<
modes
.
ISuggestion
>
{
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
resolveCompletionItem
(
URI
.
revive
(
resource
),
position
,
suggestion
));
$resolveCompletionItem
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
suggestion
:
modes
.
ISuggestion
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ISuggestion
>
{
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
resolveCompletionItem
(
URI
.
revive
(
resource
),
position
,
suggestion
,
token
));
}
$releaseCompletionItems
(
handle
:
number
,
id
:
number
):
void
{
...
...
@@ -1154,8 +1144,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideSignatureHelp
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
):
TPromis
e
<
modes
.
SignatureHelp
>
{
return
this
.
_withAdapter
(
handle
,
SignatureHelpAdapter
,
adapter
=>
adapter
.
provideSignatureHelp
(
URI
.
revive
(
resource
),
position
));
$provideSignatureHelp
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
SignatureHelp
>
{
return
this
.
_withAdapter
(
handle
,
SignatureHelpAdapter
,
adapter
=>
adapter
.
provideSignatureHelp
(
URI
.
revive
(
resource
),
position
,
token
));
}
// --- links
...
...
@@ -1166,12 +1156,12 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDocumentLinks
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
modes
.
ILink
[]
>
{
return
this
.
_withAdapter
(
handle
,
LinkProviderAdapter
,
adapter
=>
adapter
.
provideLinks
(
URI
.
revive
(
resource
)));
$provideDocumentLinks
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ILink
[]
>
{
return
this
.
_withAdapter
(
handle
,
LinkProviderAdapter
,
adapter
=>
adapter
.
provideLinks
(
URI
.
revive
(
resource
)
,
token
));
}
$resolveDocumentLink
(
handle
:
number
,
link
:
modes
.
ILink
):
TPromis
e
<
modes
.
ILink
>
{
return
this
.
_withAdapter
(
handle
,
LinkProviderAdapter
,
adapter
=>
adapter
.
resolveLink
(
link
));
$resolveDocumentLink
(
handle
:
number
,
link
:
modes
.
ILink
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
ILink
>
{
return
this
.
_withAdapter
(
handle
,
LinkProviderAdapter
,
adapter
=>
adapter
.
resolveLink
(
link
,
token
));
}
registerColorProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
DocumentColorProvider
):
vscode
.
Disposable
{
...
...
@@ -1180,12 +1170,12 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideDocumentColors
(
handle
:
number
,
resource
:
UriComponents
):
TPromis
e
<
IRawColorInfo
[]
>
{
return
this
.
_withAdapter
(
handle
,
ColorProviderAdapter
,
adapter
=>
adapter
.
provideColors
(
URI
.
revive
(
resource
)));
$provideDocumentColors
(
handle
:
number
,
resource
:
UriComponents
,
token
:
CancellationToken
):
Thenabl
e
<
IRawColorInfo
[]
>
{
return
this
.
_withAdapter
(
handle
,
ColorProviderAdapter
,
adapter
=>
adapter
.
provideColors
(
URI
.
revive
(
resource
)
,
token
));
}
$provideColorPresentations
(
handle
:
number
,
resource
:
UriComponents
,
colorInfo
:
IRawColorInfo
):
TPromis
e
<
modes
.
IColorPresentation
[]
>
{
return
this
.
_withAdapter
(
handle
,
ColorProviderAdapter
,
adapter
=>
adapter
.
provideColorPresentations
(
URI
.
revive
(
resource
),
colorInfo
));
$provideColorPresentations
(
handle
:
number
,
resource
:
UriComponents
,
colorInfo
:
IRawColorInfo
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
IColorPresentation
[]
>
{
return
this
.
_withAdapter
(
handle
,
ColorProviderAdapter
,
adapter
=>
adapter
.
provideColorPresentations
(
URI
.
revive
(
resource
),
colorInfo
,
token
));
}
registerFoldingRangeProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
FoldingRangeProvider
):
vscode
.
Disposable
{
...
...
@@ -1194,8 +1184,8 @@ export class ExtHostLanguageFeatures implements ExtHostLanguageFeaturesShape {
return
this
.
_createDisposable
(
handle
);
}
$provideFoldingRanges
(
handle
:
number
,
resource
:
UriComponents
,
context
:
vscode
.
FoldingContext
):
TPromis
e
<
modes
.
FoldingRange
[]
>
{
return
this
.
_withAdapter
(
handle
,
FoldingProviderAdapter
,
adapter
=>
adapter
.
provideFoldingRanges
(
URI
.
revive
(
resource
),
context
));
$provideFoldingRanges
(
handle
:
number
,
resource
:
UriComponents
,
context
:
vscode
.
FoldingContext
,
token
:
CancellationToken
):
Thenabl
e
<
modes
.
FoldingRange
[]
>
{
return
this
.
_withAdapter
(
handle
,
FoldingProviderAdapter
,
adapter
=>
adapter
.
provideFoldingRanges
(
URI
.
revive
(
resource
),
context
,
token
));
}
// --- configuration
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录