Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
275135a7
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,发现更多精彩内容 >>
提交
275135a7
编写于
6月 02, 2018
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prefer const
上级
20f9bf12
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
74 addition
and
75 deletion
+74
-75
src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
...rkbench/api/electron-browser/mainThreadTerminalService.ts
+5
-5
src/vs/workbench/api/node/extHostTerminalService.ts
src/vs/workbench/api/node/extHostTerminalService.ts
+7
-7
src/vs/workbench/parts/terminal/browser/terminalFindWidget.ts
...vs/workbench/parts/terminal/browser/terminalFindWidget.ts
+3
-4
src/vs/workbench/parts/terminal/browser/terminalTab.ts
src/vs/workbench/parts/terminal/browser/terminalTab.ts
+1
-1
src/vs/workbench/parts/terminal/common/terminalColorRegistry.ts
.../workbench/parts/terminal/common/terminalColorRegistry.ts
+3
-3
src/vs/workbench/parts/terminal/common/terminalService.ts
src/vs/workbench/parts/terminal/common/terminalService.ts
+2
-2
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+2
-2
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
...kbench/parts/terminal/electron-browser/terminalActions.ts
+14
-14
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
...h/parts/terminal/electron-browser/terminalConfigHelper.ts
+7
-7
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts
...ch/parts/terminal/electron-browser/terminalLinkHandler.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
...orkbench/parts/terminal/electron-browser/terminalPanel.ts
+8
-8
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
...kbench/parts/terminal/electron-browser/terminalService.ts
+1
-1
src/vs/workbench/parts/terminal/node/terminalCommandTracker.ts
...s/workbench/parts/terminal/node/terminalCommandTracker.ts
+2
-2
src/vs/workbench/parts/terminal/node/terminalEnvironment.ts
src/vs/workbench/parts/terminal/node/terminalEnvironment.ts
+2
-2
src/vs/workbench/parts/terminal/node/terminalProcess.ts
src/vs/workbench/parts/terminal/node/terminalProcess.ts
+15
-15
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadTerminalService.ts
浏览文件 @
275135a7
...
...
@@ -65,7 +65,7 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
}
public
$show
(
terminalId
:
number
,
preserveFocus
:
boolean
):
void
{
le
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
cons
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
if
(
terminalInstance
)
{
this
.
terminalService
.
setActiveInstance
(
terminalInstance
);
this
.
terminalService
.
showPanel
(
!
preserveFocus
);
...
...
@@ -79,28 +79,28 @@ export class MainThreadTerminalService implements MainThreadTerminalServiceShape
}
public
$dispose
(
terminalId
:
number
):
void
{
le
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
cons
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
if
(
terminalInstance
)
{
terminalInstance
.
dispose
();
}
}
public
$write
(
terminalId
:
number
,
text
:
string
):
void
{
le
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
cons
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
if
(
terminalInstance
&&
terminalInstance
.
shellLaunchConfig
.
isRendererOnly
)
{
terminalInstance
.
write
(
text
);
}
}
public
$sendText
(
terminalId
:
number
,
text
:
string
,
addNewLine
:
boolean
):
void
{
le
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
cons
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
if
(
terminalInstance
)
{
terminalInstance
.
sendText
(
text
,
addNewLine
);
}
}
public
$registerOnDataListener
(
terminalId
:
number
):
void
{
le
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
cons
t
terminalInstance
=
this
.
terminalService
.
getInstanceFromId
(
terminalId
);
if
(
terminalInstance
)
{
this
.
_dataListeners
[
terminalId
]
=
terminalInstance
.
onData
(
data
=>
this
.
_onTerminalData
(
terminalId
,
data
));
terminalInstance
.
onDisposed
(
instance
=>
delete
this
.
_dataListeners
[
terminalId
]);
...
...
src/vs/workbench/api/node/extHostTerminalService.ts
浏览文件 @
275135a7
...
...
@@ -18,7 +18,7 @@ import { ILogService } from 'vs/platform/log/common/log';
export
class
ExtHostTerminal
implements
vscode
.
Terminal
{
private
_id
:
number
;
private
_disposed
:
boolean
;
private
_disposed
:
boolean
=
false
;
private
_queuedRequests
:
ApiRequest
[];
private
_pidPromise
:
Promise
<
number
>
;
private
_pidPromiseComplete
:
(
value
:
number
)
=>
any
;
...
...
@@ -103,7 +103,7 @@ export class ExtHostTerminal implements vscode.Terminal {
}
private
_queueApiRequest
(
callback
:
(...
args
:
any
[])
=>
void
,
args
:
any
[])
{
le
t
request
:
ApiRequest
=
new
ApiRequest
(
callback
,
args
);
cons
t
request
:
ApiRequest
=
new
ApiRequest
(
callback
,
args
);
if
(
!
this
.
_id
)
{
this
.
_queuedRequests
.
push
(
request
);
return
;
...
...
@@ -120,7 +120,7 @@ export class ExtHostTerminal implements vscode.Terminal {
export
class
ExtHostTerminalRenderer
implements
vscode
.
TerminalRenderer
{
private
_id
:
number
;
// private _disposed: boolean
;
private
_disposed
:
boolean
=
false
;
private
_queuedRequests
:
ApiRequest
[];
public
get
name
():
string
{
return
this
.
_name
;
}
...
...
@@ -147,7 +147,7 @@ export class ExtHostTerminalRenderer implements vscode.TerminalRenderer {
}
private
_queueApiRequest
(
callback
:
(...
args
:
any
[])
=>
void
,
args
:
any
[])
{
le
t
request
:
ApiRequest
=
new
ApiRequest
(
callback
,
args
);
cons
t
request
:
ApiRequest
=
new
ApiRequest
(
callback
,
args
);
if
(
!
this
.
_id
)
{
this
.
_queuedRequests
.
push
(
request
);
return
;
...
...
@@ -278,7 +278,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
// Continue env initialization, merging in the env from the launch
// config and adding keys that are needed to create the process
const
env
=
terminalEnvironment
.
createTerminalEnv
(
parentEnv
,
shellLaunchConfig
,
initialCwd
,
locale
,
cols
,
rows
);
le
t
cwd
=
Uri
.
parse
(
require
.
toUrl
(
'
../../parts/terminal/node
'
)).
fsPath
;
cons
t
cwd
=
Uri
.
parse
(
require
.
toUrl
(
'
../../parts/terminal/node
'
)).
fsPath
;
const
options
=
{
env
,
cwd
,
execArgv
:
[]
};
// Fork the process and listen for messages
...
...
@@ -333,7 +333,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
}
private
_getTerminalById
(
id
:
number
):
ExtHostTerminal
{
le
t
index
=
this
.
_getTerminalIndexById
(
id
);
cons
t
index
=
this
.
_getTerminalIndexById
(
id
);
return
index
!==
null
?
this
.
_terminals
[
index
]
:
null
;
}
...
...
@@ -341,7 +341,7 @@ export class ExtHostTerminalService implements ExtHostTerminalServiceShape {
let
index
:
number
=
null
;
this
.
_terminals
.
some
((
terminal
,
i
)
=>
{
// TODO: This shouldn't be cas
le
t
thisId
=
(
<
any
>
terminal
).
_id
;
cons
t
thisId
=
(
<
any
>
terminal
).
_id
;
if
(
thisId
===
id
)
{
index
=
i
;
return
true
;
...
...
src/vs/workbench/parts/terminal/browser/terminalFindWidget.ts
浏览文件 @
275135a7
...
...
@@ -21,13 +21,12 @@ export class TerminalFindWidget extends SimpleFindWidget {
}
public
find
(
previous
:
boolean
)
{
let
val
=
this
.
inputValue
;
let
instance
=
this
.
_terminalService
.
getActiveInstance
();
const
instance
=
this
.
_terminalService
.
getActiveInstance
();
if
(
instance
!==
null
)
{
if
(
previous
)
{
instance
.
findPrevious
(
val
);
instance
.
findPrevious
(
this
.
inputValue
);
}
else
{
instance
.
findNext
(
val
);
instance
.
findNext
(
this
.
inputValue
);
}
}
}
...
...
src/vs/workbench/parts/terminal/browser/terminalTab.ts
浏览文件 @
275135a7
...
...
@@ -306,7 +306,7 @@ export class TerminalTab extends Disposable implements ITerminalTab {
// Adjust focus if the instance was active
if
(
wasActiveInstance
&&
this
.
_terminalInstances
.
length
>
0
)
{
le
t
newIndex
=
index
<
this
.
_terminalInstances
.
length
?
index
:
this
.
_terminalInstances
.
length
-
1
;
cons
t
newIndex
=
index
<
this
.
_terminalInstances
.
length
?
index
:
this
.
_terminalInstances
.
length
-
1
;
this
.
setActiveInstanceByIndex
(
newIndex
);
// TODO: Only focus the new instance if the tab had focus?
this
.
activeInstance
.
focus
(
true
);
...
...
src/vs/workbench/parts/terminal/common/terminalColorRegistry.ts
浏览文件 @
275135a7
...
...
@@ -160,9 +160,9 @@ const ansiColorMap = {
};
export
function
registerColors
():
void
{
for
(
le
t
id
in
ansiColorMap
)
{
le
t
entry
=
ansiColorMap
[
id
];
le
t
colorName
=
id
.
substring
(
13
);
for
(
cons
t
id
in
ansiColorMap
)
{
cons
t
entry
=
ansiColorMap
[
id
];
cons
t
colorName
=
id
.
substring
(
13
);
ansiColorIdentifiers
[
entry
.
index
]
=
registerColor
(
id
,
entry
.
defaults
,
nls
.
localize
(
'
terminal.ansiColor
'
,
'
\'
{0}
\'
ANSI color in the terminal.
'
,
colorName
));
}
}
src/vs/workbench/parts/terminal/common/terminalService.ts
浏览文件 @
275135a7
...
...
@@ -153,7 +153,7 @@ export abstract class TerminalService implements ITerminalService {
if
(
wasActiveTab
&&
this
.
_terminalTabs
.
length
>
0
)
{
// TODO: Only focus the new tab if the removed tab had focus?
// const hasFocusOnExit = tab.activeInstance.hadFocusOnExit;
le
t
newIndex
=
index
<
this
.
_terminalTabs
.
length
?
index
:
this
.
_terminalTabs
.
length
-
1
;
cons
t
newIndex
=
index
<
this
.
_terminalTabs
.
length
?
index
:
this
.
_terminalTabs
.
length
-
1
;
this
.
setActiveTabByIndex
(
newIndex
);
this
.
getActiveInstance
().
focus
(
true
);
}
...
...
@@ -302,7 +302,7 @@ export abstract class TerminalService implements ITerminalService {
public
showPanel
(
focus
?:
boolean
):
TPromise
<
void
>
{
return
new
TPromise
<
void
>
((
complete
)
=>
{
le
t
panel
=
this
.
_panelService
.
getActivePanel
();
cons
t
panel
=
this
.
_panelService
.
getActivePanel
();
if
(
!
panel
||
panel
.
getId
()
!==
TERMINAL_PANEL_ID
)
{
return
this
.
_panelService
.
openPanel
(
TERMINAL_PANEL_ID
,
focus
).
then
(()
=>
{
if
(
focus
)
{
...
...
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
275135a7
...
...
@@ -66,7 +66,7 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenTermAction, Q
const
actionBarRegistry
=
Registry
.
as
<
IActionBarRegistry
>
(
ActionBarExtensions
.
Actionbar
);
actionBarRegistry
.
registerActionBarContributor
(
Scope
.
VIEWER
,
QuickOpenActionTermContributor
);
le
t
configurationRegistry
=
Registry
.
as
<
IConfigurationRegistry
>
(
Extensions
.
Configuration
);
cons
t
configurationRegistry
=
Registry
.
as
<
IConfigurationRegistry
>
(
Extensions
.
Configuration
);
configurationRegistry
.
registerConfiguration
({
'
id
'
:
'
terminal
'
,
'
order
'
:
100
,
...
...
@@ -359,7 +359,7 @@ registerSingleton(ITerminalService, TerminalService);
// On mac cmd+` is reserved to cycle between windows, that's why the keybindings use WinCtrl
const
category
=
nls
.
localize
(
'
terminalCategory
'
,
"
Terminal
"
);
le
t
actionRegistry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
cons
t
actionRegistry
=
Registry
.
as
<
IWorkbenchActionRegistry
>
(
ActionExtensions
.
WorkbenchActions
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
KillTerminalAction
,
KillTerminalAction
.
ID
,
KillTerminalAction
.
LABEL
),
'
Terminal: Kill the Active Terminal Instance
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
CopyTerminalSelectionAction
,
CopyTerminalSelectionAction
.
ID
,
CopyTerminalSelectionAction
.
LABEL
,
{
primary
:
KeyMod
.
CtrlCmd
|
KeyCode
.
KEY_C
,
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
275135a7
...
...
@@ -71,7 +71,7 @@ export class KillTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
this
.
terminalService
.
getActiveInstance
().
dispose
();
if
(
this
.
terminalService
.
terminalInstances
.
length
>
0
)
{
...
...
@@ -121,7 +121,7 @@ export class CopyTerminalSelectionAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
copySelection
();
}
...
...
@@ -142,7 +142,7 @@ export class SelectAllTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
selectAll
();
}
...
...
@@ -161,7 +161,7 @@ export abstract class BaseSendTextTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
_terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
_terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
sendText
(
this
.
_text
,
false
);
}
...
...
@@ -598,7 +598,7 @@ export class RunSelectedTextInTerminalAction extends Action {
if
(
selection
.
isEmpty
())
{
text
=
editor
.
getModel
().
getLineContent
(
selection
.
selectionStartLineNumber
).
trim
();
}
else
{
le
t
endOfLinePreference
=
os
.
EOL
===
'
\n
'
?
EndOfLinePreference
.
LF
:
EndOfLinePreference
.
CRLF
;
cons
t
endOfLinePreference
=
os
.
EOL
===
'
\n
'
?
EndOfLinePreference
.
LF
:
EndOfLinePreference
.
CRLF
;
text
=
editor
.
getModel
().
getValueInRange
(
selection
,
endOfLinePreference
);
}
instance
.
sendText
(
text
,
true
);
...
...
@@ -695,7 +695,7 @@ export class ScrollDownTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
scrollDownLine
();
}
...
...
@@ -716,7 +716,7 @@ export class ScrollDownPageTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
scrollDownPage
();
}
...
...
@@ -737,7 +737,7 @@ export class ScrollToBottomTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
scrollToBottom
();
}
...
...
@@ -758,7 +758,7 @@ export class ScrollUpTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
scrollUpLine
();
}
...
...
@@ -779,7 +779,7 @@ export class ScrollUpPageTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
scrollUpPage
();
}
...
...
@@ -800,7 +800,7 @@ export class ScrollToTopTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
scrollToTop
();
}
...
...
@@ -821,7 +821,7 @@ export class ClearTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
)
{
terminalInstance
.
clear
();
}
...
...
@@ -842,7 +842,7 @@ export class ClearSelectionTerminalAction extends Action {
}
public
run
(
event
?:
any
):
TPromise
<
any
>
{
le
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
cons
t
terminalInstance
=
this
.
terminalService
.
getActiveInstance
();
if
(
terminalInstance
&&
terminalInstance
.
hasSelection
())
{
terminalInstance
.
clearSelection
();
}
...
...
@@ -994,7 +994,7 @@ export class QuickOpenActionTermContributor extends ActionBarContributor {
}
public
getActions
(
context
:
any
):
IAction
[]
{
le
t
actions
:
Action
[]
=
[];
cons
t
actions
:
Action
[]
=
[];
if
(
context
.
element
instanceof
TerminalEntry
)
{
actions
.
push
(
this
.
instantiationService
.
createInstance
(
RenameTerminalQuickOpenAction
,
RenameTerminalQuickOpenAction
.
ID
,
RenameTerminalQuickOpenAction
.
LABEL
,
context
.
element
));
actions
.
push
(
this
.
instantiationService
.
createInstance
(
QuickKillTerminalAction
,
QuickKillTerminalAction
.
ID
,
QuickKillTerminalAction
.
LABEL
,
context
.
element
));
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalConfigHelper.ts
浏览文件 @
275135a7
...
...
@@ -50,12 +50,12 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
public
configFontIsMonospace
():
boolean
{
this
.
_createCharMeasureElementIfNecessary
();
le
t
fontSize
=
15
;
le
t
fontFamily
=
this
.
config
.
fontFamily
||
this
.
_configurationService
.
getValue
<
IEditorOptions
>
(
'
editor
'
).
fontFamily
;
le
t
i_rect
=
this
.
_getBoundingRectFor
(
'
i
'
,
fontFamily
,
fontSize
);
le
t
w_rect
=
this
.
_getBoundingRectFor
(
'
w
'
,
fontFamily
,
fontSize
);
cons
t
fontSize
=
15
;
cons
t
fontFamily
=
this
.
config
.
fontFamily
||
this
.
_configurationService
.
getValue
<
IEditorOptions
>
(
'
editor
'
).
fontFamily
;
cons
t
i_rect
=
this
.
_getBoundingRectFor
(
'
i
'
,
fontFamily
,
fontSize
);
cons
t
w_rect
=
this
.
_getBoundingRectFor
(
'
w
'
,
fontFamily
,
fontSize
);
le
t
invalidBounds
=
!
i_rect
.
width
||
!
w_rect
.
width
;
cons
t
invalidBounds
=
!
i_rect
.
width
||
!
w_rect
.
width
;
if
(
invalidBounds
)
{
// There is no reason to believe the font is not Monospace.
return
true
;
...
...
@@ -88,7 +88,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
private
_measureFont
(
fontFamily
:
string
,
fontSize
:
number
,
letterSpacing
:
number
,
lineHeight
:
number
):
ITerminalFont
{
this
.
_createCharMeasureElementIfNecessary
();
le
t
rect
=
this
.
_getBoundingRectFor
(
'
X
'
,
fontFamily
,
fontSize
);
cons
t
rect
=
this
.
_getBoundingRectFor
(
'
X
'
,
fontFamily
,
fontSize
);
// Bounding client rect was invalid, use last font measurement if available.
if
(
this
.
_lastFontMeasurement
&&
!
rect
.
width
&&
!
rect
.
height
)
{
...
...
@@ -122,7 +122,7 @@ export class TerminalConfigHelper implements ITerminalConfigHelper {
}
}
le
t
fontSize
=
this
.
_toInteger
(
this
.
config
.
fontSize
,
MINIMUM_FONT_SIZE
,
MAXIMUM_FONT_SIZE
,
EDITOR_FONT_DEFAULTS
.
fontSize
);
cons
t
fontSize
=
this
.
_toInteger
(
this
.
config
.
fontSize
,
MINIMUM_FONT_SIZE
,
MAXIMUM_FONT_SIZE
,
EDITOR_FONT_DEFAULTS
.
fontSize
);
const
letterSpacing
=
this
.
config
.
letterSpacing
?
Math
.
max
(
Math
.
floor
(
this
.
config
.
letterSpacing
),
MINIMUM_LETTER_SPACING
)
:
DEFAULT_LETTER_SPACING
;
const
lineHeight
=
this
.
config
.
lineHeight
?
Math
.
max
(
this
.
config
.
lineHeight
,
1
)
:
DEFAULT_LINE_HEIGHT
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
275135a7
...
...
@@ -438,7 +438,7 @@ export class TerminalInstance implements ITerminalInstance {
}
private
_measureRenderTime
():
void
{
le
t
frameTimes
:
number
[]
=
[];
cons
t
frameTimes
:
number
[]
=
[];
const
textRenderLayer
=
(
<
any
>
this
.
_xterm
).
renderer
.
_renderLayers
[
0
];
const
originalOnGridChanged
=
textRenderLayer
.
onGridChanged
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalLinkHandler.ts
浏览文件 @
275135a7
...
...
@@ -172,7 +172,7 @@ export class TerminalLinkHandler {
}
private
_handleHypertextLink
(
url
:
string
):
void
{
le
t
uri
=
Uri
.
parse
(
url
);
cons
t
uri
=
Uri
.
parse
(
url
);
this
.
_openerService
.
open
(
uri
);
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
浏览文件 @
275135a7
...
...
@@ -79,7 +79,7 @@ export class TerminalPanel extends Panel {
}
if
(
e
.
affectsConfiguration
(
'
terminal.integrated.fontFamily
'
)
||
e
.
affectsConfiguration
(
'
editor.fontFamily
'
))
{
le
t
configHelper
=
this
.
_terminalService
.
configHelper
;
cons
t
configHelper
=
this
.
_terminalService
.
configHelper
;
if
(
configHelper
instanceof
TerminalConfigHelper
)
{
if
(
!
configHelper
.
configFontIsMonospace
())
{
const
choices
:
IPromptChoice
[]
=
[{
...
...
@@ -226,7 +226,7 @@ export class TerminalPanel extends Panel {
this
.
_terminalService
.
getActiveInstance
().
focus
();
}
else
if
(
event
.
which
===
3
)
{
if
(
this
.
_terminalService
.
configHelper
.
config
.
rightClickBehavior
===
'
copyPaste
'
)
{
le
t
terminal
=
this
.
_terminalService
.
getActiveInstance
();
cons
t
terminal
=
this
.
_terminalService
.
getActiveInstance
();
if
(
terminal
.
hasSelection
())
{
terminal
.
copySelection
();
terminal
.
clearSelection
();
...
...
@@ -253,7 +253,7 @@ export class TerminalPanel extends Panel {
}
if
(
event
.
which
===
1
)
{
le
t
terminal
=
this
.
_terminalService
.
getActiveInstance
();
cons
t
terminal
=
this
.
_terminalService
.
getActiveInstance
();
if
(
terminal
.
hasSelection
())
{
terminal
.
copySelection
();
}
...
...
@@ -263,7 +263,7 @@ export class TerminalPanel extends Panel {
this
.
_register
(
dom
.
addDisposableListener
(
this
.
_parentDomElement
,
'
contextmenu
'
,
(
event
:
MouseEvent
)
=>
{
if
(
!
this
.
_cancelContextMenu
)
{
const
standardEvent
=
new
StandardMouseEvent
(
event
);
le
t
anchor
:
{
x
:
number
,
y
:
number
}
=
{
x
:
standardEvent
.
posx
,
y
:
standardEvent
.
posy
};
cons
t
anchor
:
{
x
:
number
,
y
:
number
}
=
{
x
:
standardEvent
.
posx
,
y
:
standardEvent
.
posy
};
this
.
_contextMenuService
.
showContextMenu
({
getAnchor
:
()
=>
anchor
,
getActions
:
()
=>
TPromise
.
as
(
this
.
_getContextMenuActions
()),
...
...
@@ -292,7 +292,7 @@ export class TerminalPanel extends Panel {
// Check if files were dragged from the tree explorer
let
path
:
string
;
le
t
resources
=
e
.
dataTransfer
.
getData
(
DataTransfers
.
RESOURCES
);
cons
t
resources
=
e
.
dataTransfer
.
getData
(
DataTransfers
.
RESOURCES
);
if
(
resources
)
{
path
=
URI
.
parse
(
JSON
.
parse
(
resources
)[
0
]).
path
;
}
else
if
(
e
.
dataTransfer
.
files
.
length
>
0
)
{
...
...
@@ -338,15 +338,15 @@ registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
}
// Borrow the editor's hover background for now
le
t
hoverBackground
=
theme
.
getColor
(
editorHoverBackground
);
cons
t
hoverBackground
=
theme
.
getColor
(
editorHoverBackground
);
if
(
hoverBackground
)
{
collector
.
addRule
(
`.monaco-workbench .panel.integrated-terminal .terminal-message-widget { background-color:
${
hoverBackground
}
; }`
);
}
le
t
hoverBorder
=
theme
.
getColor
(
editorHoverBorder
);
cons
t
hoverBorder
=
theme
.
getColor
(
editorHoverBorder
);
if
(
hoverBorder
)
{
collector
.
addRule
(
`.monaco-workbench .panel.integrated-terminal .terminal-message-widget { border: 1px solid
${
hoverBorder
}
; }`
);
}
le
t
hoverForeground
=
theme
.
getColor
(
editorForeground
);
cons
t
hoverForeground
=
theme
.
getColor
(
editorForeground
);
if
(
hoverForeground
)
{
collector
.
addRule
(
`.monaco-workbench .panel.integrated-terminal .terminal-message-widget { color:
${
hoverForeground
}
; }`
);
}
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalService.ts
浏览文件 @
275135a7
...
...
@@ -112,7 +112,7 @@ export class TerminalService extends AbstractTerminalService implements ITermina
public
focusFindWidget
():
TPromise
<
void
>
{
return
this
.
showPanel
(
false
).
then
(()
=>
{
le
t
panel
=
this
.
_panelService
.
getActivePanel
()
as
TerminalPanel
;
cons
t
panel
=
this
.
_panelService
.
getActivePanel
()
as
TerminalPanel
;
panel
.
focusFindWidget
();
this
.
_findWidgetVisible
.
set
(
true
);
});
...
...
src/vs/workbench/parts/terminal/node/terminalCommandTracker.ts
浏览文件 @
275135a7
...
...
@@ -194,7 +194,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker {
if
(
this
.
_currentMarker
===
Boundary
.
Bottom
)
{
this
.
_currentMarker
=
this
.
_xterm
.
addMarker
(
this
.
_getOffset
()
-
1
);
}
else
{
le
t
offset
=
this
.
_getOffset
();
cons
t
offset
=
this
.
_getOffset
();
if
(
this
.
_isDisposable
)
{
this
.
_currentMarker
.
dispose
();
}
...
...
@@ -217,7 +217,7 @@ export class TerminalCommandTracker implements ITerminalCommandTracker {
if
(
this
.
_currentMarker
===
Boundary
.
Top
)
{
this
.
_currentMarker
=
this
.
_xterm
.
addMarker
(
this
.
_getOffset
()
+
1
);
}
else
{
le
t
offset
=
this
.
_getOffset
();
cons
t
offset
=
this
.
_getOffset
();
if
(
this
.
_isDisposable
)
{
this
.
_currentMarker
.
dispose
();
}
...
...
src/vs/workbench/parts/terminal/node/terminalEnvironment.ts
浏览文件 @
275135a7
...
...
@@ -25,9 +25,9 @@ export function mergeEnvironments(parent: IStringDictionary<string>, other: IStr
// On Windows apply the new values ignoring case, while still retaining
// the case of the original key.
if
(
platform
.
isWindows
)
{
for
(
le
t
configKey
in
other
)
{
for
(
cons
t
configKey
in
other
)
{
let
actualKey
=
configKey
;
for
(
le
t
envKey
in
parent
)
{
for
(
cons
t
envKey
in
parent
)
{
if
(
configKey
.
toLowerCase
()
===
envKey
.
toLowerCase
())
{
actualKey
=
envKey
;
break
;
...
...
src/vs/workbench/parts/terminal/node/terminalProcess.ts
浏览文件 @
275135a7
...
...
@@ -9,7 +9,7 @@ import * as pty from 'node-pty';
// 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
shellName
:
string
;
let
shellName
:
string
;
if
(
os
.
platform
()
===
'
win32
'
)
{
shellName
=
path
.
basename
(
process
.
env
.
PTYSHELL
);
}
else
{
...
...
@@ -17,12 +17,12 @@ if (os.platform() === 'win32') {
// color prompt as defined in the default ~/.bashrc file.
shellName
=
'
xterm-256color
'
;
}
var
shell
=
process
.
env
.
PTYSHELL
;
var
args
=
getArgs
();
var
cwd
=
process
.
env
.
PTYCWD
;
var
cols
=
process
.
env
.
PTYCOLS
;
var
rows
=
process
.
env
.
PTYROWS
;
var
currentTitle
=
''
;
const
shell
=
process
.
env
.
PTYSHELL
;
const
args
=
getArgs
();
const
cwd
=
process
.
env
.
PTYCWD
;
const
cols
=
process
.
env
.
PTYCOLS
;
const
rows
=
process
.
env
.
PTYROWS
;
let
currentTitle
=
''
;
setupPlanB
(
Number
(
process
.
env
.
PTYPID
));
cleanEnv
();
...
...
@@ -34,7 +34,7 @@ interface IOptions {
rows
?:
number
;
}
var
options
:
IOptions
=
{
const
options
:
IOptions
=
{
name
:
shellName
,
cwd
};
...
...
@@ -43,10 +43,10 @@ if (cols && rows) {
options
.
rows
=
parseInt
(
rows
,
10
);
}
var
ptyProcess
=
pty
.
spawn
(
shell
,
args
,
options
);
const
ptyProcess
=
pty
.
spawn
(
shell
,
args
,
options
);
var
closeTimeout
:
number
;
var
exitCode
:
number
;
let
closeTimeout
:
number
;
let
exitCode
:
number
;
// Allow any trailing data events to be sent before the exit event is sent.
// See https://github.com/Tyriar/node-pty/issues/72
...
...
@@ -95,8 +95,8 @@ function getArgs(): string | string[] {
if
(
process
.
env
[
'
PTYSHELLCMDLINE
'
])
{
return
process
.
env
[
'
PTYSHELLCMDLINE
'
];
}
var
args
=
[];
var
i
=
0
;
const
args
=
[];
let
i
=
0
;
while
(
process
.
env
[
'
PTYSHELLARG
'
+
i
])
{
args
.
push
(
process
.
env
[
'
PTYSHELLARG
'
+
i
]);
i
++
;
...
...
@@ -105,7 +105,7 @@ function getArgs(): string | string[] {
}
function
cleanEnv
()
{
var
keys
=
[
const
keys
=
[
'
AMD_ENTRYPOINT
'
,
'
ELECTRON_NO_ASAR
'
,
'
ELECTRON_RUN_AS_NODE
'
,
...
...
@@ -123,7 +123,7 @@ function cleanEnv() {
delete
process
.
env
[
key
];
}
});
var
i
=
0
;
let
i
=
0
;
while
(
process
.
env
[
'
PTYSHELLARG
'
+
i
])
{
delete
process
.
env
[
'
PTYSHELLARG
'
+
i
];
i
++
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录