Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
de04973a
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,发现更多精彩内容 >>
提交
de04973a
编写于
2月 19, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up AbstractModeWorker around ValidationHelper
上级
cc45c4ef
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
41 deletion
+19
-41
src/vs/editor/common/modes/abstractModeWorker.ts
src/vs/editor/common/modes/abstractModeWorker.ts
+11
-33
src/vs/editor/common/worker/validationHelper.ts
src/vs/editor/common/worker/validationHelper.ts
+8
-2
src/vs/languages/typescript/common/typescriptWorker2.ts
src/vs/languages/typescript/common/typescriptWorker2.ts
+0
-6
未找到文件。
src/vs/editor/common/modes/abstractModeWorker.ts
浏览文件 @
de04973a
...
...
@@ -8,7 +8,6 @@ import URI from 'vs/base/common/uri';
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IResourceService
}
from
'
vs/editor/common/services/resourceService
'
;
import
{
ValidationHelper
}
from
'
vs/editor/common/worker/validationHelper
'
;
import
EditorCommon
=
require
(
'
vs/editor/common/editorCommon
'
);
import
Modes
=
require
(
'
vs/editor/common/modes
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
...
@@ -23,8 +22,12 @@ export class AbstractModeWorker {
_validationHelper
:
ValidationHelper
;
constructor
(
mode
:
Modes
.
IMode
,
participants
:
Modes
.
IWorkerParticipant
[],
@
IResourceService
resourceService
:
IResourceService
,
@
IMarkerService
markerService
:
IMarkerService
)
{
constructor
(
mode
:
Modes
.
IMode
,
participants
:
Modes
.
IWorkerParticipant
[],
@
IResourceService
resourceService
:
IResourceService
,
@
IMarkerService
markerService
:
IMarkerService
)
{
this
.
_mode
=
mode
;
this
.
_participants
=
participants
;
...
...
@@ -33,8 +36,8 @@ export class AbstractModeWorker {
this
.
_validationHelper
=
new
ValidationHelper
(
this
.
resourceService
,
(
changed
,
notChanged
,
dueToConfigurationChange
)
=>
this
.
_newValidate
(
changed
,
notChanged
,
dueToConfigurationChang
e
),
(
resource
)
=>
this
.
_shouldIncludeModelInValidation
(
resource
),
(
toValidate
)
=>
this
.
doValidateOnChange
(
toValidat
e
),
(
resource
)
=>
(
resource
.
getMode
().
getId
()
===
this
.
_mode
.
getId
()
),
500
);
}
...
...
@@ -43,41 +46,16 @@ export class AbstractModeWorker {
return
this
.
_mode
;
}
_getWorkerParticipants
<
T
extends
Modes
.
IWorkerParticipant
>
(
select
:(
p
:
Modes
.
IWorkerParticipant
)
=>
boolean
):
T
[]
{
return
<
T
[]
>
this
.
_participants
.
filter
(
select
);
}
// ---- validation -----------------------------------------
_shouldIncludeModelInValidation
(
resource
:
EditorCommon
.
IMirrorModel
):
boolean
{
return
resource
.
getMode
().
getId
()
===
this
.
_mode
.
getId
();
}
public
enableValidator
():
TPromise
<
void
>
{
this
.
_validationHelper
.
enable
();
return
TPromise
.
as
(
null
);
}
private
_newValidate
(
changed
:
URI
[],
notChanged
:
URI
[],
dueToConfigurationChange
:
boolean
):
void
{
this
.
doValidateOnChange
(
changed
,
notChanged
,
dueToConfigurationChange
);
}
public
_getContextForValidationParticipants
(
resource
:
URI
):
any
{
return
null
;
}
public
doValidateOnChange
(
changed
:
URI
[],
notChanged
:
URI
[],
dueToConfigurationChange
:
boolean
):
void
{
if
(
dueToConfigurationChange
)
{
for
(
var
i
=
0
;
i
<
changed
.
length
;
i
++
)
{
this
.
doValidate
(
changed
[
i
]);
}
for
(
var
i
=
0
;
i
<
notChanged
.
length
;
i
++
)
{
this
.
doValidate
(
notChanged
[
i
]);
}
}
else
{
for
(
var
i
=
0
;
i
<
changed
.
length
;
i
++
)
{
this
.
doValidate
(
changed
[
i
]);
}
private
doValidateOnChange
(
toValidate
:
URI
[]):
void
{
for
(
var
i
=
0
;
i
<
toValidate
.
length
;
i
++
)
{
this
.
doValidate
(
toValidate
[
i
]);
}
}
...
...
src/vs/editor/common/worker/validationHelper.ts
浏览文件 @
de04973a
...
...
@@ -16,7 +16,7 @@ export interface IValidationHelperFilter {
}
export
interface
IValidationHelperCallback
{
(
changed
:
URI
[],
notChanged
:
URI
[],
isDueToConfigurationChange
:
boolean
):
void
;
(
toValidate
:
URI
[]
):
void
;
}
class
ValidationModel
implements
IDisposable
{
...
...
@@ -179,7 +179,13 @@ export class ValidationHelper implements IDisposable {
var
isDueToConfigurationChange
=
this
.
_isDueToConfigurationChange
;
this
.
_isDueToConfigurationChange
=
false
;
this
.
_callback
(
dirtyModels
,
cleanModels
,
isDueToConfigurationChange
);
let
toValidate
:
URI
[]
=
dirtyModels
;
if
(
isDueToConfigurationChange
)
{
toValidate
=
toValidate
.
concat
(
cleanModels
);
}
this
.
_callback
(
toValidate
);
}
public
enable
():
void
{
...
...
src/vs/languages/typescript/common/typescriptWorker2.ts
浏览文件 @
de04973a
...
...
@@ -172,12 +172,6 @@ export class TypeScriptWorker2 extends AbstractModeWorker {
return
fileNames
&&
fileNames
.
map
(
URI
.
parse
);
}
public
_getContextForValidationParticipants
(
resource
:
URI
):
any
{
// var project = this._findProject(resource);
// return project.languageService.getSourceFile(resource.toString());
return
null
;
}
public
suggest
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
ISuggestResult
[]
>
{
return
this
.
doSuggest
(
resource
,
position
).
then
(
value
=>
filterSuggestions
(
value
));
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录