Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
27cc191a
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,发现更多精彩内容 >>
提交
27cc191a
编写于
12月 12, 2016
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: go back to old treatment of new lines
上级
6df46e21
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
22 deletion
+16
-22
src/vs/workbench/parts/debug/common/debugModel.ts
src/vs/workbench/parts/debug/common/debugModel.ts
+11
-7
src/vs/workbench/parts/debug/test/node/debugModel.test.ts
src/vs/workbench/parts/debug/test/node/debugModel.test.ts
+5
-15
未找到文件。
src/vs/workbench/parts/debug/common/debugModel.ts
浏览文件 @
27cc191a
...
...
@@ -12,7 +12,6 @@ import { generateUuid } from 'vs/base/common/uuid';
import
{
clone
}
from
'
vs/base/common/objects
'
;
import
severity
from
'
vs/base/common/severity
'
;
import
{
isObject
,
isString
}
from
'
vs/base/common/types
'
;
import
*
as
strings
from
'
vs/base/common/strings
'
;
import
{
distinct
}
from
'
vs/base/common/arrays
'
;
import
{
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
...
...
@@ -812,26 +811,31 @@ export class Model implements debug.IModel {
public
addReplExpression
(
process
:
debug
.
IProcess
,
stackFrame
:
debug
.
IStackFrame
,
name
:
string
):
TPromise
<
void
>
{
const
expression
=
new
Expression
(
name
);
this
.
addReplElement
(
expression
);
this
.
addReplElement
s
([
expression
]
);
return
expression
.
evaluate
(
process
,
stackFrame
,
'
repl
'
)
.
then
(()
=>
this
.
_onDidChangeREPLElements
.
fire
());
}
public
appendToRepl
(
output
:
string
|
debug
.
IExpression
,
severity
:
severity
):
void
{
const
previousOutput
=
this
.
replElements
.
length
&&
(
this
.
replElements
[
this
.
replElements
.
length
-
1
]
as
OutputElement
);
if
(
previousOutput
instanceof
OutputElement
&&
s
trings
.
endsWith
(
previousOutput
.
value
,
'
\n
'
)
&&
s
everity
===
previousOutput
.
severity
&&
previousOutput
.
value
===
output
&&
output
.
trim
())
{
if
(
previousOutput
instanceof
OutputElement
&&
severity
===
previousOutput
.
severity
&&
previousOutput
.
value
===
output
&&
output
.
trim
())
{
// we got the same output (but not an empty string when trimmed) so we just increment the counter
previousOutput
.
counter
++
;
}
else
{
const
newReplElement
=
typeof
output
===
'
string
'
?
new
OutputElement
(
output
,
severity
)
:
output
;
this
.
addReplElement
(
newReplElement
);
if
(
previousOutput
&&
previousOutput
.
value
===
''
)
{
// remove potential empty lines between different output types
this
.
replElements
.
pop
();
}
const
newReplElements
=
typeof
output
===
'
string
'
?
output
.
split
(
'
\n
'
).
map
(
line
=>
new
OutputElement
(
line
,
severity
))
:
[
output
];
this
.
addReplElements
(
newReplElements
);
}
this
.
_onDidChangeREPLElements
.
fire
();
}
private
addReplElement
(
newElement
:
debug
.
ITreeElement
):
void
{
this
.
replElements
.
push
(
newElement
);
private
addReplElement
s
(
newElements
:
debug
.
ITreeElement
[]
):
void
{
this
.
replElements
.
push
(
...
newElements
);
if
(
this
.
replElements
.
length
>
MAX_REPL_LENGTH
)
{
this
.
replElements
.
splice
(
0
,
this
.
replElements
.
length
-
MAX_REPL_LENGTH
);
}
...
...
src/vs/workbench/parts/debug/test/node/debugModel.test.ts
浏览文件 @
27cc191a
...
...
@@ -358,16 +358,16 @@ suite('Debug - Model', () => {
test
(
'
repl output
'
,
()
=>
{
model
.
appendToRepl
(
'
first line
\n
'
,
severity
.
Error
);
model
.
appendToRepl
(
'
second line
\n
'
,
severity
.
Warning
);
model
.
appendToRepl
(
'
second line
\n
'
,
severity
.
Warning
);
model
.
appendToRepl
(
'
second line
\n
'
,
severity
.
Error
);
model
.
appendToRepl
(
'
second line
'
,
severity
.
Warning
);
model
.
appendToRepl
(
'
second line
'
,
severity
.
Warning
);
model
.
appendToRepl
(
'
second line
'
,
severity
.
Error
);
let
elements
=
<
OutputElement
[]
>
model
.
getReplElements
();
assert
.
equal
(
elements
.
length
,
3
);
assert
.
equal
(
elements
[
0
].
value
,
'
first line
\n
'
);
assert
.
equal
(
elements
[
0
].
value
,
'
first line
'
);
assert
.
equal
(
elements
[
0
].
counter
,
1
);
assert
.
equal
(
elements
[
0
].
severity
,
severity
.
Error
);
assert
.
equal
(
elements
[
1
].
value
,
'
second line
\n
'
);
assert
.
equal
(
elements
[
1
].
value
,
'
second line
'
);
assert
.
equal
(
elements
[
1
].
counter
,
2
);
assert
.
equal
(
elements
[
1
].
severity
,
severity
.
Warning
);
...
...
@@ -383,16 +383,6 @@ suite('Debug - Model', () => {
assert
.
equal
(
element
.
value
,
'
Object
'
);
assert
.
deepEqual
(
element
.
valueObj
,
keyValueObject
);
const
multiLineContent
=
'
multi line
\n
string
\n
last line
'
;
model
.
appendToRepl
(
multiLineContent
,
severity
.
Info
);
const
multiLineElement
=
<
OutputElement
>
model
.
getReplElements
()[
5
];
assert
.
equal
(
multiLineElement
.
value
,
multiLineContent
);
assert
.
equal
(
model
.
getReplElements
().
length
,
6
);
model
.
appendToRepl
(
'
second line
'
,
severity
.
Warning
);
assert
.
equal
((
<
OutputElement
>
model
.
getReplElements
()[
6
]).
value
,
'
second line
'
);
model
.
removeReplExpressions
();
assert
.
equal
(
model
.
getReplElements
().
length
,
0
);
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录