Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
eb8c718e
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,发现更多精彩内容 >>
提交
eb8c718e
编写于
11月 09, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - fix compile errors in bootstrap files
上级
3154dd4f
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
59 addition
and
44 deletion
+59
-44
src/bootstrap-amd.js
src/bootstrap-amd.js
+1
-1
src/bootstrap-fork.js
src/bootstrap-fork.js
+2
-2
src/bootstrap-window.js
src/bootstrap-window.js
+4
-3
src/bootstrap.js
src/bootstrap.js
+3
-3
src/main.js
src/main.js
+11
-9
src/paths.js
src/paths.js
+28
-15
src/vs/base/node/paths.ts
src/vs/base/node/paths.ts
+2
-7
src/vs/base/parts/sandbox/electron-browser/preload.js
src/vs/base/parts/sandbox/electron-browser/preload.js
+2
-0
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+5
-3
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+1
-1
未找到文件。
src/bootstrap-amd.js
浏览文件 @
eb8c718e
...
...
@@ -29,7 +29,7 @@ if (process.env['ELECTRON_RUN_AS_NODE'] || process.versions['electron']) {
}
// Pseudo NLS support
if
(
nlsConfig
.
pseudo
)
{
if
(
nlsConfig
?
.
pseudo
)
{
loader
([
'
vs/nls
'
],
function
(
nlsPlugin
)
{
nlsPlugin
.
setPseudoTranslation
(
nlsConfig
.
pseudo
);
});
...
...
src/bootstrap-fork.js
浏览文件 @
eb8c718e
...
...
@@ -81,7 +81,7 @@ function pipeLoggingToParent() {
// to start the stacktrace where the console message was being written
if
(
process
.
env
.
VSCODE_LOG_STACK
===
'
true
'
)
{
const
stack
=
new
Error
().
stack
;
argsArray
.
push
({
__
$stack
:
stack
.
split
(
'
\n
'
).
slice
(
3
).
join
(
'
\n
'
)
});
argsArray
.
push
({
__
$stack
:
stack
?
.
split
(
'
\n
'
).
slice
(
3
).
join
(
'
\n
'
)
});
}
try
{
...
...
@@ -114,7 +114,7 @@ function pipeLoggingToParent() {
*/
function
safeSend
(
arg
)
{
try
{
process
.
send
(
arg
);
process
.
send
?.
(
arg
);
}
catch
(
error
)
{
// Can happen if the parent channel is closed meanwhile
}
...
...
src/bootstrap-window.js
浏览文件 @
eb8c718e
...
...
@@ -41,7 +41,7 @@
* extensionDevelopmentPath?: string[],
* extensionTestsPath?: string,
* userEnv?: { [key: string]: string | undefined },
* appRoot
?
: string,
* appRoot: string,
* nodeCachedDataDir?: string
* }} */
const
configuration
=
JSON
.
parse
(
args
[
'
config
'
]
||
'
{}
'
)
||
{};
...
...
@@ -61,7 +61,7 @@
const
enableDeveloperTools
=
(
safeProcess
.
env
[
'
VSCODE_DEV
'
]
||
!!
configuration
.
extensionDevelopmentPath
)
&&
!
configuration
.
extensionTestsPath
;
let
developerToolsUnbind
;
if
(
enableDeveloperTools
||
(
options
&&
options
.
forceEnableDeveloperKeybindings
))
{
developerToolsUnbind
=
registerDeveloperKeybindings
(
options
&&
options
.
disallowReloadKeybinding
);
developerToolsUnbind
=
registerDeveloperKeybindings
(
options
?
.
disallowReloadKeybinding
);
}
// Correctly inherit the parent's environment (TODO@sandbox non-sandboxed only)
...
...
@@ -182,7 +182,7 @@
}
/**
* @param {boolean} disallowReloadKeybinding
* @param {boolean
| undefined
} disallowReloadKeybinding
* @returns {() => void}
*/
function
registerDeveloperKeybindings
(
disallowReloadKeybinding
)
{
...
...
@@ -203,6 +203,7 @@
const
TOGGLE_DEV_TOOLS_KB_ALT
=
'
123
'
;
// F12
const
RELOAD_KB
=
(
safeProcess
.
platform
===
'
darwin
'
?
'
meta-82
'
:
'
ctrl-82
'
);
// mac: Cmd-R, rest: Ctrl-R
/** @type {((e: any) => void) | undefined} */
let
listener
=
function
(
e
)
{
const
key
=
extractKey
(
e
);
if
(
key
===
TOGGLE_DEV_TOOLS_KB
||
key
===
TOGGLE_DEV_TOOLS_KB_ALT
)
{
...
...
src/bootstrap.js
浏览文件 @
eb8c718e
...
...
@@ -42,7 +42,7 @@
//#region Add support for using node_modules.asar
/**
* @param {string} appRoot
* @param {string
| undefined
} appRoot
*/
function
enableASARSupport
(
appRoot
)
{
if
(
!
path
||
!
Module
)
{
...
...
@@ -124,7 +124,7 @@
//#region NLS helpers
/**
* @returns {{locale?: string, availableLanguages: {[lang: string]: string;}, pseudo?: boolean }}
* @returns {{locale?: string, availableLanguages: {[lang: string]: string;}, pseudo?: boolean }
| undefined
}
*/
function
setupNLS
()
{
if
(
!
path
||
!
fs
)
{
...
...
@@ -181,7 +181,7 @@
/**
* @param {{ portable: string; applicationName: string; }} product
* @returns {{ portableDataPath: string; isPortable: boolean; }}
* @returns {{ portableDataPath: string; isPortable: boolean; }
| undefined
}
*/
function
configurePortable
(
product
)
{
if
(
!
path
||
!
fs
)
{
...
...
src/main.js
浏览文件 @
eb8c718e
...
...
@@ -107,7 +107,7 @@ crashReporter.start({
// to ensure that no 'logs' folder is created on disk at a
// location outside of the portable directory
// (https://github.com/microsoft/vscode/issues/56651)
if
(
portable
.
isPortable
)
{
if
(
portable
?
.
isPortable
)
{
app
.
setAppLogsPath
(
path
.
join
(
userDataPath
,
'
logs
'
));
}
...
...
@@ -145,7 +145,7 @@ const nodeCachedDataDir = getNodeCachedDir();
* Support user defined locale: load it early before app('ready')
* to have more things running in parallel.
*
* @type {Promise<import('./vs/base/node/languagePacks').NLSConfiguration>
} nlsConfig | undefined
* @type {Promise<import('./vs/base/node/languagePacks').NLSConfiguration>
| undefined}
*/
let
nlsConfigurationPromise
=
undefined
;
...
...
@@ -359,7 +359,7 @@ function getArgvConfigPath() {
/**
* @param {NativeParsedArgs} cliArgs
* @returns {string}
* @returns {string
| null
}
*/
function
getJSFlags
(
cliArgs
)
{
const
jsFlags
=
[];
...
...
@@ -387,7 +387,7 @@ function getUserDataPath(cliArgs) {
return
path
.
join
(
portable
.
portableDataPath
,
'
user-data
'
);
}
return
path
.
resolve
(
cliArgs
[
'
user-data-dir
'
]
||
paths
.
getDefaultUserDataPath
(
process
.
platform
));
return
path
.
resolve
(
cliArgs
[
'
user-data-dir
'
]
||
paths
.
getDefaultUserDataPath
());
}
/**
...
...
@@ -468,12 +468,14 @@ function getNodeCachedDir() {
}
async
ensureExists
()
{
try
{
await
mkdirp
(
this
.
value
);
if
(
typeof
this
.
value
===
'
string
'
)
{
try
{
await
mkdirp
(
this
.
value
);
return
this
.
value
;
}
catch
(
error
)
{
// ignore
return
this
.
value
;
}
catch
(
error
)
{
// ignore
}
}
}
...
...
src/paths.js
浏览文件 @
eb8c718e
...
...
@@ -11,25 +11,38 @@ const path = require('path');
const
os
=
require
(
'
os
'
);
/**
* @param {string} platform
* @returns {string}
*/
function
getAppDataPath
(
platform
)
{
switch
(
platform
)
{
case
'
win32
'
:
return
process
.
env
[
'
VSCODE_APPDATA
'
]
||
process
.
env
[
'
APPDATA
'
]
||
path
.
join
(
process
.
env
[
'
USERPROFILE
'
],
'
AppData
'
,
'
Roaming
'
);
case
'
darwin
'
:
return
process
.
env
[
'
VSCODE_APPDATA
'
]
||
path
.
join
(
os
.
homedir
(),
'
Library
'
,
'
Application Support
'
);
case
'
linux
'
:
return
process
.
env
[
'
VSCODE_APPDATA
'
]
||
process
.
env
[
'
XDG_CONFIG_HOME
'
]
||
path
.
join
(
os
.
homedir
(),
'
.config
'
);
default
:
throw
new
Error
(
'
Platform not supported
'
);
function
getDefaultUserDataPath
()
{
// Support global VSCODE_APPDATA environment variable
let
appDataPath
=
process
.
env
[
'
VSCODE_APPDATA
'
];
// Otherwise check per platform
if
(
!
appDataPath
)
{
switch
(
process
.
platform
)
{
case
'
win32
'
:
appDataPath
=
process
.
env
[
'
APPDATA
'
];
if
(
!
appDataPath
)
{
const
userProfile
=
process
.
env
[
'
USERPROFILE
'
];
if
(
typeof
userProfile
!==
'
string
'
)
{
throw
new
Error
(
'
Windows: Unexpected undefined %USERPROFILE% environment variable
'
);
}
appDataPath
=
path
.
join
(
userProfile
,
'
AppData
'
,
'
Roaming
'
);
}
break
;
case
'
darwin
'
:
appDataPath
=
path
.
join
(
os
.
homedir
(),
'
Library
'
,
'
Application Support
'
);
break
;
case
'
linux
'
:
appDataPath
=
process
.
env
[
'
XDG_CONFIG_HOME
'
]
||
path
.
join
(
os
.
homedir
(),
'
.config
'
);
break
;
default
:
throw
new
Error
(
'
Platform not supported
'
);
}
}
}
/**
* @param {string} platform
* @returns {string}
*/
function
getDefaultUserDataPath
(
platform
)
{
return
path
.
join
(
getAppDataPath
(
platform
),
pkg
.
name
);
return
path
.
join
(
appDataPath
,
pkg
.
name
);
}
exports
.
getAppDataPath
=
getAppDataPath
;
exports
.
getDefaultUserDataPath
=
getDefaultUserDataPath
;
src/vs/base/node/paths.ts
浏览文件 @
eb8c718e
...
...
@@ -5,12 +5,7 @@
import
{
FileAccess
}
from
'
vs/base/common/network
'
;
interface
IPaths
{
getAppDataPath
(
platform
:
string
):
string
;
getDefaultUserDataPath
(
platform
:
string
):
string
;
}
const
pathsPath
=
FileAccess
.
asFileUri
(
'
paths
'
,
require
).
fsPath
;
const
paths
=
require
.
__$__nodeRequire
<
IPaths
>
(
pathsPath
);
export
const
getAppDataPath
=
paths
.
getAppDataPath
;
const
paths
=
require
.
__$__nodeRequire
<
{
getDefaultUserDataPath
():
string
}
>
(
pathsPath
);
export
const
getDefaultUserDataPath
=
paths
.
getDefaultUserDataPath
;
src/vs/base/parts/sandbox/electron-browser/preload.js
浏览文件 @
eb8c718e
...
...
@@ -223,6 +223,8 @@
* shell specific environment from the OS shell to ensure we are seeing
* all development related environment variables. We do this from the
* main process because it may involve spawning a shell.
*
* @returns {Promise<void>}
*/
function
resolveEnv
()
{
return
new
Promise
(
function
(
resolve
)
{
...
...
src/vs/code/electron-main/app.ts
浏览文件 @
eb8c718e
...
...
@@ -591,12 +591,13 @@ export class CodeApplication extends Disposable {
return
undefined
;
}
})).
filter
(
pendingUriToHandle
=>
{
// if URI should be blocked, filter it out
// If URI should be blocked, filter it out
if
(
this
.
shouldBlockURI
(
pendingUriToHandle
))
{
return
false
;
}
//
f
ilter out any protocol link that wants to open as window so that
//
F
ilter out any protocol link that wants to open as window so that
// we open the right set of windows on startup and not restore the
// previous workspace too.
const
windowOpenable
=
this
.
getWindowOpenableFromProtocolLink
(
pendingUriToHandle
);
...
...
@@ -614,7 +615,8 @@ export class CodeApplication extends Disposable {
const
environmentService
=
this
.
environmentService
;
urlService
.
registerHandler
({
async
handleURL
(
uri
:
URI
):
Promise
<
boolean
>
{
// if URI should be blocked, behave as if it's handled
// If URI should be blocked, behave as if it's handled
if
(
app
.
shouldBlockURI
(
uri
))
{
return
true
;
}
...
...
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
eb8c718e
...
...
@@ -245,5 +245,5 @@ export function parsePathArg(arg: string | undefined, process: NodeJS.Process):
}
export
function
parseUserDataDir
(
args
:
NativeParsedArgs
,
process
:
NodeJS
.
Process
):
string
{
return
parsePathArg
(
args
[
'
user-data-dir
'
],
process
)
||
path
.
resolve
(
paths
.
getDefaultUserDataPath
(
process
.
platform
));
return
parsePathArg
(
args
[
'
user-data-dir
'
],
process
)
||
path
.
resolve
(
paths
.
getDefaultUserDataPath
());
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录