Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0a280639
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,发现更多精彩内容 >>
提交
0a280639
编写于
5月 03, 2018
作者:
I
isidor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug: base debug view tests
上级
1670e102
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
95 addition
and
5 deletion
+95
-5
src/vs/workbench/parts/debug/browser/baseDebugView.ts
src/vs/workbench/parts/debug/browser/baseDebugView.ts
+2
-2
src/vs/workbench/parts/debug/electron-browser/replViewer.ts
src/vs/workbench/parts/debug/electron-browser/replViewer.ts
+1
-1
src/vs/workbench/parts/debug/electron-browser/variablesView.ts
...s/workbench/parts/debug/electron-browser/variablesView.ts
+1
-1
src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts
...ench/parts/debug/electron-browser/watchExpressionsView.ts
+1
-1
src/vs/workbench/parts/debug/test/browser/baseDebugView.test.ts
.../workbench/parts/debug/test/browser/baseDebugView.test.ts
+90
-0
未找到文件。
src/vs/workbench/parts/debug/browser/baseDebugView.ts
浏览文件 @
0a280639
...
...
@@ -50,7 +50,7 @@ export function renderViewTree(container: HTMLElement): HTMLElement {
return
treeContainer
;
}
function
replaceWhitespace
(
value
:
string
):
string
{
export
function
replaceWhitespace
(
value
:
string
):
string
{
const
map
:
{
[
x
:
string
]:
string
}
=
{
'
\n
'
:
'
\\
n
'
,
'
\r
'
:
'
\\
r
'
,
'
\t
'
:
'
\\
t
'
};
return
value
.
replace
(
/
[\n\r\t]
/g
,
char
=>
map
[
char
]);
}
...
...
@@ -98,7 +98,7 @@ export function renderExpressionValue(expressionOrValue: IExpression | string, c
}
}
export
function
renderVariable
(
tree
:
ITree
,
variable
:
Variable
,
data
:
IVariableTemplateData
,
showChanged
:
boolean
):
void
{
export
function
renderVariable
(
variable
:
Variable
,
data
:
IVariableTemplateData
,
showChanged
:
boolean
):
void
{
if
(
variable
.
available
)
{
data
.
name
.
textContent
=
replaceWhitespace
(
variable
.
name
);
data
.
name
.
title
=
variable
.
type
?
variable
.
type
:
variable
.
name
;
...
...
src/vs/workbench/parts/debug/electron-browser/replViewer.ts
浏览文件 @
0a280639
...
...
@@ -223,7 +223,7 @@ export class ReplExpressionsRenderer implements IRenderer {
public
renderElement
(
tree
:
ITree
,
element
:
any
,
templateId
:
string
,
templateData
:
any
):
void
{
if
(
templateId
===
ReplExpressionsRenderer
.
VARIABLE_TEMPLATE_ID
)
{
renderVariable
(
tree
,
element
,
templateData
,
false
);
renderVariable
(
element
,
templateData
,
false
);
}
else
if
(
templateId
===
ReplExpressionsRenderer
.
EXPRESSION_TEMPLATE_ID
)
{
this
.
renderExpression
(
tree
,
element
,
templateData
);
}
else
if
(
templateId
===
ReplExpressionsRenderer
.
SIMPLE_REPL_ELEMENT_TEMPLATE_ID
)
{
...
...
src/vs/workbench/parts/debug/electron-browser/variablesView.ts
浏览文件 @
0a280639
...
...
@@ -284,7 +284,7 @@ export class VariablesRenderer implements IRenderer {
}
});
}
else
{
renderVariable
(
tree
,
variable
,
templateData
,
true
);
renderVariable
(
variable
,
templateData
,
true
);
}
}
}
...
...
src/vs/workbench/parts/debug/electron-browser/watchExpressionsView.ts
浏览文件 @
0a280639
...
...
@@ -284,7 +284,7 @@ class WatchExpressionsRenderer implements IRenderer {
if
(
templateId
===
WatchExpressionsRenderer
.
WATCH_EXPRESSION_TEMPLATE_ID
)
{
this
.
renderWatchExpression
(
tree
,
element
,
templateData
);
}
else
{
renderVariable
(
tree
,
element
,
templateData
,
true
);
renderVariable
(
element
,
templateData
,
true
);
}
}
...
...
src/vs/workbench/parts/debug/test/browser/baseDebugView.test.ts
0 → 100644
浏览文件 @
0a280639
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
assert
from
'
assert
'
;
import
{
replaceWhitespace
,
renderExpressionValue
,
renderVariable
}
from
'
vs/workbench/parts/debug/browser/baseDebugView
'
;
import
*
as
dom
from
'
vs/base/browser/dom
'
;
import
{
Expression
,
Variable
,
Process
,
Scope
,
StackFrame
,
Thread
}
from
'
vs/workbench/parts/debug/common/debugModel
'
;
import
{
MockSession
}
from
'
vs/workbench/parts/debug/test/common/mockDebug
'
;
const
$
=
dom
.
$
;
suite
(
'
Debug - Base Debug View
'
,
()
=>
{
test
(
'
replace whitespace
'
,
()
=>
{
assert
.
equal
(
replaceWhitespace
(
'
hey there
'
),
'
hey there
'
);
assert
.
equal
(
replaceWhitespace
(
'
hey there
\n
'
),
'
hey there
\\
n
'
);
assert
.
equal
(
replaceWhitespace
(
'
hey
\r
there
\n\t
'
),
'
hey
\\
r there
\\
n
\\
t
'
);
assert
.
equal
(
replaceWhitespace
(
'
hey
\r\t\n\t\t\n
there
'
),
'
hey
\\
r
\\
t
\\
n
\\
t
\\
t
\\
n there
'
);
});
test
(
'
render expression value
'
,
()
=>
{
let
container
=
$
(
'
.container
'
);
renderExpressionValue
(
'
render
\n
me
'
,
container
,
{
showHover
:
true
,
preserveWhitespace
:
true
});
assert
.
equal
(
container
.
className
,
'
value
'
);
assert
.
equal
(
container
.
title
,
'
render
\n
me
'
);
assert
.
equal
(
container
.
textContent
,
'
render
\n
me
'
);
const
expression
=
new
Expression
(
'
console
'
);
expression
.
value
=
'
Object
'
;
container
=
$
(
'
.container
'
);
renderExpressionValue
(
expression
,
container
,
{
colorize
:
true
});
assert
.
equal
(
container
.
className
,
'
value unavailable error
'
);
expression
.
available
=
true
;
expression
.
value
=
'
"string value"
'
;
container
=
$
(
'
.container
'
);
renderExpressionValue
(
expression
,
container
,
{
colorize
:
true
});
assert
.
equal
(
container
.
className
,
'
value string
'
);
assert
.
equal
(
container
.
textContent
,
'
"string value"
'
);
expression
.
type
=
'
boolean
'
;
container
=
$
(
'
.container
'
);
renderExpressionValue
(
expression
,
container
,
{
colorize
:
true
});
assert
.
equal
(
container
.
className
,
'
value boolean
'
);
assert
.
equal
(
container
.
textContent
,
expression
.
value
);
expression
.
value
=
'
this is a long string
'
;
container
=
$
(
'
.container
'
);
renderExpressionValue
(
expression
,
container
,
{
colorize
:
true
,
maxValueLength
:
4
});
assert
.
equal
(
container
.
textContent
,
'
this...
'
);
});
test
(
'
render variable
'
,
()
=>
{
const
rawSession
=
new
MockSession
();
const
process
=
new
Process
({
name
:
'
mockProcess
'
,
type
:
'
node
'
,
request
:
'
launch
'
},
rawSession
);
const
thread
=
new
Thread
(
process
,
'
mockthread
'
,
1
);
const
stackFrame
=
new
StackFrame
(
thread
,
1
,
null
,
'
app.js
'
,
'
normal
'
,
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
undefined
,
endColumn
:
undefined
},
0
);
const
scope
=
new
Scope
(
stackFrame
,
1
,
'
local
'
,
1
,
false
,
10
,
10
);
let
variable
=
new
Variable
(
process
,
scope
,
2
,
'
foo
'
,
'
bar.foo
'
,
undefined
,
0
,
0
,
{},
'
string
'
);
let
expression
=
$
(
'
.
'
);
let
name
=
$
(
'
.
'
);
let
value
=
$
(
'
.
'
);
renderVariable
(
variable
,
{
expression
,
name
,
value
},
false
);
assert
.
equal
(
name
.
textContent
,
'
foo
'
);
assert
.
equal
(
value
.
textContent
,
''
);
assert
.
equal
(
value
.
title
,
''
);
variable
.
value
=
'
hey
'
;
expression
=
$
(
'
.
'
);
name
=
$
(
'
.
'
);
value
=
$
(
'
.
'
);
renderVariable
(
variable
,
{
expression
,
name
,
value
},
false
);
assert
.
equal
(
value
.
textContent
,
'
hey
'
);
assert
.
equal
(
name
.
textContent
,
'
foo:
'
);
assert
.
equal
(
name
.
title
,
'
string
'
);
variable
=
new
Variable
(
process
,
scope
,
2
,
'
console
'
,
'
console
'
,
'
5
'
,
0
,
0
,
{
kind
:
'
virtual
'
});
expression
=
$
(
'
.
'
);
name
=
$
(
'
.
'
);
value
=
$
(
'
.
'
);
renderVariable
(
variable
,
{
expression
,
name
,
value
},
false
);
assert
.
equal
(
name
.
className
,
'
virtual
'
);
assert
.
equal
(
name
.
textContent
,
'
console:
'
);
assert
.
equal
(
name
.
title
,
'
console
'
);
assert
.
equal
(
value
.
className
,
'
value number
'
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录