Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
31bcb5ad
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,发现更多精彩内容 >>
提交
31bcb5ad
编写于
6月 08, 2016
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add terminal shell args setting
Fixes #7266
上级
5b0d712f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
67 addition
and
11 deletion
+67
-11
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+24
-0
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
+5
-0
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
...h/parts/terminal/electron-browser/terminalConfigHelper.ts
+19
-6
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/terminalProcess.js
...kbench/parts/terminal/electron-browser/terminalProcess.js
+13
-2
未找到文件。
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
31bcb5ad
...
...
@@ -28,16 +28,40 @@ configurationRegistry.registerConfiguration({
'
type
'
:
'
string
'
,
'
default
'
:
TERMINAL_DEFAULT_SHELL_LINUX
},
'
terminal.integrated.shellArgs.linux
'
:
{
'
description
'
:
nls
.
localize
(
'
terminal.integrated.shellArgs.linux
'
,
"
The command line arguments to use when on the Linux terminal.
"
),
'
type
'
:
'
array
'
,
'
items
'
:
{
'
type
'
:
'
string
'
},
'
default
'
:
[]
},
'
terminal.integrated.shell.osx
'
:
{
'
description
'
:
nls
.
localize
(
'
terminal.integrated.shell.osx
'
,
"
The path of the shell that the terminal uses on OS X.
"
),
'
type
'
:
'
string
'
,
'
default
'
:
TERMINAL_DEFAULT_SHELL_OSX
},
'
terminal.integrated.shellArgs.osx
'
:
{
'
description
'
:
nls
.
localize
(
'
terminal.integrated.shellArgs.osx
'
,
"
The command line arguments to use when on the OS X terminal.
"
),
'
type
'
:
'
array
'
,
'
items
'
:
{
'
type
'
:
'
string
'
},
'
default
'
:
[]
},
'
terminal.integrated.shell.windows
'
:
{
'
description
'
:
nls
.
localize
(
'
terminal.integrated.shell.windows
'
,
"
The path of the shell that the terminal uses on Windows.
"
),
'
type
'
:
'
string
'
,
'
default
'
:
TERMINAL_DEFAULT_SHELL_WINDOWS
},
'
terminal.integrated.shellArgs.windows
'
:
{
'
description
'
:
nls
.
localize
(
'
terminal.integrated.shellArgs.windows
'
,
"
The command line arguments to use when on the Windows terminal.
"
),
'
type
'
:
'
array
'
,
'
items
'
:
{
'
type
'
:
'
string
'
},
'
default
'
:
[]
},
'
terminal.integrated.fontFamily
'
:
{
'
description
'
:
nls
.
localize
(
'
terminal.integrated.fontFamily
'
,
"
Controls the font family of the terminal, this defaults to editor.fontFamily's value.
"
),
'
type
'
:
'
string
'
...
...
src/vs/workbench/parts/terminal/electron-browser/terminal.ts
浏览文件 @
31bcb5ad
...
...
@@ -27,6 +27,11 @@ export interface ITerminalConfiguration {
osx
:
string
,
windows
:
string
},
shellArgs
:
{
linux
:
string
[],
osx
:
string
[],
windows
:
string
[]
},
fontFamily
:
string
,
fontSize
:
number
,
lineHeight
:
number
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
浏览文件 @
31bcb5ad
...
...
@@ -76,6 +76,11 @@ export interface ITerminalFont {
charHeight
:
number
;
}
export
interface
IShell
{
executable
:
string
;
args
:
string
[];
}
/**
* Encapsulates terminal configuration logic, the primary purpose of this file is so that platform
* specific test cases can be written.
...
...
@@ -137,15 +142,23 @@ export class TerminalConfigHelper {
return
this
.
measureFont
(
fontFamily
,
fontSize
,
lineHeight
);
}
public
getShell
():
string
{
public
getShell
():
IShell
{
let
config
=
this
.
configurationService
.
getConfiguration
<
ITerminalConfiguration
>
();
let
shell
:
IShell
=
{
executable
:
''
,
args
:
[]
};
if
(
this
.
platform
===
Platform
.
Windows
)
{
return
config
.
terminal
.
integrated
.
shell
.
windows
;
}
if
(
this
.
platform
===
Platform
.
Mac
)
{
return
config
.
terminal
.
integrated
.
shell
.
osx
;
shell
.
executable
=
config
.
terminal
.
integrated
.
shell
.
windows
;
shell
.
args
=
config
.
terminal
.
integrated
.
shellArgs
.
windows
;
}
else
if
(
this
.
platform
===
Platform
.
Mac
)
{
shell
.
executable
=
config
.
terminal
.
integrated
.
shell
.
osx
;
shell
.
args
=
config
.
terminal
.
integrated
.
shellArgs
.
osx
;
}
else
if
(
this
.
platform
===
Platform
.
Linux
)
{
shell
.
executable
=
config
.
terminal
.
integrated
.
shell
.
linux
;
shell
.
args
=
config
.
terminal
.
integrated
.
shellArgs
.
linux
;
}
return
config
.
terminal
.
integrated
.
shell
.
linux
;
return
shell
;
}
private
toInteger
(
source
:
any
,
minimum
?:
number
):
number
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
31bcb5ad
...
...
@@ -17,7 +17,7 @@ import {IWorkspaceContextService} from 'vs/platform/workspace/common/workspace';
import
{
ITerminalService
}
from
'
vs/workbench/parts/terminal/electron-browser/terminal
'
;
import
{
DomScrollableElement
}
from
'
vs/base/browser/ui/scrollbar/scrollableElement
'
;
import
{
ScrollbarVisibility
}
from
'
vs/base/browser/ui/scrollbar/scrollableElementOptions
'
;
import
{
ITerminalFont
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalConfigHelper
'
;
import
{
I
Shell
,
I
TerminalFont
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalConfigHelper
'
;
export
class
TerminalInstance
{
...
...
@@ -28,7 +28,7 @@ export class TerminalInstance {
private
font
:
ITerminalFont
;
public
constructor
(
private
shell
:
string
,
private
shell
:
IShell
,
private
parentDomElement
:
HTMLElement
,
private
contextService
:
IWorkspaceContextService
,
private
terminalService
:
ITerminalService
,
...
...
@@ -120,7 +120,10 @@ export class TerminalInstance {
private
createTerminalProcess
():
cp
.
ChildProcess
{
let
env
=
this
.
cloneEnv
();
env
[
'
PTYSHELL
'
]
=
this
.
shell
;
env
[
'
PTYSHELL
'
]
=
this
.
shell
.
executable
;
this
.
shell
.
args
.
forEach
((
arg
,
i
)
=>
{
env
[
`PTYSHELLARG
${
i
}
`
]
=
arg
;
});
env
[
'
PTYCWD
'
]
=
this
.
contextService
.
getWorkspace
()
?
this
.
contextService
.
getWorkspace
().
resource
.
fsPath
:
os
.
homedir
();
return
cp
.
fork
(
'
./terminalProcess
'
,
[],
{
env
:
env
,
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalProcess.js
浏览文件 @
31bcb5ad
...
...
@@ -8,7 +8,8 @@ var ptyJs = require('pty.js');
// The pty process needs to be run in its own child process to get around maxing out CPU on Mac,
// see https://github.com/electron/electron/issues/38
var
ptyProcess
=
ptyJs
.
fork
(
process
.
env
.
PTYSHELL
,
[],
{
var
ptyProcess
=
ptyJs
.
fork
(
process
.
env
.
PTYSHELL
,
getArgs
(),
{
name
:
fs
.
existsSync
(
'
/usr/share/terminfo/x/xterm-256color
'
)
?
'
xterm-256color
'
:
'
xterm
'
,
cwd
:
process
.
env
.
PTYCWD
});
...
...
@@ -27,4 +28,14 @@ process.on('message', function (message) {
}
else
if
(
message
.
event
===
'
resize
'
)
{
ptyProcess
.
resize
(
message
.
cols
,
message
.
rows
);
}
});
\ No newline at end of file
});
function
getArgs
()
{
var
args
=
[];
var
i
=
0
;
while
(
process
.
env
[
'
PTYSHELLARG
'
+
i
])
{
args
.
push
(
process
.
env
[
'
PTYSHELLARG
'
+
i
]);
i
++
;
}
return
args
;
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录