Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
408b6d5f
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,发现更多精彩内容 >>
提交
408b6d5f
编写于
12月 04, 2017
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move file schemes to own file
上级
20fc7885
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
30 addition
and
14 deletion
+30
-14
extensions/typescript/src/extension.ts
extensions/typescript/src/extension.ts
+2
-7
extensions/typescript/src/typescriptServiceClient.ts
extensions/typescript/src/typescriptServiceClient.ts
+8
-7
extensions/typescript/src/utils/fileSchemes.ts
extensions/typescript/src/utils/fileSchemes.ts
+20
-0
未找到文件。
extensions/typescript/src/extension.ts
浏览文件 @
408b6d5f
...
@@ -16,7 +16,7 @@ import * as languageConfigurations from './utils/languageConfigurations';
...
@@ -16,7 +16,7 @@ import * as languageConfigurations from './utils/languageConfigurations';
import
{
standardLanguageDescriptions
}
from
'
./utils/languageDescription
'
;
import
{
standardLanguageDescriptions
}
from
'
./utils/languageDescription
'
;
import
ManagedFileContextManager
from
'
./utils/managedFileContext
'
;
import
ManagedFileContextManager
from
'
./utils/managedFileContext
'
;
import
{
lazy
,
Lazy
}
from
'
./utils/lazy
'
;
import
{
lazy
,
Lazy
}
from
'
./utils/lazy
'
;
import
TypeScriptServiceClient
from
'
./typescriptServiceClient
'
;
import
*
as
fileSchemes
from
'
./utils/fileSchemes
'
;
export
function
activate
(
export
function
activate
(
context
:
vscode
.
ExtensionContext
context
:
vscode
.
ExtensionContext
...
@@ -94,10 +94,5 @@ function isSupportedDocument(
...
@@ -94,10 +94,5 @@ function isSupportedDocument(
if
(
supportedLanguage
.
indexOf
(
document
.
languageId
)
<
0
)
{
if
(
supportedLanguage
.
indexOf
(
document
.
languageId
)
<
0
)
{
return
false
;
return
false
;
}
}
const
scheme
=
document
.
uri
.
scheme
;
return
fileSchemes
.
isSupportedScheme
(
document
.
uri
.
scheme
);
return
(
scheme
===
TypeScriptServiceClient
.
WALK_THROUGH_SNIPPET_SCHEME
||
scheme
===
'
untitled
'
||
scheme
===
'
file
'
);
}
}
\ No newline at end of file
extensions/typescript/src/typescriptServiceClient.ts
浏览文件 @
408b6d5f
...
@@ -26,6 +26,8 @@ import * as nls from 'vscode-nls';
...
@@ -26,6 +26,8 @@ import * as nls from 'vscode-nls';
import
{
TypeScriptServiceConfiguration
,
TsServerLogLevel
}
from
'
./utils/configuration
'
;
import
{
TypeScriptServiceConfiguration
,
TsServerLogLevel
}
from
'
./utils/configuration
'
;
import
{
TypeScriptVersionProvider
,
TypeScriptVersion
}
from
'
./utils/versionProvider
'
;
import
{
TypeScriptVersionProvider
,
TypeScriptVersion
}
from
'
./utils/versionProvider
'
;
import
{
TypeScriptVersionPicker
}
from
'
./utils/versionPicker
'
;
import
{
TypeScriptVersionPicker
}
from
'
./utils/versionPicker
'
;
import
*
as
fileSchemes
from
'
./utils/fileSchemes
'
;
const
localize
=
nls
.
loadMessageBundle
();
const
localize
=
nls
.
loadMessageBundle
();
interface
CallbackItem
{
interface
CallbackItem
{
...
@@ -107,8 +109,7 @@ class RequestQueue {
...
@@ -107,8 +109,7 @@ class RequestQueue {
}
}
export
default
class
TypeScriptServiceClient
implements
ITypeScriptServiceClient
{
export
default
class
TypeScriptServiceClient
implements
ITypeScriptServiceClient
{
public
static
readonly
WALK_THROUGH_SNIPPET_SCHEME
=
'
walkThroughSnippet
'
;
private
static
readonly
WALK_THROUGH_SNIPPET_SCHEME_COLON
=
`
${
fileSchemes
.
walkThroughSnippet
}
:`
;
private
static
readonly
WALK_THROUGH_SNIPPET_SCHEME_COLON
=
`
${
TypeScriptServiceClient
.
WALK_THROUGH_SNIPPET_SCHEME
}
:`
;
private
pathSeparator
:
string
;
private
pathSeparator
:
string
;
...
@@ -555,15 +556,15 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
...
@@ -555,15 +556,15 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
}
}
public
normalizePath
(
resource
:
Uri
):
string
|
null
{
public
normalizePath
(
resource
:
Uri
):
string
|
null
{
if
(
resource
.
scheme
===
TypeScriptServiceClient
.
WALK_THROUGH_SNIPPET_SCHEME
)
{
if
(
resource
.
scheme
===
fileSchemes
.
walkThroughSnippet
)
{
return
resource
.
toString
();
return
resource
.
toString
();
}
}
if
(
resource
.
scheme
===
'
untitled
'
&&
this
.
_apiVersion
.
has213Features
())
{
if
(
resource
.
scheme
===
fileSchemes
.
untitled
&&
this
.
_apiVersion
.
has213Features
())
{
return
resource
.
toString
();
return
resource
.
toString
();
}
}
if
(
resource
.
scheme
!==
'
file
'
)
{
if
(
resource
.
scheme
!==
fileSchemes
.
file
)
{
return
null
;
return
null
;
}
}
const
result
=
resource
.
fsPath
;
const
result
=
resource
.
fsPath
;
...
@@ -576,7 +577,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
...
@@ -576,7 +577,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
public
asUrl
(
filepath
:
string
):
Uri
{
public
asUrl
(
filepath
:
string
):
Uri
{
if
(
filepath
.
startsWith
(
TypeScriptServiceClient
.
WALK_THROUGH_SNIPPET_SCHEME_COLON
)
if
(
filepath
.
startsWith
(
TypeScriptServiceClient
.
WALK_THROUGH_SNIPPET_SCHEME_COLON
)
||
(
filepath
.
startsWith
(
'
untitled
:
'
)
&&
this
.
_apiVersion
.
has213Features
())
||
(
filepath
.
startsWith
(
fileSchemes
.
untitled
+
'
:
'
)
&&
this
.
_apiVersion
.
has213Features
())
)
{
)
{
return
Uri
.
parse
(
filepath
);
return
Uri
.
parse
(
filepath
);
}
}
...
@@ -589,7 +590,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
...
@@ -589,7 +590,7 @@ export default class TypeScriptServiceClient implements ITypeScriptServiceClient
return
undefined
;
return
undefined
;
}
}
if
(
resource
.
scheme
===
'
file
'
||
resource
.
scheme
===
'
untitled
'
)
{
if
(
resource
.
scheme
===
fileSchemes
.
file
||
resource
.
scheme
===
fileSchemes
.
untitled
)
{
for
(
const
root
of
roots
.
sort
((
a
,
b
)
=>
a
.
uri
.
fsPath
.
length
-
b
.
uri
.
fsPath
.
length
))
{
for
(
const
root
of
roots
.
sort
((
a
,
b
)
=>
a
.
uri
.
fsPath
.
length
-
b
.
uri
.
fsPath
.
length
))
{
if
(
resource
.
fsPath
.
startsWith
(
root
.
uri
.
fsPath
+
path
.
sep
))
{
if
(
resource
.
fsPath
.
startsWith
(
root
.
uri
.
fsPath
+
path
.
sep
))
{
return
root
.
uri
.
fsPath
;
return
root
.
uri
.
fsPath
;
...
...
extensions/typescript/src/utils/fileSchemes.ts
0 → 100644
浏览文件 @
408b6d5f
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export
const
file
=
'
file
'
;
export
const
untitled
=
'
untitled
'
;
export
const
walkThroughSnippet
=
'
walkThroughSnippet
'
;
export
const
supportedSchemes
=
[
file
,
untitled
,
walkThroughSnippet
];
export
function
isSupportedScheme
(
scheme
:
string
):
boolean
{
return
supportedSchemes
.
indexOf
(
scheme
)
>=
0
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录