Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
83519f2c
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
83519f2c
编写于
12月 31, 2021
作者:
M
meganrogge
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move consts to terminal.ts, investigate why prompt data is missing
上级
90e1ba1b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
17 deletion
+36
-17
src/vs/workbench/contrib/terminal/browser/terminal.ts
src/vs/workbench/contrib/terminal/browser/terminal.ts
+15
-0
src/vs/workbench/contrib/terminal/browser/xterm/commandTrackerAddon.ts
...nch/contrib/terminal/browser/xterm/commandTrackerAddon.ts
+20
-2
src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts
...workbench/contrib/terminal/browser/xterm/xtermTerminal.ts
+1
-15
未找到文件。
src/vs/workbench/contrib/terminal/browser/terminal.ts
浏览文件 @
83519f2c
...
...
@@ -850,3 +850,18 @@ export const enum LinuxDistro {
Fedora
=
2
,
Ubuntu
=
3
,
}
export
enum
ShellIntegrationInteraction
{
PromptStart
=
'
PROMPT_START
'
,
CommandStart
=
'
COMMAND_START
'
,
CommandExecuted
=
'
COMMAND_EXECUTED
'
,
CommandFinished
=
'
COMMAND_FINISHED
'
}
export
enum
ShellIntegrationInfo
{
RemoteHost
=
'
RemoteHost
'
,
CurrentDir
=
'
CurrentDir
'
,
}
export
interface
IShellChangeEvent
{
type
:
ShellIntegrationInfo
|
ShellIntegrationInteraction
,
value
:
string
}
src/vs/workbench/contrib/terminal/browser/xterm/commandTrackerAddon.ts
浏览文件 @
83519f2c
...
...
@@ -5,6 +5,7 @@
import
type
{
Terminal
,
IMarker
,
ITerminalAddon
}
from
'
xterm
'
;
import
{
ICommandTracker
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
ShellIntegrationInfo
,
ShellIntegrationInteraction
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
/**
* The minimum size of the prompt in which to assume the line is a command.
*/
...
...
@@ -24,16 +25,33 @@ export class CommandTrackerAddon implements ICommandTracker, ITerminalAddon {
private
_selectionStart
:
IMarker
|
Boundary
|
null
=
null
;
private
_isDisposable
:
boolean
=
false
;
private
_terminal
:
Terminal
|
undefined
;
private
_exitCode
:
number
|
undefined
;
private
_cwd
:
string
|
undefined
;
private
_prompt
:
string
|
undefined
;
activate
(
terminal
:
Terminal
):
void
{
this
.
_terminal
=
terminal
;
terminal
.
onIntegratedShellChange
(
e
=>
{
if
(
this
.
_terminal
&&
this
.
_terminal
.
buffer
.
active
.
cursorX
>=
MINIMUM_PROMPT_LENGTH
)
{
if
(
e
.
type
===
'
COMMAND_FINISHED
'
)
{
//TODO check exit code?
if
(
e
.
type
===
ShellIntegrationInteraction
.
CommandFinished
)
{
this
.
_exitCode
=
Number
.
parseInt
(
e
.
value
);
this
.
_terminal
?.
registerMarker
(
0
);
this
.
clearMarker
();
}
}
else
if
(
this
.
_terminal
)
{
if
(
e
.
type
===
ShellIntegrationInfo
.
CurrentDir
)
{
this
.
_cwd
=
e
.
value
;
}
else
if
(
e
.
type
===
ShellIntegrationInfo
.
RemoteHost
)
{
console
.
log
(
'
remote host
'
,
e
.
value
);
console
.
log
(
'
line is
'
,
this
.
_terminal
.
buffer
.
active
.
getLine
(
this
.
_terminal
.
buffer
.
active
.
baseY
)?.
translateToString
());
}
else
if
(
e
.
type
===
ShellIntegrationInteraction
.
PromptStart
)
{
console
.
log
(
'
prompt
'
);
this
.
_prompt
=
this
.
_terminal
.
buffer
.
active
.
getLine
(
0
)?.
translateToString
();
console
.
log
(
'
line is
'
,
this
.
_prompt
);
}
else
if
(
e
.
type
===
ShellIntegrationInteraction
.
CommandStart
)
{
console
.
log
(
'
command start
'
);
this
.
_prompt
=
this
.
_terminal
.
buffer
.
active
.
getLine
(
this
.
_terminal
.
buffer
.
active
.
baseY
)?.
translateToString
();
}
}
});
}
...
...
src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.ts
浏览文件 @
83519f2c
...
...
@@ -15,7 +15,7 @@ import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
import
{
TerminalLocation
,
TerminalSettingId
}
from
'
vs/platform/terminal/common/terminal
'
;
import
{
ICommandTracker
,
ITerminalFont
,
TERMINAL_VIEW_ID
}
from
'
vs/workbench/contrib/terminal/common/terminal
'
;
import
{
isSafari
}
from
'
vs/base/browser/browser
'
;
import
{
IXtermTerminal
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
IXtermTerminal
,
ShellIntegrationInfo
,
ShellIntegrationInteraction
}
from
'
vs/workbench/contrib/terminal/browser/terminal
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
IStorageService
,
StorageScope
,
StorageTarget
}
from
'
vs/platform/storage/common/storage
'
;
import
{
TerminalStorageKeys
}
from
'
vs/workbench/contrib/terminal/common/terminalStorageKeys
'
;
...
...
@@ -511,17 +511,3 @@ export class XtermTerminal extends DisposableStore implements IXtermTerminal {
}
}
}
export
enum
ShellIntegrationInteraction
{
PromptStart
=
'
PROMPT_START
'
,
CommandStart
=
'
COMMAND_START
'
,
CommandExecuted
=
'
COMMAND_EXECUTED
'
,
CommandFinished
=
'
COMMAND_FINISHED
'
}
export
enum
ShellIntegrationInfo
{
RemoteHost
=
'
RemoteHost
'
,
CurrentDir
=
'
CurrentDir
'
,
}
export
interface
IShellChangeEvent
{
type
:
ShellIntegrationInfo
|
ShellIntegrationInteraction
,
value
:
string
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录