Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
ddae83d3
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,发现更多精彩内容 >>
提交
ddae83d3
编写于
3月 24, 2017
作者:
D
Dirk Baeumer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
First step to add problem link detectors to the terminal.
上级
f10f31e7
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
51 addition
and
7 deletion
+51
-7
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
...rkbench/parts/tasks/electron-browser/task.contribution.ts
+3
-1
src/vs/workbench/parts/tasks/electron-browser/terminalTaskSystem.ts
...kbench/parts/tasks/electron-browser/terminalTaskSystem.ts
+48
-6
未找到文件。
src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts
浏览文件 @
ddae83d3
...
...
@@ -508,7 +508,8 @@ class TaskService extends EventEmitter implements ITaskService {
@
IQuickOpenService
quickOpenService
:
IQuickOpenService
,
@
IEnvironmentService
private
environmentService
:
IEnvironmentService
,
@
IConfigurationResolverService
private
configurationResolverService
:
IConfigurationResolverService
,
@
ITerminalService
private
terminalService
:
ITerminalService
@
ITerminalService
private
terminalService
:
ITerminalService
,
@
IWorkbenchEditorService
private
workbenchEditorService
:
IWorkbenchEditorService
)
{
super
();
...
...
@@ -787,6 +788,7 @@ class TaskService extends EventEmitter implements ITaskService {
this
.
_taskSystem
=
new
TerminalTaskSystem
(
this
.
terminalService
,
this
.
outputService
,
this
.
markerService
,
this
.
modelService
,
this
.
configurationResolverService
,
this
.
telemetryService
,
this
.
workbenchEditorService
,
TaskService
.
OutputChannelId
);
}
else
{
...
...
src/vs/workbench/parts/tasks/electron-browser/terminalTaskSystem.ts
浏览文件 @
ddae83d3
...
...
@@ -20,12 +20,14 @@ import { EventEmitter } from 'vs/base/common/eventEmitter';
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
TerminateResponse
}
from
'
vs/base/common/processes
'
;
import
*
as
TPath
from
'
vs/base/common/paths
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ProblemMatcher
}
from
'
vs/platform/markers/common/problemMatcher
'
;
import
{
ProblemMatcher
,
ProblemPattern
,
getResource
}
from
'
vs/platform/markers/common/problemMatcher
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkbenchEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IConfigurationResolverService
}
from
'
vs/workbench/services/configurationResolver/common/configurationResolver
'
;
import
{
ITerminalService
,
ITerminalInstance
,
IShellLaunchConfig
}
from
'
vs/workbench/parts/terminal/common/terminal
'
;
import
{
IOutputService
,
IOutputChannel
}
from
'
vs/workbench/parts/output/common/output
'
;
...
...
@@ -71,7 +73,7 @@ class TerminalDecoder {
idx
++
;
}
}
this
.
remaining
=
start
<
value
.
length
?
value
.
substr
(
start
)
:
null
;
this
.
remaining
=
start
<
value
.
length
?
value
.
substr
(
start
)
:
undefined
;
return
result
;
}
...
...
@@ -107,8 +109,11 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
private
idleTaskTerminals
:
IStringDictionary
<
string
>
;
constructor
(
private
terminalService
:
ITerminalService
,
private
outputService
:
IOutputService
,
private
markerService
:
IMarkerService
,
private
modelService
:
IModelService
,
private
configurationResolverService
:
IConfigurationResolverService
,
private
telemetryService
:
ITelemetryService
,
outputChannelId
:
string
)
{
private
markerService
:
IMarkerService
,
private
modelService
:
IModelService
,
private
configurationResolverService
:
IConfigurationResolverService
,
private
telemetryService
:
ITelemetryService
,
private
workbenchEditorService
:
IWorkbenchEditorService
,
outputChannelId
:
string
)
{
super
();
this
.
outputChannel
=
this
.
outputService
.
getChannel
(
outputChannelId
);
...
...
@@ -249,6 +254,10 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
this
.
primaryTerminal
.
busy
=
false
;
}
this
.
idleTaskTerminals
[
task
.
_id
]
=
terminal
.
id
.
toString
();
let
remaining
=
decoder
.
end
();
if
(
remaining
)
{
watchingProblemMatcher
.
processLine
(
remaining
);
}
watchingProblemMatcher
.
dispose
();
toUnbind
=
dispose
(
toUnbind
);
toUnbind
=
null
;
...
...
@@ -268,7 +277,9 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
[
terminal
,
executedCommand
]
=
this
.
createTerminal
(
task
);
this
.
emit
(
TaskSystemEvents
.
Active
,
event
);
let
decoder
=
new
TerminalDecoder
();
let
startStopProblemMatcher
=
new
StartStopProblemCollector
(
this
.
resolveMatchers
(
task
.
problemMatchers
),
this
.
markerService
,
this
.
modelService
);
let
problemMatchers
=
this
.
resolveMatchers
(
task
.
problemMatchers
);
let
startStopProblemMatcher
=
new
StartStopProblemCollector
(
problemMatchers
,
this
.
markerService
,
this
.
modelService
);
// const registeredMatchers = this.registerLinkMatchers(terminal, problemMatchers);
const
onData
=
terminal
.
onData
((
data
:
string
)
=>
{
decoder
.
write
(
data
).
forEach
((
line
)
=>
{
startStopProblemMatcher
.
processLine
(
line
);
...
...
@@ -282,9 +293,13 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
this
.
primaryTerminal
.
busy
=
false
;
}
this
.
idleTaskTerminals
[
task
.
_id
]
=
terminal
.
id
.
toString
();
startStopProblemMatcher
.
processLine
(
decoder
.
end
());
let
remaining
=
decoder
.
end
();
if
(
remaining
)
{
startStopProblemMatcher
.
processLine
(
remaining
);
}
startStopProblemMatcher
.
done
();
startStopProblemMatcher
.
dispose
();
// registeredMatchers.forEach(handle => terminal.deregisterLinkMatcher(handle));
this
.
emit
(
TaskSystemEvents
.
Inactive
,
event
);
resolve
({
exitCode
});
});
...
...
@@ -556,6 +571,33 @@ export class TerminalTaskSystem extends EventEmitter implements ITaskSystem {
return
result
;
}
protected
registerLinkMatchers
(
terminal
:
ITerminalInstance
,
problemMatchers
:
ProblemMatcher
[]):
number
[]
{
let
result
:
number
[]
=
[];
let
handlePattern
=
(
matcher
:
ProblemMatcher
,
pattern
:
ProblemPattern
):
void
=>
{
if
(
pattern
.
regexp
instanceof
RegExp
&&
Types
.
isNumber
(
pattern
.
file
))
{
result
.
push
(
terminal
.
registerLinkMatcher
(
pattern
.
regexp
,
(
match
:
string
)
=>
{
let
resource
:
URI
=
getResource
(
match
,
matcher
);
if
(
resource
)
{
this
.
workbenchEditorService
.
openEditor
({
resource
:
resource
});
}
},
pattern
.
file
));
}
};
for
(
let
problemMatcher
of
problemMatchers
)
{
if
(
Array
.
isArray
(
problemMatcher
.
pattern
))
{
for
(
let
pattern
of
problemMatcher
.
pattern
)
{
handlePattern
(
problemMatcher
,
pattern
);
}
}
else
if
(
problemMatcher
.
pattern
)
{
handlePattern
(
problemMatcher
,
problemMatcher
.
pattern
);
}
}
return
result
;
}
private
static
doubleQuotes
=
/^
[^
"
]
.* .*
[^
"
]
$/
;
protected
ensureDoubleQuotes
(
value
:
string
)
{
if
(
TerminalTaskSystem
.
doubleQuotes
.
test
(
value
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录