Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e9bb126a
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,发现更多精彩内容 >>
提交
e9bb126a
编写于
7月 09, 2020
作者:
D
Daniel Imms
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove eslint disable rule from terminal
Part of #101978
上级
9e21a4e8
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
26 addition
and
25 deletion
+26
-25
src/vs/workbench/contrib/terminal/browser/terminalService.ts
src/vs/workbench/contrib/terminal/browser/terminalService.ts
+10
-20
src/vs/workbench/contrib/terminal/common/terminal.ts
src/vs/workbench/contrib/terminal/common/terminal.ts
+1
-2
src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts
...ontrib/terminal/electron-browser/terminalNativeService.ts
+15
-3
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminalService.ts
浏览文件 @
e9bb126a
...
...
@@ -25,9 +25,6 @@ import { FindReplaceState } from 'vs/editor/contrib/find/findState';
import
{
escapeNonWindowsPath
}
from
'
vs/workbench/contrib/terminal/common/terminalEnvironment
'
;
import
{
isWindows
,
isMacintosh
,
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
basename
}
from
'
vs/base/common/path
'
;
// TODO@daniel code layering
// eslint-disable-next-line code-layering, code-import-patterns
import
{
INativeOpenFileRequest
}
from
'
vs/platform/windows/node/window
'
;
import
{
find
}
from
'
vs/base/common/arrays
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
import
{
IViewsService
,
ViewContainerLocation
,
IViewDescriptorService
}
from
'
vs/workbench/common/views
'
;
...
...
@@ -109,6 +106,8 @@ export class TerminalService implements ITerminalService {
@
IConfigurationService
private
_configurationService
:
IConfigurationService
,
@
IViewsService
private
_viewsService
:
IViewsService
,
@
IViewDescriptorService
private
readonly
_viewDescriptorService
:
IViewDescriptorService
,
// HACK: Ideally TerminalNativeService would depend on TerminalService and inject the
// additional native functionality into it.
@
optional
(
ITerminalNativeService
)
terminalNativeService
:
ITerminalNativeService
)
{
// @optional could give undefined and properly typing it breaks service registration
...
...
@@ -120,7 +119,14 @@ export class TerminalService implements ITerminalService {
lifecycleService
.
onBeforeShutdown
(
async
event
=>
event
.
veto
(
this
.
_onBeforeShutdown
()));
lifecycleService
.
onShutdown
(()
=>
this
.
_onShutdown
());
if
(
this
.
_terminalNativeService
)
{
this
.
_terminalNativeService
.
onOpenFileRequest
(
e
=>
this
.
_onOpenFileRequest
(
e
));
this
.
_terminalNativeService
.
onRequestFocusActiveInstance
(()
=>
{
if
(
this
.
terminalInstances
.
length
>
0
)
{
const
terminal
=
this
.
getActiveInstance
();
if
(
terminal
)
{
terminal
.
focus
();
}
}
});
this
.
_terminalNativeService
.
onOsResume
(()
=>
this
.
_onOsResume
());
}
this
.
_terminalFocusContextKey
=
KEYBINDING_CONTEXT_TERMINAL_FOCUS
.
bindTo
(
this
.
_contextKeyService
);
...
...
@@ -220,22 +226,6 @@ export class TerminalService implements ITerminalService {
this
.
terminalInstances
.
forEach
(
instance
=>
instance
.
dispose
(
true
));
}
private
async
_onOpenFileRequest
(
request
:
INativeOpenFileRequest
):
Promise
<
void
>
{
// if the request to open files is coming in from the integrated terminal (identified though
// the termProgram variable) and we are instructed to wait for editors close, wait for the
// marker file to get deleted and then focus back to the integrated terminal.
if
(
request
.
termProgram
===
'
vscode
'
&&
request
.
filesToWait
&&
this
.
_terminalNativeService
)
{
const
waitMarkerFileUri
=
URI
.
revive
(
request
.
filesToWait
.
waitMarkerFileUri
);
await
this
.
_terminalNativeService
.
whenFileDeleted
(
waitMarkerFileUri
);
if
(
this
.
terminalInstances
.
length
>
0
)
{
const
terminal
=
this
.
getActiveInstance
();
if
(
terminal
)
{
terminal
.
focus
();
}
}
}
}
private
_onOsResume
():
void
{
const
activeTab
=
this
.
getActiveTab
();
if
(
!
activeTab
)
{
...
...
src/vs/workbench/contrib/terminal/common/terminal.ts
浏览文件 @
e9bb126a
...
...
@@ -10,7 +10,6 @@ import { RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import
{
createDecorator
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
OperatingSystem
}
from
'
vs/base/common/platform
'
;
import
{
IOpenFileRequest
}
from
'
vs/platform/windows/common/windows
'
;
import
{
IEnvironmentVariableInfo
}
from
'
vs/workbench/contrib/terminal/common/environmentVariable
'
;
import
{
IExtensionPointDescriptor
}
from
'
vs/workbench/services/extensions/common/extensionsRegistry
'
;
...
...
@@ -238,7 +237,7 @@ export interface ITerminalNativeService {
readonly
linuxDistro
:
LinuxDistro
;
readonly
on
OpenFileRequest
:
Event
<
IOpenFileRequest
>
;
readonly
on
RequestFocusActiveInstance
:
Event
<
void
>
;
readonly
onOsResume
:
Event
<
void
>
;
getWindowsBuildNumber
():
number
;
...
...
src/vs/workbench/contrib/terminal/electron-browser/terminalNativeService.ts
浏览文件 @
e9bb126a
...
...
@@ -17,14 +17,15 @@ import { registerRemoteContributions } from 'vs/workbench/contrib/terminal/elect
import
{
IRemoteAgentService
}
from
'
vs/workbench/services/remote/common/remoteAgentService
'
;
import
{
IElectronService
}
from
'
vs/platform/electron/electron-sandbox/electron
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
INativeOpenFileRequest
}
from
'
vs/platform/windows/node/window
'
;
export
class
TerminalNativeService
extends
Disposable
implements
ITerminalNativeService
{
public
_serviceBrand
:
undefined
;
public
get
linuxDistro
():
LinuxDistro
{
return
linuxDistro
;
}
private
readonly
_on
OpenFileRequest
=
this
.
_register
(
new
Emitter
<
IOpenFileRequest
>
());
public
get
on
OpenFileRequest
():
Event
<
IOpenFileRequest
>
{
return
this
.
_onOpenFileRequest
.
event
;
}
private
readonly
_on
RequestFocusActiveInstance
=
this
.
_register
(
new
Emitter
<
void
>
());
public
get
on
RequestFocusActiveInstance
():
Event
<
void
>
{
return
this
.
_onRequestFocusActiveInstance
.
event
;
}
private
readonly
_onOsResume
=
this
.
_register
(
new
Emitter
<
void
>
());
public
get
onOsResume
():
Event
<
void
>
{
return
this
.
_onOsResume
.
event
;
}
...
...
@@ -36,7 +37,7 @@ export class TerminalNativeService extends Disposable implements ITerminalNative
)
{
super
();
ipcRenderer
.
on
(
'
vscode:openFiles
'
,
(
event
:
unknown
,
request
:
IOpenFileRequest
)
=>
this
.
_onOpenFileRequest
.
fire
(
request
));
ipcRenderer
.
on
(
'
vscode:openFiles
'
,
(
event
:
unknown
,
request
:
IOpenFileRequest
)
=>
this
.
_onOpenFileRequest
(
request
));
this
.
_register
(
electronService
.
onOSResume
(()
=>
this
.
_onOsResume
.
fire
()));
const
connection
=
remoteAgentService
.
getConnection
();
...
...
@@ -45,6 +46,17 @@ export class TerminalNativeService extends Disposable implements ITerminalNative
}
}
private
async
_onOpenFileRequest
(
request
:
INativeOpenFileRequest
):
Promise
<
void
>
{
// if the request to open files is coming in from the integrated terminal (identified though
// the termProgram variable) and we are instructed to wait for editors close, wait for the
// marker file to get deleted and then focus back to the integrated terminal.
if
(
request
.
termProgram
===
'
vscode
'
&&
request
.
filesToWait
)
{
const
waitMarkerFileUri
=
URI
.
revive
(
request
.
filesToWait
.
waitMarkerFileUri
);
await
this
.
whenFileDeleted
(
waitMarkerFileUri
);
this
.
_onRequestFocusActiveInstance
.
fire
();
}
}
public
whenFileDeleted
(
path
:
URI
):
Promise
<
void
>
{
// Complete when wait marker file is deleted
return
new
Promise
<
void
>
(
resolve
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录