Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
331da82a
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,发现更多精彩内容 >>
提交
331da82a
编写于
6月 18, 2019
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable shell selector outside Windows
Fixes #75718
上级
b3bba0c9
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
30 addition
and
27 deletion
+30
-27
src/vs/workbench/api/browser/mainThreadTerminalService.ts
src/vs/workbench/api/browser/mainThreadTerminalService.ts
+3
-3
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+3
-6
src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts
...rkbench/contrib/terminal/browser/terminal.contribution.ts
+0
-3
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
+3
-8
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+1
-1
src/vs/workbench/contrib/terminal/common/terminalService.ts
src/vs/workbench/contrib/terminal/common/terminalService.ts
+3
-3
src/vs/workbench/contrib/terminal/node/terminal.ts
src/vs/workbench/contrib/terminal/node/terminal.ts
+16
-2
未找到文件。
src/vs/workbench/api/browser/mainThreadTerminalService.ts
浏览文件 @
331da82a
...
...
@@ -42,7 +42,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_toDispose
.
push
(
_terminalService
.
onActiveInstanceChanged
(
instance
=>
this
.
_onActiveTerminalChanged
(
instance
?
instance
.
id
:
null
)));
this
.
_toDispose
.
push
(
_terminalService
.
onInstanceTitleChanged
(
instance
=>
this
.
_onTitleChanged
(
instance
.
id
,
instance
.
title
)));
this
.
_toDispose
.
push
(
_terminalService
.
configHelper
.
onWorkspacePermissionsChanged
(
isAllowed
=>
this
.
_onWorkspacePermissionsChanged
(
isAllowed
)));
this
.
_toDispose
.
push
(
_terminalService
.
onRequest
WindowsShells
(
r
=>
this
.
_onRequestDetectWindowsShell
(
r
)));
this
.
_toDispose
.
push
(
_terminalService
.
onRequest
AvailableShells
(
r
=>
this
.
_onRequestAvailableShells
(
r
)));
// Set initial ext host state
this
.
_terminalService
.
terminalInstances
.
forEach
(
t
=>
{
...
...
@@ -277,7 +277,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
this
.
_terminalProcesses
[
terminalId
].
emitLatency
(
sum
/
COUNT
);
}
private
_onRequest
DetectWindowsShell
(
resolve
:
(
shells
:
IShellDefinition
[])
=>
void
):
void
{
this
.
_proxy
.
$request
Windows
Shells
().
then
(
shells
=>
resolve
(
shells
));
private
_onRequest
AvailableShells
(
resolve
:
(
shells
:
IShellDefinition
[])
=>
void
):
void
{
this
.
_proxy
.
$request
Available
Shells
().
then
(
shells
=>
resolve
(
shells
));
}
}
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
331da82a
...
...
@@ -1128,7 +1128,7 @@ export interface ExtHostTerminalServiceShape {
$acceptProcessRequestCwd
(
id
:
number
):
void
;
$acceptProcessRequestLatency
(
id
:
number
):
number
;
$acceptWorkspacePermissionsChanged
(
isAllowed
:
boolean
):
void
;
$request
Windows
Shells
():
Promise
<
IShellDefinitionDto
[]
>
;
$request
Available
Shells
():
Promise
<
IShellDefinitionDto
[]
>
;
}
export
interface
ExtHostSCMShape
{
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
331da82a
...
...
@@ -20,7 +20,7 @@ import { ExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
import
{
IWorkspaceFolder
}
from
'
vs/platform/workspace/common/workspace
'
;
import
{
ExtHostVariableResolverService
}
from
'
vs/workbench/api/node/extHostDebugService
'
;
import
{
ExtHostDocumentsAndEditors
}
from
'
vs/workbench/api/common/extHostDocumentsAndEditors
'
;
import
{
getDefaultShell
,
detect
Windows
Shells
}
from
'
vs/workbench/contrib/terminal/node/terminal
'
;
import
{
getDefaultShell
,
detect
Available
Shells
}
from
'
vs/workbench/contrib/terminal/node/terminal
'
;
const
RENDERER_NO_PROCESS_ID
=
-
1
;
...
...
@@ -575,11 +575,8 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
return
id
;
}
public
$requestWindowsShells
():
Promise
<
IShellDefinitionDto
[]
>
{
if
(
!
platform
.
isWindows
)
{
throw
new
Error
(
'
Can only detect Windows shells on Windows
'
);
}
return
detectWindowsShells
();
public
$requestAvailableShells
():
Promise
<
IShellDefinitionDto
[]
>
{
return
detectAvailableShells
();
}
private
_onProcessExit
(
id
:
number
,
exitCode
:
number
):
void
{
...
...
src/vs/workbench/contrib/terminal/browser/terminal.contribution.ts
浏览文件 @
331da82a
...
...
@@ -370,10 +370,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ClearTerminalAct
primary
:
0
,
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_K
}
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KeybindingWeight
.
WorkbenchContrib
+
1
),
'
Terminal: Clear
'
,
category
);
// TODO: This should be the remote OS
// if (platform.isWindows) {
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
SelectDefaultShellWindowsTerminalAction
,
SelectDefaultShellWindowsTerminalAction
.
ID
,
SelectDefaultShellWindowsTerminalAction
.
LABEL
),
'
Terminal: Select Default Shell
'
,
category
);
// }
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
AllowWorkspaceShellTerminalCommand
,
AllowWorkspaceShellTerminalCommand
.
ID
,
AllowWorkspaceShellTerminalCommand
.
LABEL
),
'
Terminal: Allow Workspace Shell Configuration
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
DisallowWorkspaceShellTerminalCommand
,
DisallowWorkspaceShellTerminalCommand
.
ID
,
DisallowWorkspaceShellTerminalCommand
.
LABEL
),
'
Terminal: Disallow Workspace Shell Configuration
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
RenameTerminalAction
,
RenameTerminalAction
.
ID
,
RenameTerminalAction
.
LABEL
),
'
Terminal: Rename
'
,
category
);
...
...
src/vs/workbench/contrib/terminal/browser/terminalActions.ts
浏览文件 @
331da82a
...
...
@@ -35,7 +35,6 @@ import { Schemas } from 'vs/base/common/network';
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
isWindows
}
from
'
vs/base/common/platform
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
export
const
TERMINAL_PICKER_PREFIX
=
'
term
'
;
...
...
@@ -743,8 +742,7 @@ export class SwitchTerminalActionViewItem extends SelectActionViewItem {
action
:
IAction
,
@
ITerminalService
private
readonly
terminalService
:
ITerminalService
,
@
IThemeService
themeService
:
IThemeService
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IWorkbenchEnvironmentService
private
workbenchEnvironmentService
:
IWorkbenchEnvironmentService
@
IContextViewService
contextViewService
:
IContextViewService
)
{
super
(
null
,
action
,
terminalService
.
getTabLabels
().
map
(
label
=>
<
ISelectOptionItem
>
{
text
:
label
}),
terminalService
.
activeTabIndex
,
contextViewService
,
{
ariaLabel
:
nls
.
localize
(
'
terminals
'
,
'
Open Terminals.
'
)
});
...
...
@@ -756,11 +754,8 @@ export class SwitchTerminalActionViewItem extends SelectActionViewItem {
private
_updateItems
():
void
{
const
items
=
this
.
terminalService
.
getTabLabels
().
map
(
label
=>
<
ISelectOptionItem
>
{
text
:
label
});
let
enableSelectDefaultShell
=
this
.
workbenchEnvironmentService
.
configuration
.
remoteAuthority
?
false
:
isWindows
;
if
(
enableSelectDefaultShell
)
{
items
.
push
({
text
:
SwitchTerminalActionViewItem
.
SEPARATOR
});
items
.
push
({
text
:
SelectDefaultShellWindowsTerminalAction
.
LABEL
});
}
this
.
setOptions
(
items
,
this
.
terminalService
.
activeTabIndex
);
}
}
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
331da82a
...
...
@@ -222,7 +222,7 @@ export interface ITerminalService {
onInstancesChanged
:
Event
<
void
>
;
onInstanceTitleChanged
:
Event
<
ITerminalInstance
>
;
onActiveInstanceChanged
:
Event
<
ITerminalInstance
|
undefined
>
;
onRequest
Windows
Shells
:
Event
<
(
shells
:
IShellDefinition
[])
=>
void
>
;
onRequest
Available
Shells
:
Event
<
(
shells
:
IShellDefinition
[])
=>
void
>
;
/**
* Creates a terminal.
...
...
src/vs/workbench/contrib/terminal/common/terminalService.ts
浏览文件 @
331da82a
...
...
@@ -65,8 +65,8 @@ export abstract class TerminalService implements ITerminalService {
public
get
onActiveInstanceChanged
():
Event
<
ITerminalInstance
|
undefined
>
{
return
this
.
_onActiveInstanceChanged
.
event
;
}
protected
readonly
_onTabDisposed
=
new
Emitter
<
ITerminalTab
>
();
public
get
onTabDisposed
():
Event
<
ITerminalTab
>
{
return
this
.
_onTabDisposed
.
event
;
}
protected
readonly
_onRequest
Windows
Shells
=
new
Emitter
<
(
shells
:
IShellDefinition
[])
=>
void
>
();
public
get
onRequest
WindowsShells
():
Event
<
(
shells
:
IShellDefinition
[])
=>
void
>
{
return
this
.
_onRequestWindows
Shells
.
event
;
}
protected
readonly
_onRequest
Available
Shells
=
new
Emitter
<
(
shells
:
IShellDefinition
[])
=>
void
>
();
public
get
onRequest
AvailableShells
():
Event
<
(
shells
:
IShellDefinition
[])
=>
void
>
{
return
this
.
_onRequestAvailable
Shells
.
event
;
}
public
abstract
get
configHelper
():
ITerminalConfigHelper
;
...
...
@@ -553,6 +553,6 @@ export abstract class TerminalService implements ITerminalService {
}
private
_detectWindowsShells
():
Promise
<
IShellDefinition
[]
>
{
return
new
Promise
(
r
=>
this
.
_onRequest
Windows
Shells
.
fire
(
r
));
return
new
Promise
(
r
=>
this
.
_onRequest
Available
Shells
.
fire
(
r
));
}
}
src/vs/workbench/contrib/terminal/node/terminal.ts
浏览文件 @
331da82a
...
...
@@ -9,7 +9,7 @@ import * as processes from 'vs/base/node/processes';
import
{
readFile
,
fileExists
,
stat
}
from
'
vs/base/node/pfs
'
;
import
{
LinuxDistro
,
IShellDefinition
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
coalesce
}
from
'
vs/base/common/arrays
'
;
import
{
normalize
}
from
'
vs/base/common/path
'
;
import
{
normalize
,
basename
}
from
'
vs/base/common/path
'
;
export
function
getDefaultShell
(
p
:
platform
.
Platform
):
string
{
if
(
p
===
platform
.
Platform
.
Windows
)
{
...
...
@@ -85,7 +85,11 @@ export function getWindowsBuildNumber(): number {
return
buildNumber
;
}
export
async
function
detectWindowsShells
():
Promise
<
IShellDefinition
[]
>
{
export
function
detectAvailableShells
():
Promise
<
IShellDefinition
[]
>
{
return
platform
.
isWindows
?
detectAvailableWindowsShells
()
:
detectAvailableUnixShells
();
}
async
function
detectAvailableWindowsShells
():
Promise
<
IShellDefinition
[]
>
{
// Determine the correct System32 path. We want to point to Sysnative
// when the 32-bit version of VS Code is running on a 64-bit machine.
// The reason for this is because PowerShell's important PSReadline
...
...
@@ -118,6 +122,16 @@ export async function detectWindowsShells(): Promise<IShellDefinition[]> {
return
Promise
.
all
(
promises
).
then
(
coalesce
);
}
async
function
detectAvailableUnixShells
():
Promise
<
IShellDefinition
[]
>
{
const
contents
=
await
readFile
(
'
/etc/shells
'
,
'
utf8
'
);
const
shells
=
contents
.
split
(
'
\n
'
).
filter
(
e
=>
e
.
trim
().
indexOf
(
'
#
'
)
!==
0
&&
e
.
trim
().
length
>
0
);
return
shells
.
map
(
e
=>
{
return
{
label
:
basename
(
e
),
path
:
e
};
});
}
function
validateShellPaths
(
label
:
string
,
potentialPaths
:
string
[]):
Promise
<
IShellDefinition
|
undefined
>
{
if
(
potentialPaths
.
length
===
0
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录