Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1ba9d83f
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,发现更多精彩内容 >>
提交
1ba9d83f
编写于
3月 08, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use uris instead of string paths in more locations
String paths should only be used when talking to the ts server
上级
51638106
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
29 addition
and
28 deletion
+29
-28
extensions/typescript/src/commands.ts
extensions/typescript/src/commands.ts
+1
-1
extensions/typescript/src/features/bufferSyncSupport.ts
extensions/typescript/src/features/bufferSyncSupport.ts
+4
-3
extensions/typescript/src/languageProvider.ts
extensions/typescript/src/languageProvider.ts
+3
-3
extensions/typescript/src/typeScriptServiceClientHost.ts
extensions/typescript/src/typeScriptServiceClientHost.ts
+14
-14
extensions/typescript/src/typescriptServiceClient.ts
extensions/typescript/src/typescriptServiceClient.ts
+4
-4
extensions/typescript/src/utils/projectStatus.ts
extensions/typescript/src/utils/projectStatus.ts
+3
-3
未找到文件。
extensions/typescript/src/commands.ts
浏览文件 @
1ba9d83f
...
...
@@ -121,7 +121,7 @@ async function goToProjectConfig(
const
file
=
client
.
normalizePath
(
resource
);
// TSServer errors when 'projectInfo' is invoked on a non js/ts file
if
(
!
file
||
!
clientHost
.
handles
(
fil
e
))
{
if
(
!
file
||
!
clientHost
.
handles
(
resourc
e
))
{
vscode
.
window
.
showWarningMessage
(
localize
(
'
typescript.projectConfigUnsupportedFile
'
,
...
...
extensions/typescript/src/features/bufferSyncSupport.ts
浏览文件 @
1ba9d83f
...
...
@@ -5,7 +5,7 @@
import
*
as
fs
from
'
fs
'
;
import
{
workspace
,
TextDocument
,
TextDocumentChangeEvent
,
TextDocumentContentChangeEvent
,
Disposable
}
from
'
vscode
'
;
import
{
workspace
,
TextDocument
,
TextDocumentChangeEvent
,
TextDocumentContentChangeEvent
,
Disposable
,
Uri
}
from
'
vscode
'
;
import
*
as
Proto
from
'
../protocol
'
;
import
{
ITypeScriptServiceClient
}
from
'
../typescriptService
'
;
import
{
Delayer
}
from
'
../utils/async
'
;
...
...
@@ -142,8 +142,9 @@ export default class BufferSyncSupport {
this
.
_validate
=
value
;
}
public
handles
(
file
:
string
):
boolean
{
return
this
.
syncedBuffers
.
has
(
file
);
public
handles
(
resource
:
Uri
):
boolean
{
const
file
=
this
.
client
.
normalizePath
(
resource
);
return
!!
file
&&
this
.
syncedBuffers
.
has
(
file
);
}
public
reOpenDocuments
():
void
{
...
...
extensions/typescript/src/languageProvider.ts
浏览文件 @
1ba9d83f
...
...
@@ -171,16 +171,16 @@ export default class LanguageProvider {
}
}
public
handles
(
file
:
string
,
doc
:
TextDocument
):
boolean
{
public
handles
(
resource
:
Uri
,
doc
:
TextDocument
):
boolean
{
if
(
doc
&&
this
.
description
.
modeIds
.
indexOf
(
doc
.
languageId
)
>=
0
)
{
return
true
;
}
if
(
this
.
bufferSyncSupport
.
handles
(
fil
e
))
{
if
(
this
.
bufferSyncSupport
.
handles
(
resourc
e
))
{
return
true
;
}
const
base
=
basename
(
file
);
const
base
=
basename
(
resource
.
fsPath
);
return
!!
base
&&
base
===
this
.
description
.
configFile
;
}
...
...
extensions/typescript/src/typeScriptServiceClientHost.ts
浏览文件 @
1ba9d83f
...
...
@@ -70,8 +70,8 @@ export default class TypeScriptServiceClientHost {
this
.
client
=
new
TypeScriptServiceClient
(
workspaceState
,
version
=>
this
.
versionStatus
.
onDidChangeTypeScriptVersion
(
version
),
plugins
,
logDirectoryProvider
);
this
.
disposables
.
push
(
this
.
client
);
this
.
client
.
onSyntaxDiagnosticsReceived
(({
file
,
diagnostics
})
=>
this
.
syntaxDiagnosticsReceived
(
fil
e
,
diagnostics
),
null
,
this
.
disposables
);
this
.
client
.
onSemanticDiagnosticsReceived
(({
file
,
diagnostics
})
=>
this
.
semanticDiagnosticsReceived
(
fil
e
,
diagnostics
),
null
,
this
.
disposables
);
this
.
client
.
onSyntaxDiagnosticsReceived
(({
resource
,
diagnostics
})
=>
this
.
syntaxDiagnosticsReceived
(
resourc
e
,
diagnostics
),
null
,
this
.
disposables
);
this
.
client
.
onSemanticDiagnosticsReceived
(({
resource
,
diagnostics
})
=>
this
.
semanticDiagnosticsReceived
(
resourc
e
,
diagnostics
),
null
,
this
.
disposables
);
this
.
client
.
onConfigDiagnosticsReceived
(
diag
=>
this
.
configFileDiagnosticsReceived
(
diag
),
null
,
this
.
disposables
);
this
.
client
.
onResendModelsRequested
(()
=>
this
.
populateService
(),
null
,
this
.
disposables
);
...
...
@@ -137,8 +137,8 @@ export default class TypeScriptServiceClientHost {
this
.
triggerAllDiagnostics
();
}
public
handles
(
file
:
string
):
boolean
{
return
!!
this
.
findLanguage
(
fil
e
);
public
handles
(
resource
:
Uri
):
boolean
{
return
!!
this
.
findLanguage
(
resourc
e
);
}
private
configurationChanged
():
void
{
...
...
@@ -146,10 +146,10 @@ export default class TypeScriptServiceClientHost {
this
.
reportStyleCheckAsWarnings
=
config
.
get
(
'
reportStyleChecksAsWarnings
'
,
true
);
}
private
async
findLanguage
(
file
:
string
):
Promise
<
LanguageProvider
|
undefined
>
{
private
async
findLanguage
(
resource
:
Uri
):
Promise
<
LanguageProvider
|
undefined
>
{
try
{
const
doc
=
await
workspace
.
openTextDocument
(
this
.
client
.
asUrl
(
file
)
);
return
this
.
languages
.
find
(
language
=>
language
.
handles
(
fil
e
,
doc
));
const
doc
=
await
workspace
.
openTextDocument
(
resource
);
return
this
.
languages
.
find
(
language
=>
language
.
handles
(
resourc
e
,
doc
));
}
catch
{
return
undefined
;
}
...
...
@@ -170,20 +170,20 @@ export default class TypeScriptServiceClientHost {
});
}
private
async
syntaxDiagnosticsReceived
(
file
:
string
,
diagnostics
:
Proto
.
Diagnostic
[]):
Promise
<
void
>
{
const
language
=
await
this
.
findLanguage
(
fil
e
);
private
async
syntaxDiagnosticsReceived
(
resource
:
Uri
,
diagnostics
:
Proto
.
Diagnostic
[]):
Promise
<
void
>
{
const
language
=
await
this
.
findLanguage
(
resourc
e
);
if
(
language
)
{
language
.
syntaxDiagnosticsReceived
(
this
.
client
.
asUrl
(
file
)
,
resource
,
this
.
createMarkerDatas
(
diagnostics
,
language
.
diagnosticSource
));
}
}
private
async
semanticDiagnosticsReceived
(
file
:
string
,
diagnostics
:
Proto
.
Diagnostic
[]):
Promise
<
void
>
{
const
language
=
await
this
.
findLanguage
(
fil
e
);
private
async
semanticDiagnosticsReceived
(
resource
:
Uri
,
diagnostics
:
Proto
.
Diagnostic
[]):
Promise
<
void
>
{
const
language
=
await
this
.
findLanguage
(
resourc
e
);
if
(
language
)
{
language
.
semanticDiagnosticsReceived
(
this
.
client
.
asUrl
(
file
)
,
resource
,
this
.
createMarkerDatas
(
diagnostics
,
language
.
diagnosticSource
));
}
}
...
...
@@ -195,7 +195,7 @@ export default class TypeScriptServiceClientHost {
return
;
}
(
this
.
findLanguage
(
body
.
configFile
)).
then
(
language
=>
{
(
this
.
findLanguage
(
this
.
client
.
asUrl
(
body
.
configFile
)
)).
then
(
language
=>
{
if
(
!
language
)
{
return
;
}
...
...
extensions/typescript/src/typescriptServiceClient.ts
浏览文件 @
1ba9d83f
...
...
@@ -140,8 +140,8 @@ class ForkedTsServerProcess {
}
export
interface
TsDiagnostics
{
file
:
string
;
diagnostics
:
Proto
.
Diagnostic
[];
readonly
resource
:
Uri
;
readonly
diagnostics
:
Proto
.
Diagnostic
[];
}
export
default
class
TypeScriptServiceClient
implements
ITypeScriptServiceClient
{
...
...
@@ -802,7 +802,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
const
diagnosticEvent
:
Proto
.
DiagnosticEvent
=
event
;
if
(
diagnosticEvent
.
body
&&
diagnosticEvent
.
body
.
diagnostics
)
{
this
.
_onSyntaxDiagnosticsReceived
.
fire
({
file
:
diagnosticEvent
.
body
.
file
,
resource
:
this
.
asUrl
(
diagnosticEvent
.
body
.
file
)
,
diagnostics
:
diagnosticEvent
.
body
.
diagnostics
});
}
...
...
@@ -813,7 +813,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
const
diagnosticEvent
:
Proto
.
DiagnosticEvent
=
event
;
if
(
diagnosticEvent
.
body
&&
diagnosticEvent
.
body
.
diagnostics
)
{
this
.
_onSemanticDiagnosticsReceived
.
fire
({
file
:
diagnosticEvent
.
body
.
file
,
resource
:
this
.
asUrl
(
diagnosticEvent
.
body
.
file
)
,
diagnostics
:
diagnosticEvent
.
body
.
diagnostics
});
}
...
...
extensions/typescript/src/utils/projectStatus.ts
浏览文件 @
1ba9d83f
...
...
@@ -63,7 +63,7 @@ class ExcludeHintItem {
}
}
function
createLargeProjectMonitorForProject
(
item
:
ExcludeHintItem
,
client
:
ITypeScriptServiceClient
,
isOpen
:
(
path
:
string
)
=>
Promise
<
boolean
>
,
memento
:
vscode
.
Memento
):
vscode
.
Disposable
[]
{
function
createLargeProjectMonitorForProject
(
item
:
ExcludeHintItem
,
client
:
ITypeScriptServiceClient
,
isOpen
:
(
resource
:
vscode
.
Uri
)
=>
Promise
<
boolean
>
,
memento
:
vscode
.
Memento
):
vscode
.
Disposable
[]
{
const
toDispose
:
vscode
.
Disposable
[]
=
[];
const
projectHinted
:
ProjectHintedMap
=
Object
.
create
(
null
);
...
...
@@ -88,7 +88,7 @@ function createLargeProjectMonitorForProject(item: ExcludeHintItem, client: ITyp
if
(
!
file
)
{
return
;
}
isOpen
(
file
).
then
(
value
=>
{
isOpen
(
editor
.
document
.
uri
).
then
(
value
=>
{
if
(
!
value
)
{
return
;
}
...
...
@@ -175,7 +175,7 @@ function onConfigureExcludesSelected(
export
function
create
(
client
:
ITypeScriptServiceClient
,
telemetryReporter
:
TelemetryReporter
,
isOpen
:
(
path
:
string
)
=>
Promise
<
boolean
>
,
isOpen
:
(
resource
:
vscode
.
Uri
)
=>
Promise
<
boolean
>
,
memento
:
vscode
.
Memento
)
{
const
toDispose
:
vscode
.
Disposable
[]
=
[];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录