Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e730375b
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,发现更多精彩内容 >>
提交
e730375b
编写于
1月 11, 2019
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't make semantic requests against the TS server when the languageService has been disabled
上级
6682006c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
30 deletion
+63
-30
extensions/typescript-language-features/src/tsServer/server.ts
...sions/typescript-language-features/src/tsServer/server.ts
+7
-6
extensions/typescript-language-features/src/typescriptService.ts
...ons/typescript-language-features/src/typescriptService.ts
+4
-3
extensions/typescript-language-features/src/typescriptServiceClient.ts
...pescript-language-features/src/typescriptServiceClient.ts
+51
-20
src/vs/editor/contrib/codeAction/codeActionModel.ts
src/vs/editor/contrib/codeAction/codeActionModel.ts
+1
-1
未找到文件。
extensions/typescript-language-features/src/tsServer/server.ts
浏览文件 @
e730375b
...
...
@@ -8,7 +8,7 @@ import * as fs from 'fs';
import
*
as
path
from
'
path
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
Proto
from
'
../protocol
'
;
import
{
CancelledResponse
,
NoContentResponse
}
from
'
../typescriptService
'
;
import
{
CancelledResponse
,
NoContentResponse
,
ServerResponse
}
from
'
../typescriptService
'
;
import
API
from
'
../utils/api
'
;
import
{
TsServerLogLevel
,
TypeScriptServiceConfiguration
}
from
'
../utils/configuration
'
;
import
{
Disposable
}
from
'
../utils/dispose
'
;
...
...
@@ -307,7 +307,9 @@ export class TypeScriptServer extends Disposable {
}
}
public
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
boolean
,
lowPriority
?:
boolean
}):
Promise
<
any
>
{
public
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
false
,
lowPriority
?:
boolean
}):
undefined
;
public
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
boolean
,
lowPriority
?:
boolean
}):
Promise
<
ServerResponse
<
Proto
.
Response
>>
;
public
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
boolean
,
lowPriority
?:
boolean
}):
Promise
<
ServerResponse
<
Proto
.
Response
>>
|
undefined
{
const
request
=
this
.
_requestQueue
.
createRequest
(
command
,
args
);
const
requestInfo
:
RequestItem
=
{
request
,
...
...
@@ -315,9 +317,9 @@ export class TypeScriptServer extends Disposable {
isAsync
:
executeInfo
.
isAsync
,
queueingType
:
getQueueingType
(
command
,
executeInfo
.
lowPriority
)
};
let
result
:
Promise
<
any
>
;
let
result
:
Promise
<
ServerResponse
<
Proto
.
Response
>>
|
undefined
;
if
(
executeInfo
.
expectsResult
)
{
result
=
new
Promise
<
any
>
((
resolve
,
reject
)
=>
{
result
=
new
Promise
<
ServerResponse
<
Proto
.
Response
>
>
((
resolve
,
reject
)
=>
{
this
.
_callbacks
.
add
(
request
.
seq
,
{
onSuccess
:
resolve
,
onError
:
reject
,
startTime
:
Date
.
now
(),
isAsync
:
executeInfo
.
isAsync
},
executeInfo
.
isAsync
);
if
(
executeInfo
.
token
)
{
...
...
@@ -346,9 +348,8 @@ export class TypeScriptServer extends Disposable {
throw
err
;
});
}
else
{
result
=
Promise
.
resolve
(
null
);
}
this
.
_requestQueue
.
enqueue
(
requestInfo
);
this
.
sendNextRequests
();
...
...
extensions/typescript-language-features/src/typescriptService.ts
浏览文件 @
e730375b
...
...
@@ -20,10 +20,11 @@ export class CancelledResponse {
}
export
const
NoContentResponse
=
new
class
{
readonly
type
=
'
noContent
'
;
};
export
const
LanguageServiceDisabledContentResponse
=
new
class
{
readonly
type
=
'
languageServiceDisabled
'
;
};
export
type
ServerResponse
<
T
extends
Proto
.
Response
>
=
T
|
CancelledResponse
|
typeof
NoContentResponse
;
export
type
ServerResponse
<
T
extends
Proto
.
Response
>
=
T
|
CancelledResponse
|
typeof
NoContentResponse
|
typeof
LanguageServiceDisabledContentResponse
;
interface
TypeScriptRequestTypes
{
export
interface
TypeScriptRequestTypes
{
'
applyCodeActionCommand
'
:
[
Proto
.
ApplyCodeActionCommandRequestArgs
,
Proto
.
ApplyCodeActionCommandResponse
];
'
completionEntryDetails
'
:
[
Proto
.
CompletionDetailsRequestArgs
,
Proto
.
CompletionDetailsResponse
];
'
completionInfo
'
:
[
Proto
.
CompletionsRequestArgs
,
Proto
.
CompletionInfoResponse
];
...
...
@@ -110,7 +111,7 @@ export interface ITypeScriptServiceClient {
executeWithoutWaitingForResponse
(
command
:
'
compilerOptionsForInferredProjects
'
,
args
:
Proto
.
SetCompilerOptionsForInferredProjectsArgs
):
void
;
executeWithoutWaitingForResponse
(
command
:
'
reloadProjects
'
,
args
:
null
):
void
;
executeAsync
(
command
:
'
geterr
'
,
args
:
Proto
.
GeterrRequestArgs
,
token
:
vscode
.
CancellationToken
):
Promise
<
any
>
;
executeAsync
(
command
:
'
geterr
'
,
args
:
Proto
.
GeterrRequestArgs
,
token
:
vscode
.
CancellationToken
):
Promise
<
ServerResponse
<
Proto
.
Response
>
>
;
/**
* Cancel on going geterr requests and re-queue them after `f` has been evaluated.
...
...
extensions/typescript-language-features/src/typescriptServiceClient.ts
浏览文件 @
e730375b
...
...
@@ -11,7 +11,7 @@ import BufferSyncSupport from './features/bufferSyncSupport';
import
{
DiagnosticKind
,
DiagnosticsManager
}
from
'
./features/diagnostics
'
;
import
*
as
Proto
from
'
./protocol
'
;
import
{
TypeScriptServer
,
TypeScriptServerSpawner
}
from
'
./tsServer/server
'
;
import
{
ITypeScriptServiceClient
}
from
'
./typescriptService
'
;
import
{
ITypeScriptServiceClient
,
ServerResponse
,
LanguageServiceDisabledContentResponse
}
from
'
./typescriptService
'
;
import
API
from
'
./utils/api
'
;
import
{
TsServerLogLevel
,
TypeScriptServiceConfiguration
}
from
'
./utils/configuration
'
;
import
{
Disposable
}
from
'
./utils/dispose
'
;
...
...
@@ -57,6 +57,7 @@ namespace ServerState {
* Version reported by currently-running tsserver.
*/
public
tsserverVersion
:
string
|
undefined
,
public
langaugeServiceEnabled
:
boolean
,
)
{
}
}
...
...
@@ -243,16 +244,16 @@ export default class TypeScriptServiceClient extends Disposable implements IType
this
.
telemetryReporter
.
logTelemetry
(
eventName
,
properties
);
}
private
service
():
TypeScriptServer
{
private
service
():
ServerState
.
Running
{
if
(
this
.
serverState
.
type
===
ServerState
.
Type
.
Running
)
{
return
this
.
serverState
.
server
;
return
this
.
serverState
;
}
if
(
this
.
serverState
.
type
===
ServerState
.
Type
.
Errored
)
{
throw
this
.
serverState
.
error
;
}
const
newState
=
this
.
startService
();
if
(
newState
.
type
===
ServerState
.
Type
.
Running
)
{
return
newState
.
server
;
return
newState
;
}
throw
new
Error
(
'
Could not create TS service
'
);
}
...
...
@@ -285,7 +286,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
let
mytoken
=
++
this
.
token
;
const
handle
=
this
.
typescriptServerSpawner
.
spawn
(
currentVersion
,
this
.
configuration
,
this
.
pluginManager
);
this
.
serverState
=
new
ServerState
.
Running
(
handle
,
apiVersion
,
undefined
);
this
.
serverState
=
new
ServerState
.
Running
(
handle
,
apiVersion
,
undefined
,
true
);
this
.
lastStart
=
Date
.
now
();
handle
.
onError
((
err
:
Error
)
=>
{
...
...
@@ -589,7 +590,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
return
undefined
;
}
public
execute
(
command
:
string
,
args
:
any
,
token
:
vscode
.
CancellationToken
,
lowPriority
?:
boolean
):
Promise
<
any
>
{
public
execute
(
command
:
string
,
args
:
any
,
token
:
vscode
.
CancellationToken
,
lowPriority
?:
boolean
):
Promise
<
ServerResponse
<
Proto
.
Response
>
>
{
return
this
.
executeImpl
(
command
,
args
,
{
isAsync
:
false
,
token
,
...
...
@@ -606,7 +607,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
});
}
public
executeAsync
(
command
:
string
,
args
:
Proto
.
GeterrRequestArgs
,
token
:
vscode
.
CancellationToken
):
Promise
<
any
>
{
public
executeAsync
(
command
:
string
,
args
:
Proto
.
GeterrRequestArgs
,
token
:
vscode
.
CancellationToken
):
Promise
<
ServerResponse
<
Proto
.
Response
>
>
{
return
this
.
executeImpl
(
command
,
args
,
{
isAsync
:
true
,
token
,
...
...
@@ -614,12 +615,30 @@ export default class TypeScriptServiceClient extends Disposable implements IType
});
}
private
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
boolean
,
lowPriority
?:
boolean
}):
Promise
<
any
>
{
const
server
=
this
.
service
();
if
(
!
server
)
{
return
Promise
.
reject
(
new
Error
(
'
Could not load TS Server
'
));
private
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
false
,
lowPriority
?:
boolean
}):
undefined
;
private
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
boolean
,
lowPriority
?:
boolean
}):
Promise
<
ServerResponse
<
Proto
.
Response
>>
;
private
executeImpl
(
command
:
string
,
args
:
any
,
executeInfo
:
{
isAsync
:
boolean
,
token
?:
vscode
.
CancellationToken
,
expectsResult
:
boolean
,
lowPriority
?:
boolean
}):
Promise
<
ServerResponse
<
Proto
.
Response
>>
|
undefined
{
const
runningServerState
=
this
.
service
();
if
(
!
runningServerState
.
langaugeServiceEnabled
)
{
const
nonSemanticCommands
:
string
[]
=
[
'
change
'
,
'
close
'
,
'
compilerOptionsForInferredProjects
'
,
'
configure
'
,
'
format
'
,
'
formatonkey
'
,
'
getOutliningSpans
'
,
'
open
'
,
'
projectInfo
'
,
'
reloadProjects
'
,
];
if
(
nonSemanticCommands
.
indexOf
(
command
)
===
-
1
)
{
return
Promise
.
resolve
(
LanguageServiceDisabledContentResponse
);
}
}
return
server
.
executeImpl
(
command
,
args
,
executeInfo
);
return
runningServerState
.
server
.
executeImpl
(
command
,
args
,
executeInfo
);
}
public
interuptGetErr
<
R
>
(
f
:
()
=>
R
):
R
{
...
...
@@ -649,14 +668,23 @@ export default class TypeScriptServiceClient extends Disposable implements IType
break
;
case
'
telemetry
'
:
const
telemetryData
=
(
event
as
Proto
.
TelemetryEvent
).
body
;
this
.
dispatchTelemetryEvent
(
telemetryData
);
break
;
{
const
body
=
(
event
as
Proto
.
TelemetryEvent
).
body
;
this
.
dispatchTelemetryEvent
(
body
);
break
;
}
case
'
projectLanguageServiceState
'
:
this
.
_onProjectLanguageServiceStateChanged
.
fire
((
event
as
Proto
.
ProjectLanguageServiceStateEvent
).
body
);
break
;
{
const
body
=
(
event
as
Proto
.
ProjectLanguageServiceStateEvent
).
body
!
;
if
(
this
.
serverState
.
type
===
ServerState
.
Type
.
Running
)
{
this
.
serverState
=
{
...
this
.
serverState
,
langaugeServiceEnabled
:
body
.
languageServiceEnabled
,
};
}
this
.
_onProjectLanguageServiceStateChanged
.
fire
(
body
);
break
;
}
case
'
projectsUpdatedInBackground
'
:
const
body
=
(
event
as
Proto
.
ProjectsUpdatedInBackgroundEvent
).
body
;
const
resources
=
body
.
openFiles
.
map
(
vscode
.
Uri
.
file
);
...
...
@@ -721,7 +749,10 @@ export default class TypeScriptServiceClient extends Disposable implements IType
}
if
(
telemetryData
.
telemetryEventName
===
'
projectInfo
'
)
{
if
(
this
.
serverState
.
type
===
ServerState
.
Type
.
Running
)
{
this
.
serverState
=
new
ServerState
.
Running
(
this
.
serverState
.
server
,
this
.
serverState
.
apiVersion
,
properties
[
'
version
'
]);
this
.
serverState
=
{
...
this
.
serverState
,
tsserverVersion
:
properties
[
'
version
'
]
};
}
}
...
...
src/vs/editor/contrib/codeAction/codeActionModel.ts
浏览文件 @
e730375b
...
...
@@ -206,7 +206,7 @@ export class CodeActionModel {
}
if
(
this
.
_state
.
type
===
CodeActionsState
.
Type
.
Triggered
)
{
this
.
_state
.
actions
.
cancel
();
//
this._state.actions.cancel();
}
this
.
setState
(
CodeActionsState
.
Empty
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录