Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
a1c693ab
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,发现更多精彩内容 >>
提交
a1c693ab
编写于
3月 26, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Allow disabling JS/TS suggestion actions
Fixes #46590
上级
6eebe4ba
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
49 addition
and
5 deletion
+49
-5
extensions/typescript-language-features/package.json
extensions/typescript-language-features/package.json
+12
-0
extensions/typescript-language-features/package.nls.json
extensions/typescript-language-features/package.nls.json
+3
-1
extensions/typescript-language-features/src/features/diagnostics.ts
.../typescript-language-features/src/features/diagnostics.ts
+19
-4
extensions/typescript-language-features/src/languageProvider.ts
...ions/typescript-language-features/src/languageProvider.ts
+15
-0
未找到文件。
extensions/typescript-language-features/package.json
浏览文件 @
a1c693ab
...
...
@@ -413,6 +413,18 @@
"type"
:
"boolean"
,
"default"
:
true
,
"description"
:
"%typescript.experimental.syntaxFolding%"
},
"javascript.suggestionActions.enabled"
:
{
"type"
:
"boolean"
,
"default"
:
true
,
"description"
:
"%javascript.suggestionActions.enabled%"
,
"scope"
:
"window"
},
"typescript.suggestionActions.enabled"
:
{
"type"
:
"boolean"
,
"default"
:
true
,
"description"
:
"%typescript.suggestionActions.enabled%"
,
"scope"
:
"window"
}
}
},
...
...
extensions/typescript-language-features/package.nls.json
浏览文件 @
a1c693ab
...
...
@@ -53,5 +53,7 @@
"typescript.autoImportSuggestions.enabled"
:
"Enable/disable auto import suggestions. Requires TypeScript >=2.6.1"
,
"typescript.experimental.syntaxFolding"
:
"Enables/disables syntax aware folding markers."
,
"taskDefinition.tsconfig.description"
:
"The tsconfig file that defines the TS build."
,
"typescript.organizeImports"
:
"Organize Imports"
"typescript.organizeImports"
:
"Organize Imports"
,
"javascript.suggestionActions.enabled"
:
"Enable/disable suggestion diagnostics for JavaScript files in the editor. Requires TypeScript >= 2.8"
,
"typescript.suggestionActions.enabled"
:
"Enable/disable suggestion diagnostics for TypeScript files in the editor. Requires TypeScript >= 2.8."
}
\ No newline at end of file
extensions/typescript-language-features/src/features/diagnostics.ts
浏览文件 @
a1c693ab
...
...
@@ -41,6 +41,7 @@ export class DiagnosticsManager {
private
readonly
_diagnostics
=
new
Map
<
DiagnosticKind
,
DiagnosticSet
>
();
private
readonly
_currentDiagnostics
:
vscode
.
DiagnosticCollection
;
private
_validate
:
boolean
=
true
;
private
_enableSuggestions
:
boolean
=
true
;
constructor
(
language
:
string
...
...
@@ -68,12 +69,24 @@ export class DiagnosticsManager {
if
(
this
.
_validate
===
value
)
{
return
;
}
this
.
_validate
=
value
;
if
(
!
value
)
{
this
.
_currentDiagnostics
.
clear
();
}
}
public
set
enableSuggestions
(
value
:
boolean
)
{
if
(
this
.
_enableSuggestions
===
value
)
{
return
;
}
this
.
_enableSuggestions
=
value
;
if
(
!
value
)
{
this
.
_currentDiagnostics
.
clear
();
}
}
public
diagnosticsReceived
(
kind
:
DiagnosticKind
,
file
:
vscode
.
Uri
,
...
...
@@ -99,10 +112,12 @@ export class DiagnosticsManager {
return
;
}
const
allDiagnostics
=
allDiagnosticKinds
.
reduce
((
sum
,
kind
)
=>
{
sum
.
push
(...
this
.
_diagnostics
.
get
(
kind
)
!
.
get
(
file
));
return
sum
;
},
[]
as
vscode
.
Diagnostic
[]);
const
allDiagnostics
:
vscode
.
Diagnostic
[]
=
[];
allDiagnostics
.
push
(...
this
.
_diagnostics
.
get
(
DiagnosticKind
.
Syntax
)
!
.
get
(
file
));
allDiagnostics
.
push
(...
this
.
_diagnostics
.
get
(
DiagnosticKind
.
Semantic
)
!
.
get
(
file
));
if
(
this
.
_enableSuggestions
)
{
allDiagnostics
.
push
(...
this
.
_diagnostics
.
get
(
DiagnosticKind
.
Suggestion
)
!
.
get
(
file
));
}
this
.
_currentDiagnostics
.
set
(
file
,
allDiagnostics
);
}
...
...
extensions/typescript-language-features/src/languageProvider.ts
浏览文件 @
a1c693ab
...
...
@@ -22,6 +22,7 @@ import { memoize } from './utils/memoize';
import
{
disposeAll
}
from
'
./utils/dipose
'
;
const
validateSetting
=
'
validate.enable
'
;
const
suggestionSetting
=
'
suggestionActions.enabled
'
;
const
foldingSetting
=
'
typescript.experimental.syntaxFolding
'
;
export
default
class
LanguageProvider
{
...
...
@@ -32,6 +33,7 @@ export default class LanguageProvider {
private
readonly
toUpdateOnConfigurationChanged
:
({
updateConfiguration
:
()
=>
void
})[]
=
[];
private
_validate
:
boolean
=
true
;
private
_enableSuggestionDiagnostics
:
boolean
=
true
;
private
readonly
disposables
:
Disposable
[]
=
[];
private
readonly
versionDependentDisposables
:
Disposable
[]
=
[];
...
...
@@ -165,6 +167,7 @@ export default class LanguageProvider {
private
configurationChanged
():
void
{
const
config
=
workspace
.
getConfiguration
(
this
.
id
);
this
.
updateValidate
(
config
.
get
(
validateSetting
,
true
));
this
.
updateSuggestionDiagnostics
(
config
.
get
(
suggestionSetting
,
true
));
for
(
const
toUpdate
of
this
.
toUpdateOnConfigurationChanged
)
{
toUpdate
.
updateConfiguration
();
...
...
@@ -204,6 +207,18 @@ export default class LanguageProvider {
}
}
private
updateSuggestionDiagnostics
(
value
:
boolean
)
{
if
(
this
.
_enableSuggestionDiagnostics
===
value
)
{
return
;
}
this
.
_enableSuggestionDiagnostics
=
value
;
this
.
diagnosticsManager
.
enableSuggestions
=
value
;
if
(
value
)
{
this
.
triggerAllDiagnostics
();
}
}
public
reInitialize
():
void
{
this
.
diagnosticsManager
.
reInitialize
();
this
.
bufferSyncSupport
.
reOpenDocuments
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录