Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
755d45a1
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,发现更多精彩内容 >>
提交
755d45a1
编写于
5月 24, 2017
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up termianl imports
上级
f95866f0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
41 deletion
+41
-41
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
+2
-2
src/vs/workbench/parts/terminal/electron-browser/terminalColorRegistry.ts
.../parts/terminal/electron-browser/terminalColorRegistry.ts
+1
-1
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
...bench/parts/terminal/electron-browser/terminalInstance.ts
+23
-23
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
...orkbench/parts/terminal/electron-browser/terminalPanel.ts
+13
-13
未找到文件。
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
755d45a1
...
...
@@ -7,9 +7,10 @@ import 'vs/css!./media/scrollbar';
import
'
vs/css!./media/terminal
'
;
import
'
vs/css!./media/xterm
'
;
import
'
vs/css!./media/widgets
'
;
import
*
as
debugActions
from
'
vs/workbench/parts/debug/browser/debugActions
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
panel
from
'
vs/workbench/browser/panel
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
Extensions
,
IConfigurationRegistry
}
from
'
vs/platform/configuration/common/configurationRegistry
'
;
import
{
GlobalQuickOpenAction
}
from
'
vs/workbench/browser/parts/quickopen/quickopen.contribution
'
;
import
{
ITerminalService
,
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED
,
TERMINAL_PANEL_ID
,
TERMINAL_DEFAULT_RIGHT_CLICK_COPY_PASTE
,
TerminalCursorStyle
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
...
...
@@ -24,7 +25,6 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import
{
TerminalService
}
from
'
vs/workbench/parts/terminal/electron-browser/terminalService
'
;
import
{
ToggleTabFocusModeAction
}
from
'
vs/editor/contrib/toggleTabFocusMode/common/toggleTabFocusMode
'
;
import
{
registerSingleton
}
from
'
vs/platform/instantiation/common/extensions
'
;
import
debugActions
=
require
(
'
vs/workbench/parts/debug/browser/debugActions
'
);
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
OpenNextRecentlyUsedEditorInGroupAction
,
OpenPreviousRecentlyUsedEditorInGroupAction
,
FocusActiveGroupAction
,
FocusFirstGroupAction
,
FocusSecondGroupAction
,
FocusThirdGroupAction
}
from
'
vs/workbench/browser/parts/editor/editorActions
'
;
import
{
EDITOR_FONT_DEFAULTS
}
from
"
vs/editor/common/config/editorOptions
"
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts
浏览文件 @
755d45a1
...
...
@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
nls
=
require
(
'
vs/nls
'
)
;
import
os
=
require
(
'
os
'
)
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
os
from
'
os
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
EndOfLinePreference
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/common/services/codeEditorService
'
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalColorRegistry.ts
浏览文件 @
755d45a1
...
...
@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
nls
=
require
(
'
vs/nls
'
)
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
registerColor
,
ColorIdentifier
}
from
'
vs/platform/theme/common/colorRegistry
'
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalInstance.ts
浏览文件 @
755d45a1
...
...
@@ -3,15 +3,15 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
cp
from
'
child_process
'
;
import
*
as
os
from
'
os
'
;
import
*
as
path
from
'
path
'
;
import
DOM
=
require
(
'
vs/base/browser/dom
'
);
import
*
as
lifecycle
from
'
vs/base/common/lifecycle
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
cp
=
require
(
'
child_process
'
);
import
lifecycle
=
require
(
'
vs/base/common/lifecycle
'
);
import
nls
=
require
(
'
vs/nls
'
);
import
os
=
require
(
'
os
'
);
import
platform
=
require
(
'
vs/base/common/platform
'
);
import
Uri
from
'
vs/base/common/uri
'
;
import
xterm
=
require
(
'
xterm
'
);
import
{
Dimension
}
from
'
vs/base/browser/builder
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
...
@@ -39,7 +39,7 @@ class StandardTerminalProcessFactory implements ITerminalProcessFactory {
public
create
(
env
:
{
[
key
:
string
]:
string
}):
cp
.
ChildProcess
{
return
cp
.
fork
(
'
./terminalProcess
'
,
[],
{
env
,
cwd
:
U
RI
.
parse
(
path
.
dirname
(
require
.
toUrl
(
'
./terminalProcess
'
))).
fsPath
cwd
:
U
ri
.
parse
(
path
.
dirname
(
require
.
toUrl
(
'
./terminalProcess
'
))).
fsPath
});
}
}
...
...
@@ -217,7 +217,7 @@ export class TerminalInstance implements ITerminalInstance {
this
.
_container
=
container
;
this
.
_wrapperElement
=
document
.
createElement
(
'
div
'
);
DOM
.
addClass
(
this
.
_wrapperElement
,
'
terminal-wrapper
'
);
dom
.
addClass
(
this
.
_wrapperElement
,
'
terminal-wrapper
'
);
this
.
_xtermElement
=
document
.
createElement
(
'
div
'
);
this
.
_xterm
.
open
(
this
.
_xtermElement
,
false
);
...
...
@@ -242,7 +242,7 @@ export class TerminalInstance implements ITerminalInstance {
}
return
undefined
;
});
this
.
_instanceDisposables
.
push
(
DOM
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
mouseup
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_instanceDisposables
.
push
(
dom
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
mouseup
'
,
(
event
:
KeyboardEvent
)
=>
{
// Wait until mouseup has propogated through the DOM before evaluating the new selection
// state.
setTimeout
(()
=>
{
...
...
@@ -251,7 +251,7 @@ export class TerminalInstance implements ITerminalInstance {
}));
// xterm.js currently drops selection on keyup as we need to handle this case.
this
.
_instanceDisposables
.
push
(
DOM
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
keyup
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_instanceDisposables
.
push
(
dom
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
keyup
'
,
(
event
:
KeyboardEvent
)
=>
{
// Wait until keyup has propogated through the DOM before evaluating the new selection
// state.
setTimeout
(()
=>
{
...
...
@@ -262,10 +262,10 @@ export class TerminalInstance implements ITerminalInstance {
const
xtermHelper
:
HTMLElement
=
this
.
_xterm
.
element
.
querySelector
(
'
.xterm-helpers
'
);
const
focusTrap
:
HTMLElement
=
document
.
createElement
(
'
div
'
);
focusTrap
.
setAttribute
(
'
tabindex
'
,
'
0
'
);
DOM
.
addClass
(
focusTrap
,
'
focus-trap
'
);
this
.
_instanceDisposables
.
push
(
DOM
.
addDisposableListener
(
focusTrap
,
'
focus
'
,
(
event
:
FocusEvent
)
=>
{
dom
.
addClass
(
focusTrap
,
'
focus-trap
'
);
this
.
_instanceDisposables
.
push
(
dom
.
addDisposableListener
(
focusTrap
,
'
focus
'
,
(
event
:
FocusEvent
)
=>
{
let
currentElement
=
focusTrap
;
while
(
!
DOM
.
hasClass
(
currentElement
,
'
part
'
))
{
while
(
!
dom
.
hasClass
(
currentElement
,
'
part
'
))
{
currentElement
=
currentElement
.
parentElement
;
}
const
hidePanelElement
=
<
HTMLElement
>
currentElement
.
querySelector
(
'
.hide-panel-action
'
);
...
...
@@ -273,17 +273,17 @@ export class TerminalInstance implements ITerminalInstance {
}));
xtermHelper
.
insertBefore
(
focusTrap
,
this
.
_xterm
.
textarea
);
this
.
_instanceDisposables
.
push
(
DOM
.
addDisposableListener
(
this
.
_xterm
.
textarea
,
'
focus
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_instanceDisposables
.
push
(
dom
.
addDisposableListener
(
this
.
_xterm
.
textarea
,
'
focus
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_terminalFocusContextKey
.
set
(
true
);
}));
this
.
_instanceDisposables
.
push
(
DOM
.
addDisposableListener
(
this
.
_xterm
.
textarea
,
'
blur
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_instanceDisposables
.
push
(
dom
.
addDisposableListener
(
this
.
_xterm
.
textarea
,
'
blur
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_terminalFocusContextKey
.
reset
();
this
.
_refreshSelectionContextKey
();
}));
this
.
_instanceDisposables
.
push
(
DOM
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
focus
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_instanceDisposables
.
push
(
dom
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
focus
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_terminalFocusContextKey
.
set
(
true
);
}));
this
.
_instanceDisposables
.
push
(
DOM
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
blur
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_instanceDisposables
.
push
(
dom
.
addDisposableListener
(
this
.
_xterm
.
element
,
'
blur
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_terminalFocusContextKey
.
reset
();
this
.
_refreshSelectionContextKey
();
}));
...
...
@@ -336,7 +336,7 @@ export class TerminalInstance implements ITerminalInstance {
this
.
_linkHandler
.
dispose
();
}
if
(
this
.
_xterm
&&
this
.
_xterm
.
element
)
{
this
.
_hadFocusOnExit
=
DOM
.
hasClass
(
this
.
_xterm
.
element
,
'
focus
'
);
this
.
_hadFocusOnExit
=
dom
.
hasClass
(
this
.
_xterm
.
element
,
'
focus
'
);
}
if
(
this
.
_wrapperElement
)
{
this
.
_container
.
removeChild
(
this
.
_wrapperElement
);
...
...
@@ -389,7 +389,7 @@ export class TerminalInstance implements ITerminalInstance {
public
setVisible
(
visible
:
boolean
):
void
{
this
.
_isVisible
=
visible
;
if
(
this
.
_wrapperElement
)
{
DOM
.
toggleClass
(
this
.
_wrapperElement
,
'
active
'
,
visible
);
dom
.
toggleClass
(
this
.
_wrapperElement
,
'
active
'
,
visible
);
}
if
(
visible
&&
this
.
_xterm
)
{
// Trigger a manual scroll event which will sync the viewport and scroll bar. This is
...
...
@@ -473,9 +473,9 @@ export class TerminalInstance implements ITerminalInstance {
}
const
env
=
TerminalInstance
.
createTerminalEnv
(
process
.
env
,
shell
,
this
.
_getCwd
(
shell
,
workspace
),
locale
,
this
.
_cols
,
this
.
_rows
);
this
.
_title
=
shell
.
name
||
''
;
this
.
_process
=
cp
.
fork
(
U
RI
.
parse
(
require
.
toUrl
(
'
bootstrap
'
)).
fsPath
,
[
'
--type=terminal
'
],
{
this
.
_process
=
cp
.
fork
(
U
ri
.
parse
(
require
.
toUrl
(
'
bootstrap
'
)).
fsPath
,
[
'
--type=terminal
'
],
{
env
,
cwd
:
U
RI
.
parse
(
path
.
dirname
(
require
.
toUrl
(
'
../node/terminalProcess
'
))).
fsPath
cwd
:
U
ri
.
parse
(
path
.
dirname
(
require
.
toUrl
(
'
../node/terminalProcess
'
))).
fsPath
});
if
(
!
shell
.
name
)
{
// Only listen for process title changes when a name is not provided
...
...
@@ -559,7 +559,7 @@ export class TerminalInstance implements ITerminalInstance {
}
private
_attachPressAnyKeyToCloseListener
()
{
this
.
_processDisposables
.
push
(
DOM
.
addDisposableListener
(
this
.
_xterm
.
textarea
,
'
keypress
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_processDisposables
.
push
(
dom
.
addDisposableListener
(
this
.
_xterm
.
textarea
,
'
keypress
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
dispose
();
event
.
preventDefault
();
}));
...
...
src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts
浏览文件 @
755d45a1
...
...
@@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
DOM
=
require
(
'
vs/base/browser/dom
'
)
;
import
nls
=
require
(
'
vs/nls
'
)
;
import
platform
=
require
(
'
vs/base/common/platform
'
)
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
Action
,
IAction
}
from
'
vs/base/common/actions
'
;
import
{
Builder
,
Dimension
}
from
'
vs/base/browser/builder
'
;
import
{
IActionItem
,
Separator
}
from
'
vs/base/browser/ui/actionbar/actionbar
'
;
...
...
@@ -51,12 +51,12 @@ export class TerminalPanel extends Panel {
public
create
(
parent
:
Builder
):
TPromise
<
any
>
{
super
.
create
(
parent
);
this
.
_parentDomElement
=
parent
.
getHTMLElement
();
DOM
.
addClass
(
this
.
_parentDomElement
,
'
integrated-terminal
'
);
dom
.
addClass
(
this
.
_parentDomElement
,
'
integrated-terminal
'
);
this
.
_themeStyleElement
=
document
.
createElement
(
'
style
'
);
this
.
_fontStyleElement
=
document
.
createElement
(
'
style
'
);
this
.
_terminalContainer
=
document
.
createElement
(
'
div
'
);
DOM
.
addClass
(
this
.
_terminalContainer
,
'
terminal-outer-container
'
);
dom
.
addClass
(
this
.
_terminalContainer
,
'
terminal-outer-container
'
);
this
.
_parentDomElement
.
appendChild
(
this
.
_themeStyleElement
);
this
.
_parentDomElement
.
appendChild
(
this
.
_fontStyleElement
);
this
.
_parentDomElement
.
appendChild
(
this
.
_terminalContainer
);
...
...
@@ -152,7 +152,7 @@ export class TerminalPanel extends Panel {
}
private
_attachEventListeners
():
void
{
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
_parentDomElement
,
'
mousedown
'
,
(
event
:
MouseEvent
)
=>
{
this
.
_register
(
dom
.
addDisposableListener
(
this
.
_parentDomElement
,
'
mousedown
'
,
(
event
:
MouseEvent
)
=>
{
if
(
this
.
_terminalService
.
terminalInstances
.
length
===
0
)
{
return
;
}
...
...
@@ -183,7 +183,7 @@ export class TerminalPanel extends Panel {
}
}
}));
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
_parentDomElement
,
'
contextmenu
'
,
(
event
:
MouseEvent
)
=>
{
this
.
_register
(
dom
.
addDisposableListener
(
this
.
_parentDomElement
,
'
contextmenu
'
,
(
event
:
MouseEvent
)
=>
{
if
(
!
this
.
_cancelContextMenu
)
{
const
standardEvent
=
new
StandardMouseEvent
(
event
);
let
anchor
:
{
x
:
number
,
y
:
number
}
=
{
x
:
standardEvent
.
posx
,
y
:
standardEvent
.
posy
};
...
...
@@ -196,7 +196,7 @@ export class TerminalPanel extends Panel {
}
this
.
_cancelContextMenu
=
false
;
}));
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
_parentDomElement
,
'
click
'
,
(
event
)
=>
{
this
.
_register
(
dom
.
addDisposableListener
(
this
.
_parentDomElement
,
'
click
'
,
(
event
)
=>
{
if
(
this
.
_terminalService
.
terminalInstances
.
length
===
0
)
{
return
;
}
...
...
@@ -205,14 +205,14 @@ export class TerminalPanel extends Panel {
this
.
_terminalService
.
getActiveInstance
().
focus
();
}
}));
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
_parentDomElement
,
'
keyup
'
,
(
event
:
KeyboardEvent
)
=>
{
this
.
_register
(
dom
.
addDisposableListener
(
this
.
_parentDomElement
,
'
keyup
'
,
(
event
:
KeyboardEvent
)
=>
{
if
(
event
.
keyCode
===
27
)
{
// Keep terminal open on escape
event
.
stopPropagation
();
}
}));
this
.
_register
(
DOM
.
addDisposableListener
(
this
.
_parentDomElement
,
DOM
.
EventType
.
DROP
,
(
e
:
DragEvent
)
=>
{
if
(
e
.
target
===
this
.
_parentDomElement
||
DOM
.
isAncestor
(
e
.
target
as
HTMLElement
,
this
.
_parentDomElement
))
{
this
.
_register
(
dom
.
addDisposableListener
(
this
.
_parentDomElement
,
dom
.
EventType
.
DROP
,
(
e
:
DragEvent
)
=>
{
if
(
e
.
target
===
this
.
_parentDomElement
||
dom
.
isAncestor
(
e
.
target
as
HTMLElement
,
this
.
_parentDomElement
))
{
if
(
!
e
.
dataTransfer
)
{
return
;
}
...
...
@@ -269,8 +269,8 @@ export class TerminalPanel extends Panel {
return
;
}
let
newFont
=
this
.
_terminalService
.
configHelper
.
getFont
();
DOM
.
toggleClass
(
this
.
_parentDomElement
,
'
enable-ligatures
'
,
this
.
_terminalService
.
configHelper
.
config
.
fontLigatures
);
DOM
.
toggleClass
(
this
.
_parentDomElement
,
'
disable-bold
'
,
!
this
.
_terminalService
.
configHelper
.
config
.
enableBold
);
dom
.
toggleClass
(
this
.
_parentDomElement
,
'
enable-ligatures
'
,
this
.
_terminalService
.
configHelper
.
config
.
fontLigatures
);
dom
.
toggleClass
(
this
.
_parentDomElement
,
'
disable-bold
'
,
!
this
.
_terminalService
.
configHelper
.
config
.
enableBold
);
if
(
!
this
.
_font
||
this
.
_fontsDiffer
(
this
.
_font
,
newFont
))
{
this
.
_fontStyleElement
.
innerHTML
=
'
.monaco-workbench .panel.integrated-terminal .xterm {
'
+
`font-family:
${
newFont
.
fontFamily
}
;`
+
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录