Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
3976cb23
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,发现更多精彩内容 >>
提交
3976cb23
编写于
6月 01, 2018
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #50835
上级
b6764974
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
58 deletion
+48
-58
src/vs/workbench/parts/markers/electron-browser/markersModel.ts
.../workbench/parts/markers/electron-browser/markersModel.ts
+5
-6
src/vs/workbench/parts/markers/test/electron-browser/markersModel.test.ts
.../parts/markers/test/electron-browser/markersModel.test.ts
+43
-52
未找到文件。
src/vs/workbench/parts/markers/electron-browser/markersModel.ts
浏览文件 @
3976cb23
...
...
@@ -35,18 +35,16 @@ export class ResourceMarkers extends NodeWithId {
private
_name
:
string
=
null
;
private
_path
:
string
=
null
;
readonly
markers
:
Marker
[];
markers
:
Marker
[]
=
[];
isExcluded
:
boolean
=
false
;
isIncluded
:
boolean
=
false
;
filteredCount
:
number
;
uriMatches
:
IMatch
[]
=
[];
constructor
(
readonly
uri
:
URI
,
markers
:
Marker
[]
readonly
uri
:
URI
)
{
super
(
uri
.
toString
());
this
.
markers
=
markers
.
sort
(
Marker
.
compare
);
}
public
get
path
():
string
{
...
...
@@ -271,8 +269,8 @@ export class MarkersModel {
private
createResource
(
uri
:
URI
,
rawMarkers
:
IMarker
[]):
ResourceMarkers
{
le
t
markers
:
Marker
[]
=
[];
const
resource
=
new
ResourceMarkers
(
uri
,
markers
);
cons
t
markers
:
Marker
[]
=
[];
const
resource
=
new
ResourceMarkers
(
uri
);
this
.
updateResource
(
resource
);
rawMarkers
.
forEach
((
rawMarker
,
index
)
=>
{
...
...
@@ -285,6 +283,7 @@ export class MarkersModel {
this
.
updateMarker
(
marker
,
resource
);
markers
.
push
(
marker
);
});
resource
.
markers
=
markers
.
sort
(
Marker
.
compare
);
this
.
updateFilteredCount
(
resource
);
...
...
src/vs/workbench/parts/markers/test/electron-browser/markersModel.test.ts
浏览文件 @
3976cb23
...
...
@@ -13,34 +13,25 @@ import { MarkersModel, Marker, ResourceMarkers, RelatedInformation } from 'vs/wo
class
TestMarkersModel
extends
MarkersModel
{
get
filteredResources
():
ResourceMarkers
[]
{
le
t
res
:
ResourceMarkers
[]
=
[];
cons
t
res
:
ResourceMarkers
[]
=
[];
this
.
forEachFilteredResource
(
resource
=>
res
.
push
(
resource
));
return
res
;
}
static
compare
(
a
:
any
,
b
:
any
):
number
{
if
(
a
instanceof
ResourceMarkers
&&
b
instanceof
ResourceMarkers
)
{
return
ResourceMarkers
.
compare
(
a
,
b
);
}
if
(
a
instanceof
Marker
&&
b
instanceof
Marker
)
{
return
Marker
.
compare
(
a
,
b
);
}
return
0
;
}
}
suite
(
'
MarkersModel Test
'
,
()
=>
{
test
(
'
getFilteredResource return markers grouped by resource
'
,
function
()
{
le
t
marker1
=
aMarker
(
'
res1
'
);
le
t
marker2
=
aMarker
(
'
res2
'
);
le
t
marker3
=
aMarker
(
'
res1
'
);
le
t
marker4
=
aMarker
(
'
res3
'
);
le
t
marker5
=
aMarker
(
'
res4
'
);
le
t
marker6
=
aMarker
(
'
res2
'
);
le
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
]);
cons
t
marker1
=
aMarker
(
'
res1
'
);
cons
t
marker2
=
aMarker
(
'
res2
'
);
cons
t
marker3
=
aMarker
(
'
res1
'
);
cons
t
marker4
=
aMarker
(
'
res3
'
);
cons
t
marker5
=
aMarker
(
'
res4
'
);
cons
t
marker6
=
aMarker
(
'
res2
'
);
cons
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
]);
le
t
actuals
=
testObject
.
filteredResources
;
cons
t
actuals
=
testObject
.
filteredResources
;
assert
.
equal
(
4
,
actuals
.
length
);
...
...
@@ -64,15 +55,15 @@ suite('MarkersModel Test', () => {
});
test
(
'
sort palces resources with no errors at the end
'
,
function
()
{
le
t
marker1
=
aMarker
(
'
a/res1
'
,
MarkerSeverity
.
Warning
);
le
t
marker2
=
aMarker
(
'
a/res2
'
);
le
t
marker3
=
aMarker
(
'
res4
'
);
le
t
marker4
=
aMarker
(
'
b/res3
'
);
le
t
marker5
=
aMarker
(
'
res4
'
);
le
t
marker6
=
aMarker
(
'
c/res2
'
,
MarkerSeverity
.
Info
);
le
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
]);
cons
t
marker1
=
aMarker
(
'
a/res1
'
,
MarkerSeverity
.
Warning
);
cons
t
marker2
=
aMarker
(
'
a/res2
'
);
cons
t
marker3
=
aMarker
(
'
res4
'
);
cons
t
marker4
=
aMarker
(
'
b/res3
'
);
cons
t
marker5
=
aMarker
(
'
res4
'
);
cons
t
marker6
=
aMarker
(
'
c/res2
'
,
MarkerSeverity
.
Info
);
cons
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
]);
let
actuals
=
testObject
.
filteredResources
.
sort
(
TestMarkersModel
.
compare
)
;
const
actuals
=
testObject
.
resources
;
assert
.
equal
(
5
,
actuals
.
length
);
assert
.
ok
(
compareResource
(
actuals
[
0
],
'
a/res2
'
));
...
...
@@ -83,15 +74,15 @@ suite('MarkersModel Test', () => {
});
test
(
'
sort resources by file path
'
,
function
()
{
le
t
marker1
=
aMarker
(
'
a/res1
'
);
le
t
marker2
=
aMarker
(
'
a/res2
'
);
le
t
marker3
=
aMarker
(
'
res4
'
);
le
t
marker4
=
aMarker
(
'
b/res3
'
);
le
t
marker5
=
aMarker
(
'
res4
'
);
le
t
marker6
=
aMarker
(
'
c/res2
'
);
le
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
]);
cons
t
marker1
=
aMarker
(
'
a/res1
'
);
cons
t
marker2
=
aMarker
(
'
a/res2
'
);
cons
t
marker3
=
aMarker
(
'
res4
'
);
cons
t
marker4
=
aMarker
(
'
b/res3
'
);
cons
t
marker5
=
aMarker
(
'
res4
'
);
cons
t
marker6
=
aMarker
(
'
c/res2
'
);
cons
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
]);
let
actuals
=
testObject
.
filteredResources
.
sort
(
TestMarkersModel
.
compare
)
;
const
actuals
=
testObject
.
resources
;
assert
.
equal
(
5
,
actuals
.
length
);
assert
.
ok
(
compareResource
(
actuals
[
0
],
'
a/res1
'
));
...
...
@@ -102,24 +93,24 @@ suite('MarkersModel Test', () => {
});
test
(
'
sort markers by severity, line and column
'
,
function
()
{
le
t
marker1
=
aWarningWithRange
(
8
,
1
,
9
,
3
);
le
t
marker2
=
aWarningWithRange
(
3
);
le
t
marker3
=
anErrorWithRange
(
8
,
1
,
9
,
3
);
le
t
marker4
=
anIgnoreWithRange
(
5
);
le
t
marker5
=
anInfoWithRange
(
8
,
1
,
8
,
4
,
'
ab
'
);
le
t
marker6
=
anErrorWithRange
(
3
);
le
t
marker7
=
anErrorWithRange
(
5
);
le
t
marker8
=
anInfoWithRange
(
5
);
le
t
marker9
=
anErrorWithRange
(
8
,
1
,
8
,
4
,
'
ab
'
);
le
t
marker10
=
anErrorWithRange
(
10
);
le
t
marker11
=
anErrorWithRange
(
8
,
1
,
8
,
4
,
'
ba
'
);
le
t
marker12
=
anIgnoreWithRange
(
3
);
le
t
marker13
=
aWarningWithRange
(
5
);
le
t
marker14
=
anErrorWithRange
(
4
);
le
t
marker15
=
anErrorWithRange
(
8
,
2
,
8
,
4
);
le
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
,
marker7
,
marker8
,
marker9
,
marker10
,
marker11
,
marker12
,
marker13
,
marker14
,
marker15
]);
let
actuals
=
testObject
.
filteredResources
[
0
].
markers
.
sort
(
TestMarkersModel
.
compare
)
;
cons
t
marker1
=
aWarningWithRange
(
8
,
1
,
9
,
3
);
cons
t
marker2
=
aWarningWithRange
(
3
);
cons
t
marker3
=
anErrorWithRange
(
8
,
1
,
9
,
3
);
cons
t
marker4
=
anIgnoreWithRange
(
5
);
cons
t
marker5
=
anInfoWithRange
(
8
,
1
,
8
,
4
,
'
ab
'
);
cons
t
marker6
=
anErrorWithRange
(
3
);
cons
t
marker7
=
anErrorWithRange
(
5
);
cons
t
marker8
=
anInfoWithRange
(
5
);
cons
t
marker9
=
anErrorWithRange
(
8
,
1
,
8
,
4
,
'
ab
'
);
cons
t
marker10
=
anErrorWithRange
(
10
);
cons
t
marker11
=
anErrorWithRange
(
8
,
1
,
8
,
4
,
'
ba
'
);
cons
t
marker12
=
anIgnoreWithRange
(
3
);
cons
t
marker13
=
aWarningWithRange
(
5
);
cons
t
marker14
=
anErrorWithRange
(
4
);
cons
t
marker15
=
anErrorWithRange
(
8
,
2
,
8
,
4
);
cons
t
testObject
=
new
TestMarkersModel
([
marker1
,
marker2
,
marker3
,
marker4
,
marker5
,
marker6
,
marker7
,
marker8
,
marker9
,
marker10
,
marker11
,
marker12
,
marker13
,
marker14
,
marker15
]);
const
actuals
=
testObject
.
resources
[
0
].
markers
;
assert
.
equal
(
actuals
[
0
].
raw
,
marker6
);
assert
.
equal
(
actuals
[
1
].
raw
,
marker14
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录