Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
59a5aa19
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,发现更多精彩内容 >>
提交
59a5aa19
编写于
5月 05, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add trace logging to extHostDiagnostics, #96837
上级
55e86cd5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
12 deletion
+31
-12
src/vs/workbench/api/common/extHost.api.impl.ts
src/vs/workbench/api/common/extHost.api.impl.ts
+1
-1
src/vs/workbench/api/common/extHostDiagnostics.ts
src/vs/workbench/api/common/extHostDiagnostics.ts
+23
-5
src/vs/workbench/test/browser/api/extHostDiagnostics.test.ts
src/vs/workbench/test/browser/api/extHostDiagnostics.test.ts
+7
-6
未找到文件。
src/vs/workbench/api/common/extHost.api.impl.ts
浏览文件 @
59a5aa19
...
@@ -324,7 +324,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
...
@@ -324,7 +324,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
// namespace: languages
// namespace: languages
const
languages
:
typeof
vscode
.
languages
=
{
const
languages
:
typeof
vscode
.
languages
=
{
createDiagnosticCollection
(
name
?:
string
):
vscode
.
DiagnosticCollection
{
createDiagnosticCollection
(
name
?:
string
):
vscode
.
DiagnosticCollection
{
return
extHostDiagnostics
.
createDiagnosticCollection
(
name
);
return
extHostDiagnostics
.
createDiagnosticCollection
(
extension
.
identifier
,
name
);
},
},
get
onDidChangeDiagnostics
()
{
get
onDidChangeDiagnostics
()
{
return
extHostDiagnostics
.
onDidChangeDiagnostics
;
return
extHostDiagnostics
.
onDidChangeDiagnostics
;
...
...
src/vs/workbench/api/common/extHostDiagnostics.ts
浏览文件 @
59a5aa19
...
@@ -14,6 +14,7 @@ import { mergeSort } from 'vs/base/common/arrays';
...
@@ -14,6 +14,7 @@ import { mergeSort } from 'vs/base/common/arrays';
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
import
{
ResourceMap
}
from
'
vs/base/common/map
'
;
import
{
ExtensionIdentifier
}
from
'
vs/platform/extensions/common/extensions
'
;
export
class
DiagnosticCollection
implements
vscode
.
DiagnosticCollection
{
export
class
DiagnosticCollection
implements
vscode
.
DiagnosticCollection
{
...
@@ -25,7 +26,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
...
@@ -25,7 +26,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
private
readonly
_owner
:
string
,
private
readonly
_owner
:
string
,
private
readonly
_maxDiagnosticsPerFile
:
number
,
private
readonly
_maxDiagnosticsPerFile
:
number
,
private
readonly
_proxy
:
MainThreadDiagnosticsShape
|
undefined
,
private
readonly
_proxy
:
MainThreadDiagnosticsShape
|
undefined
,
private
readonly
_onDidChangeDiagnostics
:
Emitter
<
(
vscode
.
Uri
|
string
)
[]
>
private
readonly
_onDidChangeDiagnostics
:
Emitter
<
vscode
.
Uri
[]
>
)
{
}
)
{
}
dispose
():
void
{
dispose
():
void
{
...
@@ -215,7 +216,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
...
@@ -215,7 +216,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
private
readonly
_proxy
:
MainThreadDiagnosticsShape
;
private
readonly
_proxy
:
MainThreadDiagnosticsShape
;
private
readonly
_collections
=
new
Map
<
string
,
DiagnosticCollection
>
();
private
readonly
_collections
=
new
Map
<
string
,
DiagnosticCollection
>
();
private
readonly
_onDidChangeDiagnostics
=
new
Emitter
<
(
vscode
.
Uri
|
string
)
[]
>
();
private
readonly
_onDidChangeDiagnostics
=
new
Emitter
<
vscode
.
Uri
[]
>
();
static
_debouncer
(
last
:
(
vscode
.
Uri
|
string
)[]
|
undefined
,
current
:
(
vscode
.
Uri
|
string
)[]):
(
vscode
.
Uri
|
string
)[]
{
static
_debouncer
(
last
:
(
vscode
.
Uri
|
string
)[]
|
undefined
,
current
:
(
vscode
.
Uri
|
string
)[]):
(
vscode
.
Uri
|
string
)[]
{
if
(
!
last
)
{
if
(
!
last
)
{
...
@@ -251,8 +252,25 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
...
@@ -251,8 +252,25 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadDiagnostics
);
this
.
_proxy
=
mainContext
.
getProxy
(
MainContext
.
MainThreadDiagnostics
);
}
}
createDiagnosticCollection
(
name
?:
string
):
vscode
.
DiagnosticCollection
{
createDiagnosticCollection
(
extensionId
:
ExtensionIdentifier
,
name
?:
string
):
vscode
.
DiagnosticCollection
{
let
{
_collections
,
_proxy
,
_onDidChangeDiagnostics
}
=
this
;
const
{
_collections
,
_proxy
,
_onDidChangeDiagnostics
,
_logService
}
=
this
;
const
loggingProxy
=
new
class
implements
MainThreadDiagnosticsShape
{
$changeMany
(
owner
:
string
,
entries
:
[
UriComponents
,
IMarkerData
[]
|
undefined
][]):
void
{
_proxy
.
$changeMany
(
owner
,
entries
);
_logService
.
trace
(
'
[DiagnosticCollection] change many (extension, owner, uris)
'
,
extensionId
.
value
,
owner
,
entries
.
length
===
0
?
'
CLEARING
'
:
entries
);
}
$clear
(
owner
:
string
):
void
{
_proxy
.
$clear
(
owner
);
_logService
.
trace
(
'
[DiagnosticCollection] remove all (extension, owner)
'
,
extensionId
.
value
,
owner
);
}
dispose
():
void
{
_proxy
.
dispose
();
}
};
let
owner
:
string
;
let
owner
:
string
;
if
(
!
name
)
{
if
(
!
name
)
{
name
=
'
_generated_diagnostic_collection_name_#
'
+
ExtHostDiagnostics
.
_idPool
++
;
name
=
'
_generated_diagnostic_collection_name_#
'
+
ExtHostDiagnostics
.
_idPool
++
;
...
@@ -268,7 +286,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
...
@@ -268,7 +286,7 @@ export class ExtHostDiagnostics implements ExtHostDiagnosticsShape {
const
result
=
new
class
extends
DiagnosticCollection
{
const
result
=
new
class
extends
DiagnosticCollection
{
constructor
()
{
constructor
()
{
super
(
name
!
,
owner
,
ExtHostDiagnostics
.
_maxDiagnosticsPerFile
,
_p
roxy
,
_onDidChangeDiagnostics
);
super
(
name
!
,
owner
,
ExtHostDiagnostics
.
_maxDiagnosticsPerFile
,
loggingP
roxy
,
_onDidChangeDiagnostics
);
_collections
.
set
(
owner
,
this
);
_collections
.
set
(
owner
,
this
);
}
}
dispose
()
{
dispose
()
{
...
...
src/vs/workbench/test/browser/api/extHostDiagnostics.test.ts
浏览文件 @
59a5aa19
...
@@ -13,6 +13,7 @@ import { mock } from 'vs/workbench/test/browser/api/mock';
...
@@ -13,6 +13,7 @@ import { mock } from 'vs/workbench/test/browser/api/mock';
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
type
*
as
vscode
from
'
vscode
'
;
import
type
*
as
vscode
from
'
vscode
'
;
import
{
nullExtensionDescription
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
suite
(
'
ExtHostDiagnostics
'
,
()
=>
{
suite
(
'
ExtHostDiagnostics
'
,
()
=>
{
...
@@ -286,7 +287,7 @@ suite('ExtHostDiagnostics', () => {
...
@@ -286,7 +287,7 @@ suite('ExtHostDiagnostics', () => {
});
});
test
(
'
diagnostic eventing
'
,
async
function
()
{
test
(
'
diagnostic eventing
'
,
async
function
()
{
let
emitter
=
new
Emitter
<
Array
<
string
|
URI
>>
();
let
emitter
=
new
Emitter
<
Array
<
URI
>>
();
let
collection
=
new
DiagnosticCollection
(
'
ddd
'
,
'
test
'
,
100
,
new
DiagnosticsShape
(),
emitter
);
let
collection
=
new
DiagnosticCollection
(
'
ddd
'
,
'
test
'
,
100
,
new
DiagnosticsShape
(),
emitter
);
let
diag1
=
new
Diagnostic
(
new
Range
(
1
,
1
,
2
,
3
),
'
diag1
'
);
let
diag1
=
new
Diagnostic
(
new
Range
(
1
,
1
,
2
,
3
),
'
diag1
'
);
...
@@ -316,15 +317,15 @@ suite('ExtHostDiagnostics', () => {
...
@@ -316,15 +317,15 @@ suite('ExtHostDiagnostics', () => {
p
=
Event
.
toPromise
(
emitter
.
event
).
then
(
e
=>
{
p
=
Event
.
toPromise
(
emitter
.
event
).
then
(
e
=>
{
assert
.
equal
(
e
.
length
,
2
);
assert
.
equal
(
e
.
length
,
2
);
assert
.
ok
(
typeof
e
[
0
]
===
'
string
'
);
assert
.
ok
(
URI
.
isUri
(
e
[
0
])
);
assert
.
ok
(
typeof
e
[
1
]
===
'
string
'
);
assert
.
ok
(
URI
.
isUri
(
e
[
1
])
);
});
});
collection
.
clear
();
collection
.
clear
();
await
p
;
await
p
;
});
});
test
(
'
vscode.languages.onDidChangeDiagnostics Does Not Provide Document URI #49582
'
,
async
function
()
{
test
(
'
vscode.languages.onDidChangeDiagnostics Does Not Provide Document URI #49582
'
,
async
function
()
{
let
emitter
=
new
Emitter
<
Array
<
string
|
URI
>>
();
let
emitter
=
new
Emitter
<
Array
<
URI
>>
();
let
collection
=
new
DiagnosticCollection
(
'
ddd
'
,
'
test
'
,
100
,
new
DiagnosticsShape
(),
emitter
);
let
collection
=
new
DiagnosticCollection
(
'
ddd
'
,
'
test
'
,
100
,
new
DiagnosticsShape
(),
emitter
);
let
diag1
=
new
Diagnostic
(
new
Range
(
1
,
1
,
2
,
3
),
'
diag1
'
);
let
diag1
=
new
Diagnostic
(
new
Range
(
1
,
1
,
2
,
3
),
'
diag1
'
);
...
@@ -390,8 +391,8 @@ suite('ExtHostDiagnostics', () => {
...
@@ -390,8 +391,8 @@ suite('ExtHostDiagnostics', () => {
}
}
},
new
NullLogService
());
},
new
NullLogService
());
let
collection1
=
diags
.
createDiagnosticCollection
(
'
foo
'
);
let
collection1
=
diags
.
createDiagnosticCollection
(
nullExtensionDescription
.
identifier
,
'
foo
'
);
let
collection2
=
diags
.
createDiagnosticCollection
(
'
foo
'
);
// warns, uses a different owner
let
collection2
=
diags
.
createDiagnosticCollection
(
nullExtensionDescription
.
identifier
,
'
foo
'
);
// warns, uses a different owner
collection1
.
clear
();
collection1
.
clear
();
collection2
.
clear
();
collection2
.
clear
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录