Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
c6c7edaa
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c6c7edaa
编写于
12月 13, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - asThenable -> asPromise because it returns a promise
上级
71ccf693
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
63 addition
and
63 deletion
+63
-63
src/vs/base/common/async.ts
src/vs/base/common/async.ts
+1
-1
src/vs/workbench/api/node/extHostComments.ts
src/vs/workbench/api/node/extHostComments.ts
+10
-10
src/vs/workbench/api/node/extHostDebugService.ts
src/vs/workbench/api/node/extHostDebugService.ts
+8
-8
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+28
-28
src/vs/workbench/api/node/extHostQuickOpen.ts
src/vs/workbench/api/node/extHostQuickOpen.ts
+2
-2
src/vs/workbench/api/node/extHostSCM.ts
src/vs/workbench/api/node/extHostSCM.ts
+4
-4
src/vs/workbench/api/node/extHostTask.ts
src/vs/workbench/api/node/extHostTask.ts
+2
-2
src/vs/workbench/api/node/extHostTreeViews.ts
src/vs/workbench/api/node/extHostTreeViews.ts
+6
-6
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
...vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
+2
-2
未找到文件。
src/vs/base/common/async.ts
浏览文件 @
c6c7edaa
...
...
@@ -47,7 +47,7 @@ export function createCancelablePromise<T>(callback: (token: CancellationToken)
};
}
export
function
as
Thenabl
e
<
T
>
(
callback
:
()
=>
T
|
Thenable
<
T
>
):
Promise
<
T
>
{
export
function
as
Promis
e
<
T
>
(
callback
:
()
=>
T
|
Thenable
<
T
>
):
Promise
<
T
>
{
return
new
Promise
<
T
>
((
resolve
,
reject
)
=>
{
let
item
=
callback
();
if
(
isThenable
<
T
>
(
item
))
{
...
...
src/vs/workbench/api/node/extHostComments.ts
浏览文件 @
c6c7edaa
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
as
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
ExtHostDocuments
}
from
'
vs/workbench/api/node/extHostDocuments
'
;
...
...
@@ -76,7 +76,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
}
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
createNewCommentThread
(
data
.
document
,
ran
,
text
,
CancellationToken
.
None
);
}).
then
(
commentThread
=>
commentThread
?
convertToCommentThread
(
provider
,
commentThread
,
this
.
_commandsConverter
)
:
null
);
}
...
...
@@ -90,7 +90,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
}
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
replyToCommentThread
(
data
.
document
,
ran
,
convertFromCommentThread
(
thread
),
text
,
CancellationToken
.
None
);
}).
then
(
commentThread
=>
commentThread
?
convertToCommentThread
(
provider
,
commentThread
,
this
.
_commandsConverter
)
:
null
);
}
...
...
@@ -103,7 +103,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
}
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
editComment
(
data
.
document
,
convertFromComment
(
comment
),
text
,
CancellationToken
.
None
);
});
}
...
...
@@ -116,28 +116,28 @@ export class ExtHostComments implements ExtHostCommentsShape {
}
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
deleteComment
(
data
.
document
,
convertFromComment
(
comment
),
CancellationToken
.
None
);
});
}
$startDraft
(
handle
:
number
):
Promise
<
void
>
{
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
startDraft
(
CancellationToken
.
None
);
});
}
$deleteDraft
(
handle
:
number
):
Promise
<
void
>
{
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
deleteDraft
(
CancellationToken
.
None
);
});
}
$finishDraft
(
handle
:
number
):
Promise
<
void
>
{
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
finishDraft
(
CancellationToken
.
None
);
});
}
...
...
@@ -149,7 +149,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
}
const
provider
=
this
.
_documentProviders
.
get
(
handle
);
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
provideDocumentComments
(
data
.
document
,
CancellationToken
.
None
);
}).
then
(
commentInfo
=>
commentInfo
?
convertCommentInfo
(
handle
,
provider
,
commentInfo
,
this
.
_commandsConverter
)
:
null
);
}
...
...
@@ -160,7 +160,7 @@ export class ExtHostComments implements ExtHostCommentsShape {
return
Promise
.
resolve
(
null
);
}
return
as
Thenabl
e
(()
=>
{
return
as
Promis
e
(()
=>
{
return
provider
.
provideWorkspaceComments
(
CancellationToken
.
None
);
}).
then
(
comments
=>
comments
.
map
(
comment
=>
convertToCommentThread
(
provider
,
comment
,
this
.
_commandsConverter
)
...
...
src/vs/workbench/api/node/extHostDebugService.ts
浏览文件 @
c6c7edaa
...
...
@@ -7,7 +7,7 @@ import * as paths from 'vs/base/common/paths';
import
{
Schemas
}
from
'
vs/base/common/network
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
as
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
MainContext
,
MainThreadDebugServiceShape
,
ExtHostDebugServiceShape
,
DebugSessionUUID
,
...
...
@@ -558,7 +558,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if
(
!
provider
.
provideDebugConfigurations
)
{
return
Promise
.
reject
(
new
Error
(
'
handler has no method provideDebugConfigurations
'
));
}
return
as
Thenabl
e
(()
=>
provider
.
provideDebugConfigurations
(
this
.
getFolder
(
folderUri
),
CancellationToken
.
None
));
return
as
Promis
e
(()
=>
provider
.
provideDebugConfigurations
(
this
.
getFolder
(
folderUri
),
CancellationToken
.
None
));
}
public
$resolveDebugConfiguration
(
configProviderHandle
:
number
,
folderUri
:
UriComponents
|
undefined
,
debugConfiguration
:
vscode
.
DebugConfiguration
):
Promise
<
vscode
.
DebugConfiguration
>
{
...
...
@@ -569,7 +569,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if
(
!
provider
.
resolveDebugConfiguration
)
{
return
Promise
.
reject
(
new
Error
(
'
handler has no method resolveDebugConfiguration
'
));
}
return
as
Thenabl
e
(()
=>
provider
.
resolveDebugConfiguration
(
this
.
getFolder
(
folderUri
),
debugConfiguration
,
CancellationToken
.
None
));
return
as
Promis
e
(()
=>
provider
.
resolveDebugConfiguration
(
this
.
getFolder
(
folderUri
),
debugConfiguration
,
CancellationToken
.
None
));
}
// TODO@AW legacy
...
...
@@ -581,7 +581,7 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
if
(
!
provider
.
debugAdapterExecutable
)
{
return
Promise
.
reject
(
new
Error
(
'
handler has no method debugAdapterExecutable
'
));
}
return
as
Thenabl
e
(()
=>
provider
.
debugAdapterExecutable
(
this
.
getFolder
(
folderUri
),
CancellationToken
.
None
)).
then
(
x
=>
this
.
convertToDto
(
x
));
return
as
Promis
e
(()
=>
provider
.
debugAdapterExecutable
(
this
.
getFolder
(
folderUri
),
CancellationToken
.
None
)).
then
(
x
=>
this
.
convertToDto
(
x
));
}
public
$provideDebugAdapter
(
adapterProviderHandle
:
number
,
sessionDto
:
IDebugSessionDto
):
Promise
<
IAdapterDescriptor
>
{
...
...
@@ -696,11 +696,11 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
const
promises1
=
this
.
_configProviders
.
filter
(
tuple
=>
tuple
.
provider
.
provideDebugAdapterTracker
&&
(
tuple
.
type
===
type
||
tuple
.
type
===
'
*
'
))
.
map
(
tuple
=>
as
Thenabl
e
(()
=>
tuple
.
provider
.
provideDebugAdapterTracker
(
session
,
session
.
workspaceFolder
,
session
.
configuration
,
CancellationToken
.
None
)).
then
(
p
=>
p
).
catch
(
err
=>
null
));
.
map
(
tuple
=>
as
Promis
e
(()
=>
tuple
.
provider
.
provideDebugAdapterTracker
(
session
,
session
.
workspaceFolder
,
session
.
configuration
,
CancellationToken
.
None
)).
then
(
p
=>
p
).
catch
(
err
=>
null
));
const
promises2
=
this
.
_trackerFactories
.
filter
(
tuple
=>
tuple
.
type
===
type
||
tuple
.
type
===
'
*
'
)
.
map
(
tuple
=>
as
Thenabl
e
(()
=>
tuple
.
factory
.
createDebugAdapterTracker
(
session
)).
then
(
p
=>
p
).
catch
(
err
=>
null
));
.
map
(
tuple
=>
as
Promis
e
(()
=>
tuple
.
factory
.
createDebugAdapterTracker
(
session
)).
then
(
p
=>
p
).
catch
(
err
=>
null
));
const
promises
=
promises1
.
concat
(
promises2
);
...
...
@@ -736,13 +736,13 @@ export class ExtHostDebugService implements ExtHostDebugServiceShape {
const
pairs
=
this
.
_configProviders
.
filter
(
p
=>
p
.
type
===
session
.
type
);
if
(
pairs
.
length
>
0
)
{
if
(
pairs
[
0
].
provider
.
debugAdapterExecutable
)
{
return
as
Thenabl
e
(()
=>
pairs
[
0
].
provider
.
debugAdapterExecutable
(
session
.
workspaceFolder
,
CancellationToken
.
None
));
return
as
Promis
e
(()
=>
pairs
[
0
].
provider
.
debugAdapterExecutable
(
session
.
workspaceFolder
,
CancellationToken
.
None
));
}
}
if
(
adapterProvider
)
{
const
extensionRegistry
=
await
this
.
_extensionService
.
getExtensionRegistry
();
return
as
Thenabl
e
(()
=>
adapterProvider
.
createDebugAdapterDescriptor
(
session
,
this
.
daExecutableFromPackage
(
session
,
extensionRegistry
)));
return
as
Promis
e
(()
=>
adapterProvider
.
createDebugAdapterDescriptor
(
session
,
this
.
daExecutableFromPackage
(
session
,
extensionRegistry
)));
}
// try deprecated command based extension API "adapterExecutableCommand" to determine the executable
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
c6c7edaa
...
...
@@ -14,7 +14,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
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
{
MainContext
,
MainThreadLanguageFeaturesShape
,
ExtHostLanguageFeaturesShape
,
ObjectIdentifier
,
IRawColorInfo
,
IMainContext
,
IdObject
,
ISerializedRegExp
,
ISerializedIndentationRule
,
ISerializedOnEnterRule
,
ISerializedLanguageConfiguration
,
WorkspaceSymbolDto
,
SuggestResultDto
,
WorkspaceSymbolsDto
,
SuggestionDto
,
CodeActionDto
,
ISerializedDocumentFilter
,
WorkspaceEditDto
,
ISerializedSignatureHelpProviderMetadata
}
from
'
./extHost.protocol
'
;
import
{
regExpLeadsToEndlessLoop
,
regExpFlags
}
from
'
vs/base/common/strings
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
...
...
@@ -40,7 +40,7 @@ class OutlineAdapter {
provideDocumentSymbols
(
resource
:
URI
,
token
:
CancellationToken
):
Promise
<
modes
.
DocumentSymbol
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDocumentSymbols
(
doc
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDocumentSymbols
(
doc
,
token
)).
then
(
value
=>
{
if
(
isFalsyOrEmpty
(
value
))
{
return
undefined
;
}
...
...
@@ -107,7 +107,7 @@ class CodeLensAdapter {
provideCodeLenses
(
resource
:
URI
,
token
:
CancellationToken
):
Promise
<
modes
.
ICodeLensSymbol
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideCodeLenses
(
doc
,
token
)).
then
(
lenses
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideCodeLenses
(
doc
,
token
)).
then
(
lenses
=>
{
if
(
Array
.
isArray
(
lenses
))
{
return
lenses
.
map
(
lens
=>
{
const
id
=
this
.
_heapService
.
keep
(
lens
);
...
...
@@ -132,7 +132,7 @@ class CodeLensAdapter {
if
(
typeof
this
.
_provider
.
resolveCodeLens
!==
'
function
'
||
lens
.
isResolved
)
{
resolve
=
Promise
.
resolve
(
lens
);
}
else
{
resolve
=
as
Thenabl
e
(()
=>
this
.
_provider
.
resolveCodeLens
(
lens
,
token
));
resolve
=
as
Promis
e
(()
=>
this
.
_provider
.
resolveCodeLens
(
lens
,
token
));
}
return
resolve
.
then
(
newLens
=>
{
...
...
@@ -162,7 +162,7 @@ class DefinitionAdapter {
provideDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
DefinitionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
}
}
...
...
@@ -176,7 +176,7 @@ class DeclarationAdapter {
provideDeclaration
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
DefinitionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDeclaration
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDeclaration
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
}
}
...
...
@@ -190,7 +190,7 @@ class ImplementationAdapter {
provideImplementation
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
DefinitionLink
[]
>
{
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideImplementation
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
return
as
Promis
e
(()
=>
this
.
_provider
.
provideImplementation
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
}
}
...
...
@@ -204,7 +204,7 @@ class TypeDefinitionAdapter {
provideTypeDefinition
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
modes
.
DefinitionLink
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideTypeDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
return
as
Promis
e
(()
=>
this
.
_provider
.
provideTypeDefinition
(
doc
,
pos
,
token
)).
then
(
convertToDefinitionLinks
);
}
}
...
...
@@ -220,7 +220,7 @@ class HoverAdapter {
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideHover
(
doc
,
pos
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideHover
(
doc
,
pos
,
token
)).
then
(
value
=>
{
if
(
!
value
||
isFalsyOrEmpty
(
value
.
contents
))
{
return
undefined
;
}
...
...
@@ -248,7 +248,7 @@ class DocumentHighlightAdapter {
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDocumentHighlights
(
doc
,
pos
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDocumentHighlights
(
doc
,
pos
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
DocumentHighlight
.
from
);
}
...
...
@@ -268,7 +268,7 @@ class ReferenceAdapter {
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideReferences
(
doc
,
pos
,
context
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideReferences
(
doc
,
pos
,
context
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
location
.
from
);
}
...
...
@@ -311,7 +311,7 @@ class CodeActionAdapter {
only
:
context
.
only
?
new
CodeActionKind
(
context
.
only
)
:
undefined
};
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideCodeActions
(
doc
,
ran
,
codeActionContext
,
token
)).
then
(
commandsOrActions
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideCodeActions
(
doc
,
ran
,
codeActionContext
,
token
)).
then
(
commandsOrActions
=>
{
if
(
isFalsyOrEmpty
(
commandsOrActions
))
{
return
undefined
;
}
...
...
@@ -367,7 +367,7 @@ class DocumentFormattingAdapter {
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDocumentFormattingEdits
(
document
,
<
any
>
options
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDocumentFormattingEdits
(
document
,
<
any
>
options
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
TextEdit
.
from
);
}
...
...
@@ -388,7 +388,7 @@ class RangeFormattingAdapter {
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
const
ran
=
typeConvert
.
Range
.
to
(
range
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDocumentRangeFormattingEdits
(
document
,
ran
,
<
any
>
options
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDocumentRangeFormattingEdits
(
document
,
ran
,
<
any
>
options
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
TextEdit
.
from
);
}
...
...
@@ -411,7 +411,7 @@ class OnTypeFormattingAdapter {
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideOnTypeFormattingEdits
(
document
,
pos
,
ch
,
<
any
>
options
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideOnTypeFormattingEdits
(
document
,
pos
,
ch
,
<
any
>
options
,
token
)).
then
(
value
=>
{
if
(
Array
.
isArray
(
value
))
{
return
value
.
map
(
typeConvert
.
TextEdit
.
from
);
}
...
...
@@ -432,7 +432,7 @@ class NavigateTypeAdapter {
provideWorkspaceSymbols
(
search
:
string
,
token
:
CancellationToken
):
Promise
<
WorkspaceSymbolsDto
>
{
const
result
:
WorkspaceSymbolsDto
=
IdObject
.
mixin
({
symbols
:
[]
});
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideWorkspaceSymbols
(
search
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideWorkspaceSymbols
(
search
,
token
)).
then
(
value
=>
{
if
(
isNonEmptyArray
(
value
))
{
for
(
const
item
of
value
)
{
if
(
!
item
)
{
...
...
@@ -464,7 +464,7 @@ class NavigateTypeAdapter {
const
item
=
this
.
_symbolCache
[
symbol
.
_id
];
if
(
item
)
{
return
as
Thenabl
e
(()
=>
this
.
_provider
.
resolveWorkspaceSymbol
(
item
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
resolveWorkspaceSymbol
(
item
,
token
)).
then
(
value
=>
{
return
value
&&
mixin
(
symbol
,
typeConvert
.
WorkspaceSymbol
.
from
(
value
),
true
);
});
}
...
...
@@ -498,7 +498,7 @@ class RenameAdapter {
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideRenameEdits
(
doc
,
pos
,
newName
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideRenameEdits
(
doc
,
pos
,
newName
,
token
)).
then
(
value
=>
{
if
(
!
value
)
{
return
undefined
;
}
...
...
@@ -522,7 +522,7 @@ class RenameAdapter {
let
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
let
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
prepareRename
(
doc
,
pos
,
token
)).
then
(
rangeOrLocation
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
prepareRename
(
doc
,
pos
,
token
)).
then
(
rangeOrLocation
=>
{
let
range
:
vscode
.
Range
;
let
text
:
string
;
...
...
@@ -588,7 +588,7 @@ class SuggestAdapter {
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
<
vscode
.
CompletionItem
[]
|
vscode
.
CompletionList
>
(
return
as
Promis
e
<
vscode
.
CompletionItem
[]
|
vscode
.
CompletionList
>
(
()
=>
this
.
_provider
.
provideCompletionItems
(
doc
,
pos
,
token
,
typeConvert
.
CompletionContext
.
to
(
context
))
).
then
(
value
=>
{
...
...
@@ -642,7 +642,7 @@ class SuggestAdapter {
return
Promise
.
resolve
(
suggestion
);
}
return
as
Thenabl
e
(()
=>
this
.
_provider
.
resolveCompletionItem
(
item
,
token
)).
then
(
resolvedItem
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
resolveCompletionItem
(
item
,
token
)).
then
(
resolvedItem
=>
{
if
(
!
resolvedItem
)
{
return
suggestion
;
...
...
@@ -738,7 +738,7 @@ class SignatureHelpAdapter {
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideSignatureHelp
(
doc
,
pos
,
token
,
context
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideSignatureHelp
(
doc
,
pos
,
token
,
context
)).
then
(
value
=>
{
if
(
value
)
{
return
typeConvert
.
SignatureHelp
.
from
(
value
);
}
...
...
@@ -758,7 +758,7 @@ class LinkProviderAdapter {
provideLinks
(
resource
:
URI
,
token
:
CancellationToken
):
Promise
<
modes
.
ILink
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDocumentLinks
(
doc
,
token
)).
then
(
links
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDocumentLinks
(
doc
,
token
)).
then
(
links
=>
{
if
(
!
Array
.
isArray
(
links
))
{
return
undefined
;
}
...
...
@@ -784,7 +784,7 @@ class LinkProviderAdapter {
return
undefined
;
}
return
as
Thenabl
e
(()
=>
this
.
_provider
.
resolveDocumentLink
(
item
,
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
resolveDocumentLink
(
item
,
token
)).
then
(
value
=>
{
if
(
value
)
{
return
typeConvert
.
DocumentLink
.
from
(
value
);
}
...
...
@@ -802,7 +802,7 @@ class ColorProviderAdapter {
provideColors
(
resource
:
URI
,
token
:
CancellationToken
):
Promise
<
IRawColorInfo
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideDocumentColors
(
doc
,
token
)).
then
(
colors
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideDocumentColors
(
doc
,
token
)).
then
(
colors
=>
{
if
(
!
Array
.
isArray
(
colors
))
{
return
[];
}
...
...
@@ -822,7 +822,7 @@ class ColorProviderAdapter {
const
document
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
const
range
=
typeConvert
.
Range
.
to
(
raw
.
range
);
const
color
=
typeConvert
.
Color
.
to
(
raw
.
color
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideColorPresentations
(
color
,
{
document
,
range
},
token
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideColorPresentations
(
color
,
{
document
,
range
},
token
)).
then
(
value
=>
{
return
value
.
map
(
typeConvert
.
ColorPresentation
.
from
);
});
}
...
...
@@ -837,7 +837,7 @@ class FoldingProviderAdapter {
provideFoldingRanges
(
resource
:
URI
,
context
:
modes
.
FoldingContext
,
token
:
CancellationToken
):
Promise
<
modes
.
FoldingRange
[]
>
{
const
doc
=
this
.
_documents
.
getDocumentData
(
resource
).
document
;
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideFoldingRanges
(
doc
,
context
,
token
)).
then
(
ranges
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideFoldingRanges
(
doc
,
context
,
token
)).
then
(
ranges
=>
{
if
(
!
Array
.
isArray
(
ranges
))
{
return
void
0
;
}
...
...
@@ -856,7 +856,7 @@ class SelectionRangeAdapter {
provideSelectionRanges
(
resource
:
URI
,
position
:
IPosition
,
token
:
CancellationToken
):
Promise
<
IRange
[]
>
{
const
{
document
}
=
this
.
_documents
.
getDocumentData
(
resource
);
const
pos
=
typeConvert
.
Position
.
to
(
position
);
return
as
Thenabl
e
(()
=>
this
.
_provider
.
provideSelectionRanges
(
document
,
pos
,
token
)).
then
(
ranges
=>
{
return
as
Promis
e
(()
=>
this
.
_provider
.
provideSelectionRanges
(
document
,
pos
,
token
)).
then
(
ranges
=>
{
if
(
isFalsyOrEmpty
(
ranges
))
{
return
undefined
;
}
...
...
src/vs/workbench/api/node/extHostQuickOpen.ts
浏览文件 @
c6c7edaa
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
as
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
Emitter
}
from
'
vs/base/common/event
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -150,7 +150,7 @@ export class ExtHostQuickOpen implements ExtHostQuickOpenShape {
$validateInput
(
input
:
string
):
Promise
<
string
>
{
if
(
this
.
_validateInput
)
{
return
as
Thenabl
e
(()
=>
this
.
_validateInput
(
input
));
return
as
Promis
e
(()
=>
this
.
_validateInput
(
input
));
}
return
undefined
;
}
...
...
src/vs/workbench/api/node/extHostSCM.ts
浏览文件 @
c6c7edaa
...
...
@@ -7,7 +7,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
debounce
}
from
'
vs/base/common/decorators
'
;
import
{
dispose
,
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
as
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
{
IExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
ExtHostCommands
}
from
'
vs/workbench/api/node/extHostCommands
'
;
import
{
MainContext
,
MainThreadSCMShape
,
SCMRawResource
,
SCMRawResourceSplice
,
SCMRawResourceSplices
,
IMainContext
,
ExtHostSCMShape
}
from
'
./extHost.protocol
'
;
...
...
@@ -286,7 +286,7 @@ class ExtHostSourceControlResourceGroup implements vscode.SourceControlResourceG
return
Promise
.
resolve
(
null
);
}
return
as
Thenabl
e
(()
=>
this
.
_commands
.
executeCommand
(
command
.
command
,
...
command
.
arguments
));
return
as
Promis
e
(()
=>
this
.
_commands
.
executeCommand
(
command
.
command
,
...
command
.
arguments
));
}
_takeResourceStateSnapshot
():
SCMRawResourceSplice
[]
{
...
...
@@ -618,7 +618,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
return
Promise
.
resolve
(
null
);
}
return
as
Thenabl
e
(()
=>
sourceControl
.
quickDiffProvider
.
provideOriginalResource
(
uri
,
token
));
return
as
Promis
e
(()
=>
sourceControl
.
quickDiffProvider
.
provideOriginalResource
(
uri
,
token
));
}
$onInputBoxValueChange
(
sourceControlHandle
:
number
,
value
:
string
):
Promise
<
void
>
{
...
...
@@ -665,7 +665,7 @@ export class ExtHostSCM implements ExtHostSCMShape {
return
Promise
.
resolve
(
undefined
);
}
return
as
Thenabl
e
(()
=>
sourceControl
.
inputBox
.
validateInput
(
value
,
cursorPosition
)).
then
(
result
=>
{
return
as
Promis
e
(()
=>
sourceControl
.
inputBox
.
validateInput
(
value
,
cursorPosition
)).
then
(
result
=>
{
if
(
!
result
)
{
return
Promise
.
resolve
(
undefined
);
}
...
...
src/vs/workbench/api/node/extHostTask.ts
浏览文件 @
c6c7edaa
...
...
@@ -8,7 +8,7 @@ import * as path from 'path';
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
Objects
from
'
vs/base/common/objects
'
;
import
{
as
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
win32
}
from
'
vs/base/node/processes
'
;
...
...
@@ -870,7 +870,7 @@ export class ExtHostTask implements ExtHostTaskShape {
if
(
!
handler
)
{
return
Promise
.
reject
(
new
Error
(
'
no handler found
'
));
}
return
as
Thenabl
e
(()
=>
handler
.
provider
.
provideTasks
(
CancellationToken
.
None
)).
then
(
value
=>
{
return
as
Promis
e
(()
=>
handler
.
provider
.
provideTasks
(
CancellationToken
.
None
)).
then
(
value
=>
{
let
sanitized
:
vscode
.
Task
[]
=
[];
for
(
let
task
of
value
)
{
if
(
task
.
definition
&&
validTypes
[
task
.
definition
.
type
]
===
true
)
{
...
...
src/vs/workbench/api/node/extHostTreeViews.ts
浏览文件 @
c6c7edaa
...
...
@@ -12,7 +12,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
import
{
ExtHostTreeViewsShape
,
MainThreadTreeViewsShape
}
from
'
./extHost.protocol
'
;
import
{
ITreeItem
,
TreeViewItemHandleArg
,
ITreeItemLabel
,
IRevealOptions
}
from
'
vs/workbench/common/views
'
;
import
{
ExtHostCommands
,
CommandsConverter
}
from
'
vs/workbench/api/node/extHostCommands
'
;
import
{
as
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
{
TreeItemCollapsibleState
,
ThemeIcon
,
MarkdownString
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
isUndefinedOrNull
,
isString
}
from
'
vs/base/common/types
'
;
import
{
equals
,
coalesce
}
from
'
vs/base/common/arrays
'
;
...
...
@@ -280,7 +280,7 @@ class ExtHostTreeView<T> extends Disposable {
if
(
node
)
{
return
Promise
.
resolve
(
node
.
parent
?
this
.
elements
.
get
(
node
.
parent
.
item
.
handle
)
:
null
);
}
return
as
Thenabl
e
(()
=>
this
.
dataProvider
.
getParent
(
element
));
return
as
Promis
e
(()
=>
this
.
dataProvider
.
getParent
(
element
));
}
private
resolveTreeNode
(
element
:
T
,
parent
?:
TreeNode
):
Promise
<
TreeNode
>
{
...
...
@@ -288,7 +288,7 @@ class ExtHostTreeView<T> extends Disposable {
if
(
node
)
{
return
Promise
.
resolve
(
node
);
}
return
as
Thenabl
e
(()
=>
this
.
dataProvider
.
getTreeItem
(
element
))
return
as
Promis
e
(()
=>
this
.
dataProvider
.
getTreeItem
(
element
))
.
then
(
extTreeItem
=>
this
.
createHandle
(
element
,
extTreeItem
,
parent
,
true
))
.
then
(
handle
=>
this
.
getChildren
(
parent
?
parent
.
item
.
handle
:
null
)
.
then
(()
=>
{
...
...
@@ -322,10 +322,10 @@ class ExtHostTreeView<T> extends Disposable {
this
.
clearChildren
(
parentElement
);
const
parentNode
=
parentElement
?
this
.
nodes
.
get
(
parentElement
)
:
void
0
;
return
as
Thenabl
e
(()
=>
this
.
dataProvider
.
getChildren
(
parentElement
))
return
as
Promis
e
(()
=>
this
.
dataProvider
.
getChildren
(
parentElement
))
.
then
(
elements
=>
Promise
.
all
(
coalesce
(
elements
||
[])
.
map
(
element
=>
as
Thenabl
e
(()
=>
this
.
dataProvider
.
getTreeItem
(
element
))
.
map
(
element
=>
as
Promis
e
(()
=>
this
.
dataProvider
.
getTreeItem
(
element
))
.
then
(
extTreeItem
=>
extTreeItem
?
this
.
createAndRegisterTreeNode
(
element
,
extTreeItem
,
parentNode
)
:
null
))))
.
then
(
coalesce
);
}
...
...
@@ -390,7 +390,7 @@ class ExtHostTreeView<T> extends Disposable {
const
extElement
=
this
.
getExtensionElement
(
treeItemHandle
);
const
existing
=
this
.
nodes
.
get
(
extElement
);
this
.
clearChildren
(
extElement
);
// clear children cache
return
as
Thenabl
e
(()
=>
this
.
dataProvider
.
getTreeItem
(
extElement
))
return
as
Promis
e
(()
=>
this
.
dataProvider
.
getTreeItem
(
extElement
))
.
then
(
extTreeItem
=>
{
if
(
extTreeItem
)
{
const
newNode
=
this
.
createTreeNode
(
extElement
,
extTreeItem
,
existing
.
parent
);
...
...
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
浏览文件 @
c6c7edaa
...
...
@@ -23,7 +23,7 @@ import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRe
import
{
GroupIdentifier
,
IEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorGroup
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
as
Thenabl
e
}
from
'
vs/base/common/async
'
;
import
{
as
Promis
e
}
from
'
vs/base/common/async
'
;
import
{
CancellationToken
,
CancellationTokenSource
}
from
'
vs/base/common/cancellation
'
;
export
const
GOTO_SYMBOL_PREFIX
=
'
@
'
;
...
...
@@ -499,7 +499,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
}
if
(
model
&&
types
.
isFunction
((
<
ITextModel
>
model
).
getLanguageIdentifier
))
{
return
Promise
.
resolve
(
as
Thenabl
e
(()
=>
getDocumentSymbols
(
<
ITextModel
>
model
,
true
,
this
.
pendingOutlineRequest
.
token
)).
then
(
entries
=>
{
return
Promise
.
resolve
(
as
Promis
e
(()
=>
getDocumentSymbols
(
<
ITextModel
>
model
,
true
,
this
.
pendingOutlineRequest
.
token
)).
then
(
entries
=>
{
return
new
OutlineModel
(
this
.
toQuickOpenEntries
(
entries
));
}));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录