Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8afa7773
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,发现更多精彩内容 >>
提交
8afa7773
编写于
3月 04, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove os dep in terminalEnvironment
上级
5d2a154d
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
52 addition
and
30 deletion
+52
-30
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+2
-1
src/vs/workbench/contrib/terminal/browser/terminalService.ts
src/vs/workbench/contrib/terminal/browser/terminalService.ts
+25
-0
src/vs/workbench/contrib/terminal/common/terminalService.ts
src/vs/workbench/contrib/terminal/common/terminalService.ts
+7
-2
src/vs/workbench/contrib/terminal/electron-browser/terminalProcessManager.ts
...ntrib/terminal/electron-browser/terminalProcessManager.ts
+3
-1
src/vs/workbench/contrib/terminal/electron-browser/terminalService.ts
...ench/contrib/terminal/electron-browser/terminalService.ts
+2
-11
src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts
...vs/workbench/contrib/terminal/node/terminalEnvironment.ts
+2
-3
src/vs/workbench/contrib/terminal/test/node/terminalEnvironment.test.ts
...ch/contrib/terminal/test/node/terminalEnvironment.test.ts
+11
-12
未找到文件。
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
8afa7773
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
*
as
vscode
from
'
vscode
'
;
import
*
as
vscode
from
'
vscode
'
;
import
*
as
os
from
'
os
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
URI
,
UriComponents
}
from
'
vs/base/common/uri
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
terminalEnvironment
from
'
vs/workbench/contrib/terminal/node/terminalEnvironment
'
;
import
*
as
terminalEnvironment
from
'
vs/workbench/contrib/terminal/node/terminalEnvironment
'
;
...
@@ -429,7 +430,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
...
@@ -429,7 +430,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
// TODO: @daniel
// TODO: @daniel
const
activeWorkspaceRootUri
=
URI
.
revive
(
activeWorkspaceRootUriComponents
);
const
activeWorkspaceRootUri
=
URI
.
revive
(
activeWorkspaceRootUriComponents
);
const
initialCwd
=
terminalEnvironment
.
getCwd
(
shellLaunchConfig
,
activeWorkspaceRootUri
,
terminalConfig
.
cwd
);
const
initialCwd
=
terminalEnvironment
.
getCwd
(
shellLaunchConfig
,
os
.
homedir
(),
activeWorkspaceRootUri
,
terminalConfig
.
cwd
);
// TODO: Pull in and resolve config settings
// TODO: Pull in and resolve config settings
// // Resolve env vars from config and shell
// // Resolve env vars from config and shell
...
...
src/vs/workbench/contrib/terminal/browser/terminalService.ts
0 → 100644
浏览文件 @
8afa7773
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
{
ITerminalService
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
TerminalService
as
CommonTerminalService
}
from
'
vs/workbench/contrib/terminal/common/terminalService
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
export
abstract
class
TerminalService
extends
CommonTerminalService
implements
ITerminalService
{
constructor
(
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IPanelService
panelService
:
IPanelService
,
@
IPartService
partService
:
IPartService
,
@
ILifecycleService
lifecycleService
:
ILifecycleService
,
@
IStorageService
storageService
:
IStorageService
)
{
super
(
contextKeyService
,
panelService
,
partService
,
lifecycleService
,
storageService
);
}
}
\ No newline at end of file
src/vs/workbench/contrib/terminal/common/terminalService.ts
浏览文件 @
8afa7773
...
@@ -21,7 +21,9 @@ export abstract class TerminalService implements ITerminalService {
...
@@ -21,7 +21,9 @@ export abstract class TerminalService implements ITerminalService {
protected
_findWidgetVisible
:
IContextKey
<
boolean
>
;
protected
_findWidgetVisible
:
IContextKey
<
boolean
>
;
protected
_terminalContainer
:
HTMLElement
;
protected
_terminalContainer
:
HTMLElement
;
protected
_terminalTabs
:
ITerminalTab
[];
protected
_terminalTabs
:
ITerminalTab
[];
protected
abstract
_terminalInstances
:
ITerminalInstance
[];
protected
get
_terminalInstances
():
ITerminalInstance
[]
{
return
this
.
_terminalTabs
.
reduce
((
p
,
c
)
=>
p
.
concat
(
c
.
terminalInstances
),
<
ITerminalInstance
[]
>
[]);
}
private
_findState
:
FindReplaceState
;
private
_findState
:
FindReplaceState
;
private
_activeTabIndex
:
number
;
private
_activeTabIndex
:
number
;
...
@@ -89,13 +91,16 @@ export abstract class TerminalService implements ITerminalService {
...
@@ -89,13 +91,16 @@ export abstract class TerminalService implements ITerminalService {
protected
abstract
_showTerminalCloseConfirmation
():
Promise
<
boolean
>
;
protected
abstract
_showTerminalCloseConfirmation
():
Promise
<
boolean
>
;
protected
abstract
_showNotEnoughSpaceToast
():
void
;
protected
abstract
_showNotEnoughSpaceToast
():
void
;
public
abstract
createTerminal
(
shell
?:
IShellLaunchConfig
,
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
public
abstract
createTerminal
(
shell
?:
IShellLaunchConfig
,
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
public
abstract
createTerminalRenderer
(
name
:
string
):
ITerminalInstance
;
public
abstract
createInstance
(
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
configHelper
:
ITerminalConfigHelper
,
container
:
HTMLElement
,
shellLaunchConfig
:
IShellLaunchConfig
,
doCreateProcess
:
boolean
):
ITerminalInstance
;
public
abstract
createInstance
(
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
configHelper
:
ITerminalConfigHelper
,
container
:
HTMLElement
,
shellLaunchConfig
:
IShellLaunchConfig
,
doCreateProcess
:
boolean
):
ITerminalInstance
;
public
abstract
getActiveOrCreateInstance
(
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
public
abstract
getActiveOrCreateInstance
(
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
public
abstract
selectDefaultWindowsShell
():
Promise
<
string
>
;
public
abstract
selectDefaultWindowsShell
():
Promise
<
string
>
;
public
abstract
setContainers
(
panelContainer
:
HTMLElement
,
terminalContainer
:
HTMLElement
):
void
;
public
abstract
setContainers
(
panelContainer
:
HTMLElement
,
terminalContainer
:
HTMLElement
):
void
;
public
abstract
requestExtHostProcess
(
proxy
:
ITerminalProcessExtHostProxy
,
shellLaunchConfig
:
IShellLaunchConfig
,
activeWorkspaceRootUri
:
URI
,
cols
:
number
,
rows
:
number
):
void
;
public
abstract
requestExtHostProcess
(
proxy
:
ITerminalProcessExtHostProxy
,
shellLaunchConfig
:
IShellLaunchConfig
,
activeWorkspaceRootUri
:
URI
,
cols
:
number
,
rows
:
number
):
void
;
public
createTerminalRenderer
(
name
:
string
):
ITerminalInstance
{
return
this
.
createTerminal
({
name
,
isRendererOnly
:
true
});
}
private
_onBeforeShutdown
():
boolean
|
Promise
<
boolean
>
{
private
_onBeforeShutdown
():
boolean
|
Promise
<
boolean
>
{
if
(
this
.
terminalInstances
.
length
===
0
)
{
if
(
this
.
terminalInstances
.
length
===
0
)
{
// No terminal instances, don't veto
// No terminal instances, don't veto
...
...
src/vs/workbench/contrib/terminal/electron-browser/terminalProcessManager.ts
浏览文件 @
8afa7773
...
@@ -21,6 +21,7 @@ import { Schemas } from 'vs/base/common/network';
...
@@ -21,6 +21,7 @@ import { Schemas } from 'vs/base/common/network';
import
{
REMOTE_HOST_SCHEME
,
getRemoteAuthority
}
from
'
vs/platform/remote/common/remoteHosts
'
;
import
{
REMOTE_HOST_SCHEME
,
getRemoteAuthority
}
from
'
vs/platform/remote/common/remoteHosts
'
;
import
{
sanitizeProcessEnvironment
}
from
'
vs/base/node/processes
'
;
import
{
sanitizeProcessEnvironment
}
from
'
vs/base/node/processes
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IWorkspaceConfigurationService
}
from
'
vs/workbench/services/configuration/common/configuration
'
;
import
{
IEnvironmentService
}
from
'
vs/platform/environment/common/environment
'
;
/** The amount of time to consider terminal errors to be related to the launch */
/** The amount of time to consider terminal errors to be related to the launch */
const
LAUNCHING_DURATION
=
500
;
const
LAUNCHING_DURATION
=
500
;
...
@@ -61,6 +62,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
...
@@ -61,6 +62,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
@
IConfigurationResolverService
private
readonly
_configurationResolverService
:
IConfigurationResolverService
,
@
IConfigurationResolverService
private
readonly
_configurationResolverService
:
IConfigurationResolverService
,
@
IWindowService
private
readonly
_windowService
:
IWindowService
,
@
IWindowService
private
readonly
_windowService
:
IWindowService
,
@
IWorkspaceConfigurationService
private
readonly
_workspaceConfigurationService
:
IWorkspaceConfigurationService
,
@
IWorkspaceConfigurationService
private
readonly
_workspaceConfigurationService
:
IWorkspaceConfigurationService
,
@
IEnvironmentService
private
readonly
_environmentSertvice
:
IEnvironmentService
)
{
)
{
this
.
ptyProcessReady
=
new
Promise
<
void
>
(
c
=>
{
this
.
ptyProcessReady
=
new
Promise
<
void
>
(
c
=>
{
this
.
onProcessReady
(()
=>
{
this
.
onProcessReady
(()
=>
{
...
@@ -110,7 +112,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
...
@@ -110,7 +112,7 @@ export class TerminalProcessManager implements ITerminalProcessManager {
}
}
const
activeWorkspaceRootUri
=
this
.
_historyService
.
getLastActiveWorkspaceRoot
(
Schemas
.
file
);
const
activeWorkspaceRootUri
=
this
.
_historyService
.
getLastActiveWorkspaceRoot
(
Schemas
.
file
);
const
initialCwd
=
terminalEnvironment
.
getCwd
(
shellLaunchConfig
,
activeWorkspaceRootUri
,
this
.
_configHelper
.
config
.
cwd
);
const
initialCwd
=
terminalEnvironment
.
getCwd
(
shellLaunchConfig
,
this
.
_environmentSertvice
.
userHome
,
activeWorkspaceRootUri
,
this
.
_configHelper
.
config
.
cwd
);
// Compel type system as process.env should not have any undefined entries
// Compel type system as process.env should not have any undefined entries
let
env
:
platform
.
IProcessEnvironment
=
{};
let
env
:
platform
.
IProcessEnvironment
=
{};
...
...
src/vs/workbench/contrib/terminal/electron-browser/terminalService.ts
浏览文件 @
8afa7773
...
@@ -13,7 +13,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
...
@@ -13,7 +13,7 @@ import { IPanelService } from 'vs/workbench/services/panel/common/panelService';
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IPartService
}
from
'
vs/workbench/services/part/common/partService
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
IConfigurationService
,
ConfigurationTarget
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ITerminalInstance
,
ITerminalService
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY
,
TERMINAL_PANEL_ID
,
ITerminalProcessExtHostProxy
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ITerminalInstance
,
ITerminalService
,
IShellLaunchConfig
,
ITerminalConfigHelper
,
NEVER_SUGGEST_SELECT_WINDOWS_SHELL_STORAGE_KEY
,
TERMINAL_PANEL_ID
,
ITerminalProcessExtHostProxy
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
TerminalService
as
AbstractTerminalService
}
from
'
vs/workbench/contrib/terminal/common
/terminalService
'
;
import
{
TerminalService
as
BrowserTerminalService
}
from
'
vs/workbench/contrib/terminal/browser
/terminalService
'
;
import
{
TerminalConfigHelper
}
from
'
vs/workbench/contrib/terminal/electron-browser/terminalConfigHelper
'
;
import
{
TerminalConfigHelper
}
from
'
vs/workbench/contrib/terminal/electron-browser/terminalConfigHelper
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
Severity
from
'
vs/base/common/severity
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
...
@@ -30,15 +30,10 @@ import { URI } from 'vs/base/common/uri';
...
@@ -30,15 +30,10 @@ import { URI } from 'vs/base/common/uri';
import
{
IQuickInputService
,
IQuickPickItem
,
IPickOptions
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
IQuickInputService
,
IQuickPickItem
,
IPickOptions
}
from
'
vs/platform/quickinput/common/quickInput
'
;
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
export
class
TerminalService
extends
Abstract
TerminalService
implements
ITerminalService
{
export
class
TerminalService
extends
Browser
TerminalService
implements
ITerminalService
{
private
_configHelper
:
TerminalConfigHelper
;
private
_configHelper
:
TerminalConfigHelper
;
public
get
configHelper
():
ITerminalConfigHelper
{
return
this
.
_configHelper
;
}
public
get
configHelper
():
ITerminalConfigHelper
{
return
this
.
_configHelper
;
}
protected
_terminalTabs
:
TerminalTab
[];
protected
get
_terminalInstances
():
ITerminalInstance
[]
{
return
this
.
_terminalTabs
.
reduce
((
p
,
c
)
=>
p
.
concat
(
c
.
terminalInstances
),
<
ITerminalInstance
[]
>
[]);
}
constructor
(
constructor
(
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IPanelService
panelService
:
IPanelService
,
@
IPanelService
panelService
:
IPanelService
,
...
@@ -98,10 +93,6 @@ export class TerminalService extends AbstractTerminalService implements ITermina
...
@@ -98,10 +93,6 @@ export class TerminalService extends AbstractTerminalService implements ITermina
return
instance
;
return
instance
;
}
}
public
createTerminalRenderer
(
name
:
string
):
ITerminalInstance
{
return
this
.
createTerminal
({
name
,
isRendererOnly
:
true
});
}
public
createInstance
(
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
configHelper
:
ITerminalConfigHelper
,
container
:
HTMLElement
|
undefined
,
shellLaunchConfig
:
IShellLaunchConfig
,
doCreateProcess
:
boolean
):
ITerminalInstance
{
public
createInstance
(
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
configHelper
:
ITerminalConfigHelper
,
container
:
HTMLElement
|
undefined
,
shellLaunchConfig
:
IShellLaunchConfig
,
doCreateProcess
:
boolean
):
ITerminalInstance
{
const
instance
=
this
.
_instantiationService
.
createInstance
(
TerminalInstance
,
terminalFocusContextKey
,
configHelper
,
container
,
shellLaunchConfig
);
const
instance
=
this
.
_instantiationService
.
createInstance
(
TerminalInstance
,
terminalFocusContextKey
,
configHelper
,
container
,
shellLaunchConfig
);
this
.
_onInstanceCreated
.
fire
(
instance
);
this
.
_onInstanceCreated
.
fire
(
instance
);
...
...
src/vs/workbench/contrib/terminal/node/terminalEnvironment.ts
浏览文件 @
8afa7773
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
*
as
os
from
'
os
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
*
as
path
from
'
vs/base/common/path
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
pkg
from
'
vs/platform/product/node/package
'
;
import
pkg
from
'
vs/platform/product/node/package
'
;
...
@@ -102,7 +101,7 @@ function _getLangEnvVariable(locale?: string) {
...
@@ -102,7 +101,7 @@ function _getLangEnvVariable(locale?: string) {
return
parts
.
join
(
'
_
'
)
+
'
.UTF-8
'
;
return
parts
.
join
(
'
_
'
)
+
'
.UTF-8
'
;
}
}
export
function
getCwd
(
shell
:
IShellLaunchConfig
,
root
?:
Uri
,
customCwd
?:
string
):
string
{
export
function
getCwd
(
shell
:
IShellLaunchConfig
,
userHome
:
string
,
root
?:
Uri
,
customCwd
?:
string
):
string
{
if
(
shell
.
cwd
)
{
if
(
shell
.
cwd
)
{
return
(
typeof
shell
.
cwd
===
'
object
'
)
?
shell
.
cwd
.
fsPath
:
shell
.
cwd
;
return
(
typeof
shell
.
cwd
===
'
object
'
)
?
shell
.
cwd
.
fsPath
:
shell
.
cwd
;
}
}
...
@@ -120,7 +119,7 @@ export function getCwd(shell: IShellLaunchConfig, root?: Uri, customCwd?: string
...
@@ -120,7 +119,7 @@ export function getCwd(shell: IShellLaunchConfig, root?: Uri, customCwd?: string
// If there was no custom cwd or it was relative with no workspace
// If there was no custom cwd or it was relative with no workspace
if
(
!
cwd
)
{
if
(
!
cwd
)
{
cwd
=
root
?
root
.
fsPath
:
os
.
homedir
()
;
cwd
=
root
?
root
.
fsPath
:
userHome
;
}
}
return
_sanitizeCwd
(
cwd
);
return
_sanitizeCwd
(
cwd
);
...
...
src/vs/workbench/contrib/terminal/test/node/terminalEnvironment.test.ts
浏览文件 @
8afa7773
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
*
as
assert
from
'
assert
'
;
import
*
as
os
from
'
os
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
terminalEnvironment
from
'
vs/workbench/contrib/terminal/node/terminalEnvironment
'
;
import
*
as
terminalEnvironment
from
'
vs/workbench/contrib/terminal/node/terminalEnvironment
'
;
import
{
URI
as
Uri
}
from
'
vs/base/common/uri
'
;
import
{
URI
as
Uri
}
from
'
vs/base/common/uri
'
;
...
@@ -101,32 +100,32 @@ suite('Workbench - TerminalEnvironment', () => {
...
@@ -101,32 +100,32 @@ suite('Workbench - TerminalEnvironment', () => {
assert
.
equal
(
Uri
.
file
(
a
).
fsPath
,
Uri
.
file
(
b
).
fsPath
);
assert
.
equal
(
Uri
.
file
(
a
).
fsPath
,
Uri
.
file
(
b
).
fsPath
);
}
}
test
(
'
should default to
os.homedir()
for an empty workspace
'
,
()
=>
{
test
(
'
should default to
userHome
for an empty workspace
'
,
()
=>
{
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
undefined
,
undefined
),
os
.
homedir
()
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
undefined
,
undefined
),
'
/userHome/
'
);
});
});
test
(
'
should use to the workspace if it exists
'
,
()
=>
{
test
(
'
should use to the workspace if it exists
'
,
()
=>
{
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
Uri
.
file
(
'
/foo
'
),
undefined
),
'
/foo
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
Uri
.
file
(
'
/foo
'
),
undefined
),
'
/foo
'
);
});
});
test
(
'
should use an absolute custom cwd as is
'
,
()
=>
{
test
(
'
should use an absolute custom cwd as is
'
,
()
=>
{
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
undefined
,
'
/foo
'
),
'
/foo
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
undefined
,
'
/foo
'
),
'
/foo
'
);
});
});
test
(
'
should normalize a relative custom cwd against the workspace path
'
,
()
=>
{
test
(
'
should normalize a relative custom cwd against the workspace path
'
,
()
=>
{
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
Uri
.
file
(
'
/bar
'
),
'
foo
'
),
'
/bar/foo
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
Uri
.
file
(
'
/bar
'
),
'
foo
'
),
'
/bar/foo
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
Uri
.
file
(
'
/bar
'
),
'
./foo
'
),
'
/bar/foo
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
Uri
.
file
(
'
/bar
'
),
'
./foo
'
),
'
/bar/foo
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
Uri
.
file
(
'
/bar
'
),
'
../foo
'
),
'
/foo
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
Uri
.
file
(
'
/bar
'
),
'
../foo
'
),
'
/foo
'
);
});
});
test
(
'
should fall back for relative a custom cwd that doesn
\'
t have a workspace
'
,
()
=>
{
test
(
'
should fall back for relative a custom cwd that doesn
\'
t have a workspace
'
,
()
=>
{
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
undefined
,
'
foo
'
),
os
.
homedir
()
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
undefined
,
'
foo
'
),
'
/userHome/
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
undefined
,
'
./foo
'
),
os
.
homedir
()
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
undefined
,
'
./foo
'
),
'
/userHome/
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
undefined
,
'
../foo
'
),
os
.
homedir
()
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[]
},
'
/userHome/
'
,
undefined
,
'
../foo
'
),
'
/userHome/
'
);
});
});
test
(
'
should ignore custom cwd when told to ignore
'
,
()
=>
{
test
(
'
should ignore custom cwd when told to ignore
'
,
()
=>
{
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[],
ignoreConfigurationCwd
:
true
},
Uri
.
file
(
'
/bar
'
),
'
/foo
'
),
'
/bar
'
);
assertPathsMatch
(
terminalEnvironment
.
getCwd
({
executable
:
undefined
,
args
:
[],
ignoreConfigurationCwd
:
true
},
'
/userHome/
'
,
Uri
.
file
(
'
/bar
'
),
'
/foo
'
),
'
/bar
'
);
});
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录