Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
cee2a0a9
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,发现更多精彩内容 >>
提交
cee2a0a9
编写于
9月 05, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debt - quick outline cancellation token
上级
7845ce83
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
12 addition
and
11 deletion
+12
-11
src/vs/editor/contrib/quickOpen/quickOpen.ts
src/vs/editor/contrib/quickOpen/quickOpen.ts
+5
-6
src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
+3
-2
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
...vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
+2
-1
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+2
-2
未找到文件。
src/vs/editor/contrib/quickOpen/quickOpen.ts
浏览文件 @
cee2a0a9
...
...
@@ -7,21 +7,20 @@
import
{
illegalArgument
,
onUnexpectedExternalError
}
from
'
vs/base/common/errors
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
registerLanguageCommand
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
DocumentSymbol
,
DocumentSymbolProviderRegistry
}
from
'
vs/editor/common/modes
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
export
function
getDocumentSymbols
(
model
:
ITextModel
):
TPromis
e
<
DocumentSymbol
[]
>
{
export
function
getDocumentSymbols
(
model
:
ITextModel
,
token
:
CancellationToken
):
Thenabl
e
<
DocumentSymbol
[]
>
{
let
roots
:
DocumentSymbol
[]
=
[];
let
promises
=
DocumentSymbolProviderRegistry
.
all
(
model
).
map
(
support
=>
{
return
asWinJsPromise
(
token
=>
support
.
provideDocumentSymbols
(
model
,
token
)).
then
(
result
=>
{
return
Promise
.
resolve
(
support
.
provideDocumentSymbols
(
model
,
token
)).
then
(
result
=>
{
if
(
Array
.
isArray
(
result
))
{
roots
.
push
(...
result
);
}
...
...
@@ -30,7 +29,7 @@ export function getDocumentSymbols(model: ITextModel): TPromise<DocumentSymbol[]
});
});
return
TPromise
.
join
(
promises
).
then
(()
=>
{
return
Promise
.
all
(
promises
).
then
(()
=>
{
let
flatEntries
:
DocumentSymbol
[]
=
[];
flatten
(
flatEntries
,
roots
,
''
);
flatEntries
.
sort
(
compareEntriesUsingStart
);
...
...
@@ -69,5 +68,5 @@ registerLanguageCommand('_executeDocumentSymbolProvider', function (accessor, ar
if
(
!
model
)
{
throw
illegalArgument
(
'
resource
'
);
}
return
getDocumentSymbols
(
model
);
return
getDocumentSymbols
(
model
,
CancellationToken
.
None
);
});
src/vs/editor/standalone/browser/quickOpen/quickOutline.ts
浏览文件 @
cee2a0a9
...
...
@@ -23,6 +23,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import
{
Range
,
IRange
}
from
'
vs/editor/common/core/range
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
KeybindingWeight
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
let
SCOPE_PREFIX
=
'
:
'
;
...
...
@@ -140,13 +141,13 @@ export class QuickOutlineAction extends BaseEditorQuickOpenAction {
}
// Resolve outline
return
getDocumentSymbols
(
model
).
then
((
result
:
DocumentSymbol
[])
=>
{
return
TPromise
.
wrap
(
getDocumentSymbols
(
model
,
CancellationToken
.
None
).
then
((
result
:
DocumentSymbol
[])
=>
{
if
(
result
.
length
===
0
)
{
return
;
}
this
.
_run
(
editor
,
result
);
});
})
)
;
}
private
_run
(
editor
:
ICodeEditor
,
result
:
DocumentSymbol
[]):
void
{
...
...
src/vs/workbench/parts/quickopen/browser/gotoSymbolHandler.ts
浏览文件 @
cee2a0a9
...
...
@@ -26,6 +26,7 @@ import { overviewRulerRangeHighlight } from 'vs/editor/common/view/editorColorRe
import
{
GroupIdentifier
,
IEditorInput
}
from
'
vs/workbench/common/editor
'
;
import
{
IEditorService
,
SIDE_GROUP
}
from
'
vs/workbench/services/editor/common/editorService
'
;
import
{
IEditorGroup
}
from
'
vs/workbench/services/group/common/editorGroupsService
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
export
const
GOTO_SYMBOL_PREFIX
=
'
@
'
;
export
const
SCOPE_PREFIX
=
'
:
'
;
...
...
@@ -483,7 +484,7 @@ export class GotoSymbolHandler extends QuickOpenHandler {
return
TPromise
.
as
(
this
.
outlineToModelCache
[
modelId
]);
}
return
getDocumentSymbols
(
<
ITextModel
>
model
).
then
(
entries
=>
{
return
asWinJsPromise
(
token
=>
getDocumentSymbols
(
<
ITextModel
>
model
,
token
)
).
then
(
entries
=>
{
const
model
=
new
OutlineModel
(
this
.
toQuickOpenEntries
(
entries
));
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
cee2a0a9
...
...
@@ -163,7 +163,7 @@ suite('ExtHostLanguageFeatures', function () {
return
rpcProtocol
.
sync
().
then
(()
=>
{
return
getDocumentSymbols
(
model
).
then
(
value
=>
{
return
getDocumentSymbols
(
model
,
CancellationToken
.
None
).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
});
});
...
...
@@ -178,7 +178,7 @@ suite('ExtHostLanguageFeatures', function () {
return
rpcProtocol
.
sync
().
then
(()
=>
{
return
getDocumentSymbols
(
model
).
then
(
value
=>
{
return
getDocumentSymbols
(
model
,
CancellationToken
.
None
).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
let
entry
=
value
[
0
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录