Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
a020b859
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,发现更多精彩内容 >>
提交
a020b859
编写于
9月 10, 2016
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/master' into tyriar/11275_terminal_refactor
上级
f26b1d08
c0c4029d
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
30 addition
and
18 deletion
+30
-18
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+2
-1
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+2
-2
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+1
-1
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+6
-4
src/vs/workbench/api/node/mainThreadTerminalService.ts
src/vs/workbench/api/node/mainThreadTerminalService.ts
+2
-2
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+6
-3
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+9
-3
src/vs/workbench/parts/terminal/test/terminalService.test.ts
src/vs/workbench/parts/terminal/test/terminalService.test.ts
+1
-1
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
a020b859
...
@@ -3497,9 +3497,10 @@ declare namespace vscode {
...
@@ -3497,9 +3497,10 @@ declare namespace vscode {
* [Terminal.show](#Terminal.show) in order to show the terminal panel.
* [Terminal.show](#Terminal.show) in order to show the terminal panel.
*
*
* @param name Optional human-readable string which will be used to represent the terminal in the UI.
* @param name Optional human-readable string which will be used to represent the terminal in the UI.
* @param shellPath Optional path to a custom shell executable to be used in the terminal.
* @return A new Terminal.
* @return A new Terminal.
*/
*/
export
function
createTerminal
(
name
?:
string
):
Terminal
;
export
function
createTerminal
(
name
?:
string
,
shellPath
?:
string
):
Terminal
;
}
}
/**
/**
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
a020b859
...
@@ -260,8 +260,8 @@ export class ExtHostAPIImplementation {
...
@@ -260,8 +260,8 @@ export class ExtHostAPIImplementation {
createOutputChannel
(
name
:
string
):
vscode
.
OutputChannel
{
createOutputChannel
(
name
:
string
):
vscode
.
OutputChannel
{
return
extHostOutputService
.
createOutputChannel
(
name
);
return
extHostOutputService
.
createOutputChannel
(
name
);
},
},
createTerminal
(
name
?:
string
):
vscode
.
Terminal
{
createTerminal
(
name
?:
string
,
shellPath
?:
string
):
vscode
.
Terminal
{
return
extHostTerminalService
.
createTerminal
(
name
);
return
extHostTerminalService
.
createTerminal
(
name
,
shellPath
);
}
}
};
};
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
a020b859
...
@@ -153,7 +153,7 @@ export abstract class MainThreadOutputServiceShape {
...
@@ -153,7 +153,7 @@ export abstract class MainThreadOutputServiceShape {
}
}
export
abstract
class
MainThreadTerminalServiceShape
{
export
abstract
class
MainThreadTerminalServiceShape
{
$createTerminal
(
name
?:
string
):
number
{
throw
ni
();
}
$createTerminal
(
name
?:
string
,
shellPath
?:
string
):
number
{
throw
ni
();
}
$dispose
(
terminalId
:
number
):
void
{
throw
ni
();
}
$dispose
(
terminalId
:
number
):
void
{
throw
ni
();
}
$hide
(
terminalId
:
number
):
void
{
throw
ni
();
}
$hide
(
terminalId
:
number
):
void
{
throw
ni
();
}
$sendText
(
terminalId
:
number
,
text
:
string
,
addNewLine
:
boolean
):
void
{
throw
ni
();
}
$sendText
(
terminalId
:
number
,
text
:
string
,
addNewLine
:
boolean
):
void
{
throw
ni
();
}
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
a020b859
...
@@ -11,15 +11,17 @@ import {MainContext, MainThreadTerminalServiceShape} from './extHost.protocol';
...
@@ -11,15 +11,17 @@ import {MainContext, MainThreadTerminalServiceShape} from './extHost.protocol';
export
class
ExtHostTerminal
implements
vscode
.
Terminal
{
export
class
ExtHostTerminal
implements
vscode
.
Terminal
{
public
_name
:
string
;
public
_name
:
string
;
public
_shellPath
:
string
;
private
_id
:
number
;
private
_id
:
number
;
private
_proxy
:
MainThreadTerminalServiceShape
;
private
_proxy
:
MainThreadTerminalServiceShape
;
private
_disposed
:
boolean
;
private
_disposed
:
boolean
;
constructor
(
proxy
:
MainThreadTerminalServiceShape
,
id
:
number
,
name
?:
string
)
{
constructor
(
proxy
:
MainThreadTerminalServiceShape
,
id
:
number
,
name
?:
string
,
shellPath
?:
string
)
{
this
.
_name
=
name
;
this
.
_name
=
name
;
this
.
_shellPath
=
shellPath
;
this
.
_proxy
=
proxy
;
this
.
_proxy
=
proxy
;
this
.
_id
=
this
.
_proxy
.
$createTerminal
(
name
);
this
.
_id
=
this
.
_proxy
.
$createTerminal
(
name
,
shellPath
);
}
}
public
get
name
():
string
{
public
get
name
():
string
{
...
@@ -64,7 +66,7 @@ export class ExtHostTerminalService {
...
@@ -64,7 +66,7 @@ export class ExtHostTerminalService {
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadTerminalService
);
this
.
_proxy
=
threadService
.
get
(
MainContext
.
MainThreadTerminalService
);
}
}
public
createTerminal
(
name
?:
string
):
vscode
.
Terminal
{
public
createTerminal
(
name
?:
string
,
shellPath
?:
string
):
vscode
.
Terminal
{
return
new
ExtHostTerminal
(
this
.
_proxy
,
-
1
,
name
);
return
new
ExtHostTerminal
(
this
.
_proxy
,
-
1
,
name
,
shellPath
);
}
}
}
}
src/vs/workbench/api/node/mainThreadTerminalService.ts
浏览文件 @
a020b859
...
@@ -19,8 +19,8 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
...
@@ -19,8 +19,8 @@ export class MainThreadTerminalService extends MainThreadTerminalServiceShape {
super
();
super
();
}
}
public
$createTerminal
(
name
?:
string
):
number
{
public
$createTerminal
(
name
?:
string
,
shellPath
?:
string
):
number
{
return
this
.
terminalService
.
createInstance
(
name
).
id
;
return
this
.
terminalService
.
createInstance
(
name
,
shellPath
).
id
;
}
}
public
$show
(
terminalId
:
number
,
preserveFocus
:
boolean
):
void
{
public
$show
(
terminalId
:
number
,
preserveFocus
:
boolean
):
void
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
浏览文件 @
a020b859
...
@@ -103,7 +103,7 @@ export interface ITerminalService {
...
@@ -103,7 +103,7 @@ export interface ITerminalService {
configHelper
:
TerminalConfigHelper
;
configHelper
:
TerminalConfigHelper
;
terminalInstances
:
ITerminalInstance
[];
terminalInstances
:
ITerminalInstance
[];
createInstance
(
name
?:
string
):
ITerminalInstance
;
createInstance
(
name
?:
string
,
shellPath
?:
string
):
ITerminalInstance
;
getInstanceFromId
(
terminalId
:
number
):
ITerminalInstance
;
getInstanceFromId
(
terminalId
:
number
):
ITerminalInstance
;
getActiveInstance
():
ITerminalInstance
;
getActiveInstance
():
ITerminalInstance
;
setActiveInstance
(
terminalInstance
:
ITerminalInstance
):
void
;
setActiveInstance
(
terminalInstance
:
ITerminalInstance
):
void
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
a020b859
...
@@ -48,13 +48,15 @@ export class TerminalInstance implements ITerminalInstance {
...
@@ -48,13 +48,15 @@ export class TerminalInstance implements ITerminalInstance {
private
onExitCallback
:
(
TerminalInstance
)
=>
void
,
private
onExitCallback
:
(
TerminalInstance
)
=>
void
,
private
configHelper
:
TerminalConfigHelper
,
private
configHelper
:
TerminalConfigHelper
,
private
container
:
HTMLElement
,
private
container
:
HTMLElement
,
name
:
string
,
shellPath
:
string
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
IKeybindingService
private
keybindingService
:
IKeybindingService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
ITerminalService
private
terminalService
:
ITerminalService
,
@
ITerminalService
private
terminalService
:
ITerminalService
,
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
@
IWorkspaceContextService
private
contextService
:
IWorkspaceContextService
)
{
)
{
this
.
_id
=
TerminalInstance
.
ID_COUNTER
++
;
this
.
_id
=
TerminalInstance
.
ID_COUNTER
++
;
this
.
createProcess
();
this
.
createProcess
(
name
,
shellPath
);
if
(
container
)
{
if
(
container
)
{
console
.
log
(
'
attach to element
'
,
container
);
console
.
log
(
'
attach to element
'
,
container
);
...
@@ -149,9 +151,10 @@ export class TerminalInstance implements ITerminalInstance {
...
@@ -149,9 +151,10 @@ export class TerminalInstance implements ITerminalInstance {
return
typeof
data
===
'
string
'
?
data
.
replace
(
TerminalInstance
.
EOL_REGEX
,
os
.
EOL
)
:
data
;
return
typeof
data
===
'
string
'
?
data
.
replace
(
TerminalInstance
.
EOL_REGEX
,
os
.
EOL
)
:
data
;
}
}
private
createProcess
(
name
?:
string
)
{
private
createProcess
(
name
?:
string
,
shellPath
?:
string
)
{
let
locale
=
this
.
configHelper
.
isSetLocaleVariables
()
?
platform
.
locale
:
undefined
;
let
locale
=
this
.
configHelper
.
isSetLocaleVariables
()
?
platform
.
locale
:
undefined
;
let
env
=
this
.
createTerminalEnv
(
process
.
env
,
this
.
configHelper
.
getShell
(),
this
.
contextService
.
getWorkspace
(),
locale
);
let
shell
=
shellPath
?
{
executable
:
shellPath
,
args
:
[]
}
:
this
.
configHelper
.
getShell
();
let
env
=
this
.
createTerminalEnv
(
process
.
env
,
shell
,
this
.
contextService
.
getWorkspace
(),
locale
);
this
.
_title
=
name
?
name
:
''
;
this
.
_title
=
name
?
name
:
''
;
this
.
process
=
cp
.
fork
(
'
./terminalProcess
'
,
[],
{
this
.
process
=
cp
.
fork
(
'
./terminalProcess
'
,
[],
{
env
:
env
,
env
:
env
,
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
a020b859
...
@@ -50,9 +50,9 @@ export class TerminalService implements ITerminalService {
...
@@ -50,9 +50,9 @@ export class TerminalService implements ITerminalService {
this
.
_configHelper
=
<
TerminalConfigHelper
>
this
.
instantiationService
.
createInstance
(
TerminalConfigHelper
,
platform
.
platform
);
this
.
_configHelper
=
<
TerminalConfigHelper
>
this
.
instantiationService
.
createInstance
(
TerminalConfigHelper
,
platform
.
platform
);
}
}
public
createInstance
():
ITerminalInstance
{
public
createInstance
(
name
?:
string
,
shellPath
?:
string
):
ITerminalInstance
{
let
terminalInstance
=
<
TerminalInstance
>
this
.
instantiationService
.
createInstance
(
TerminalInstance
,
let
terminalInstance
=
<
TerminalInstance
>
this
.
instantiationService
.
createInstance
(
TerminalInstance
,
this
.
terminalFocusContextKey
,
this
.
onTerminalInstanceDispose
.
bind
(
this
),
this
.
_configHelper
,
this
.
terminalContainer
);
this
.
terminalFocusContextKey
,
this
.
onTerminalInstanceDispose
.
bind
(
this
),
this
.
_configHelper
,
name
,
shellPath
,
this
.
terminalContainer
);
this
.
terminalInstances
.
push
(
terminalInstance
);
this
.
terminalInstances
.
push
(
terminalInstance
);
if
(
this
.
terminalInstances
.
length
===
1
)
{
if
(
this
.
terminalInstances
.
length
===
1
)
{
// It's the first instance so it should be focused
// It's the first instance so it should be focused
...
@@ -522,4 +522,10 @@ export class TerminalService implements ITerminalService {
...
@@ -522,4 +522,10 @@ export class TerminalService implements ITerminalService {
// }
// }
// return parts.join('_') + '.UTF-8';
// return parts.join('_') + '.UTF-8';
// }
// }
// }
// }
\ No newline at end of file
=======
export
interface
ITerminalProcessConfiguration
{
name
:
string
;
shell
:
IShell
;
}
>>>>>>>
origin
/
master
src/vs/workbench/parts/terminal/test/terminalService.test.ts
浏览文件 @
a020b859
...
@@ -26,7 +26,7 @@ suite('Workbench - TerminalService', () => {
...
@@ -26,7 +26,7 @@ suite('Workbench - TerminalService', () => {
// assert.ok(env1['ok'], 'Parent environment is copied');
// assert.ok(env1['ok'], 'Parent environment is copied');
// assert.deepStrictEqual(parentEnv1, { ok: true }, 'Parent environment is unchanged');
// assert.deepStrictEqual(parentEnv1, { ok: true }, 'Parent environment is unchanged');
// assert.equal(env1['PTYPID'], process.pid.toString(), 'PTYPID is equal to the current PID');
// assert.equal(env1['PTYPID'], process.pid.toString(), 'PTYPID is equal to the current PID');
// assert.equal(env1['PTYSHELL'], '/bin/foosh', 'PTYSHELL is equal to the
request
ed shell');
// assert.equal(env1['PTYSHELL'], '/bin/foosh', 'PTYSHELL is equal to the
provid
ed shell');
// assert.equal(env1['PTYSHELLARG0'], '-bar', 'PTYSHELLARG0 is equal to the first shell argument');
// assert.equal(env1['PTYSHELLARG0'], '-bar', 'PTYSHELLARG0 is equal to the first shell argument');
// assert.equal(env1['PTYSHELLARG1'], 'baz', 'PTYSHELLARG1 is equal to the first shell argument');
// assert.equal(env1['PTYSHELLARG1'], 'baz', 'PTYSHELLARG1 is equal to the first shell argument');
// assert.ok(!('PTYSHELLARG2' in env1), 'PTYSHELLARG2 is unset');
// assert.ok(!('PTYSHELLARG2' in env1), 'PTYSHELLARG2 is unset');
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录