Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
055ac07c
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,发现更多精彩内容 >>
提交
055ac07c
编写于
3月 15, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add goto next/prev reference command, #44414
上级
6c8b65d1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
53 addition
and
10 deletion
+53
-10
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
+24
-0
src/vs/editor/contrib/referenceSearch/referencesController.ts
...vs/editor/contrib/referenceSearch/referencesController.ts
+7
-0
src/vs/editor/contrib/referenceSearch/referencesModel.ts
src/vs/editor/contrib/referenceSearch/referencesModel.ts
+22
-10
未找到文件。
src/vs/editor/contrib/referenceSearch/referenceSearch.ts
浏览文件 @
055ac07c
...
@@ -194,6 +194,30 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC
...
@@ -194,6 +194,30 @@ function withController(accessor: ServicesAccessor, fn: (controller: ReferencesC
fn
(
controller
);
fn
(
controller
);
}
}
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
goToNextReference
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(
50
),
primary
:
KeyCode
.
F4
,
when
:
ctxReferenceSearchVisible
,
handler
(
accessor
)
{
withController
(
accessor
,
controller
=>
{
controller
.
goToNextOrPreviousReference
(
true
);
});
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
goToPreviousReference
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(
50
),
primary
:
KeyMod
.
Shift
|
KeyCode
.
F4
,
when
:
ctxReferenceSearchVisible
,
handler
(
accessor
)
{
withController
(
accessor
,
controller
=>
{
controller
.
goToNextOrPreviousReference
(
false
);
});
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
'
closeReferenceSearch
'
,
id
:
'
closeReferenceSearch
'
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(
50
),
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(
50
),
...
...
src/vs/editor/contrib/referenceSearch/referencesController.ts
浏览文件 @
055ac07c
...
@@ -174,6 +174,13 @@ export class ReferencesController implements editorCommon.IEditorContribution {
...
@@ -174,6 +174,13 @@ export class ReferencesController implements editorCommon.IEditorContribution {
});
});
}
}
public
goToNextOrPreviousReference
(
fwd
:
boolean
)
{
let
source
=
this
.
_model
.
nearestReference
(
this
.
_editor
.
getModel
().
uri
,
this
.
_widget
.
position
);
let
target
=
this
.
_model
.
nextOrPreviousReference
(
source
,
fwd
);
this
.
_gotoReference
(
target
);
this
.
_editor
.
focus
();
}
public
closeWidget
():
void
{
public
closeWidget
():
void
{
if
(
this
.
_widget
)
{
if
(
this
.
_widget
)
{
this
.
_widget
.
dispose
();
this
.
_widget
.
dispose
();
...
...
src/vs/editor/contrib/referenceSearch/referencesModel.ts
浏览文件 @
055ac07c
...
@@ -253,20 +253,32 @@ export class ReferencesModel implements IDisposable {
...
@@ -253,20 +253,32 @@ export class ReferencesModel implements IDisposable {
}
}
}
}
public
next
Reference
(
reference
:
OneReference
):
OneReference
{
public
next
OrPreviousReference
(
reference
:
OneReference
,
next
:
boolean
):
OneReference
{
var
idx
=
reference
.
parent
.
children
.
indexOf
(
reference
),
let
{
parent
}
=
reference
;
len
=
reference
.
parent
.
children
.
length
,
totalLength
=
reference
.
parent
.
parent
.
groups
.
length
;
if
(
idx
+
1
<
len
||
totalLength
===
1
)
{
let
idx
=
parent
.
children
.
indexOf
(
reference
);
return
reference
.
parent
.
children
[(
idx
+
1
)
%
len
]
;
let
childCount
=
parent
.
children
.
length
;
}
let
groupCount
=
parent
.
parent
.
groups
.
length
;
idx
=
reference
.
parent
.
parent
.
groups
.
indexOf
(
reference
.
parent
);
if
(
groupCount
===
1
||
next
&&
idx
+
1
<
childCount
||
!
next
&&
idx
>
1
)
{
idx
=
(
idx
+
1
)
%
totalLength
;
// cycling within one file
if
(
next
)
{
idx
=
(
idx
+
1
)
%
childCount
;
}
else
{
idx
=
(
idx
+
childCount
-
1
)
%
childCount
;
}
return
parent
.
children
[
idx
];
}
return
reference
.
parent
.
parent
.
groups
[
idx
].
children
[
0
];
idx
=
parent
.
parent
.
groups
.
indexOf
(
parent
);
if
(
next
)
{
idx
=
(
idx
+
1
)
%
groupCount
;
return
parent
.
parent
.
groups
[
idx
].
children
[
0
];
}
else
{
idx
=
(
idx
+
groupCount
-
1
)
%
groupCount
;
return
parent
.
parent
.
groups
[
idx
].
children
[
parent
.
parent
.
groups
[
idx
].
children
.
length
-
1
];
}
}
}
public
nearestReference
(
resource
:
URI
,
position
:
Position
):
OneReference
{
public
nearestReference
(
resource
:
URI
,
position
:
Position
):
OneReference
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录