Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7ab45337
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,发现更多精彩内容 >>
提交
7ab45337
编写于
6月 13, 2018
作者:
M
Matt Bierner
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Using resource map for storing diagnostic
上级
29198d7e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
25 deletion
+20
-25
extensions/typescript-language-features/src/features/bufferSyncSupport.ts
...cript-language-features/src/features/bufferSyncSupport.ts
+0
-4
extensions/typescript-language-features/src/features/diagnostics.ts
.../typescript-language-features/src/features/diagnostics.ts
+14
-18
extensions/typescript-language-features/src/features/resourceMap.ts
.../typescript-language-features/src/features/resourceMap.ts
+6
-3
未找到文件。
extensions/typescript-language-features/src/features/bufferSyncSupport.ts
浏览文件 @
7ab45337
...
...
@@ -364,7 +364,3 @@ export default class BufferSyncSupport {
return
this
.
client
.
normalizedPath
(
path
);
}
}
export
function
isWindowsPath
(
path
:
string
):
boolean
{
return
/^
[
a-zA-Z
]
:
\\
/
.
test
(
path
);
}
extensions/typescript-language-features/src/features/diagnostics.ts
浏览文件 @
7ab45337
...
...
@@ -4,27 +4,24 @@
*--------------------------------------------------------------------------------------------*/
import
*
as
vscode
from
'
vscode
'
;
import
{
ResourceMap
}
from
'
./resourceMap
'
;
export
class
DiagnosticSet
{
private
_map
:
ObjectMap
<
vscode
.
Diagnostic
[]
>
=
Object
.
create
(
null
);
private
_map
=
new
ResourceMap
<
vscode
.
Diagnostic
[]
>
(
);
public
set
(
file
:
vscode
.
Uri
,
diagnostics
:
vscode
.
Diagnostic
[]
)
{
this
.
_map
[
this
.
key
(
file
)]
=
diagnostics
;
this
.
_map
.
set
(
file
,
diagnostics
)
;
}
public
get
(
file
:
vscode
.
Uri
):
vscode
.
Diagnostic
[]
{
return
this
.
_map
[
this
.
key
(
file
)]
||
[];
return
this
.
_map
.
get
(
file
)
||
[];
}
public
clear
():
void
{
this
.
_map
=
Object
.
create
(
null
);
}
private
key
(
file
:
vscode
.
Uri
):
string
{
return
file
.
toString
(
true
);
this
.
_map
=
new
ResourceMap
<
vscode
.
Diagnostic
[]
>
();
}
}
...
...
@@ -40,7 +37,7 @@ export class DiagnosticsManager {
private
readonly
_diagnostics
=
new
Map
<
DiagnosticKind
,
DiagnosticSet
>
();
private
readonly
_currentDiagnostics
:
vscode
.
DiagnosticCollection
;
private
readonly
_pendingUpdates
:
{
[
key
:
string
]:
any
}
=
Object
.
create
(
null
);
private
_pendingUpdates
=
new
ResourceMap
<
any
>
(
);
private
_validate
:
boolean
=
true
;
private
_enableSuggestions
:
boolean
=
true
;
...
...
@@ -59,10 +56,10 @@ export class DiagnosticsManager {
public
dispose
()
{
this
.
_currentDiagnostics
.
dispose
();
for
(
const
key
of
Object
.
keys
(
this
.
_pendingUpdates
))
{
clearTimeout
(
this
.
_pendingUpdates
[
key
]);
delete
this
.
_pendingUpdates
[
key
];
for
(
const
value
of
this
.
_pendingUpdates
.
values
)
{
clearTimeout
(
value
);
}
this
.
_pendingUpdates
=
new
ResourceMap
<
any
>
();
}
public
reInitialize
():
void
{
...
...
@@ -131,16 +128,15 @@ export class DiagnosticsManager {
}
private
scheduleDiagnosticsUpdate
(
file
:
vscode
.
Uri
)
{
const
key
=
file
.
fsPath
;
if
(
!
this
.
_pendingUpdates
[
key
])
{
this
.
_pendingUpdates
[
key
]
=
setTimeout
(()
=>
this
.
updateCurrentDiagnostics
(
file
),
this
.
updateDelay
);
if
(
!
this
.
_pendingUpdates
.
has
(
file
))
{
this
.
_pendingUpdates
.
set
(
file
,
setTimeout
(()
=>
this
.
updateCurrentDiagnostics
(
file
),
this
.
updateDelay
));
}
}
private
updateCurrentDiagnostics
(
file
:
vscode
.
Uri
)
{
if
(
this
.
_pendingUpdates
[
file
.
fsPath
]
)
{
clearTimeout
(
this
.
_pendingUpdates
[
file
.
fsPath
]
);
delete
this
.
_pendingUpdates
[
file
.
fsPath
]
;
if
(
this
.
_pendingUpdates
.
has
(
file
)
)
{
clearTimeout
(
this
.
_pendingUpdates
.
get
(
file
)
);
this
.
_pendingUpdates
.
delete
(
file
)
;
}
if
(
!
this
.
_validate
)
{
...
...
extensions/typescript-language-features/src/features/resourceMap.ts
浏览文件 @
7ab45337
...
...
@@ -7,7 +7,6 @@ import * as fs from 'fs';
import
{
Uri
}
from
'
vscode
'
;
import
{
memoize
}
from
'
../utils/memoize
'
;
import
{
getTempFile
}
from
'
../utils/temp
'
;
import
{
isWindowsPath
}
from
'
./bufferSyncSupport
'
;
/**
* Maps of file resources
...
...
@@ -19,7 +18,7 @@ export class ResourceMap<T> {
private
readonly
_map
=
new
Map
<
string
,
T
>
();
constructor
(
private
readonly
_normalizePath
:
(
resource
:
Uri
)
=>
string
|
null
private
readonly
_normalizePath
?
:
(
resource
:
Uri
)
=>
string
|
null
)
{
}
public
has
(
resource
:
Uri
):
boolean
{
...
...
@@ -55,7 +54,7 @@ export class ResourceMap<T> {
}
private
toKey
(
resource
:
Uri
):
string
|
null
{
const
key
=
this
.
_normalizePath
(
resourc
e
);
const
key
=
this
.
_normalizePath
?
this
.
_normalizePath
(
resource
)
:
resource
.
toString
(
tru
e
);
if
(
!
key
)
{
return
key
;
}
...
...
@@ -82,3 +81,7 @@ export class ResourceMap<T> {
return
fs
.
existsSync
(
temp
.
toUpperCase
());
}
}
export
function
isWindowsPath
(
path
:
string
):
boolean
{
return
/^
[
a-zA-Z
]
:
\\
/
.
test
(
path
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录