Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ce850e02
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,发现更多精彩内容 >>
提交
ce850e02
编写于
5月 01, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - don't send data that's not needed, make resolve a function not a property
上级
bda1d3ee
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
36 addition
and
42 deletion
+36
-42
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+1
-1
src/vs/editor/contrib/suggest/suggest.ts
src/vs/editor/contrib/suggest/suggest.ts
+27
-33
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+1
-1
src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts
src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts
+2
-2
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/common/extHostLanguageFeatures.ts
src/vs/workbench/api/common/extHostLanguageFeatures.ts
+3
-3
src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.ts
...nch/contrib/snippets/browser/snippetCompletionProvider.ts
+1
-1
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
ce850e02
...
@@ -608,7 +608,7 @@ export interface CompletionItemProvider {
...
@@ -608,7 +608,7 @@ export interface CompletionItemProvider {
*
*
* The editor will only resolve a completion item once.
* The editor will only resolve a completion item once.
*/
*/
resolveCompletionItem
?(
model
:
model
.
ITextModel
,
position
:
Position
,
item
:
CompletionItem
,
token
:
CancellationToken
):
ProviderResult
<
CompletionItem
>
;
resolveCompletionItem
?(
item
:
CompletionItem
,
token
:
CancellationToken
):
ProviderResult
<
CompletionItem
>
;
}
}
export
interface
CodeAction
{
export
interface
CodeAction
{
...
...
src/vs/editor/contrib/suggest/suggest.ts
浏览文件 @
ce850e02
...
@@ -33,12 +33,6 @@ export class CompletionItem {
...
@@ -33,12 +33,6 @@ export class CompletionItem {
_brand
!
:
'
ISuggestionItem
'
;
_brand
!
:
'
ISuggestionItem
'
;
private
static
readonly
_defaultResolve
=
()
=>
Promise
.
resolve
();
readonly
resolve
:
(
token
:
CancellationToken
)
=>
Promise
<
void
>
;
isResolved
:
boolean
=
false
;
//
//
readonly
editStart
:
IPosition
;
readonly
editStart
:
IPosition
;
readonly
editInsertEnd
:
IPosition
;
readonly
editInsertEnd
:
IPosition
;
...
@@ -104,35 +98,35 @@ export class CompletionItem {
...
@@ -104,35 +98,35 @@ export class CompletionItem {
}
}
// create the suggestion resolver
// create the suggestion resolver
const
{
resolveCompletionItem
}
=
provider
;
if
(
typeof
provider
.
resolveCompletionItem
!==
'
function
'
)
{
if
(
typeof
resolveCompletionItem
!==
'
function
'
)
{
this
.
_resolveCache
=
Promise
.
resolve
();
this
.
resolve
=
CompletionItem
.
_defaultResolve
;
}
this
.
isResolved
=
true
;
}
}
else
{
let
cached
:
Promise
<
void
>
|
undefined
;
// resolving
this
.
resolve
=
(
token
)
=>
{
get
isResolved
()
{
if
(
!
cached
)
{
return
Boolean
(
this
.
_resolveCache
);
cached
=
Promise
.
resolve
(
resolveCompletionItem
.
call
(
provider
,
model
,
Position
.
lift
(
position
),
completion
,
token
)).
then
(
value
=>
{
}
Object
.
assign
(
completion
,
value
);
this
.
isResolved
=
true
;
private
_resolveCache
?:
Promise
<
void
>
;
},
err
=>
{
if
(
isPromiseCanceledError
(
err
)
)
{
async
resolve
(
token
:
CancellationToken
)
{
// the IPC queue will reject the request with the
if
(
!
this
.
_resolveCache
)
{
// cancellation error -> reset cached
const
sub
=
token
.
onCancellationRequested
(()
=>
{
cached
=
undefined
;
this
.
_resolveCache
=
undefined
;
}
});
});
this
.
_resolveCache
=
Promise
.
resolve
(
this
.
provider
.
resolveCompletionItem
!
(
this
.
completion
,
token
)).
then
(
value
=>
{
token
.
onCancellationRequested
(()
=>
{
Object
.
assign
(
this
.
completion
,
value
);
if
(
!
this
.
isResolved
)
{
sub
.
dispose
();
// cancellation after the request has been
},
err
=>
{
// dispatched -> reset cache
if
(
isPromiseCanceledError
(
err
))
{
cached
=
undefined
;
// the IPC queue will reject the request with the
}
// cancellation error -> reset cached
})
;
this
.
_resolveCache
=
undefined
;
}
}
return
cached
;
});
};
}
}
return
this
.
_resolveCache
;
}
}
}
}
...
...
src/vs/monaco.d.ts
浏览文件 @
ce850e02
...
@@ -5586,7 +5586,7 @@ declare namespace monaco.languages {
...
@@ -5586,7 +5586,7 @@ declare namespace monaco.languages {
*
*
* The editor will only resolve a completion item once.
* The editor will only resolve a completion item once.
*/
*/
resolveCompletionItem
?(
model
:
editor
.
ITextModel
,
position
:
Position
,
item
:
CompletionItem
,
token
:
CancellationToken
):
ProviderResult
<
CompletionItem
>
;
resolveCompletionItem
?(
item
:
CompletionItem
,
token
:
CancellationToken
):
ProviderResult
<
CompletionItem
>
;
}
}
export
interface
CodeAction
{
export
interface
CodeAction
{
...
...
src/vs/workbench/api/browser/mainThreadLanguageFeatures.ts
浏览文件 @
ce850e02
...
@@ -447,8 +447,8 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
...
@@ -447,8 +447,8 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
}
}
};
};
if
(
supportsResolveDetails
)
{
if
(
supportsResolveDetails
)
{
provider
.
resolveCompletionItem
=
(
model
,
position
,
suggestion
,
token
)
=>
{
provider
.
resolveCompletionItem
=
(
suggestion
,
token
)
=>
{
return
this
.
_proxy
.
$resolveCompletionItem
(
handle
,
model
.
uri
,
position
,
suggestion
.
_id
!
,
token
).
then
(
result
=>
{
return
this
.
_proxy
.
$resolveCompletionItem
(
handle
,
suggestion
.
_id
!
,
token
).
then
(
result
=>
{
if
(
!
result
)
{
if
(
!
result
)
{
return
suggestion
;
return
suggestion
;
}
}
...
...
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
ce850e02
...
@@ -1313,7 +1313,7 @@ export interface ExtHostLanguageFeaturesShape {
...
@@ -1313,7 +1313,7 @@ export interface ExtHostLanguageFeaturesShape {
$releaseDocumentSemanticTokens
(
handle
:
number
,
semanticColoringResultId
:
number
):
void
;
$releaseDocumentSemanticTokens
(
handle
:
number
,
semanticColoringResultId
:
number
):
void
;
$provideDocumentRangeSemanticTokens
(
handle
:
number
,
resource
:
UriComponents
,
range
:
IRange
,
token
:
CancellationToken
):
Promise
<
VSBuffer
|
null
>
;
$provideDocumentRangeSemanticTokens
(
handle
:
number
,
resource
:
UriComponents
,
range
:
IRange
,
token
:
CancellationToken
):
Promise
<
VSBuffer
|
null
>
;
$provideCompletionItems
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
CompletionContext
,
token
:
CancellationToken
):
Promise
<
ISuggestResultDto
|
undefined
>
;
$provideCompletionItems
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
CompletionContext
,
token
:
CancellationToken
):
Promise
<
ISuggestResultDto
|
undefined
>
;
$resolveCompletionItem
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
id
:
ChainedCacheId
,
token
:
CancellationToken
):
Promise
<
ISuggestDataDto
|
undefined
>
;
$resolveCompletionItem
(
handle
:
number
,
id
:
ChainedCacheId
,
token
:
CancellationToken
):
Promise
<
ISuggestDataDto
|
undefined
>
;
$releaseCompletionItems
(
handle
:
number
,
id
:
number
):
void
;
$releaseCompletionItems
(
handle
:
number
,
id
:
number
):
void
;
$provideSignatureHelp
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
SignatureHelpContext
,
token
:
CancellationToken
):
Promise
<
ISignatureHelpDto
|
undefined
>
;
$provideSignatureHelp
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
context
:
modes
.
SignatureHelpContext
,
token
:
CancellationToken
):
Promise
<
ISignatureHelpDto
|
undefined
>
;
$releaseSignatureHelp
(
handle
:
number
,
id
:
number
):
void
;
$releaseSignatureHelp
(
handle
:
number
,
id
:
number
):
void
;
...
...
src/vs/workbench/api/common/extHostLanguageFeatures.ts
浏览文件 @
ce850e02
...
@@ -883,7 +883,7 @@ class SuggestAdapter {
...
@@ -883,7 +883,7 @@ class SuggestAdapter {
return
result
;
return
result
;
}
}
async
resolveCompletionItem
(
_resource
:
URI
,
_position
:
IPosition
,
id
:
extHostProtocol
.
ChainedCacheId
,
token
:
CancellationToken
):
Promise
<
extHostProtocol
.
ISuggestDataDto
|
undefined
>
{
async
resolveCompletionItem
(
id
:
extHostProtocol
.
ChainedCacheId
,
token
:
CancellationToken
):
Promise
<
extHostProtocol
.
ISuggestDataDto
|
undefined
>
{
if
(
typeof
this
.
_provider
.
resolveCompletionItem
!==
'
function
'
)
{
if
(
typeof
this
.
_provider
.
resolveCompletionItem
!==
'
function
'
)
{
return
undefined
;
return
undefined
;
...
@@ -1753,8 +1753,8 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF
...
@@ -1753,8 +1753,8 @@ export class ExtHostLanguageFeatures implements extHostProtocol.ExtHostLanguageF
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
provideCompletionItems
(
URI
.
revive
(
resource
),
position
,
context
,
token
),
undefined
);
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
provideCompletionItems
(
URI
.
revive
(
resource
),
position
,
context
,
token
),
undefined
);
}
}
$resolveCompletionItem
(
handle
:
number
,
resource
:
UriComponents
,
position
:
IPosition
,
id
:
extHostProtocol
.
ChainedCacheId
,
token
:
CancellationToken
):
Promise
<
extHostProtocol
.
ISuggestDataDto
|
undefined
>
{
$resolveCompletionItem
(
handle
:
number
,
id
:
extHostProtocol
.
ChainedCacheId
,
token
:
CancellationToken
):
Promise
<
extHostProtocol
.
ISuggestDataDto
|
undefined
>
{
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
resolveCompletionItem
(
URI
.
revive
(
resource
),
position
,
id
,
token
),
undefined
);
return
this
.
_withAdapter
(
handle
,
SuggestAdapter
,
adapter
=>
adapter
.
resolveCompletionItem
(
id
,
token
),
undefined
);
}
}
$releaseCompletionItems
(
handle
:
number
,
id
:
number
):
void
{
$releaseCompletionItems
(
handle
:
number
,
id
:
number
):
void
{
...
...
src/vs/workbench/contrib/snippets/browser/snippetCompletionProvider.ts
浏览文件 @
ce850e02
...
@@ -144,7 +144,7 @@ export class SnippetCompletionProvider implements CompletionItemProvider {
...
@@ -144,7 +144,7 @@ export class SnippetCompletionProvider implements CompletionItemProvider {
return
{
suggestions
};
return
{
suggestions
};
}
}
resolveCompletionItem
(
_model
:
ITextModel
,
_position
:
Position
,
item
:
CompletionItem
):
CompletionItem
{
resolveCompletionItem
(
item
:
CompletionItem
):
CompletionItem
{
return
(
item
instanceof
SnippetCompletion
)
?
item
.
resolve
()
:
item
;
return
(
item
instanceof
SnippetCompletion
)
?
item
.
resolve
()
:
item
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录