Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
66319f4a
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,发现更多精彩内容 >>
提交
66319f4a
编写于
11月 19, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Strict null check environmentService
上级
04067138
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
39 deletion
+47
-39
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+1
-0
src/vs/platform/environment/common/environment.ts
src/vs/platform/environment/common/environment.ts
+10
-10
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+36
-29
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
66319f4a
...
...
@@ -427,6 +427,7 @@
"./vs/platform/editor/common/editor.ts"
,
"./vs/platform/environment/common/environment.ts"
,
"./vs/platform/environment/node/argv.ts"
,
"./vs/platform/environment/node/environmentService.ts"
,
"./vs/platform/extensionManagement/common/extensionEnablementService.ts"
,
"./vs/platform/extensionManagement/common/extensionManagement.ts"
,
"./vs/platform/extensionManagement/common/extensionManagementUtil.ts"
,
...
...
src/vs/platform/environment/common/environment.ts
浏览文件 @
66319f4a
...
...
@@ -74,12 +74,12 @@ export interface ParsedArgs {
export
const
IEnvironmentService
=
createDecorator
<
IEnvironmentService
>
(
'
environmentService
'
);
export
interface
IDebugParams
{
port
:
number
;
port
:
number
|
null
;
break
:
boolean
;
}
export
interface
IExtensionHostDebugParams
extends
IDebugParams
{
debugId
:
string
;
debugId
?
:
string
;
}
export
interface
IEnvironmentService
{
...
...
@@ -95,13 +95,13 @@ export interface IEnvironmentService {
userDataPath
:
string
;
appNameLong
:
string
;
appQuality
:
string
;
appQuality
?
:
string
;
appSettingsHome
:
string
;
appSettingsPath
:
string
;
appKeybindingsPath
:
string
;
settingsSearchBuildId
:
number
;
settingsSearchUrl
:
string
;
settingsSearchBuildId
?
:
number
;
settingsSearchUrl
?
:
string
;
workspaceStorageHome
:
string
;
...
...
@@ -114,8 +114,8 @@ export interface IEnvironmentService {
disableExtensions
:
boolean
|
string
[];
builtinExtensionsPath
:
string
;
extensionsPath
:
string
;
extensionDevelopmentLocationURI
:
URI
;
extensionTestsPath
:
string
;
extensionDevelopmentLocationURI
?
:
URI
;
extensionTestsPath
?
:
string
;
debugExtensionHost
:
IExtensionHostDebugParams
;
debugSearch
:
IDebugParams
;
...
...
@@ -128,7 +128,7 @@ export interface IEnvironmentService {
performance
:
boolean
;
// logging
log
:
string
;
log
?
:
string
;
logsPath
:
string
;
verbose
:
boolean
;
...
...
@@ -140,12 +140,12 @@ export interface IEnvironmentService {
mainIPCHandle
:
string
;
sharedIPCHandle
:
string
;
nodeCachedDataDir
:
string
;
nodeCachedDataDir
?
:
string
;
installSourcePath
:
string
;
disableUpdates
:
boolean
;
disableCrashReporter
:
boolean
;
driverHandle
:
string
;
driverHandle
?
:
string
;
driverVerbose
:
boolean
;
}
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
66319f4a
...
...
@@ -92,8 +92,9 @@ export class EnvironmentService implements IEnvironmentService {
@
memoize
get
userDataPath
():
string
{
if
(
process
.
env
[
'
VSCODE_PORTABLE
'
])
{
return
path
.
join
(
process
.
env
[
'
VSCODE_PORTABLE
'
],
'
user-data
'
);
const
vscodePortable
=
process
.
env
[
'
VSCODE_PORTABLE
'
];
if
(
vscodePortable
)
{
return
path
.
join
(
vscodePortable
,
'
user-data
'
);
}
return
parseUserDataDir
(
this
.
_args
,
process
);
...
...
@@ -101,7 +102,7 @@ export class EnvironmentService implements IEnvironmentService {
get
appNameLong
():
string
{
return
product
.
nameLong
;
}
get
appQuality
():
string
{
return
product
.
quality
;
}
get
appQuality
():
string
|
undefined
{
return
product
.
quality
;
}
@
memoize
get
appSettingsHome
():
string
{
return
path
.
join
(
this
.
userDataPath
,
'
User
'
);
}
...
...
@@ -113,10 +114,10 @@ export class EnvironmentService implements IEnvironmentService {
get
workspaceStorageHome
():
string
{
return
path
.
join
(
this
.
appSettingsHome
,
'
workspaceStorage
'
);
}
@
memoize
get
settingsSearchBuildId
():
number
{
return
product
.
settingsSearchBuildId
;
}
get
settingsSearchBuildId
():
number
|
undefined
{
return
product
.
settingsSearchBuildId
;
}
@
memoize
get
settingsSearchUrl
():
string
{
return
product
.
settingsSearchUrl
;
}
get
settingsSearchUrl
():
string
|
undefined
{
return
product
.
settingsSearchUrl
;
}
@
memoize
get
appKeybindingsPath
():
string
{
return
path
.
join
(
this
.
appSettingsHome
,
'
keybindings.json
'
);
}
...
...
@@ -152,17 +153,23 @@ export class EnvironmentService implements IEnvironmentService {
if
(
fromArgs
)
{
return
fromArgs
;
}
else
if
(
process
.
env
[
'
VSCODE_EXTENSIONS
'
])
{
return
process
.
env
[
'
VSCODE_EXTENSIONS
'
];
}
else
if
(
process
.
env
[
'
VSCODE_PORTABLE
'
])
{
return
path
.
join
(
process
.
env
[
'
VSCODE_PORTABLE
'
],
'
extensions
'
);
}
else
{
return
path
.
join
(
this
.
userHome
,
product
.
dataFolderName
,
'
extensions
'
);
}
const
vscodeExtensions
=
process
.
env
[
'
VSCODE_EXTENSIONS
'
];
if
(
vscodeExtensions
)
{
return
vscodeExtensions
;
}
const
vscodePortable
=
process
.
env
[
'
VSCODE_PORTABLE
'
];
if
(
vscodePortable
)
{
return
path
.
join
(
vscodePortable
,
'
extensions
'
);
}
return
path
.
join
(
this
.
userHome
,
product
.
dataFolderName
,
'
extensions
'
);
}
@
memoize
get
extensionDevelopmentLocationURI
():
URI
{
get
extensionDevelopmentLocationURI
():
URI
|
undefined
{
const
s
=
this
.
_args
.
extensionDevelopmentPath
;
if
(
s
)
{
if
(
/^
[^
:
/
?#
]
+
?
:
\/\/
/
.
test
(
s
))
{
...
...
@@ -174,13 +181,13 @@ export class EnvironmentService implements IEnvironmentService {
}
@
memoize
get
extensionTestsPath
():
string
{
return
this
.
_args
.
extensionTestsPath
?
path
.
normalize
(
this
.
_args
.
extensionTestsPath
)
:
this
.
_args
.
extensionTestsPath
;
}
get
extensionTestsPath
():
string
|
undefined
{
return
this
.
_args
.
extensionTestsPath
?
path
.
normalize
(
this
.
_args
.
extensionTestsPath
)
:
this
.
_args
.
extensionTestsPath
;
}
get
disableExtensions
():
boolean
|
string
[]
{
if
(
this
.
_args
[
'
disable-extensions
'
])
{
return
true
;
}
const
disableExtensions
:
string
|
string
[]
=
this
.
_args
[
'
disable-extension
'
];
const
disableExtensions
=
this
.
_args
[
'
disable-extension
'
];
if
(
disableExtensions
)
{
if
(
typeof
disableExtensions
===
'
string
'
)
{
return
[
disableExtensions
];
...
...
@@ -192,11 +199,11 @@ export class EnvironmentService implements IEnvironmentService {
return
false
;
}
get
skipGettingStarted
():
boolean
{
return
this
.
_args
[
'
skip-getting-started
'
];
}
get
skipGettingStarted
():
boolean
{
return
!!
this
.
_args
[
'
skip-getting-started
'
];
}
get
skipReleaseNotes
():
boolean
{
return
this
.
_args
[
'
skip-release-notes
'
];
}
get
skipReleaseNotes
():
boolean
{
return
!!
this
.
_args
[
'
skip-release-notes
'
];
}
get
skipAddToRecentlyOpened
():
boolean
{
return
this
.
_args
[
'
skip-add-to-recently-opened
'
];
}
get
skipAddToRecentlyOpened
():
boolean
{
return
!!
this
.
_args
[
'
skip-add-to-recently-opened
'
];
}
@
memoize
get
debugExtensionHost
():
IExtensionHostDebugParams
{
return
parseExtensionHostPort
(
this
.
_args
,
this
.
isBuilt
);
}
...
...
@@ -205,15 +212,15 @@ export class EnvironmentService implements IEnvironmentService {
get
debugSearch
():
IDebugParams
{
return
parseSearchPort
(
this
.
_args
,
this
.
isBuilt
);
}
get
isBuilt
():
boolean
{
return
!
process
.
env
[
'
VSCODE_DEV
'
];
}
get
verbose
():
boolean
{
return
this
.
_args
.
verbose
;
}
get
log
():
string
{
return
this
.
_args
.
log
;
}
get
verbose
():
boolean
{
return
!!
this
.
_args
.
verbose
;
}
get
log
():
string
|
undefined
{
return
this
.
_args
.
log
;
}
get
wait
():
boolean
{
return
this
.
_args
.
wait
;
}
get
wait
():
boolean
{
return
!!
this
.
_args
.
wait
;
}
get
logExtensionHostCommunication
():
boolean
{
return
this
.
_args
.
logExtensionHostCommunication
;
}
get
logExtensionHostCommunication
():
boolean
{
return
!!
this
.
_args
.
logExtensionHostCommunication
;
}
get
performance
():
boolean
{
return
this
.
_args
.
performance
;
}
get
status
():
boolean
{
return
this
.
_args
.
status
;
}
get
performance
():
boolean
{
return
!!
this
.
_args
.
performance
;
}
get
status
():
boolean
{
return
!!
this
.
_args
.
status
;
}
@
memoize
get
mainIPCHandle
():
string
{
return
getIPCHandle
(
this
.
userDataPath
,
'
main
'
);
}
...
...
@@ -222,13 +229,13 @@ export class EnvironmentService implements IEnvironmentService {
get
sharedIPCHandle
():
string
{
return
getIPCHandle
(
this
.
userDataPath
,
'
shared
'
);
}
@
memoize
get
nodeCachedDataDir
():
string
{
return
process
.
env
[
'
VSCODE_NODE_CACHED_DATA_DIR
'
]
||
undefined
;
}
get
nodeCachedDataDir
():
string
|
undefined
{
return
process
.
env
[
'
VSCODE_NODE_CACHED_DATA_DIR
'
]
||
undefined
;
}
get
disableUpdates
():
boolean
{
return
!!
this
.
_args
[
'
disable-updates
'
];
}
get
disableCrashReporter
():
boolean
{
return
!!
this
.
_args
[
'
disable-crash-reporter
'
];
}
get
driverHandle
():
string
{
return
this
.
_args
[
'
driver
'
];
}
get
driverVerbose
():
boolean
{
return
this
.
_args
[
'
driver-verbose
'
];
}
get
driverHandle
():
string
|
undefined
{
return
this
.
_args
[
'
driver
'
];
}
get
driverVerbose
():
boolean
{
return
!!
this
.
_args
[
'
driver-verbose
'
];
}
constructor
(
private
_args
:
ParsedArgs
,
private
_execPath
:
string
)
{
if
(
!
process
.
env
[
'
VSCODE_LOGS
'
])
{
...
...
@@ -236,7 +243,7 @@ export class EnvironmentService implements IEnvironmentService {
process
.
env
[
'
VSCODE_LOGS
'
]
=
path
.
join
(
this
.
userDataPath
,
'
logs
'
,
key
);
}
this
.
logsPath
=
process
.
env
[
'
VSCODE_LOGS
'
];
this
.
logsPath
=
process
.
env
[
'
VSCODE_LOGS
'
]
!
;
}
}
...
...
@@ -248,14 +255,14 @@ export function parseSearchPort(args: ParsedArgs, isBuild: boolean): IDebugParam
return
parseDebugPort
(
args
.
debugSearch
,
args
.
debugBrkSearch
,
5876
,
isBuild
);
}
export
function
parseDebugPort
(
debugArg
:
string
,
debugBrkArg
:
string
,
defaultBuildPort
:
number
,
isBuild
:
boolean
,
debugId
?:
string
):
IExtensionHostDebugParams
{
export
function
parseDebugPort
(
debugArg
:
string
|
undefined
,
debugBrkArg
:
string
|
undefined
,
defaultBuildPort
:
number
,
isBuild
:
boolean
,
debugId
?:
string
):
IExtensionHostDebugParams
{
const
portStr
=
debugBrkArg
||
debugArg
;
const
port
=
Number
(
portStr
)
||
(
!
isBuild
?
defaultBuildPort
:
null
);
const
brk
=
port
?
Boolean
(
!!
debugBrkArg
)
:
false
;
return
{
port
,
break
:
brk
,
debugId
};
}
function
parsePathArg
(
arg
:
string
,
process
:
NodeJS
.
Process
):
string
{
function
parsePathArg
(
arg
:
string
|
undefined
,
process
:
NodeJS
.
Process
):
string
|
undefined
{
if
(
!
arg
)
{
return
undefined
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录