Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2a216734
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a216734
编写于
12月 21, 2015
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - remove suggest participants
上级
a4e13a9a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
57 deletion
+13
-57
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+0
-5
src/vs/editor/common/modes/abstractModeWorker.ts
src/vs/editor/common/modes/abstractModeWorker.ts
+13
-52
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
2a216734
...
...
@@ -22,11 +22,6 @@ export interface IWorkerParticipant {
}
export
interface
ISuggestParticipant
extends
IWorkerParticipant
{
filter
?:(
word
:
string
,
suggestion
:
ISuggestion
)
=>
IMatch
[];
suggest
?:(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
,
context
?:
any
)
=>
TPromise
<
ISuggestResult
>
;
}
export
enum
Bracket
{
None
=
0
,
Open
=
1
,
...
...
src/vs/editor/common/modes/abstractModeWorker.ts
浏览文件 @
2a216734
...
...
@@ -18,15 +18,10 @@ import EditorCommon = require('vs/editor/common/editorCommon');
import
Modes
=
require
(
'
vs/editor/common/modes
'
);
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
function
isISuggestParticipant
(
thing
:
any
):
boolean
{
return
typeof
(
<
Modes
.
ISuggestParticipant
>
thing
).
suggest
===
'
function
'
||
typeof
(
<
Modes
.
ISuggestParticipant
>
thing
).
filter
===
'
function
'
;
}
export
class
AbstractModeWorker
{
static
filter
:
Modes
.
ISuggestionFilter
=
DefaultFilter
;
private
_suggestParticipants
:
Modes
.
ISuggestParticipant
[]
=
[];
private
_participants
:
Modes
.
IWorkerParticipant
[]
=
[];
public
resourceService
:
IResourceService
;
...
...
@@ -53,9 +48,6 @@ export class AbstractModeWorker {
500
);
// add contributed participants
this
.
_suggestParticipants
=
this
.
_getWorkerParticipants
<
Modes
.
ISuggestParticipant
>
(
p
=>
isISuggestParticipant
(
p
));
this
.
inplaceReplaceSupport
=
this
.
_createInPlaceReplaceSupport
();
}
...
...
@@ -111,50 +103,32 @@ export class AbstractModeWorker {
// ---- suggestion ---------------------------------------------------------------------------------------
public
suggest
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
TPromise
<
Modes
.
ISuggestResult
[]
>
{
public
suggest
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
TPromise
<
Modes
.
ISuggestResult
[]
>
{
return
this
.
_getSuggestContext
(
resource
).
then
((
context
)
=>
{
var
promises
=
[
this
.
doSuggest
(
resource
,
position
)
];
promises
.
push
.
apply
(
promises
,
this
.
_participantSuggests
(
resource
,
position
,
context
));
return
TPromise
.
join
(
promises
);
return
this
.
doSuggest
(
resource
,
position
).
then
(
value
=>
{
}).
then
((
values
)
=>
{
if
(
!
value
)
{
return
;
}
// filter suggestions
var
accept
=
this
.
getSuggestionFilter
Main
(),
result
:
Modes
.
ISuggestResult
[]
=
[];
var
accept
=
this
.
getSuggestionFilter
(),
result
:
Modes
.
ISuggestResult
[]
=
[];
for
(
var
i
=
0
,
len
=
values
.
length
;
i
<
len
;
i
++
)
{
var
value
=
values
[
i
];
if
(
!
value
)
{
continue
;
}
result
.
push
(
<
Modes
.
ISuggestResult
>
{
currentWord
:
value
.
currentWord
,
suggestions
:
value
.
suggestions
.
filter
((
element
)
=>
!!
accept
(
values
[
i
].
currentWord
,
element
)),
incomplete
:
value
.
incomplete
});
}
result
.
push
(
<
Modes
.
ISuggestResult
>
{
currentWord
:
value
.
currentWord
,
suggestions
:
value
.
suggestions
.
filter
((
element
)
=>
!!
accept
(
value
.
currentWord
,
element
)),
incomplete
:
value
.
incomplete
});
return
result
;
},
(
error
)
=>
{
return
<
Modes
.
ISuggestResult
[]
>
[{
return
<
Modes
.
ISuggestResult
[]
>
[{
currentWord
:
''
,
suggestions
:
[]
}];
});
}
public
_participantSuggests
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
,
context
:
any
):
TPromise
<
Modes
.
ISuggestResult
>
[]
{
return
this
.
_suggestParticipants
.
map
((
participant
)
=>
{
try
{
return
participant
.
suggest
(
resource
,
position
,
context
);
}
catch
(
e
)
{
/// We should install a watch dog here. If a participant fails
/// too often we should shut the participant down.
}
});
}
public
_getSuggestContext
(
resource
:
URI
):
TPromise
<
any
>
{
return
TPromise
.
as
(
undefined
);
}
...
...
@@ -199,19 +173,6 @@ export class AbstractModeWorker {
return
[];
}
private
getSuggestionFilterMain
():
Modes
.
ISuggestionFilter
{
var
filter
=
this
.
getSuggestionFilter
();
// Collect Suggestion Participants
this
.
_suggestParticipants
.
forEach
((
participant
:
any
)
=>
{
if
(
typeof
participant
.
filter
===
'
function
'
)
{
filter
=
and
(
filter
,
(
<
Modes
.
ISuggestParticipant
>
participant
).
filter
);
}
});
return
filter
;
}
public
getSuggestionFilter
():
Modes
.
ISuggestionFilter
{
return
AbstractModeWorker
.
filter
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录