Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
1759649e
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(gitcode.net)2024年7月9日维护升级公告
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1759649e
编写于
3月 23, 2020
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
quick access - keep track of viewstate in anything picker
上级
3c18886a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
5 deletion
+49
-5
src/vs/editor/contrib/quickAccess/editorNavigationQuickAccess.ts
...editor/contrib/quickAccess/editorNavigationQuickAccess.ts
+2
-2
src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts
...s/workbench/contrib/search/browser/anythingQuickAccess.ts
+47
-3
未找到文件。
src/vs/editor/contrib/quickAccess/editorNavigationQuickAccess.ts
浏览文件 @
1759649e
...
...
@@ -80,11 +80,11 @@ export abstract class AbstractEditorNavigationQuickAccessProvider implements IQu
lastKnownEditorViewState
=
withNullAsUndefined
(
editor
.
saveViewState
());
}));
once
(
token
.
onCancellationRequested
)(()
=>
{
disposables
.
add
(
once
(
token
.
onCancellationRequested
)(()
=>
{
if
(
lastKnownEditorViewState
)
{
editor
.
restoreViewState
(
lastKnownEditorViewState
);
}
});
})
)
;
}
// Clean up decorations on dispose
...
...
src/vs/workbench/contrib/search/browser/anythingQuickAccess.ts
浏览文件 @
1759649e
...
...
@@ -43,8 +43,11 @@ import { DefaultQuickAccessFilterValue } from 'vs/platform/quickinput/common/qui
import
{
IWorkbenchQuickOpenConfiguration
}
from
'
vs/workbench/browser/quickopen
'
;
import
{
GotoSymbolQuickAccessProvider
}
from
'
vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess
'
;
import
{
ITextModelService
}
from
'
vs/editor/common/services/resolverService
'
;
import
{
ScrollType
,
IEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ScrollType
,
IEditor
,
ICodeEditorViewState
,
IDiffEditorViewState
}
from
'
vs/editor/common/editorCommon
'
;
import
{
once
}
from
'
vs/base/common/functional
'
;
import
{
IEditorGroup
}
from
'
vs/workbench/services/editor/common/editorGroupsService
'
;
import
{
getCodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
withNullAsUndefined
}
from
'
vs/base/common/types
'
;
interface
IAnythingQuickPickItem
extends
IPickerQuickAccessItem
{
resource
:
URI
|
undefined
;
...
...
@@ -73,6 +76,12 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
picker
:
IQuickPick
<
IAnythingQuickPickItem
>
|
undefined
=
undefined
;
editorViewState
:
{
editor
:
IEditorInput
,
group
:
IEditorGroup
,
state
:
ICodeEditorViewState
|
IDiffEditorViewState
|
undefined
}
|
undefined
=
undefined
;
scorerCache
:
ScorerCache
=
Object
.
create
(
null
);
fileQueryCache
:
FileQueryCacheState
|
undefined
=
undefined
;
...
...
@@ -83,7 +92,7 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
isQuickNavigating
:
boolean
|
undefined
=
undefined
;
constructor
(
private
readonly
provider
:
AnythingQuickAccessProvider
)
{
}
constructor
(
private
readonly
provider
:
AnythingQuickAccessProvider
,
private
readonly
editorService
:
IEditorService
)
{
}
set
(
picker
:
IQuickPick
<
IAnythingQuickPickItem
>
):
void
{
...
...
@@ -108,8 +117,24 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
this
.
lastFilter
=
undefined
;
this
.
lastRange
=
undefined
;
this
.
lastActiveGlobalPick
=
undefined
;
this
.
editorViewState
=
undefined
;
}
}(
this
);
rememberEditorViewState
():
void
{
if
(
this
.
editorViewState
)
{
return
;
// return early if already done
}
const
activeEditorPane
=
this
.
editorService
.
activeEditorPane
;
if
(
activeEditorPane
)
{
this
.
editorViewState
=
{
group
:
activeEditorPane
.
group
,
editor
:
activeEditorPane
.
input
,
state
:
withNullAsUndefined
(
getCodeEditor
(
activeEditorPane
.
getControl
())?.
saveViewState
())
};
}
}
}(
this
,
this
.
editorService
);
get
defaultFilterValue
():
DefaultQuickAccessFilterValue
|
undefined
{
if
(
this
.
configuration
.
preserveInput
)
{
...
...
@@ -175,6 +200,17 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
}
}));
// Restore view state upon cancellation if we changed it
disposables
.
add
(
once
(
token
.
onCancellationRequested
)(()
=>
{
if
(
this
.
pickState
.
editorViewState
)
{
this
.
editorService
.
openEditor
(
this
.
pickState
.
editorViewState
.
editor
,
{
viewState
:
this
.
pickState
.
editorViewState
.
state
},
this
.
pickState
.
editorViewState
.
group
);
}
}));
// Start picker
disposables
.
add
(
super
.
provide
(
picker
,
token
));
...
...
@@ -192,6 +228,9 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
return
Disposable
.
None
;
// we need a text editor control to decorate and reveal
}
// we must remember our curret view state to be able to restore
this
.
pickState
.
rememberEditorViewState
();
// Reveal
activeEditorControl
.
revealRangeInCenter
(
pick
.
range
.
selection
,
ScrollType
.
Smooth
);
...
...
@@ -616,6 +655,11 @@ export class AnythingQuickAccessProvider extends PickerQuickAccessProvider<IAnyt
// Bring the editor to front to review symbols to go to
try
{
// we must remember our curret view state to be able to restore
this
.
pickState
.
rememberEditorViewState
();
// open it
await
this
.
editorService
.
openEditor
({
resource
:
activeGlobalResource
,
options
:
{
preserveFocus
:
true
,
revealIfOpened
:
true
,
ignoreError
:
true
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录