Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5a61ae11
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,发现更多精彩内容 >>
提交
5a61ae11
编写于
10月 15, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
💄
上级
db592233
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
15 addition
and
13 deletion
+15
-13
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
+15
-13
未找到文件。
src/vs/workbench/parts/quickopen/browser/commandsHandler.ts
浏览文件 @
5a61ae11
...
...
@@ -22,7 +22,6 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import
{
IQuickOpenService
}
from
'
vs/platform/quickOpen/common/quickOpen
'
;
import
{
registerEditorAction
,
EditorAction
,
IEditorCommandMenuOptions
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
once
}
from
'
vs/base/common/event
'
;
import
{
LRUCache
}
from
'
vs/base/common/map
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ResolvedKeybinding
}
from
'
vs/base/common/keyCodes
'
;
...
...
@@ -32,6 +31,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
CancellationToken
}
from
'
vs/base/common/cancellation
'
;
import
{
IExtensionService
}
from
'
vs/workbench/services/extensions/common/extensions
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
export
const
ALL_COMMANDS_PREFIX
=
'
>
'
;
...
...
@@ -55,7 +55,7 @@ function resolveCommandHistory(configurationService: IConfigurationService): num
return
commandHistory
;
}
class
CommandsHistory
{
class
CommandsHistory
extends
Disposable
{
static
readonly
DEFAULT_COMMANDS_HISTORY_LENGTH
=
50
;
...
...
@@ -68,12 +68,19 @@ class CommandsHistory {
@
IStorageService
private
storageService
:
IStorageService
,
@
IConfigurationService
private
configurationService
:
IConfigurationService
)
{
super
();
this
.
updateConfiguration
();
this
.
load
();
this
.
registerListeners
();
}
private
registerListeners
():
void
{
this
.
_register
(
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
updateConfiguration
()));
this
.
_register
(
this
.
storageService
.
onWillSaveState
(()
=>
this
.
saveState
()));
}
private
updateConfiguration
():
void
{
this
.
commandHistoryLength
=
resolveCommandHistory
(
this
.
configurationService
);
...
...
@@ -107,9 +114,12 @@ class CommandsHistory {
commandCounter
=
this
.
storageService
.
getInteger
(
CommandsHistory
.
PREF_KEY_COUNTER
,
StorageScope
.
GLOBAL
,
commandCounter
);
}
private
registerListeners
():
void
{
this
.
configurationService
.
onDidChangeConfiguration
(
e
=>
this
.
updateConfiguration
());
once
(
this
.
storageService
.
onWillSaveState
)(()
=>
this
.
saveState
());
push
(
commandId
:
string
):
void
{
commandHistory
.
set
(
commandId
,
commandCounter
++
);
// set counter to command
}
peek
(
commandId
:
string
):
number
{
return
commandHistory
.
peek
(
commandId
);
}
private
saveState
():
void
{
...
...
@@ -119,14 +129,6 @@ class CommandsHistory {
this
.
storageService
.
store
(
CommandsHistory
.
PREF_KEY_CACHE
,
JSON
.
stringify
(
serializedCache
),
StorageScope
.
GLOBAL
);
this
.
storageService
.
store
(
CommandsHistory
.
PREF_KEY_COUNTER
,
commandCounter
,
StorageScope
.
GLOBAL
);
}
push
(
commandId
:
string
):
void
{
commandHistory
.
set
(
commandId
,
commandCounter
++
);
// set counter to command
}
peek
(
commandId
:
string
):
number
{
return
commandHistory
.
peek
(
commandId
);
}
}
export
class
ShowAllCommandsAction
extends
Action
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录