Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
321cb28e
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,发现更多精彩内容 >>
提交
321cb28e
编写于
4月 16, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove terminalTab dependency on electron-browser
上级
a6f0ec30
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
34 addition
and
22 deletion
+34
-22
src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
...rkbench/api/electron-browser/mainThreadTerminalService.ts
+1
-1
src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts
...workbench/parts/debug/electron-browser/terminalSupport.ts
+1
-1
src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts
...arts/execution/electron-browser/execution.contribution.ts
+1
-1
src/vs/workbench/parts/tasks/electron-browser/terminalTaskSystem.ts
...kbench/parts/tasks/electron-browser/terminalTaskSystem.ts
+1
-1
src/vs/workbench/parts/terminal/common/terminal.ts
src/vs/workbench/parts/terminal/common/terminal.ts
+11
-1
src/vs/workbench/parts/terminal/common/terminalService.ts
src/vs/workbench/parts/terminal/common/terminalService.ts
+3
-2
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+4
-4
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
...orkbench/parts/terminal/electron-browser/terminalPanel.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+9
-4
src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts
.../workbench/parts/terminal/electron-browser/terminalTab.ts
+2
-6
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
浏览文件 @
321cb28e
...
...
@@ -55,7 +55,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
ignoreConfigurationCwd
:
true
,
env
};
return
TPromise
.
as
(
this
.
terminalService
.
create
Instance
(
shellLaunchConfig
).
id
);
return
TPromise
.
as
(
this
.
terminalService
.
create
Terminal
(
shellLaunchConfig
).
id
);
}
public
$show
(
terminalId
:
number
,
preserveFocus
:
boolean
):
void
{
...
...
src/vs/workbench/parts/debug/electron-browser/terminalSupport.ts
浏览文件 @
321cb28e
...
...
@@ -42,7 +42,7 @@ export class TerminalLauncher implements ITerminalLauncher {
let
t
=
this
.
integratedTerminalInstance
;
if
((
t
&&
this
.
isBusy
(
t
))
||
!
t
)
{
t
=
this
.
terminalService
.
create
Instance
({
name
:
args
.
title
||
nls
.
localize
(
'
debug.terminal.title
'
,
"
debuggee
"
)
});
t
=
this
.
terminalService
.
create
Terminal
({
name
:
args
.
title
||
nls
.
localize
(
'
debug.terminal.title
'
,
"
debuggee
"
)
});
this
.
integratedTerminalInstance
=
t
;
}
this
.
terminalService
.
setActiveInstance
(
t
);
...
...
src/vs/workbench/parts/execution/electron-browser/execution.contribution.ts
浏览文件 @
321cb28e
...
...
@@ -91,7 +91,7 @@ CommandsRegistry.registerCommand({
const
directoriesToOpen
=
distinct
(
stats
.
map
(({
stat
})
=>
stat
.
isDirectory
?
stat
.
resource
.
fsPath
:
paths
.
dirname
(
stat
.
resource
.
fsPath
)));
return
directoriesToOpen
.
map
(
dir
=>
{
if
(
configurationService
.
getValue
<
ITerminalConfiguration
>
().
terminal
.
explorerKind
===
'
integrated
'
)
{
const
instance
=
integratedTerminalService
.
create
Instance
({
cwd
:
dir
},
true
);
const
instance
=
integratedTerminalService
.
create
Terminal
({
cwd
:
dir
},
true
);
if
(
instance
&&
(
resources
.
length
===
1
||
!
resource
||
dir
===
resource
.
fsPath
||
dir
===
paths
.
dirname
(
resource
.
fsPath
)))
{
integratedTerminalService
.
setActiveInstance
(
instance
);
integratedTerminalService
.
showPanel
(
true
);
...
...
src/vs/workbench/parts/tasks/electron-browser/terminalTaskSystem.ts
浏览文件 @
321cb28e
...
...
@@ -571,7 +571,7 @@ export class TerminalTaskSystem implements ITaskSystem {
return
[
terminalToReuse
.
terminal
,
commandExecutable
];
}
const
result
=
this
.
terminalService
.
create
Instance
(
shellLaunchConfig
);
const
result
=
this
.
terminalService
.
create
Terminal
(
shellLaunchConfig
);
const
terminalKey
=
result
.
id
.
toString
();
result
.
onDisposed
((
terminal
)
=>
{
let
terminalData
=
this
.
terminals
[
terminalKey
];
...
...
src/vs/workbench/parts/terminal/common/terminal.ts
浏览文件 @
321cb28e
...
...
@@ -156,7 +156,17 @@ export interface ITerminalService {
terminalInstances
:
ITerminalInstance
[];
terminalTabs
:
ITerminalTab
[];
createInstance
(
shell
?:
IShellLaunchConfig
,
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
/**
* Creates a terminal.
* @param shell The shell launch configuration to use.
* @param wasNewTerminalAction Whether this was triggered by a new terminal action, if so a
* default shell selection dialog may display.
*/
createTerminal
(
shell
?:
IShellLaunchConfig
,
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
/**
* Creates a raw terminal instance, this should not be used outside of the terminal part.
*/
createInstance
(
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
configHelper
:
ITerminalConfigHelper
,
container
:
HTMLElement
,
shellLaunchConfig
:
IShellLaunchConfig
,
doCreateProcess
:
boolean
):
ITerminalInstance
;
getInstanceFromId
(
terminalId
:
number
):
ITerminalInstance
;
getInstanceFromIndex
(
terminalIndex
:
number
):
ITerminalInstance
;
getTabLabels
():
string
[];
...
...
src/vs/workbench/parts/terminal/common/terminalService.ts
浏览文件 @
321cb28e
...
...
@@ -75,7 +75,8 @@ export abstract class TerminalService implements ITerminalService {
}
protected
abstract
_showTerminalCloseConfirmation
():
TPromise
<
boolean
>
;
public
abstract
createInstance
(
shell
?:
IShellLaunchConfig
,
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
;
public
abstract
createTerminal
(
shell
?:
IShellLaunchConfig
,
wasNewTerminalAction
?:
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
selectDefaultWindowsShell
():
TPromise
<
string
>
;
public
abstract
setContainers
(
panelContainer
:
HTMLElement
,
terminalContainer
:
HTMLElement
):
void
;
...
...
@@ -96,7 +97,7 @@ export abstract class TerminalService implements ITerminalService {
}
tabConfigs
.
forEach
(
tabConfig
=>
{
const
instance
=
this
.
create
Instance
(
tabConfig
.
instances
[
0
]);
const
instance
=
this
.
create
Terminal
(
tabConfig
.
instances
[
0
]);
for
(
let
i
=
1
;
i
<
tabConfig
.
instances
.
length
;
i
++
)
{
this
.
splitInstance
(
instance
,
tabConfig
.
instances
[
i
]);
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
321cb28e
...
...
@@ -46,7 +46,7 @@ export class ToggleTerminalAction extends TogglePanelAction {
if
(
this
.
terminalService
.
terminalInstances
.
length
===
0
)
{
// If there is not yet an instance attempt to create it here so that we can suggest a
// new shell on Windows (and not do so when the panel is restored on reload).
const
newTerminalInstance
=
this
.
terminalService
.
create
Instance
(
undefined
,
true
);
const
newTerminalInstance
=
this
.
terminalService
.
create
Terminal
(
undefined
,
true
);
const
toDispose
=
newTerminalInstance
.
onProcessIdReady
(()
=>
{
newTerminalInstance
.
focus
();
toDispose
.
dispose
();
...
...
@@ -258,7 +258,7 @@ export class CreateNewTerminalAction extends Action {
if
(
folders
.
length
<=
1
)
{
// Allow terminal service to handle the path when there is only a
// single root
instancePromise
=
TPromise
.
as
(
this
.
terminalService
.
create
Instance
(
undefined
,
true
));
instancePromise
=
TPromise
.
as
(
this
.
terminalService
.
create
Terminal
(
undefined
,
true
));
}
else
{
const
options
:
IPickOptions
=
{
placeHolder
:
nls
.
localize
(
'
workbench.action.terminal.newWorkspacePlaceholder
'
,
"
Select current working directory for new terminal
"
)
...
...
@@ -268,7 +268,7 @@ export class CreateNewTerminalAction extends Action {
// Don't create the instance if the workspace picker was canceled
return
null
;
}
return
this
.
terminalService
.
create
Instance
({
cwd
:
workspace
.
uri
.
fsPath
},
true
);
return
this
.
terminalService
.
create
Terminal
({
cwd
:
workspace
.
uri
.
fsPath
},
true
);
});
}
...
...
@@ -295,7 +295,7 @@ export class CreateNewInActiveWorkspaceTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
const
instance
=
this
.
terminalService
.
create
Instance
(
undefined
,
true
);
const
instance
=
this
.
terminalService
.
create
Terminal
(
undefined
,
true
);
if
(
!
instance
)
{
return
TPromise
.
as
(
void
0
);
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
浏览文件 @
321cb28e
...
...
@@ -111,7 +111,7 @@ export class TerminalPanel extends Panel {
return
;
}
const
instance
=
this
.
_terminalService
.
create
Instance
();
const
instance
=
this
.
_terminalService
.
create
Terminal
();
if
(
instance
)
{
this
.
_updateFont
();
this
.
_updateTheme
();
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
321cb28e
...
...
@@ -6,7 +6,7 @@
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
pfs
from
'
vs/base/node/pfs
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
ILifecycleService
}
from
'
vs/platform/lifecycle/common/lifecycle
'
;
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
...
...
@@ -26,6 +26,7 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
ipcRenderer
as
ipc
}
from
'
electron
'
;
import
{
IOpenFileRequest
}
from
'
vs/platform/windows/common/windows
'
;
import
{
TerminalInstance
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalInstance
'
;
export
class
TerminalService
extends
AbstractTerminalService
implements
ITerminalService
{
private
_configHelper
:
TerminalConfigHelper
;
...
...
@@ -67,7 +68,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
});
}
public
create
Instance
(
shell
:
IShellLaunchConfig
=
{},
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
{
public
create
Terminal
(
shell
:
IShellLaunchConfig
=
{},
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
{
const
terminalTab
=
this
.
_instantiationService
.
createInstance
(
TerminalTab
,
this
.
_terminalFocusContextKey
,
this
.
_configHelper
,
...
...
@@ -88,6 +89,10 @@ export class TerminalService extends AbstractTerminalService implements ITermina
return
instance
;
}
public
createInstance
(
terminalFocusContextKey
:
IContextKey
<
boolean
>
,
configHelper
:
ITerminalConfigHelper
,
container
:
HTMLElement
,
shellLaunchConfig
:
IShellLaunchConfig
,
doCreateProcess
:
boolean
):
ITerminalInstance
{
return
this
.
_instantiationService
.
createInstance
(
TerminalInstance
,
terminalFocusContextKey
,
configHelper
,
undefined
,
shellLaunchConfig
,
true
);
}
public
focusFindWidget
():
TPromise
<
void
>
{
return
this
.
showPanel
(
false
).
then
(()
=>
{
let
panel
=
this
.
_panelService
.
getActivePanel
()
as
TerminalPanel
;
...
...
@@ -154,7 +159,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
return
TPromise
.
as
(
null
);
}
// Launch a new instance with the newly selected shell
const
instance
=
this
.
create
Instance
({
const
instance
=
this
.
create
Terminal
({
executable
:
shell
,
args
:
this
.
_configHelper
.
config
.
shellArgs
.
windows
});
...
...
@@ -234,7 +239,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
public
getActiveOrCreateInstance
(
wasNewTerminalAction
?:
boolean
):
ITerminalInstance
{
const
activeInstance
=
this
.
getActiveInstance
();
return
activeInstance
?
activeInstance
:
this
.
create
Instance
(
undefined
,
wasNewTerminalAction
);
return
activeInstance
?
activeInstance
:
this
.
create
Terminal
(
undefined
,
wasNewTerminalAction
);
}
protected
_showTerminalCloseConfirmation
():
TPromise
<
boolean
>
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalTab.ts
浏览文件 @
321cb28e
...
...
@@ -4,10 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
{
ITerminalInstance
,
IShellLaunchConfig
,
ITerminalTab
,
Direction
,
ITerminalService
,
ITerminalConfigHelper
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
// TODO: Let service create instance, and move to browser layer
import
{
TerminalInstance
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalInstance
'
;
import
{
Event
,
Emitter
,
anyEvent
}
from
'
vs/base/common/event
'
;
import
{
IDisposable
,
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
SplitView
,
Orientation
,
IView
}
from
'
vs/base/browser/ui/splitview/splitview
'
;
...
...
@@ -258,7 +255,6 @@ export class TerminalTab extends Disposable implements ITerminalTab {
configHelper
:
ITerminalConfigHelper
,
private
_container
:
HTMLElement
,
shellLaunchConfig
:
IShellLaunchConfig
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
ITerminalService
private
readonly
_terminalService
:
ITerminalService
,
@
IPartService
private
readonly
_partService
:
IPartService
)
{
...
...
@@ -266,7 +262,7 @@ export class TerminalTab extends Disposable implements ITerminalTab {
this
.
_onDisposed
=
new
Emitter
<
ITerminalTab
>
();
this
.
_onInstancesChanged
=
new
Emitter
<
void
>
();
const
instance
=
this
.
_
instantiationService
.
createInstance
(
TerminalInstance
,
const
instance
=
this
.
_
terminalService
.
createInstance
(
terminalFocusContextKey
,
configHelper
,
undefined
,
...
...
@@ -396,7 +392,7 @@ export class TerminalTab extends Disposable implements ITerminalTab {
configHelper
:
ITerminalConfigHelper
,
shellLaunchConfig
:
IShellLaunchConfig
):
ITerminalInstance
{
const
instance
=
this
.
_
instantiationService
.
createInstance
(
TerminalInstance
,
const
instance
=
this
.
_
terminalService
.
createInstance
(
terminalFocusContextKey
,
configHelper
,
undefined
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录