Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
3af9e456
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3af9e456
编写于
10月 11, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
labels: strict null checks
上级
3ba32665
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
21 deletion
+24
-21
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+2
-1
src/vs/base/common/labels.ts
src/vs/base/common/labels.ts
+22
-20
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
3af9e456
...
...
@@ -58,6 +58,7 @@
"./vs/base/common/severity.ts"
,
"./vs/base/common/stopwatch.ts"
,
"./vs/base/common/strings.ts"
,
"./vs/base/common/labels.ts"
,
"./vs/base/common/types.ts"
,
"./vs/base/common/uri.ts"
,
"./vs/base/common/uriIpc.ts"
,
...
...
@@ -134,4 +135,4 @@
"exclude"
:
[
"./typings/require-monaco.d.ts"
]
}
\ No newline at end of file
}
src/vs/base/common/labels.ts
浏览文件 @
3af9e456
...
...
@@ -24,9 +24,9 @@ export interface IUserHomeProvider {
/**
* @deprecated use LabelService instead
*/
export
function
getPathLabel
(
resource
:
URI
|
string
,
userHomeProvider
:
IUserHomeProvider
,
rootProvider
?:
IWorkspaceFolderProvider
):
string
{
export
function
getPathLabel
(
resource
:
URI
|
string
,
userHomeProvider
:
IUserHomeProvider
,
rootProvider
?:
IWorkspaceFolderProvider
):
string
|
undefined
{
if
(
!
resource
)
{
return
null
;
return
undefined
;
}
if
(
typeof
resource
===
'
string
'
)
{
...
...
@@ -34,23 +34,25 @@ export function getPathLabel(resource: URI | string, userHomeProvider: IUserHome
}
// return early if we can resolve a relative path label from the root
const
baseResource
=
rootProvider
?
rootProvider
.
getWorkspaceFolder
(
resource
)
:
null
;
if
(
baseResource
)
{
const
hasMultipleRoots
=
rootProvider
.
getWorkspace
().
folders
.
length
>
1
;
let
pathLabel
:
string
;
if
(
isEqual
(
baseResource
.
uri
,
resource
,
!
isLinux
))
{
pathLabel
=
''
;
// no label if paths are identical
}
else
{
pathLabel
=
normalize
(
ltrim
(
resource
.
path
.
substr
(
baseResource
.
uri
.
path
.
length
),
sep
),
true
);
}
if
(
rootProvider
)
{
const
baseResource
=
rootProvider
.
getWorkspaceFolder
(
resource
);
if
(
baseResource
)
{
const
hasMultipleRoots
=
rootProvider
.
getWorkspace
().
folders
.
length
>
1
;
let
pathLabel
:
string
;
if
(
isEqual
(
baseResource
.
uri
,
resource
,
!
isLinux
))
{
pathLabel
=
''
;
// no label if paths are identical
}
else
{
pathLabel
=
normalize
(
ltrim
(
resource
.
path
.
substr
(
baseResource
.
uri
.
path
.
length
),
sep
)
!
,
true
);
}
if
(
hasMultipleRoots
)
{
const
rootName
=
(
baseResource
&&
baseResource
.
name
)
?
baseResource
.
name
:
pathsBasename
(
baseResource
.
uri
.
fsPath
);
pathLabel
=
pathLabel
?
(
rootName
+
'
•
'
+
pathLabel
)
:
rootName
;
// always show root basename if there are multiple
}
if
(
hasMultipleRoots
)
{
const
rootName
=
(
baseResource
&&
baseResource
.
name
)
?
baseResource
.
name
:
pathsBasename
(
baseResource
.
uri
.
fsPath
);
pathLabel
=
pathLabel
?
(
rootName
+
'
•
'
+
pathLabel
)
:
rootName
;
// always show root basename if there are multiple
}
return
pathLabel
;
return
pathLabel
;
}
}
// return if the resource is neither file:// nor untitled:// and no baseResource was provided
...
...
@@ -72,9 +74,9 @@ export function getPathLabel(resource: URI | string, userHomeProvider: IUserHome
return
res
;
}
export
function
getBaseLabel
(
resource
:
URI
|
string
):
string
{
export
function
getBaseLabel
(
resource
:
URI
|
string
):
string
|
undefined
{
if
(
!
resource
)
{
return
null
;
return
undefined
;
}
if
(
typeof
resource
===
'
string
'
)
{
...
...
@@ -92,7 +94,7 @@ export function getBaseLabel(resource: URI | string): string {
}
function
hasDriveLetter
(
path
:
string
):
boolean
{
return
isWindows
&&
path
&&
path
[
1
]
===
'
:
'
;
return
!!
(
isWindows
&&
path
&&
path
[
1
]
===
'
:
'
)
;
}
export
function
normalizeDriveLetter
(
path
:
string
):
string
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录