Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
905c4f1a
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,发现更多精彩内容 >>
提交
905c4f1a
编写于
5月 04, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
type converters, use namespace in more places
上级
4e46d2a1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
66 addition
and
65 deletion
+66
-65
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
...kbench/api/electron-browser/mainThreadLanguageFeatures.ts
+19
-19
src/vs/workbench/api/node/apiCommands.ts
src/vs/workbench/api/node/apiCommands.ts
+2
-2
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+4
-4
src/vs/workbench/api/node/extHostTypeConverters.ts
src/vs/workbench/api/node/extHostTypeConverters.ts
+41
-40
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadLanguageFeatures.ts
浏览文件 @
905c4f1a
...
...
@@ -20,7 +20,7 @@ import { LanguageConfiguration, IndentationRule, OnEnterRule } from 'vs/editor/c
import
{
IHeapService
}
from
'
./mainThreadHeapService
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
extHostNamedCustomer
}
from
'
vs/workbench/api/electron-browser/extHostCustomers
'
;
import
{
toLanguageSelector
}
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
*
as
typeConverters
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
URI
from
'
vs/base/common/uri
'
;
@
extHostNamedCustomer
(
MainContext
.
MainThreadLanguageFeatures
)
...
...
@@ -97,7 +97,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- outline
$registerOutlineSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentSymbolProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
DocumentSymbolProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentSymbolProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DocumentSymbolProvider
>
{
provideDocumentSymbols
:
(
model
:
ITextModel
,
token
:
CancellationToken
):
Thenable
<
modes
.
SymbolInformation
[]
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentSymbols
(
handle
,
model
.
uri
)).
then
(
MainThreadLanguageFeatures
.
_reviveSymbolInformationDto
);
}
...
...
@@ -123,7 +123,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
provider
.
onDidChange
=
emitter
.
event
;
}
this
.
_registrations
[
handle
]
=
modes
.
CodeLensProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
provider
);
this
.
_registrations
[
handle
]
=
modes
.
CodeLensProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
provider
);
}
$emitCodeLensEvent
(
eventHandle
:
number
,
event
?:
any
):
void
{
...
...
@@ -136,7 +136,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- declaration
$registerDeclaractionSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DefinitionProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
DefinitionProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
DefinitionProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DefinitionProvider
>
{
provideDefinition
:
(
model
,
position
,
token
):
Thenable
<
modes
.
Definition
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDefinition
(
handle
,
model
.
uri
,
position
)).
then
(
MainThreadLanguageFeatures
.
_reviveLocationDto
);
}
...
...
@@ -144,7 +144,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
}
$registerImplementationSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
ImplementationProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
ImplementationProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
ImplementationProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
ImplementationProvider
>
{
provideImplementation
:
(
model
,
position
,
token
):
Thenable
<
modes
.
Definition
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideImplementation
(
handle
,
model
.
uri
,
position
)).
then
(
MainThreadLanguageFeatures
.
_reviveLocationDto
);
}
...
...
@@ -152,7 +152,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
}
$registerTypeDefinitionSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
TypeDefinitionProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
TypeDefinitionProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
TypeDefinitionProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
TypeDefinitionProvider
>
{
provideTypeDefinition
:
(
model
,
position
,
token
):
Thenable
<
modes
.
Definition
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideTypeDefinition
(
handle
,
model
.
uri
,
position
)).
then
(
MainThreadLanguageFeatures
.
_reviveLocationDto
);
}
...
...
@@ -162,7 +162,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- extra info
$registerHoverProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
HoverProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
HoverProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
HoverProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
HoverProvider
>
{
provideHover
:
(
model
:
ITextModel
,
position
:
EditorPosition
,
token
:
CancellationToken
):
Thenable
<
modes
.
Hover
>
=>
{
return
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideHover
(
handle
,
model
.
uri
,
position
));
}
...
...
@@ -172,7 +172,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- occurrences
$registerDocumentHighlightProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentHighlightProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
DocumentHighlightProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentHighlightProviderRegistry
.
register
(
t
ypeConverters
.
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
));
}
...
...
@@ -182,7 +182,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- references
$registerReferenceSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
ReferenceProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
ReferenceProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
ReferenceProviderRegistry
.
register
(
t
ypeConverters
.
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
);
}
...
...
@@ -192,7 +192,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- quick fix
$registerQuickFixSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[],
providedCodeActionKinds
?:
string
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
CodeActionProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
CodeActionProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
CodeActionProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
CodeActionProvider
>
{
provideCodeActions
:
(
model
:
ITextModel
,
range
:
EditorRange
,
context
:
modes
.
CodeActionContext
,
token
:
CancellationToken
):
Thenable
<
modes
.
CodeAction
[]
>
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideCodeActions
(
handle
,
model
.
uri
,
range
,
context
))).
then
(
MainThreadLanguageFeatures
.
_reviveCodeActionDto
);
},
...
...
@@ -203,7 +203,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- formatting
$registerDocumentFormattingSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentFormattingEditProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
DocumentFormattingEditProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentFormattingEditProviderRegistry
.
register
(
t
ypeConverters
.
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
));
}
...
...
@@ -211,7 +211,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
}
$registerRangeFormattingSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentRangeFormattingEditProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
DocumentRangeFormattingEditProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
DocumentRangeFormattingEditProviderRegistry
.
register
(
t
ypeConverters
.
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
));
}
...
...
@@ -219,7 +219,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
}
$registerOnTypeFormattingSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[],
autoFormatTriggerCharacters
:
string
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
OnTypeFormattingEditProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
OnTypeFormattingEditProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
OnTypeFormattingEditProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
OnTypeFormattingEditProvider
>
{
autoFormatTriggerCharacters
,
...
...
@@ -253,7 +253,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerRenameSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[],
supportResolveLocation
:
boolean
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
RenameProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
RenameProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
RenameProviderRegistry
.
register
(
t
ypeConverters
.
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
);
},
...
...
@@ -266,7 +266,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- suggest
$registerSuggestSupport
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[],
triggerCharacters
:
string
[],
supportsResolveDetails
:
boolean
):
void
{
this
.
_registrations
[
handle
]
=
modes
.
SuggestRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
ISuggestSupport
>
{
this
.
_registrations
[
handle
]
=
modes
.
SuggestRegistry
.
register
(
t
ypeConverters
.
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
=>
{
...
...
@@ -289,7 +289,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- parameter hints
$registerSignatureHelpProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[],
triggerCharacter
:
string
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
SignatureHelpProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
SignatureHelpProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
SignatureHelpProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
SignatureHelpProvider
>
{
signatureHelpTriggerCharacters
:
triggerCharacter
,
...
...
@@ -303,7 +303,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
// --- links
$registerDocumentLinkProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
this
.
_registrations
[
handle
]
=
modes
.
LinkProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
LinkProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
LinkProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
LinkProvider
>
{
provideLinks
:
(
model
,
token
)
=>
{
return
this
.
_heapService
.
trackRecursive
(
wireCancellationToken
(
token
,
this
.
_proxy
.
$provideDocumentLinks
(
handle
,
model
.
uri
)));
},
...
...
@@ -317,7 +317,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerDocumentColorProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
const
proxy
=
this
.
_proxy
;
this
.
_registrations
[
handle
]
=
modes
.
ColorProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
DocumentColorProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
ColorProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
DocumentColorProvider
>
{
provideDocumentColors
:
(
model
,
token
)
=>
{
return
wireCancellationToken
(
token
,
proxy
.
$provideDocumentColors
(
handle
,
model
.
uri
))
.
then
(
documentColors
=>
{
...
...
@@ -351,7 +351,7 @@ export class MainThreadLanguageFeatures implements MainThreadLanguageFeaturesSha
$registerFoldingRangeProvider
(
handle
:
number
,
selector
:
ISerializedDocumentFilter
[]):
void
{
const
proxy
=
this
.
_proxy
;
this
.
_registrations
[
handle
]
=
modes
.
FoldingRangeProviderRegistry
.
register
(
t
oLanguageSelector
(
selector
),
<
modes
.
FoldingRangeProvider
>
{
this
.
_registrations
[
handle
]
=
modes
.
FoldingRangeProviderRegistry
.
register
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
<
modes
.
FoldingRangeProvider
>
{
provideFoldingRanges
:
(
model
,
context
,
token
)
=>
{
return
wireCancellationToken
(
token
,
proxy
.
$provideFoldingRanges
(
handle
,
model
.
uri
,
context
));
}
...
...
src/vs/workbench/api/node/apiCommands.ts
浏览文件 @
905c4f1a
...
...
@@ -59,7 +59,7 @@ export class DiffAPICommand {
left
,
right
,
label
,
undefined
,
typeConverters
.
toTextEditorOptions
(
options
),
typeConverters
.
TextEditorOptions
.
from
(
options
),
options
?
typeConverters
.
ViewColumn
.
from
(
options
.
viewColumn
)
:
undefined
]);
}
...
...
@@ -76,7 +76,7 @@ export class OpenAPICommand {
if
(
typeof
columnOrOptions
===
'
number
'
)
{
column
=
typeConverters
.
ViewColumn
.
from
(
columnOrOptions
);
}
else
{
options
=
typeConverters
.
toTextEditorOptions
(
columnOrOptions
);
options
=
typeConverters
.
TextEditorOptions
.
from
(
columnOrOptions
);
column
=
typeConverters
.
ViewColumn
.
from
(
columnOrOptions
.
viewColumn
);
}
}
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
905c4f1a
...
...
@@ -53,7 +53,7 @@ import { ProxyIdentifier } from 'vs/workbench/services/extensions/node/proxyIden
import
{
ExtHostDialogs
}
from
'
vs/workbench/api/node/extHostDialogs
'
;
import
{
ExtHostFileSystem
}
from
'
vs/workbench/api/node/extHostFileSystem
'
;
import
{
ExtHostDecorations
}
from
'
vs/workbench/api/node/extHostDecorations
'
;
import
{
toGlobPattern
,
toLanguageSelector
}
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
*
as
typeConverters
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
ExtensionActivatedByAPI
}
from
'
vs/workbench/api/node/extHostExtensionActivator
'
;
import
{
OverviewRulerLane
}
from
'
vs/editor/common/model
'
;
import
{
ExtHostLogService
}
from
'
vs/workbench/api/node/extHostLogService
'
;
...
...
@@ -255,7 +255,7 @@ export function createApiFactory(
return
extHostLanguages
.
getLanguages
();
},
match
(
selector
:
vscode
.
DocumentSelector
,
document
:
vscode
.
TextDocument
):
number
{
return
score
(
t
oLanguageSelector
(
selector
),
document
.
uri
,
document
.
languageId
,
true
);
return
score
(
t
ypeConverters
.
LanguageSelector
.
from
(
selector
),
document
.
uri
,
document
.
languageId
,
true
);
},
registerCodeActionsProvider
(
selector
:
vscode
.
DocumentSelector
,
provider
:
vscode
.
CodeActionProvider
,
metadata
?:
vscode
.
CodeActionProviderMetadata
):
vscode
.
Disposable
{
return
extHostLanguageFeatures
.
registerCodeActionProvider
(
checkSelector
(
selector
),
provider
,
metadata
);
...
...
@@ -474,7 +474,7 @@ export function createApiFactory(
return
extHostWorkspace
.
getRelativePath
(
pathOrUri
,
includeWorkspace
);
},
findFiles
:
(
include
,
exclude
,
maxResults
?,
token
?)
=>
{
return
extHostWorkspace
.
findFiles
(
t
oGlobPattern
(
include
),
toGlobPattern
(
exclude
),
maxResults
,
extension
.
id
,
token
);
return
extHostWorkspace
.
findFiles
(
t
ypeConverters
.
GlobPattern
.
from
(
include
),
typeConverters
.
GlobPattern
.
from
(
exclude
),
maxResults
,
extension
.
id
,
token
);
},
saveAll
:
(
includeUntitled
?)
=>
{
return
extHostWorkspace
.
saveAll
(
includeUntitled
);
...
...
@@ -483,7 +483,7 @@ export function createApiFactory(
return
extHostEditors
.
applyWorkspaceEdit
(
edit
);
},
createFileSystemWatcher
:
(
pattern
,
ignoreCreate
,
ignoreChange
,
ignoreDelete
):
vscode
.
FileSystemWatcher
=>
{
return
extHostFileSystemEvent
.
createFileSystemWatcher
(
t
oGlobPattern
(
pattern
),
ignoreCreate
,
ignoreChange
,
ignoreDelete
);
return
extHostFileSystemEvent
.
createFileSystemWatcher
(
t
ypeConverters
.
GlobPattern
.
from
(
pattern
),
ignoreCreate
,
ignoreChange
,
ignoreDelete
);
},
get
textDocuments
()
{
return
extHostDocuments
.
getAllDocumentData
().
map
(
data
=>
data
.
document
);
...
...
src/vs/workbench/api/node/extHostTypeConverters.ts
浏览文件 @
905c4f1a
...
...
@@ -18,7 +18,7 @@ import { IRange } from 'vs/editor/common/core/range';
import
{
ISelection
}
from
'
vs/editor/common/core/selection
'
;
import
*
as
htmlContent
from
'
vs/base/common/htmlContent
'
;
import
{
IRelativePattern
}
from
'
vs/base/common/glob
'
;
import
{
LanguageSelector
,
LanguageFilter
}
from
'
vs/editor/common/modes/languageSelector
'
;
import
*
as
languageSelector
from
'
vs/editor/common/modes/languageSelector
'
;
import
{
WorkspaceEditDto
,
ResourceTextEditDto
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
MarkerSeverity
,
IRelatedInformation
,
IMarkerData
}
from
'
vs/platform/markers/common/markers
'
;
...
...
@@ -698,57 +698,58 @@ export namespace FoldingRangeKind {
}
}
export
function
toTextEditorOptions
(
options
?:
vscode
.
TextDocumentShowOptions
):
ITextEditorOptions
{
if
(
options
)
{
return
{
pinned
:
typeof
options
.
preview
===
'
boolean
'
?
!
options
.
preview
:
undefined
,
preserveFocus
:
options
.
preserveFocus
,
selection
:
typeof
options
.
selection
===
'
object
'
?
Range
.
from
(
options
.
selection
)
:
undefined
}
as
ITextEditorOptions
;
}
return
undefined
;
}
export
namespace
TextEditorOptions
{
export
function
toGlobPattern
(
pattern
:
vscode
.
GlobPattern
):
string
|
IRelativePattern
{
if
(
typeof
pattern
===
'
string
'
)
{
return
pattern
;
}
export
function
from
(
options
?:
vscode
.
TextDocumentShowOptions
):
ITextEditorOptions
{
if
(
options
)
{
return
{
pinned
:
typeof
options
.
preview
===
'
boolean
'
?
!
options
.
preview
:
undefined
,
preserveFocus
:
options
.
preserveFocus
,
selection
:
typeof
options
.
selection
===
'
object
'
?
Range
.
from
(
options
.
selection
)
:
undefined
}
as
ITextEditorOptions
;
}
if
(
isRelativePattern
(
pattern
))
{
return
new
types
.
RelativePattern
(
pattern
.
base
,
pattern
.
pattern
);
return
undefined
;
}
return
pattern
;
// preserve `undefined` and `null`
}
function
isRelativePattern
(
obj
:
any
):
obj
is
vscode
.
RelativePattern
{
const
rp
=
obj
as
vscode
.
RelativePattern
;
export
namespace
GlobPattern
{
return
rp
&&
typeof
rp
.
base
===
'
string
'
&&
typeof
rp
.
pattern
===
'
string
'
;
}
export
function
from
(
pattern
:
vscode
.
GlobPattern
):
string
|
IRelativePattern
{
if
(
typeof
pattern
===
'
string
'
)
{
return
pattern
;
}
export
function
toLanguageSelector
(
selector
:
vscode
.
DocumentSelector
):
LanguageSelector
{
if
(
Array
.
isArray
(
selector
))
{
return
selector
.
map
(
sel
=>
doToLanguageSelector
(
sel
));
if
(
isRelativePattern
(
pattern
))
{
return
new
types
.
RelativePattern
(
pattern
.
base
,
pattern
.
pattern
);
}
return
pattern
;
// preserve `undefined` and `null`
}
return
doToLanguageSelector
(
selector
);
function
isRelativePattern
(
obj
:
any
):
obj
is
vscode
.
RelativePattern
{
const
rp
=
obj
as
vscode
.
RelativePattern
;
return
rp
&&
typeof
rp
.
base
===
'
string
'
&&
typeof
rp
.
pattern
===
'
string
'
;
}
}
function
doToLanguageSelector
(
selector
:
string
|
vscode
.
DocumentFilter
):
string
|
LanguageFilter
{
if
(
typeof
selector
===
'
string
'
)
{
return
selector
;
}
export
namespace
LanguageSelector
{
if
(
selector
)
{
return
{
language
:
selector
.
language
,
scheme
:
selector
.
scheme
,
pattern
:
toGlobPattern
(
selector
.
pattern
),
exclusive
:
selector
.
exclusive
};
export
function
from
(
selector
:
vscode
.
DocumentSelector
):
languageSelector
.
LanguageSelector
{
if
(
!
selector
)
{
return
undefined
;
}
else
if
(
Array
.
isArray
(
selector
))
{
return
<
languageSelector
.
LanguageSelector
>
selector
.
map
(
from
);
}
else
if
(
typeof
selector
===
'
string
'
)
{
return
selector
;
}
else
{
return
<
languageSelector
.
LanguageFilter
>
{
language
:
selector
.
language
,
scheme
:
selector
.
scheme
,
pattern
:
GlobPattern
.
from
(
selector
.
pattern
),
exclusive
:
selector
.
exclusive
};
}
}
return
undefined
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录