Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
ff1887be
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,发现更多精彩内容 >>
提交
ff1887be
编写于
11月 20, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Preserve per-window environment variables between workspace changes (fix #108571)
上级
7d1cd1ff
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
25 addition
and
7 deletion
+25
-7
src/vs/code/electron-main/app.ts
src/vs/code/electron-main/app.ts
+2
-1
src/vs/code/electron-main/window.ts
src/vs/code/electron-main/window.ts
+11
-0
src/vs/code/node/shellEnv.ts
src/vs/code/node/shellEnv.ts
+3
-2
src/vs/platform/environment/node/argvHelper.ts
src/vs/platform/environment/node/argvHelper.ts
+6
-2
src/vs/platform/environment/node/environmentService.ts
src/vs/platform/environment/node/environmentService.ts
+1
-1
src/vs/platform/launch/electron-main/launchMainService.ts
src/vs/platform/launch/electron-main/launchMainService.ts
+2
-1
未找到文件。
src/vs/code/electron-main/app.ts
浏览文件 @
ff1887be
...
...
@@ -86,6 +86,7 @@ import { IKeyboardLayoutMainService, KeyboardLayoutMainService } from 'vs/platfo
import
{
toErrorMessage
}
from
'
vs/base/common/errorMessage
'
;
import
{
NativeParsedArgs
}
from
'
vs/platform/environment/common/argv
'
;
import
{
DisplayMainService
,
IDisplayMainService
}
from
'
vs/platform/display/electron-main/displayMainService
'
;
import
{
isLaunchedFromCli
}
from
'
vs/platform/environment/node/argvHelper
'
;
export
class
CodeApplication
extends
Disposable
{
private
windowsMainService
:
IWindowsMainService
|
undefined
;
...
...
@@ -703,7 +704,7 @@ export class CodeApplication extends Disposable {
// Open our first window
const
args
=
this
.
environmentService
.
args
;
const
macOpenFiles
:
string
[]
=
(
<
any
>
global
).
macOpenFiles
;
const
context
=
!!
process
.
env
[
'
VSCODE_CLI
'
]
?
OpenContext
.
CLI
:
OpenContext
.
DESKTOP
;
const
context
=
isLaunchedFromCli
(
process
.
env
)
?
OpenContext
.
CLI
:
OpenContext
.
DESKTOP
;
const
hasCliArgs
=
args
.
_
.
length
;
const
hasFolderURIs
=
!!
args
[
'
folder-uri
'
];
const
hasFileURIs
=
!!
args
[
'
file-uri
'
];
...
...
src/vs/code/electron-main/window.ts
浏览文件 @
ff1887be
...
...
@@ -35,6 +35,7 @@ import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifec
import
{
IStorageMainService
}
from
'
vs/platform/storage/node/storageMainService
'
;
import
{
ByteSize
,
IFileService
}
from
'
vs/platform/files/common/files
'
;
import
{
FileAccess
,
Schemas
}
from
'
vs/base/common/network
'
;
import
{
isLaunchedFromCli
}
from
'
vs/platform/environment/node/argvHelper
'
;
export
interface
IWindowCreationOptions
{
state
:
IWindowState
;
...
...
@@ -677,6 +678,16 @@ export class CodeWindow extends Disposable implements ICodeWindow {
load
(
config
:
INativeWindowConfiguration
,
isReload
?:
boolean
,
disableExtensions
?:
boolean
):
void
{
// If this window was loaded before from the command line
// (as indicated by VSCODE_CLI environment), make sure to
// preserve that user environment in subsequent loads,
// unless the new configuration context was also a CLI
// (for https://github.com/microsoft/vscode/issues/108571)
const
currentUserEnv
=
(
this
.
currentConfig
??
this
.
pendingLoadConfig
)?.
userEnv
;
if
(
currentUserEnv
&&
isLaunchedFromCli
(
currentUserEnv
)
&&
!
isLaunchedFromCli
(
config
.
userEnv
))
{
config
.
userEnv
=
currentUserEnv
;
}
// If this is the first time the window is loaded, we associate the paths
// directly with the window because we assume the loading will just work
if
(
this
.
_readyState
===
ReadyState
.
NONE
)
{
...
...
src/vs/code/node/shellEnv.ts
浏览文件 @
ff1887be
...
...
@@ -8,6 +8,7 @@ import { generateUuid } from 'vs/base/common/uuid';
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
NativeParsedArgs
}
from
'
vs/platform/environment/common/argv
'
;
import
{
isLaunchedFromCli
}
from
'
vs/platform/environment/node/argvHelper
'
;
/**
* We need to get the environment from a user's shell.
...
...
@@ -31,7 +32,7 @@ export async function resolveShellEnv(logService: ILogService, args: NativeParse
}
// Skip if running from CLI already
else
if
(
env
[
'
VSCODE_CLI
'
]
===
'
1
'
&&
!
args
[
'
force-user-env
'
])
{
else
if
(
isLaunchedFromCli
(
env
)
&&
!
args
[
'
force-user-env
'
])
{
logService
.
trace
(
'
resolveShellEnv(): skipped (VSCODE_CLI is set)
'
);
return
{};
...
...
@@ -39,7 +40,7 @@ export async function resolveShellEnv(logService: ILogService, args: NativeParse
// Otherwise resolve (macOS, Linux)
else
{
if
(
env
[
'
VSCODE_CLI
'
]
===
'
1
'
)
{
if
(
isLaunchedFromCli
(
env
)
)
{
logService
.
trace
(
'
resolveShellEnv(): running (--force-user-env)
'
);
}
else
{
logService
.
trace
(
'
resolveShellEnv(): running (macOS/Linux)
'
);
...
...
src/vs/platform/environment/node/argvHelper.ts
浏览文件 @
ff1887be
...
...
@@ -52,7 +52,7 @@ export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {
}
// If called from CLI, don't report warnings as they are already reported.
let
reportWarnings
=
!
process
.
env
[
'
VSCODE_CLI
'
]
;
const
reportWarnings
=
!
isLaunchedFromCli
(
process
.
env
)
;
return
parseAndValidate
(
args
,
reportWarnings
);
}
...
...
@@ -60,7 +60,7 @@ export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {
* Use this to parse raw code CLI process.argv such as: `Electron cli.js . --verbose --wait`
*/
export
function
parseCLIProcessArgv
(
processArgv
:
string
[]):
NativeParsedArgs
{
le
t
[,
,
...
args
]
=
processArgv
;
// remove the first non-option argument: it's always the app location
cons
t
[,
,
...
args
]
=
processArgv
;
// remove the first non-option argument: it's always the app location
return
parseAndValidate
(
args
,
true
);
}
...
...
@@ -78,3 +78,7 @@ export function addArg(argv: string[], ...args: string[]): string[] {
return
argv
;
}
export
function
isLaunchedFromCli
(
env
:
NodeJS
.
ProcessEnv
):
boolean
{
return
env
[
'
VSCODE_CLI
'
]
===
'
1
'
;
}
src/vs/platform/environment/node/environmentService.ts
浏览文件 @
ff1887be
...
...
@@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
os
from
'
os
'
;
import
{
IDebugParams
,
IExtensionHostDebugParams
,
INativeEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
import
{
NativeParsedArgs
}
from
'
vs/platform/environment/common/argv
'
;
import
*
as
paths
from
'
vs/base/node/paths
'
;
import
*
as
os
from
'
os
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
*
as
resources
from
'
vs/base/common/resources
'
;
import
{
memoize
}
from
'
vs/base/common/decorators
'
;
...
...
src/vs/platform/launch/electron-main/launchMainService.ts
浏览文件 @
ff1887be
...
...
@@ -19,6 +19,7 @@ import { BrowserWindow, ipcMain, Event as IpcEvent, app } from 'electron';
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
IDiagnosticInfoOptions
,
IDiagnosticInfo
,
IRemoteDiagnosticInfo
,
IRemoteDiagnosticError
}
from
'
vs/platform/diagnostics/common/diagnostics
'
;
import
{
IMainProcessInfo
,
IWindowInfo
}
from
'
vs/platform/launch/node/launch
'
;
import
{
isLaunchedFromCli
}
from
'
vs/platform/environment/node/argvHelper
'
;
export
const
ID
=
'
launchMainService
'
;
export
const
ILaunchMainService
=
createDecorator
<
ILaunchMainService
>
(
ID
);
...
...
@@ -112,7 +113,7 @@ export class LaunchMainService implements ILaunchMainService {
}
private
startOpenWindow
(
args
:
NativeParsedArgs
,
userEnv
:
IProcessEnvironment
):
Promise
<
void
>
{
const
context
=
!!
userEnv
[
'
VSCODE_CLI
'
]
?
OpenContext
.
CLI
:
OpenContext
.
DESKTOP
;
const
context
=
isLaunchedFromCli
(
userEnv
)
?
OpenContext
.
CLI
:
OpenContext
.
DESKTOP
;
let
usedWindows
:
ICodeWindow
[]
=
[];
const
waitMarkerFileURI
=
args
.
wait
&&
args
.
waitMarkerFilePath
?
URI
.
file
(
args
.
waitMarkerFilePath
)
:
undefined
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录