Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
05fee0cf
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,发现更多精彩内容 >>
提交
05fee0cf
编写于
11月 04, 2020
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract implictProjectConfiguration class
上级
64705a07
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
46 addition
and
39 deletion
+46
-39
extensions/typescript-language-features/src/typescriptServiceClient.ts
...pescript-language-features/src/typescriptServiceClient.ts
+1
-5
extensions/typescript-language-features/src/utils/configuration.ts
...s/typescript-language-features/src/utils/configuration.ts
+41
-30
extensions/typescript-language-features/src/utils/tsconfig.ts
...nsions/typescript-language-features/src/utils/tsconfig.ts
+4
-4
未找到文件。
extensions/typescript-language-features/src/typescriptServiceClient.ts
浏览文件 @
05fee0cf
...
@@ -189,11 +189,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
...
@@ -189,11 +189,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
this
.
tracer
.
updateConfiguration
();
this
.
tracer
.
updateConfiguration
();
if
(
this
.
serverState
.
type
===
ServerState
.
Type
.
Running
)
{
if
(
this
.
serverState
.
type
===
ServerState
.
Type
.
Running
)
{
if
(
this
.
_configuration
.
checkJs
!==
oldConfiguration
.
checkJs
if
(
!
this
.
_configuration
.
implictProjectConfiguration
.
isEqualTo
(
oldConfiguration
.
implictProjectConfiguration
))
{
||
this
.
_configuration
.
experimentalDecorators
!==
oldConfiguration
.
experimentalDecorators
||
this
.
_configuration
.
implicitStrictNullChecks
!==
oldConfiguration
.
implicitStrictNullChecks
||
this
.
_configuration
.
implicitStrictFunctionTypes
!==
oldConfiguration
.
implicitStrictFunctionTypes
)
{
this
.
setCompilerOptionsForInferredProjects
(
this
.
_configuration
);
this
.
setCompilerOptionsForInferredProjects
(
this
.
_configuration
);
}
}
...
...
extensions/typescript-language-features/src/utils/configuration.ts
浏览文件 @
05fee0cf
...
@@ -51,6 +51,44 @@ export const enum SeparateSyntaxServerConfiguration {
...
@@ -51,6 +51,44 @@ export const enum SeparateSyntaxServerConfiguration {
Enabled
,
Enabled
,
}
}
export
class
ImplicitProjectConfiguration
{
public
readonly
checkJs
:
boolean
;
public
readonly
experimentalDecorators
:
boolean
;
public
readonly
strictNullChecks
:
boolean
;
public
readonly
strictFunctionTypes
:
boolean
;
constructor
(
configuration
:
vscode
.
WorkspaceConfiguration
)
{
this
.
checkJs
=
ImplicitProjectConfiguration
.
readCheckJs
(
configuration
);
this
.
experimentalDecorators
=
ImplicitProjectConfiguration
.
readExperimentalDecorators
(
configuration
);
this
.
strictNullChecks
=
ImplicitProjectConfiguration
.
readImplicitStrictNullChecks
(
configuration
);
this
.
strictFunctionTypes
=
ImplicitProjectConfiguration
.
readImplicitStrictFunctionTypes
(
configuration
);
}
public
isEqualTo
(
other
:
ImplicitProjectConfiguration
):
boolean
{
return
this
.
checkJs
===
other
.
checkJs
&&
this
.
experimentalDecorators
===
other
.
experimentalDecorators
&&
this
.
strictNullChecks
===
other
.
strictNullChecks
&&
this
.
strictFunctionTypes
===
other
.
strictFunctionTypes
;
}
private
static
readCheckJs
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
javascript.implicitProjectConfig.checkJs
'
,
false
);
}
private
static
readExperimentalDecorators
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
javascript.implicitProjectConfig.experimentalDecorators
'
,
false
);
}
private
static
readImplicitStrictNullChecks
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
js/ts.implicitProjectConfig.strictNullChecks
'
,
true
);
}
private
static
readImplicitStrictFunctionTypes
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
js/ts.implicitProjectConfig.strictFunctionTypes
'
,
true
);
}
}
export
class
TypeScriptServiceConfiguration
{
export
class
TypeScriptServiceConfiguration
{
public
readonly
locale
:
string
|
null
;
public
readonly
locale
:
string
|
null
;
public
readonly
globalTsdk
:
string
|
null
;
public
readonly
globalTsdk
:
string
|
null
;
...
@@ -58,12 +96,7 @@ export class TypeScriptServiceConfiguration {
...
@@ -58,12 +96,7 @@ export class TypeScriptServiceConfiguration {
public
readonly
npmLocation
:
string
|
null
;
public
readonly
npmLocation
:
string
|
null
;
public
readonly
tsServerLogLevel
:
TsServerLogLevel
=
TsServerLogLevel
.
Off
;
public
readonly
tsServerLogLevel
:
TsServerLogLevel
=
TsServerLogLevel
.
Off
;
public
readonly
tsServerPluginPaths
:
readonly
string
[];
public
readonly
tsServerPluginPaths
:
readonly
string
[];
public
readonly
implictProjectConfiguration
:
ImplicitProjectConfiguration
;
public
readonly
checkJs
:
boolean
;
public
readonly
experimentalDecorators
:
boolean
;
public
readonly
implicitStrictNullChecks
:
boolean
;
public
readonly
implicitStrictFunctionTypes
:
boolean
;
public
readonly
disableAutomaticTypeAcquisition
:
boolean
;
public
readonly
disableAutomaticTypeAcquisition
:
boolean
;
public
readonly
separateSyntaxServer
:
SeparateSyntaxServerConfiguration
;
public
readonly
separateSyntaxServer
:
SeparateSyntaxServerConfiguration
;
public
readonly
enableProjectDiagnostics
:
boolean
;
public
readonly
enableProjectDiagnostics
:
boolean
;
...
@@ -85,10 +118,7 @@ export class TypeScriptServiceConfiguration {
...
@@ -85,10 +118,7 @@ export class TypeScriptServiceConfiguration {
this
.
npmLocation
=
TypeScriptServiceConfiguration
.
readNpmLocation
(
configuration
);
this
.
npmLocation
=
TypeScriptServiceConfiguration
.
readNpmLocation
(
configuration
);
this
.
tsServerLogLevel
=
TypeScriptServiceConfiguration
.
readTsServerLogLevel
(
configuration
);
this
.
tsServerLogLevel
=
TypeScriptServiceConfiguration
.
readTsServerLogLevel
(
configuration
);
this
.
tsServerPluginPaths
=
TypeScriptServiceConfiguration
.
readTsServerPluginPaths
(
configuration
);
this
.
tsServerPluginPaths
=
TypeScriptServiceConfiguration
.
readTsServerPluginPaths
(
configuration
);
this
.
checkJs
=
TypeScriptServiceConfiguration
.
readCheckJs
(
configuration
);
this
.
implictProjectConfiguration
=
new
ImplicitProjectConfiguration
(
configuration
);
this
.
experimentalDecorators
=
TypeScriptServiceConfiguration
.
readExperimentalDecorators
(
configuration
);
this
.
implicitStrictNullChecks
=
TypeScriptServiceConfiguration
.
readImplicitStrictNullChecks
(
configuration
);
this
.
implicitStrictFunctionTypes
=
TypeScriptServiceConfiguration
.
readImplicitStrictFunctionTypes
(
configuration
);
this
.
disableAutomaticTypeAcquisition
=
TypeScriptServiceConfiguration
.
readDisableAutomaticTypeAcquisition
(
configuration
);
this
.
disableAutomaticTypeAcquisition
=
TypeScriptServiceConfiguration
.
readDisableAutomaticTypeAcquisition
(
configuration
);
this
.
separateSyntaxServer
=
TypeScriptServiceConfiguration
.
readUseSeparateSyntaxServer
(
configuration
);
this
.
separateSyntaxServer
=
TypeScriptServiceConfiguration
.
readUseSeparateSyntaxServer
(
configuration
);
this
.
enableProjectDiagnostics
=
TypeScriptServiceConfiguration
.
readEnableProjectDiagnostics
(
configuration
);
this
.
enableProjectDiagnostics
=
TypeScriptServiceConfiguration
.
readEnableProjectDiagnostics
(
configuration
);
...
@@ -104,10 +134,7 @@ export class TypeScriptServiceConfiguration {
...
@@ -104,10 +134,7 @@ export class TypeScriptServiceConfiguration {
&&
this
.
localTsdk
===
other
.
localTsdk
&&
this
.
localTsdk
===
other
.
localTsdk
&&
this
.
npmLocation
===
other
.
npmLocation
&&
this
.
npmLocation
===
other
.
npmLocation
&&
this
.
tsServerLogLevel
===
other
.
tsServerLogLevel
&&
this
.
tsServerLogLevel
===
other
.
tsServerLogLevel
&&
this
.
checkJs
===
other
.
checkJs
&&
this
.
implictProjectConfiguration
.
isEqualTo
(
other
.
implictProjectConfiguration
)
&&
this
.
experimentalDecorators
===
other
.
experimentalDecorators
&&
this
.
implicitStrictNullChecks
===
other
.
implicitStrictNullChecks
&&
this
.
implicitStrictFunctionTypes
===
other
.
implicitStrictFunctionTypes
&&
this
.
disableAutomaticTypeAcquisition
===
other
.
disableAutomaticTypeAcquisition
&&
this
.
disableAutomaticTypeAcquisition
===
other
.
disableAutomaticTypeAcquisition
&&
arrays
.
equals
(
this
.
tsServerPluginPaths
,
other
.
tsServerPluginPaths
)
&&
arrays
.
equals
(
this
.
tsServerPluginPaths
,
other
.
tsServerPluginPaths
)
&&
this
.
separateSyntaxServer
===
other
.
separateSyntaxServer
&&
this
.
separateSyntaxServer
===
other
.
separateSyntaxServer
...
@@ -153,22 +180,6 @@ export class TypeScriptServiceConfiguration {
...
@@ -153,22 +180,6 @@ export class TypeScriptServiceConfiguration {
return
configuration
.
get
<
string
[]
>
(
'
typescript.tsserver.pluginPaths
'
,
[]);
return
configuration
.
get
<
string
[]
>
(
'
typescript.tsserver.pluginPaths
'
,
[]);
}
}
private
static
readCheckJs
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
javascript.implicitProjectConfig.checkJs
'
,
false
);
}
private
static
readExperimentalDecorators
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
javascript.implicitProjectConfig.experimentalDecorators
'
,
false
);
}
private
static
readImplicitStrictNullChecks
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
js/ts.implicitProjectConfig.strictNullChecks
'
,
true
);
}
private
static
readImplicitStrictFunctionTypes
(
configuration
:
vscode
.
WorkspaceConfiguration
):
boolean
{
return
configuration
.
get
<
boolean
>
(
'
js/ts.implicitProjectConfig.strictFunctionTypes
'
,
true
);
}
private
static
readNpmLocation
(
configuration
:
vscode
.
WorkspaceConfiguration
):
string
|
null
{
private
static
readNpmLocation
(
configuration
:
vscode
.
WorkspaceConfiguration
):
string
|
null
{
return
configuration
.
get
<
string
|
null
>
(
'
typescript.npm
'
,
null
);
return
configuration
.
get
<
string
|
null
>
(
'
typescript.npm
'
,
null
);
}
}
...
...
extensions/typescript-language-features/src/utils/tsconfig.ts
浏览文件 @
05fee0cf
...
@@ -32,22 +32,22 @@ export function inferredProjectCompilerOptions(
...
@@ -32,22 +32,22 @@ export function inferredProjectCompilerOptions(
jsx
:
'
preserve
'
as
Proto
.
JsxEmit
,
jsx
:
'
preserve
'
as
Proto
.
JsxEmit
,
};
};
if
(
serviceConfig
.
checkJs
)
{
if
(
serviceConfig
.
implictProjectConfiguration
.
checkJs
)
{
projectConfig
.
checkJs
=
true
;
projectConfig
.
checkJs
=
true
;
if
(
projectType
===
ProjectType
.
TypeScript
)
{
if
(
projectType
===
ProjectType
.
TypeScript
)
{
projectConfig
.
allowJs
=
true
;
projectConfig
.
allowJs
=
true
;
}
}
}
}
if
(
serviceConfig
.
experimentalDecorators
)
{
if
(
serviceConfig
.
implictProjectConfiguration
.
experimentalDecorators
)
{
projectConfig
.
experimentalDecorators
=
true
;
projectConfig
.
experimentalDecorators
=
true
;
}
}
if
(
serviceConfig
.
implic
itS
trictNullChecks
)
{
if
(
serviceConfig
.
implic
tProjectConfiguration
.
s
trictNullChecks
)
{
projectConfig
.
strictNullChecks
=
true
;
projectConfig
.
strictNullChecks
=
true
;
}
}
if
(
serviceConfig
.
implic
itS
trictFunctionTypes
)
{
if
(
serviceConfig
.
implic
tProjectConfiguration
.
s
trictFunctionTypes
)
{
projectConfig
.
strictFunctionTypes
=
true
;
projectConfig
.
strictFunctionTypes
=
true
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录