Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
abcdfe2c
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,发现更多精彩内容 >>
提交
abcdfe2c
编写于
10月 26, 2017
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Set checkjs when generating jsconfig if javascript.implicitProjectConfig.checkJS is set
Fixes #37011
上级
33aeb8e9
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
55 addition
and
26 deletion
+55
-26
extensions/typescript/src/typescriptMain.ts
extensions/typescript/src/typescriptMain.ts
+1
-1
extensions/typescript/src/typescriptService.ts
extensions/typescript/src/typescriptService.ts
+3
-0
extensions/typescript/src/typescriptServiceClient.ts
extensions/typescript/src/typescriptServiceClient.ts
+22
-18
extensions/typescript/src/utils/projectStatus.ts
extensions/typescript/src/utils/projectStatus.ts
+11
-3
extensions/typescript/src/utils/tsconfig.ts
extensions/typescript/src/utils/tsconfig.ts
+18
-4
未找到文件。
extensions/typescript/src/typescriptMain.ts
浏览文件 @
abcdfe2c
...
...
@@ -570,7 +570,7 @@ class TypeScriptServiceClientHost implements ITypescriptServiceClientHost {
switch
(
selected
&&
selected
.
id
)
{
case
ProjectConfigAction
.
CreateConfig
:
openOrCreateConfigFile
(
isTypeScriptProject
,
rootPath
);
openOrCreateConfigFile
(
isTypeScriptProject
,
rootPath
,
this
.
client
.
configuration
);
return
;
case
ProjectConfigAction
.
LearnMore
:
...
...
extensions/typescript/src/typescriptService.ts
浏览文件 @
abcdfe2c
...
...
@@ -8,6 +8,7 @@ import { CancellationToken, Uri, Event } from 'vscode';
import
*
as
Proto
from
'
./protocol
'
;
import
API
from
'
./utils/api
'
;
import
{
TypeScriptServerPlugin
}
from
'
./utils/plugins
'
;
import
{
TypeScriptServiceConfiguration
}
from
'
./utils/configuration
'
;
export
interface
ITypescriptServiceClientHost
{
syntaxDiagnosticsReceived
(
event
:
Proto
.
DiagnosticEvent
):
void
;
...
...
@@ -37,6 +38,8 @@ export interface ITypescriptServiceClient {
plugins
:
TypeScriptServerPlugin
[];
configuration
:
TypeScriptServiceConfiguration
;
execute
(
command
:
'
configure
'
,
args
:
Proto
.
ConfigureRequestArguments
,
token
?:
CancellationToken
):
Promise
<
Proto
.
ConfigureResponse
>
;
execute
(
command
:
'
open
'
,
args
:
Proto
.
OpenRequestArgs
,
expectedResult
:
boolean
,
token
?:
CancellationToken
):
Promise
<
any
>
;
execute
(
command
:
'
close
'
,
args
:
Proto
.
FileRequestArgs
,
expectedResult
:
boolean
,
token
?:
CancellationToken
):
Promise
<
any
>
;
...
...
extensions/typescript/src/typescriptServiceClient.ts
浏览文件 @
abcdfe2c
...
...
@@ -124,7 +124,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
private
pathSeparator
:
string
;
private
_onReady
:
{
promise
:
Promise
<
void
>
;
resolve
:
()
=>
void
;
reject
:
()
=>
void
;
};
private
configuration
:
TypeScriptServiceConfiguration
;
private
_
configuration
:
TypeScriptServiceConfiguration
;
private
versionProvider
:
TypeScriptVersionProvider
;
private
versionPicker
:
TypeScriptVersionPicker
;
...
...
@@ -173,28 +173,28 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this
.
requestQueue
=
new
RequestQueue
();
this
.
callbacks
=
new
CallbackMap
();
this
.
configuration
=
TypeScriptServiceConfiguration
.
loadFromWorkspace
();
this
.
versionProvider
=
new
TypeScriptVersionProvider
(
this
.
configuration
);
this
.
_
configuration
=
TypeScriptServiceConfiguration
.
loadFromWorkspace
();
this
.
versionProvider
=
new
TypeScriptVersionProvider
(
this
.
_
configuration
);
this
.
versionPicker
=
new
TypeScriptVersionPicker
(
this
.
versionProvider
,
this
.
workspaceState
);
this
.
_apiVersion
=
API
.
defaultVersion
;
this
.
tracer
=
new
Tracer
(
this
.
logger
);
workspace
.
onDidChangeConfiguration
(()
=>
{
const
oldConfiguration
=
this
.
configuration
;
this
.
configuration
=
TypeScriptServiceConfiguration
.
loadFromWorkspace
();
const
oldConfiguration
=
this
.
_
configuration
;
this
.
_
configuration
=
TypeScriptServiceConfiguration
.
loadFromWorkspace
();
this
.
versionProvider
.
updateConfiguration
(
this
.
configuration
);
this
.
versionProvider
.
updateConfiguration
(
this
.
_
configuration
);
this
.
tracer
.
updateConfiguration
();
if
(
this
.
servicePromise
)
{
if
(
this
.
configuration
.
checkJs
!==
oldConfiguration
.
checkJs
||
this
.
configuration
.
experimentalDecorators
!==
oldConfiguration
.
experimentalDecorators
if
(
this
.
_
configuration
.
checkJs
!==
oldConfiguration
.
checkJs
||
this
.
_
configuration
.
experimentalDecorators
!==
oldConfiguration
.
experimentalDecorators
)
{
this
.
setCompilerOptionsForInferredProjects
(
this
.
configuration
);
this
.
setCompilerOptionsForInferredProjects
(
this
.
_
configuration
);
}
if
(
!
this
.
configuration
.
isEqualTo
(
oldConfiguration
))
{
if
(
!
this
.
_
configuration
.
isEqualTo
(
oldConfiguration
))
{
this
.
restartTsServer
();
}
}
...
...
@@ -204,6 +204,10 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
this
.
startService
();
}
public
get
configuration
()
{
return
this
.
_configuration
;
}
public
dispose
()
{
if
(
this
.
servicePromise
)
{
this
.
servicePromise
.
then
(
cp
=>
{
...
...
@@ -333,7 +337,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
args
.
push
(
'
--useSingleInferredProject
'
);
}
if
(
this
.
configuration
.
disableAutomaticTypeAcquisition
)
{
if
(
this
.
_
configuration
.
disableAutomaticTypeAcquisition
)
{
args
.
push
(
'
--disableAutomaticTypingAcquisition
'
);
}
}
...
...
@@ -346,7 +350,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
}
if
(
this
.
apiVersion
.
has222Features
())
{
if
(
this
.
configuration
.
tsServerLogLevel
!==
TsServerLogLevel
.
Off
)
{
if
(
this
.
_
configuration
.
tsServerLogLevel
!==
TsServerLogLevel
.
Off
)
{
try
{
const
logDir
=
fs
.
mkdtempSync
(
path
.
join
(
os
.
tmpdir
(),
`vscode-tsserver-log-`
));
this
.
tsServerLogFile
=
path
.
join
(
logDir
,
`tsserver.log`
);
...
...
@@ -356,7 +360,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
}
if
(
this
.
tsServerLogFile
)
{
args
.
push
(
'
--logVerbosity
'
,
TsServerLogLevel
.
toString
(
this
.
configuration
.
tsServerLogLevel
));
args
.
push
(
'
--logVerbosity
'
,
TsServerLogLevel
.
toString
(
this
.
_
configuration
.
tsServerLogLevel
));
args
.
push
(
'
--logFile
'
,
this
.
tsServerLogFile
);
}
}
...
...
@@ -372,13 +376,13 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
}
if
(
this
.
apiVersion
.
has234Features
())
{
if
(
this
.
configuration
.
npmLocation
)
{
args
.
push
(
'
--npmLocation
'
,
`"
${
this
.
configuration
.
npmLocation
}
"`
);
if
(
this
.
_
configuration
.
npmLocation
)
{
args
.
push
(
'
--npmLocation
'
,
`"
${
this
.
_
configuration
.
npmLocation
}
"`
);
}
}
if
(
this
.
apiVersion
.
has260Features
())
{
const
tsLocale
=
getTsLocale
(
this
.
configuration
);
const
tsLocale
=
getTsLocale
(
this
.
_
configuration
);
if
(
tsLocale
)
{
args
.
push
(
'
--locale
'
,
tsLocale
);
}
...
...
@@ -472,7 +476,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
.
then
(()
=>
false
);
}
if
(
this
.
configuration
.
tsServerLogLevel
===
TsServerLogLevel
.
Off
)
{
if
(
this
.
_
configuration
.
tsServerLogLevel
===
TsServerLogLevel
.
Off
)
{
return
window
.
showErrorMessage
<
MessageItem
>
(
localize
(
'
typescript.openTsServerLog.loggingNotEnabled
'
,
...
...
@@ -513,7 +517,7 @@ export default class TypeScriptServiceClient implements ITypescriptServiceClient
hostInfo
:
'
vscode
'
};
this
.
execute
(
'
configure
'
,
configureOptions
);
this
.
setCompilerOptionsForInferredProjects
(
this
.
configuration
);
this
.
setCompilerOptionsForInferredProjects
(
this
.
_
configuration
);
if
(
resendModels
)
{
this
.
host
.
populateService
();
}
...
...
extensions/typescript/src/utils/projectStatus.ts
浏览文件 @
abcdfe2c
...
...
@@ -152,7 +152,10 @@ function createLargeProjectMonitorFromTypeScript(item: ExcludeHintItem, client:
});
}
function
onConfigureExcludesSelected
(
client
:
ITypescriptServiceClient
,
configFileName
:
string
)
{
function
onConfigureExcludesSelected
(
client
:
ITypescriptServiceClient
,
configFileName
:
string
)
{
if
(
!
isImplicitProjectConfigFile
(
configFileName
))
{
vscode
.
workspace
.
openTextDocument
(
configFileName
)
.
then
(
vscode
.
window
.
showTextDocument
);
...
...
@@ -161,12 +164,17 @@ function onConfigureExcludesSelected(client: ITypescriptServiceClient, configFil
if
(
root
)
{
openOrCreateConfigFile
(
configFileName
.
match
(
/tsconfig
\.?
.*
\.
json/
)
!==
null
,
root
);
root
,
client
.
configuration
);
}
}
}
export
function
create
(
client
:
ITypescriptServiceClient
,
isOpen
:
(
path
:
string
)
=>
Promise
<
boolean
>
,
memento
:
vscode
.
Memento
)
{
export
function
create
(
client
:
ITypescriptServiceClient
,
isOpen
:
(
path
:
string
)
=>
Promise
<
boolean
>
,
memento
:
vscode
.
Memento
)
{
const
toDispose
:
vscode
.
Disposable
[]
=
[];
const
item
=
new
ExcludeHintItem
(
client
);
...
...
extensions/typescript/src/utils/tsconfig.ts
浏览文件 @
abcdfe2c
...
...
@@ -5,24 +5,38 @@
import
*
as
vscode
from
'
vscode
'
;
import
*
as
path
from
'
path
'
;
import
{
TypeScriptServiceConfiguration
}
from
'
./configuration
'
;
export
function
isImplicitProjectConfigFile
(
configFileName
:
string
)
{
return
configFileName
.
indexOf
(
'
/dev/null/
'
)
===
0
;
}
const
emptyConfig
=
new
vscode
.
SnippetString
(
`{
function
getEmptyConfig
(
isTypeScriptProject
:
boolean
,
config
:
TypeScriptServiceConfiguration
)
{
const
compilerOptions
=
[
'
"target": "ES6"
'
];
if
(
!
isTypeScriptProject
&&
config
.
checkJs
)
{
compilerOptions
.
push
(
'
"checkJs": true
'
);
}
if
(
!
isTypeScriptProject
&&
config
.
experimentalDecorators
)
{
compilerOptions
.
push
(
'
"experimentalDecorators": true
'
);
}
return
new
vscode
.
SnippetString
(
`{
"compilerOptions": {
"target": "ES6"
$0
${
compilerOptions
.
join
(
'
,
\n\t\t
'
)}
$0
},
"exclude": [
"node_modules",
"**/node_modules/*"
]
}`
);
}
export
function
openOrCreateConfigFile
(
isTypeScriptProject
:
boolean
,
rootPath
:
string
rootPath
:
string
,
config
:
TypeScriptServiceConfiguration
):
Thenable
<
vscode
.
TextEditor
|
null
>
{
const
configFile
=
vscode
.
Uri
.
file
(
path
.
join
(
rootPath
,
isTypeScriptProject
?
'
tsconfig.json
'
:
'
jsconfig.json
'
));
const
col
=
vscode
.
window
.
activeTextEditor
?
vscode
.
window
.
activeTextEditor
.
viewColumn
:
undefined
;
...
...
@@ -33,7 +47,7 @@ export function openOrCreateConfigFile(
const
doc
=
await
vscode
.
workspace
.
openTextDocument
(
configFile
.
with
({
scheme
:
'
untitled
'
}));
const
editor
=
await
vscode
.
window
.
showTextDocument
(
doc
,
col
);
if
(
editor
.
document
.
getText
().
length
===
0
)
{
await
editor
.
insertSnippet
(
emptyConfig
);
await
editor
.
insertSnippet
(
getEmptyConfig
(
isTypeScriptProject
,
config
)
);
}
return
editor
;
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录