Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
7075821a
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,发现更多精彩内容 >>
提交
7075821a
编写于
12月 02, 2015
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adopt `isTooLargeForHavingAMode` in language feature registry
上级
e581c62a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
41 deletion
+47
-41
src/vs/editor/common/modes/languageFeatureRegistry.ts
src/vs/editor/common/modes/languageFeatureRegistry.ts
+47
-41
未找到文件。
src/vs/editor/common/modes/languageFeatureRegistry.ts
浏览文件 @
7075821a
...
...
@@ -45,7 +45,7 @@ export default class LanguageFeatureRegistry<T> {
};
this
.
_entries
.
push
(
entry
);
this
.
_
c
andidate
=
undefined
;
this
.
_
lastC
andidate
=
undefined
;
this
.
_onDidChange
.
fire
(
this
.
_entries
.
length
);
return
{
...
...
@@ -54,7 +54,7 @@ export default class LanguageFeatureRegistry<T> {
let
idx
=
this
.
_entries
.
indexOf
(
entry
);
if
(
idx
>=
0
)
{
this
.
_entries
.
splice
(
idx
,
1
);
this
.
_
c
andidate
=
undefined
;
this
.
_
lastC
andidate
=
undefined
;
this
.
_onDidChange
.
fire
(
this
.
_entries
.
length
);
entry
=
undefined
;
}
...
...
@@ -67,21 +67,25 @@ export default class LanguageFeatureRegistry<T> {
return
this
.
all
(
model
).
length
>
0
;
}
all
(
model
:
IModel
):
T
[]{
let
result
:
T
[]
=
[];
if
(
model
)
{
this
.
_updateScores
(
model
);
// from registry
for
(
let
entry
of
this
.
_entries
)
{
if
(
entry
.
_score
>
0
)
{
result
.
push
(
entry
.
provider
);
}
}
// from mode
if
(
model
.
getMode
()
&&
model
.
getMode
()[
this
.
_supportName
])
{
result
.
push
(
model
.
getMode
()[
this
.
_supportName
]);
all
(
model
:
IModel
):
T
[]
{
if
(
!
model
||
model
.
isTooLargeForHavingAMode
())
{
return
[];
}
this
.
_updateScores
(
model
);
const
result
:
T
[]
=
[];
// (1) from registry
for
(
let
entry
of
this
.
_entries
)
{
if
(
entry
.
_score
>
0
)
{
result
.
push
(
entry
.
provider
);
}
}
// (2) from mode
if
(
model
.
getMode
()
&&
model
.
getMode
()[
this
.
_supportName
])
{
result
.
push
(
model
.
getMode
()[
this
.
_supportName
]);
}
return
result
;
}
...
...
@@ -110,37 +114,39 @@ export default class LanguageFeatureRegistry<T> {
}
private
_orderedEntries
(
model
:
IModel
):
Entry
<
T
>
[]
{
let
result
:
Entry
<
T
>
[]
=
[];
if
(
model
)
{
if
(
this
.
_updateScores
(
model
))
{
this
.
_sortByScore
();
}
if
(
!
model
||
model
.
isTooLargeForHavingAMode
())
{
return
[];
}
const
result
:
Entry
<
T
>
[]
=
[];
// from registry
for
(
let
entry
of
this
.
_entries
)
{
if
(
entry
.
_score
>
0
)
{
result
.
push
(
entry
);
}
if
(
this
.
_updateScores
(
model
))
{
this
.
_sortByScore
();
}
// (1) from registry
for
(
let
entry
of
this
.
_entries
)
{
if
(
entry
.
_score
>
0
)
{
result
.
push
(
entry
);
}
}
//
from mode
if
(
model
.
getMode
()
&&
model
.
getMode
()[
this
.
_supportName
])
{
// (2)
from mode
if
(
model
.
getMode
()
&&
model
.
getMode
()[
this
.
_supportName
])
{
let
entry
:
Entry
<
T
>
=
{
selector
:
undefined
,
provider
:
model
.
getMode
()[
this
.
_supportName
],
_score
:
.
5
,
_time
:
0
};
let
entry
:
Entry
<
T
>
=
{
selector
:
undefined
,
provider
:
model
.
getMode
()[
this
.
_supportName
],
_score
:
.
5
,
_time
:
0
};
let
idx
=
binarySearch
(
result
,
entry
,
LanguageFeatureRegistry
.
_compareByScoreAndTime
);
result
.
splice
(
idx
<
0
?
~
idx
:
idx
,
0
,
entry
);
}
let
idx
=
binarySearch
(
result
,
entry
,
LanguageFeatureRegistry
.
_compareByScoreAndTime
);
result
.
splice
(
idx
<
0
?
~
idx
:
idx
,
0
,
entry
);
}
return
result
;
}
private
_
c
andidate
:
{
uri
:
string
;
language
:
string
;
};
private
_
lastC
andidate
:
{
uri
:
string
;
language
:
string
;
};
private
_updateScores
(
model
:
IModel
):
boolean
{
...
...
@@ -149,15 +155,15 @@ export default class LanguageFeatureRegistry<T> {
language
:
model
.
getModeId
()
};
if
(
this
.
_
c
andidate
&&
this
.
_
c
andidate
.
language
===
candidate
.
language
&&
this
.
_
c
andidate
.
uri
===
candidate
.
uri
)
{
if
(
this
.
_
lastC
andidate
&&
this
.
_
lastC
andidate
.
language
===
candidate
.
language
&&
this
.
_
lastC
andidate
.
uri
===
candidate
.
uri
)
{
// nothing has changed
return
;
}
this
.
_
c
andidate
=
candidate
;
this
.
_
lastC
andidate
=
candidate
;
for
(
let
entry
of
this
.
_entries
)
{
entry
.
_score
=
score
(
entry
.
selector
,
model
.
getAssociatedResource
(),
model
.
getModeId
());
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录