Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8e95a312
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,发现更多精彩内容 >>
未验证
提交
8e95a312
编写于
6月 04, 2018
作者:
I
Isidor Nikolic
提交者:
GitHub
6月 04, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #49764 from danielfrankcom/#47457/background
Added background ANSI colour codes
上级
3de69510
29b9dafd
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
55 addition
and
9 deletion
+55
-9
src/vs/workbench/parts/debug/browser/debugANSIHandling.ts
src/vs/workbench/parts/debug/browser/debugANSIHandling.ts
+10
-5
src/vs/workbench/parts/debug/browser/media/repl.css
src/vs/workbench/parts/debug/browser/media/repl.css
+27
-0
src/vs/workbench/parts/debug/test/browser/debugANSIHandling.test.ts
...kbench/parts/debug/test/browser/debugANSIHandling.test.ts
+18
-4
未找到文件。
src/vs/workbench/parts/debug/browser/debugANSIHandling.ts
浏览文件 @
8e95a312
...
...
@@ -56,12 +56,12 @@ export function handleANSIOutput(text: string, linkDetector: LinkDetector): HTML
* Certain ranges that are matched here do not contain real graphics rendition sequences. For
* the sake of having a simpler expression, they have been included anyway.
*/
if
(
ansiSequence
.
match
(
/^
(?:[
3
9
][
0-7
]
|
[
0-8
]
|39
)(?:
;
(?:[
39
][
0-7
]
|
[
0-8
]
|3
9
))
*;
?
m$/
))
{
if
(
ansiSequence
.
match
(
/^
(?:[
3
49
][
0-7
]
|10
[
0-7
]
|
[
01
]
|4|
[
34
]
9
)(?:
;
(?:[
349
][
0-7
]
|10
[
0-7
]
|
[
01
]
|4|
[
34
]
9
))
*;
?
m$/
))
{
const
styleCodes
:
number
[]
=
ansiSequence
.
slice
(
0
,
-
1
)
// Remove final 'm' character.
.
split
(
'
;
'
)
// Separate style codes.
.
filter
(
elem
=>
elem
!==
''
)
// Filter empty elems as '34;m' -> ['34', ''].
.
map
(
elem
=>
parseInt
(
elem
,
10
));
// Convert to numbers.
.
split
(
'
;
'
)
// Separate style codes.
.
filter
(
elem
=>
elem
!==
''
)
// Filter empty elems as '34;m' -> ['34', ''].
.
map
(
elem
=>
parseInt
(
elem
,
10
));
// Convert to numbers.
for
(
let
code
of
styleCodes
)
{
if
(
code
===
0
)
{
...
...
@@ -75,6 +75,11 @@ export function handleANSIOutput(text: string, linkDetector: LinkDetector): HTML
}
else
if
(
code
===
39
)
{
// Remove all foreground colour codes
styleNames
=
styleNames
.
filter
(
style
=>
!
style
.
match
(
/^code-foreground-
\d
+$/
));
}
else
if
((
code
>=
40
&&
code
<=
47
)
||
(
code
>=
100
&&
code
<=
107
))
{
styleNames
.
push
(
'
code-background-
'
+
code
);
}
else
if
(
code
===
49
)
{
// Remove all background colour codes
styleNames
=
styleNames
.
filter
(
style
=>
!
style
.
match
(
/^code-background-
\d
+$/
));
}
}
...
...
@@ -127,4 +132,4 @@ export function appendStylizedStringToContainer(root: HTMLElement, stringContent
container
.
className
=
cssClasses
.
join
(
'
'
);
root
.
appendChild
(
container
);
}
\ No newline at end of file
}
src/vs/workbench/parts/debug/browser/media/repl.css
浏览文件 @
8e95a312
...
...
@@ -175,6 +175,15 @@
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-36
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-96
{
color
:
darkcyan
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-37
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-97
{
color
:
#BDBDBD
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-40
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-100
{
background-color
:
gray
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-41
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-101
{
background-color
:
#BE1717
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-42
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-102
{
background-color
:
#338A2F
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-43
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-103
{
background-color
:
#BEB817
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-44
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-104
{
background-color
:
darkblue
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-45
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-105
{
background-color
:
darkmagenta
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-46
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-106
{
background-color
:
darkcyan
;
}
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-47
,
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-107
{
background-color
:
#BDBDBD
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-30
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-90
{
color
:
#A0A0A0
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-31
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-91
{
color
:
#A74747
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-32
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-92
{
color
:
#348F34
;
}
...
...
@@ -184,6 +193,15 @@
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-36
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-96
{
color
:
#218D8D
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-37
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-97
{
color
:
#707070
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-40
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-100
{
background-color
:
#A0A0A0
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-41
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-101
{
background-color
:
#A74747
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-42
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-102
{
background-color
:
#348F34
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-43
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-103
{
background-color
:
#5F4C29
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-44
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-104
{
background-color
:
#6286BB
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-45
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-105
{
background-color
:
#914191
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-46
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-106
{
background-color
:
#218D8D
;
}
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-47
,
.vs-dark
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-107
{
background-color
:
#707070
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-30
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-90
{
color
:
gray
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-31
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-91
{
color
:
#A74747
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-32
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-92
{
color
:
#348F34
;
}
...
...
@@ -193,6 +211,15 @@
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-36
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-96
{
color
:
#218D8D
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-37
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-foreground-97
{
color
:
#707070
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-40
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-100
{
background-color
:
gray
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-41
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-101
{
background-color
:
#A74747
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-42
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-102
{
background-color
:
#348F34
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-43
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-103
{
background-color
:
#5F4C29
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-44
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-104
{
background-color
:
#6286BB
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-45
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-105
{
background-color
:
#914191
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-46
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-106
{
background-color
:
#218D8D
;
}
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-47
,
.hc-black
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
.code-background-107
{
background-color
:
#707070
;
}
/* Links */
.monaco-workbench
.repl
.repl-tree
.monaco-tree
.monaco-tree-row
>
.content
>
.output.expression
a
{
text-decoration
:
underline
;
...
...
src/vs/workbench/parts/debug/test/browser/debugANSIHandling.test.ts
浏览文件 @
8e95a312
...
...
@@ -111,6 +111,20 @@ suite('Debug - ANSI Handling', () => {
});
}
for
(
let
i
=
40
;
i
<=
47
;
i
++
)
{
const
style
:
string
=
'
code-background-
'
+
i
;
// Foreground colour codes
assertSingleSequenceElement
(
'
\
x1b[
'
+
i
+
'
m
'
,
(
child
)
=>
{
assert
(
dom
.
hasClass
(
child
,
style
));
});
// Cancellation code removes colour code
assertSingleSequenceElement
(
'
\
x1b[
'
+
i
+
'
;49m
'
,
(
child
)
=>
{
assert
(
dom
.
hasClass
(
child
,
style
)
===
false
);
});
}
// Codes do not interfere
assertSingleSequenceElement
(
'
\
x1b[1;4;30;31;32;33;34;35;36;37m
'
,
(
child
)
=>
{
assert
.
equal
(
10
,
child
.
classList
.
length
);
...
...
@@ -134,8 +148,8 @@ suite('Debug - ANSI Handling', () => {
assert
(
dom
.
hasClass
(
child
,
'
code-underline
'
));
});
// Cancellation code removes
all
codes
assertSingleSequenceElement
(
'
\
x1b[1;4;30;
31;32;33;34;35;36;3
7;0m
'
,
(
child
)
=>
{
// Cancellation code removes
multiple
codes
assertSingleSequenceElement
(
'
\
x1b[1;4;30;
41;32;43;34;45;36;4
7;0m
'
,
(
child
)
=>
{
assert
.
equal
(
0
,
child
.
classList
.
length
);
});
...
...
@@ -244,8 +258,8 @@ suite('Debug - ANSI Handling', () => {
'
\
x1b[1;;m
'
,
'
\
x1b[m
'
,
// Unsupported colour codes
'
\
x1b[30;
4
0m
'
,
'
\
x1b[
100
m
'
'
\
x1b[30;
5
0m
'
,
'
\
x1b[
99
m
'
];
sequences
.
forEach
(
sequence
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录