Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6f01cf8a
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,发现更多精彩内容 >>
提交
6f01cf8a
编写于
1月 04, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move LanguageProvider into own file
上级
4b0a5d86
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
240 addition
and
227 deletion
+240
-227
extensions/typescript/src/languageProvider.ts
extensions/typescript/src/languageProvider.ts
+238
-0
extensions/typescript/src/typescriptMain.ts
extensions/typescript/src/typescriptMain.ts
+2
-227
未找到文件。
extensions/typescript/src/languageProvider.ts
0 → 100644
浏览文件 @
6f01cf8a
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
languages
,
workspace
,
Diagnostic
,
Disposable
,
Uri
,
TextDocument
,
DocumentFilter
}
from
'
vscode
'
;
import
{
basename
}
from
'
path
'
;
import
TypeScriptServiceClient
from
'
./typescriptServiceClient
'
;
import
BufferSyncSupport
from
'
./features/bufferSyncSupport
'
;
import
TypingsStatus
from
'
./utils/typingsStatus
'
;
import
FormattingConfigurationManager
from
'
./features/formattingConfigurationManager
'
;
import
*
as
languageConfigurations
from
'
./utils/languageConfigurations
'
;
import
{
CommandManager
}
from
'
./utils/commandManager
'
;
import
DiagnosticsManager
from
'
./features/diagnostics
'
;
import
{
LanguageDescription
}
from
'
./utils/languageDescription
'
;
import
*
as
fileSchemes
from
'
./utils/fileSchemes
'
;
import
{
CachedNavTreeResponse
}
from
'
./features/baseCodeLensProvider
'
;
const
validateSetting
=
'
validate.enable
'
;
export
default
class
LanguageProvider
{
private
readonly
diagnosticsManager
:
DiagnosticsManager
;
private
readonly
bufferSyncSupport
:
BufferSyncSupport
;
private
readonly
formattingOptionsManager
:
FormattingConfigurationManager
;
private
readonly
toUpdateOnConfigurationChanged
:
({
updateConfiguration
:
()
=>
void
})[]
=
[];
private
_validate
:
boolean
=
true
;
private
_documentSelector
:
DocumentFilter
[];
private
readonly
disposables
:
Disposable
[]
=
[];
private
readonly
versionDependentDisposables
:
Disposable
[]
=
[];
constructor
(
private
readonly
client
:
TypeScriptServiceClient
,
private
readonly
description
:
LanguageDescription
,
commandManager
:
CommandManager
,
typingsStatus
:
TypingsStatus
)
{
this
.
formattingOptionsManager
=
new
FormattingConfigurationManager
(
client
);
this
.
bufferSyncSupport
=
new
BufferSyncSupport
(
client
,
description
.
modeIds
,
{
delete
:
(
file
:
string
)
=>
{
this
.
diagnosticsManager
.
delete
(
file
);
}
},
this
.
_validate
);
this
.
diagnosticsManager
=
new
DiagnosticsManager
(
description
.
id
,
this
.
client
);
workspace
.
onDidChangeConfiguration
(
this
.
configurationChanged
,
this
,
this
.
disposables
);
this
.
configurationChanged
();
client
.
onReady
(
async
()
=>
{
await
this
.
registerProviders
(
client
,
commandManager
,
typingsStatus
);
this
.
bufferSyncSupport
.
listen
();
});
}
public
dispose
():
void
{
while
(
this
.
disposables
.
length
)
{
const
obj
=
this
.
disposables
.
pop
();
if
(
obj
)
{
obj
.
dispose
();
}
}
while
(
this
.
versionDependentDisposables
.
length
)
{
const
obj
=
this
.
versionDependentDisposables
.
pop
();
if
(
obj
)
{
obj
.
dispose
();
}
}
this
.
diagnosticsManager
.
dispose
();
this
.
bufferSyncSupport
.
dispose
();
this
.
formattingOptionsManager
.
dispose
();
}
private
get
documentSelector
():
DocumentFilter
[]
{
if
(
!
this
.
_documentSelector
)
{
this
.
_documentSelector
=
[];
for
(
const
language
of
this
.
description
.
modeIds
)
{
for
(
const
scheme
of
fileSchemes
.
supportedSchemes
)
{
this
.
_documentSelector
.
push
({
language
,
scheme
});
}
}
}
return
this
.
_documentSelector
;
}
private
async
registerProviders
(
client
:
TypeScriptServiceClient
,
commandManager
:
CommandManager
,
typingsStatus
:
TypingsStatus
):
Promise
<
void
>
{
const
selector
=
this
.
documentSelector
;
const
config
=
workspace
.
getConfiguration
(
this
.
id
);
this
.
disposables
.
push
(
languages
.
registerCompletionItemProvider
(
selector
,
new
(
await
import
(
'
./features/completionItemProvider
'
)).
default
(
client
,
typingsStatus
,
commandManager
),
'
.
'
,
'
"
'
,
'
\'
'
,
'
/
'
,
'
@
'
));
this
.
disposables
.
push
(
languages
.
registerCompletionItemProvider
(
selector
,
new
(
await
import
(
'
./features/directiveCommentCompletionProvider
'
)).
default
(
client
),
'
@
'
));
const
{
TypeScriptFormattingProvider
,
FormattingProviderManager
}
=
await
import
(
'
./features/formattingProvider
'
);
const
formattingProvider
=
new
TypeScriptFormattingProvider
(
client
,
this
.
formattingOptionsManager
);
formattingProvider
.
updateConfiguration
(
config
);
this
.
disposables
.
push
(
languages
.
registerOnTypeFormattingEditProvider
(
selector
,
formattingProvider
,
'
;
'
,
'
}
'
,
'
\n
'
));
const
formattingProviderManager
=
new
FormattingProviderManager
(
this
.
description
.
id
,
formattingProvider
,
selector
);
formattingProviderManager
.
updateConfiguration
();
this
.
disposables
.
push
(
formattingProviderManager
);
this
.
toUpdateOnConfigurationChanged
.
push
(
formattingProviderManager
);
this
.
disposables
.
push
(
languages
.
registerCompletionItemProvider
(
selector
,
new
(
await
import
(
'
./features/jsDocCompletionProvider
'
)).
default
(
client
,
commandManager
),
'
*
'
));
this
.
disposables
.
push
(
languages
.
registerHoverProvider
(
selector
,
new
(
await
import
(
'
./features/hoverProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerDefinitionProvider
(
selector
,
new
(
await
import
(
'
./features/definitionProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerDocumentHighlightProvider
(
selector
,
new
(
await
import
(
'
./features/documentHighlightProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerReferenceProvider
(
selector
,
new
(
await
import
(
'
./features/referenceProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerDocumentSymbolProvider
(
selector
,
new
(
await
import
(
'
./features/documentSymbolProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerSignatureHelpProvider
(
selector
,
new
(
await
import
(
'
./features/signatureHelpProvider
'
)).
default
(
client
),
'
(
'
,
'
,
'
));
this
.
disposables
.
push
(
languages
.
registerRenameProvider
(
selector
,
new
(
await
import
(
'
./features/renameProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerCodeActionsProvider
(
selector
,
new
(
await
import
(
'
./features/quickFixProvider
'
)).
default
(
client
,
this
.
formattingOptionsManager
,
commandManager
)));
this
.
disposables
.
push
(
languages
.
registerCodeActionsProvider
(
selector
,
new
(
await
import
(
'
./features/refactorProvider
'
)).
default
(
client
,
this
.
formattingOptionsManager
,
commandManager
)));
this
.
registerVersionDependentProviders
();
const
cachedResponse
=
new
CachedNavTreeResponse
();
const
referenceCodeLensProvider
=
new
(
await
import
(
'
./features/referencesCodeLensProvider
'
)).
default
(
client
,
this
.
description
.
id
,
cachedResponse
);
referenceCodeLensProvider
.
updateConfiguration
();
this
.
toUpdateOnConfigurationChanged
.
push
(
referenceCodeLensProvider
);
this
.
disposables
.
push
(
languages
.
registerCodeLensProvider
(
selector
,
referenceCodeLensProvider
));
const
implementationCodeLensProvider
=
new
(
await
import
(
'
./features/implementationsCodeLensProvider
'
)).
default
(
client
,
this
.
description
.
id
,
cachedResponse
);
implementationCodeLensProvider
.
updateConfiguration
();
this
.
toUpdateOnConfigurationChanged
.
push
(
implementationCodeLensProvider
);
this
.
disposables
.
push
(
languages
.
registerCodeLensProvider
(
selector
,
implementationCodeLensProvider
));
this
.
disposables
.
push
(
languages
.
registerWorkspaceSymbolProvider
(
new
(
await
import
(
'
./features/workspaceSymbolProvider
'
)).
default
(
client
,
this
.
description
.
modeIds
)));
if
(
!
this
.
description
.
isExternal
)
{
for
(
const
modeId
of
this
.
description
.
modeIds
)
{
this
.
disposables
.
push
(
languages
.
setLanguageConfiguration
(
modeId
,
languageConfigurations
.
jsTsLanguageConfiguration
));
}
}
}
private
configurationChanged
():
void
{
const
config
=
workspace
.
getConfiguration
(
this
.
id
);
this
.
updateValidate
(
config
.
get
(
validateSetting
,
true
));
for
(
const
toUpdate
of
this
.
toUpdateOnConfigurationChanged
)
{
toUpdate
.
updateConfiguration
();
}
}
public
handles
(
file
:
string
,
doc
:
TextDocument
):
boolean
{
if
(
doc
&&
this
.
description
.
modeIds
.
indexOf
(
doc
.
languageId
)
>=
0
)
{
return
true
;
}
if
(
this
.
bufferSyncSupport
.
handles
(
file
))
{
return
true
;
}
const
base
=
basename
(
file
);
return
!!
base
&&
base
===
this
.
description
.
configFile
;
}
public
get
id
():
string
{
return
this
.
description
.
id
;
}
public
get
diagnosticSource
():
string
{
return
this
.
description
.
diagnosticSource
;
}
private
updateValidate
(
value
:
boolean
)
{
if
(
this
.
_validate
===
value
)
{
return
;
}
this
.
_validate
=
value
;
this
.
bufferSyncSupport
.
validate
=
value
;
this
.
diagnosticsManager
.
validate
=
value
;
if
(
value
)
{
this
.
triggerAllDiagnostics
();
}
}
public
reInitialize
():
void
{
this
.
diagnosticsManager
.
reInitialize
();
this
.
bufferSyncSupport
.
reOpenDocuments
();
this
.
bufferSyncSupport
.
requestAllDiagnostics
();
this
.
formattingOptionsManager
.
reset
();
this
.
registerVersionDependentProviders
();
}
private
async
registerVersionDependentProviders
():
Promise
<
void
>
{
while
(
this
.
versionDependentDisposables
.
length
)
{
const
obj
=
this
.
versionDependentDisposables
.
pop
();
if
(
obj
)
{
obj
.
dispose
();
}
}
if
(
!
this
.
client
)
{
return
;
}
const
selector
=
this
.
documentSelector
;
if
(
this
.
client
.
apiVersion
.
has220Features
())
{
this
.
versionDependentDisposables
.
push
(
languages
.
registerImplementationProvider
(
selector
,
new
(
await
import
(
'
./features/implementationProvider
'
)).
default
(
this
.
client
)));
}
if
(
this
.
client
.
apiVersion
.
has213Features
())
{
this
.
versionDependentDisposables
.
push
(
languages
.
registerTypeDefinitionProvider
(
selector
,
new
(
await
import
(
'
./features/typeDefinitionProvider
'
)).
default
(
this
.
client
)));
}
}
public
triggerAllDiagnostics
():
void
{
this
.
bufferSyncSupport
.
requestAllDiagnostics
();
}
public
syntaxDiagnosticsReceived
(
file
:
Uri
,
syntaxDiagnostics
:
Diagnostic
[]):
void
{
this
.
diagnosticsManager
.
syntaxDiagnosticsReceived
(
file
,
syntaxDiagnostics
);
}
public
semanticDiagnosticsReceived
(
file
:
Uri
,
semanticDiagnostics
:
Diagnostic
[]):
void
{
this
.
diagnosticsManager
.
semanticDiagnosticsReceived
(
file
,
semanticDiagnostics
);
}
public
configFileDiagnosticsReceived
(
file
:
Uri
,
diagnostics
:
Diagnostic
[]):
void
{
this
.
diagnosticsManager
.
configFileDiagnosticsReceived
(
file
,
diagnostics
);
}
}
\ No newline at end of file
extensions/typescript/src/typescriptMain.ts
浏览文件 @
6f01cf8a
...
...
@@ -8,248 +8,23 @@
* https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/TypeScript%20Indent.tmPreferences
* ------------------------------------------------------------------------------------------ */
import
{
languages
,
workspace
,
Memento
,
Diagnostic
,
Range
,
Disposable
,
Uri
,
DiagnosticSeverity
,
TextDocument
,
DocumentFilter
}
from
'
vscode
'
;
import
{
basename
}
from
'
path
'
;
import
{
workspace
,
Memento
,
Diagnostic
,
Range
,
Disposable
,
Uri
,
DiagnosticSeverity
}
from
'
vscode
'
;
import
*
as
Proto
from
'
./protocol
'
;
import
*
as
PConst
from
'
./protocol.const
'
;
import
TypeScriptServiceClient
from
'
./typescriptServiceClient
'
;
import
{
ITypeScriptServiceClientHost
}
from
'
./typescriptService
'
;
import
BufferSyncSupport
from
'
./features/bufferSyncSupport
'
;
import
LanguageProvider
from
'
./languageProvider
'
;
import
TypingsStatus
,
{
AtaProgressReporter
}
from
'
./utils/typingsStatus
'
;
import
VersionStatus
from
'
./utils/versionStatus
'
;
import
{
TypeScriptServerPlugin
}
from
'
./utils/plugins
'
;
import
{
tsLocationToVsPosition
}
from
'
./utils/convert
'
;
import
FormattingConfigurationManager
from
'
./features/formattingConfigurationManager
'
;
import
*
as
languageConfigurations
from
'
./utils/languageConfigurations
'
;
import
{
CommandManager
}
from
'
./utils/commandManager
'
;
import
DiagnosticsManager
from
'
./features/diagnostics
'
;
import
{
LanguageDescription
}
from
'
./utils/languageDescription
'
;
import
*
as
fileSchemes
from
'
./utils/fileSchemes
'
;
import
{
CachedNavTreeResponse
}
from
'
./features/baseCodeLensProvider
'
;
import
LogDirectoryProvider
from
'
./utils/logDirectoryProvider
'
;
const
validateSetting
=
'
validate.enable
'
;
class
LanguageProvider
{
private
readonly
diagnosticsManager
:
DiagnosticsManager
;
private
readonly
bufferSyncSupport
:
BufferSyncSupport
;
private
readonly
formattingOptionsManager
:
FormattingConfigurationManager
;
private
readonly
toUpdateOnConfigurationChanged
:
({
updateConfiguration
:
()
=>
void
})[]
=
[];
private
_validate
:
boolean
=
true
;
private
_documentSelector
:
DocumentFilter
[];
private
readonly
disposables
:
Disposable
[]
=
[];
private
readonly
versionDependentDisposables
:
Disposable
[]
=
[];
constructor
(
private
readonly
client
:
TypeScriptServiceClient
,
private
readonly
description
:
LanguageDescription
,
commandManager
:
CommandManager
,
typingsStatus
:
TypingsStatus
)
{
this
.
formattingOptionsManager
=
new
FormattingConfigurationManager
(
client
);
this
.
bufferSyncSupport
=
new
BufferSyncSupport
(
client
,
description
.
modeIds
,
{
delete
:
(
file
:
string
)
=>
{
this
.
diagnosticsManager
.
delete
(
file
);
}
},
this
.
_validate
);
this
.
diagnosticsManager
=
new
DiagnosticsManager
(
description
.
id
,
this
.
client
);
workspace
.
onDidChangeConfiguration
(
this
.
configurationChanged
,
this
,
this
.
disposables
);
this
.
configurationChanged
();
client
.
onReady
(
async
()
=>
{
await
this
.
registerProviders
(
client
,
commandManager
,
typingsStatus
);
this
.
bufferSyncSupport
.
listen
();
});
}
public
dispose
():
void
{
while
(
this
.
disposables
.
length
)
{
const
obj
=
this
.
disposables
.
pop
();
if
(
obj
)
{
obj
.
dispose
();
}
}
while
(
this
.
versionDependentDisposables
.
length
)
{
const
obj
=
this
.
versionDependentDisposables
.
pop
();
if
(
obj
)
{
obj
.
dispose
();
}
}
this
.
diagnosticsManager
.
dispose
();
this
.
bufferSyncSupport
.
dispose
();
this
.
formattingOptionsManager
.
dispose
();
}
private
get
documentSelector
():
DocumentFilter
[]
{
if
(
!
this
.
_documentSelector
)
{
this
.
_documentSelector
=
[];
for
(
const
language
of
this
.
description
.
modeIds
)
{
for
(
const
scheme
of
fileSchemes
.
supportedSchemes
)
{
this
.
_documentSelector
.
push
({
language
,
scheme
});
}
}
}
return
this
.
_documentSelector
;
}
private
async
registerProviders
(
client
:
TypeScriptServiceClient
,
commandManager
:
CommandManager
,
typingsStatus
:
TypingsStatus
):
Promise
<
void
>
{
const
selector
=
this
.
documentSelector
;
const
config
=
workspace
.
getConfiguration
(
this
.
id
);
this
.
disposables
.
push
(
languages
.
registerCompletionItemProvider
(
selector
,
new
(
await
import
(
'
./features/completionItemProvider
'
)).
default
(
client
,
typingsStatus
,
commandManager
),
'
.
'
,
'
"
'
,
'
\'
'
,
'
/
'
,
'
@
'
));
this
.
disposables
.
push
(
languages
.
registerCompletionItemProvider
(
selector
,
new
(
await
import
(
'
./features/directiveCommentCompletionProvider
'
)).
default
(
client
),
'
@
'
));
const
{
TypeScriptFormattingProvider
,
FormattingProviderManager
}
=
await
import
(
'
./features/formattingProvider
'
);
const
formattingProvider
=
new
TypeScriptFormattingProvider
(
client
,
this
.
formattingOptionsManager
);
formattingProvider
.
updateConfiguration
(
config
);
this
.
disposables
.
push
(
languages
.
registerOnTypeFormattingEditProvider
(
selector
,
formattingProvider
,
'
;
'
,
'
}
'
,
'
\n
'
));
const
formattingProviderManager
=
new
FormattingProviderManager
(
this
.
description
.
id
,
formattingProvider
,
selector
);
formattingProviderManager
.
updateConfiguration
();
this
.
disposables
.
push
(
formattingProviderManager
);
this
.
toUpdateOnConfigurationChanged
.
push
(
formattingProviderManager
);
this
.
disposables
.
push
(
languages
.
registerCompletionItemProvider
(
selector
,
new
(
await
import
(
'
./features/jsDocCompletionProvider
'
)).
default
(
client
,
commandManager
),
'
*
'
));
this
.
disposables
.
push
(
languages
.
registerHoverProvider
(
selector
,
new
(
await
import
(
'
./features/hoverProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerDefinitionProvider
(
selector
,
new
(
await
import
(
'
./features/definitionProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerDocumentHighlightProvider
(
selector
,
new
(
await
import
(
'
./features/documentHighlightProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerReferenceProvider
(
selector
,
new
(
await
import
(
'
./features/referenceProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerDocumentSymbolProvider
(
selector
,
new
(
await
import
(
'
./features/documentSymbolProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerSignatureHelpProvider
(
selector
,
new
(
await
import
(
'
./features/signatureHelpProvider
'
)).
default
(
client
),
'
(
'
,
'
,
'
));
this
.
disposables
.
push
(
languages
.
registerRenameProvider
(
selector
,
new
(
await
import
(
'
./features/renameProvider
'
)).
default
(
client
)));
this
.
disposables
.
push
(
languages
.
registerCodeActionsProvider
(
selector
,
new
(
await
import
(
'
./features/quickFixProvider
'
)).
default
(
client
,
this
.
formattingOptionsManager
,
commandManager
)));
this
.
disposables
.
push
(
languages
.
registerCodeActionsProvider
(
selector
,
new
(
await
import
(
'
./features/refactorProvider
'
)).
default
(
client
,
this
.
formattingOptionsManager
,
commandManager
)));
this
.
registerVersionDependentProviders
();
const
cachedResponse
=
new
CachedNavTreeResponse
();
const
referenceCodeLensProvider
=
new
(
await
import
(
'
./features/referencesCodeLensProvider
'
)).
default
(
client
,
this
.
description
.
id
,
cachedResponse
);
referenceCodeLensProvider
.
updateConfiguration
();
this
.
toUpdateOnConfigurationChanged
.
push
(
referenceCodeLensProvider
);
this
.
disposables
.
push
(
languages
.
registerCodeLensProvider
(
selector
,
referenceCodeLensProvider
));
const
implementationCodeLensProvider
=
new
(
await
import
(
'
./features/implementationsCodeLensProvider
'
)).
default
(
client
,
this
.
description
.
id
,
cachedResponse
);
implementationCodeLensProvider
.
updateConfiguration
();
this
.
toUpdateOnConfigurationChanged
.
push
(
implementationCodeLensProvider
);
this
.
disposables
.
push
(
languages
.
registerCodeLensProvider
(
selector
,
implementationCodeLensProvider
));
this
.
disposables
.
push
(
languages
.
registerWorkspaceSymbolProvider
(
new
(
await
import
(
'
./features/workspaceSymbolProvider
'
)).
default
(
client
,
this
.
description
.
modeIds
)));
if
(
!
this
.
description
.
isExternal
)
{
for
(
const
modeId
of
this
.
description
.
modeIds
)
{
this
.
disposables
.
push
(
languages
.
setLanguageConfiguration
(
modeId
,
languageConfigurations
.
jsTsLanguageConfiguration
));
}
}
}
private
configurationChanged
():
void
{
const
config
=
workspace
.
getConfiguration
(
this
.
id
);
this
.
updateValidate
(
config
.
get
(
validateSetting
,
true
));
for
(
const
toUpdate
of
this
.
toUpdateOnConfigurationChanged
)
{
toUpdate
.
updateConfiguration
();
}
}
public
handles
(
file
:
string
,
doc
:
TextDocument
):
boolean
{
if
(
doc
&&
this
.
description
.
modeIds
.
indexOf
(
doc
.
languageId
)
>=
0
)
{
return
true
;
}
if
(
this
.
bufferSyncSupport
.
handles
(
file
))
{
return
true
;
}
const
base
=
basename
(
file
);
return
!!
base
&&
base
===
this
.
description
.
configFile
;
}
public
get
id
():
string
{
return
this
.
description
.
id
;
}
public
get
diagnosticSource
():
string
{
return
this
.
description
.
diagnosticSource
;
}
private
updateValidate
(
value
:
boolean
)
{
if
(
this
.
_validate
===
value
)
{
return
;
}
this
.
_validate
=
value
;
this
.
bufferSyncSupport
.
validate
=
value
;
this
.
diagnosticsManager
.
validate
=
value
;
if
(
value
)
{
this
.
triggerAllDiagnostics
();
}
}
public
reInitialize
():
void
{
this
.
diagnosticsManager
.
reInitialize
();
this
.
bufferSyncSupport
.
reOpenDocuments
();
this
.
bufferSyncSupport
.
requestAllDiagnostics
();
this
.
formattingOptionsManager
.
reset
();
this
.
registerVersionDependentProviders
();
}
private
async
registerVersionDependentProviders
():
Promise
<
void
>
{
while
(
this
.
versionDependentDisposables
.
length
)
{
const
obj
=
this
.
versionDependentDisposables
.
pop
();
if
(
obj
)
{
obj
.
dispose
();
}
}
if
(
!
this
.
client
)
{
return
;
}
const
selector
=
this
.
documentSelector
;
if
(
this
.
client
.
apiVersion
.
has220Features
())
{
this
.
versionDependentDisposables
.
push
(
languages
.
registerImplementationProvider
(
selector
,
new
(
await
import
(
'
./features/implementationProvider
'
)).
default
(
this
.
client
)));
}
if
(
this
.
client
.
apiVersion
.
has213Features
())
{
this
.
versionDependentDisposables
.
push
(
languages
.
registerTypeDefinitionProvider
(
selector
,
new
(
await
import
(
'
./features/typeDefinitionProvider
'
)).
default
(
this
.
client
)));
}
}
public
triggerAllDiagnostics
():
void
{
this
.
bufferSyncSupport
.
requestAllDiagnostics
();
}
public
syntaxDiagnosticsReceived
(
file
:
Uri
,
syntaxDiagnostics
:
Diagnostic
[]):
void
{
this
.
diagnosticsManager
.
syntaxDiagnosticsReceived
(
file
,
syntaxDiagnostics
);
}
public
semanticDiagnosticsReceived
(
file
:
Uri
,
semanticDiagnostics
:
Diagnostic
[]):
void
{
this
.
diagnosticsManager
.
semanticDiagnosticsReceived
(
file
,
semanticDiagnostics
);
}
public
configFileDiagnosticsReceived
(
file
:
Uri
,
diagnostics
:
Diagnostic
[]):
void
{
this
.
diagnosticsManager
.
configFileDiagnosticsReceived
(
file
,
diagnostics
);
}
}
// Style check diagnostics that can be reported as warnings
const
styleCheckDiagnostics
=
[
6133
,
// variable is declared but never used
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录