Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
8e09e964
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,发现更多精彩内容 >>
提交
8e09e964
编写于
9月 21, 2017
作者:
S
Sandeep Somavarapu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix #34403
上级
a1f78c66
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
92 addition
and
26 deletion
+92
-26
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
.../workbench/parts/preferences/browser/keybindingsEditor.ts
+4
-0
src/vs/workbench/parts/preferences/browser/preferences.contribution.ts
...nch/parts/preferences/browser/preferences.contribution.ts
+12
-1
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
.../workbench/parts/preferences/browser/preferencesEditor.ts
+70
-2
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
...workbench/parts/preferences/browser/preferencesWidgets.ts
+0
-22
src/vs/workbench/parts/preferences/common/preferences.ts
src/vs/workbench/parts/preferences/common/preferences.ts
+5
-0
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
.../parts/terminal/electron-browser/terminal.contribution.ts
+1
-1
未找到文件。
src/vs/workbench/parts/preferences/browser/keybindingsEditor.ts
浏览文件 @
8e09e964
...
...
@@ -251,6 +251,10 @@ export class KeybindingsEditor extends BaseEditor implements IKeybindingsEditor
this
.
searchWidget
.
focus
();
}
clearSearchResults
():
void
{
this
.
searchWidget
.
clear
();
}
showConflicts
(
keybindingEntry
:
IKeybindingItemEntry
):
TPromise
<
any
>
{
const
value
=
`"
${
keybindingEntry
.
keybindingItem
.
keybinding
.
getAriaLabel
()}
"`
;
if
(
value
!==
this
.
searchWidget
.
getValue
())
{
...
...
src/vs/workbench/parts/preferences/browser/preferences.contribution.ts
浏览文件 @
8e09e964
...
...
@@ -20,7 +20,7 @@ import { KeybindingsEditor, KeybindingsEditorInput } from 'vs/workbench/parts/pr
import
{
OpenGlobalSettingsAction
,
OpenGlobalKeybindingsAction
,
OpenGlobalKeybindingsFileAction
,
OpenWorkspaceSettingsAction
,
OpenFolderSettingsAction
,
ConfigureLanguageBasedSettingsAction
}
from
'
vs/workbench/parts/preferences/browser/preferencesActions
'
;
import
{
IPreferencesService
,
IKeybindingsEditor
,
CONTEXT_KEYBINDING_FOCUS
,
CONTEXT_KEYBINDINGS_EDITOR
,
CONTEXT_KEYBINDINGS_SEARCH_FOCUS
,
KEYBINDINGS_EDITOR_COMMAND_DEFINE
,
KEYBINDINGS_EDITOR_COMMAND_REMOVE
,
KEYBINDINGS_EDITOR_COMMAND_SEARCH
,
KEYBINDINGS_EDITOR_COMMAND_COPY
,
KEYBINDINGS_EDITOR_COMMAND_RESET
,
KEYBINDINGS_EDITOR_COMMAND_SHOW_CONFLICTS
,
KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS
KEYBINDINGS_EDITOR_COMMAND_COPY
,
KEYBINDINGS_EDITOR_COMMAND_RESET
,
KEYBINDINGS_EDITOR_COMMAND_SHOW_CONFLICTS
,
KEYBINDINGS_EDITOR_COMMAND_FOCUS_KEYBINDINGS
,
KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
PreferencesService
}
from
'
vs/workbench/parts/preferences/browser/preferencesService
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
...
...
@@ -246,4 +246,15 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
workbenchContrib
(),
when
:
ContextKeyExpr
.
and
(
CONTEXT_KEYBINDINGS_EDITOR
,
CONTEXT_KEYBINDINGS_SEARCH_FOCUS
),
primary
:
KeyCode
.
Escape
,
handler
:
(
accessor
,
args
:
any
)
=>
{
const
editor
=
accessor
.
get
(
IWorkbenchEditorService
).
getActiveEditor
()
as
IKeybindingsEditor
;
editor
.
clearSearchResults
();
}
});
Registry
.
as
<
IWorkbenchContributionsRegistry
>
(
WorkbenchExtensions
.
Workbench
).
registerWorkbenchContribution
(
PreferencesContentProvider
);
\ No newline at end of file
src/vs/workbench/parts/preferences/browser/preferencesEditor.ts
浏览文件 @
8e09e964
...
...
@@ -23,7 +23,7 @@ import { CodeEditor } from 'vs/editor/browser/codeEditor';
import
{
IInstantiationService
,
ServicesAccessor
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IPreferencesService
,
ISettingsGroup
,
ISetting
,
IFilterResult
,
CONTEXT_SETTINGS_EDITOR
,
CONTEXT_SETTINGS_SEARCH_FOCUS
,
SETTINGS_EDITOR_COMMAND_SEARCH
,
SETTINGS_EDITOR_COMMAND_FOCUS_FILE
,
ISettingsEditorModel
CONTEXT_SETTINGS_EDITOR
,
CONTEXT_SETTINGS_SEARCH_FOCUS
,
SETTINGS_EDITOR_COMMAND_SEARCH
,
SETTINGS_EDITOR_COMMAND_FOCUS_FILE
,
ISettingsEditorModel
,
SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS
,
SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING
,
SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING
}
from
'
vs/workbench/parts/preferences/common/preferences
'
;
import
{
SettingsEditorModel
,
DefaultSettingsEditorModel
}
from
'
vs/workbench/parts/preferences/common/preferencesModels
'
;
import
{
editorContribution
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
...
...
@@ -140,7 +140,6 @@ export class PreferencesEditor extends BaseEditor {
focusKey
:
this
.
focusSettingsContextKey
}));
this
.
_register
(
this
.
searchWidget
.
onDidChange
(
value
=>
this
.
filterPreferences
(
value
.
trim
())));
this
.
_register
(
this
.
searchWidget
.
onNavigate
(
shift
=>
this
.
preferencesRenderers
.
focusNextPreference
(
!
shift
)));
this
.
_register
(
this
.
searchWidget
.
onFocus
(()
=>
this
.
lastFocusedWidget
=
this
.
searchWidget
));
this
.
lastFocusedWidget
=
this
.
searchWidget
;
...
...
@@ -156,6 +155,24 @@ export class PreferencesEditor extends BaseEditor {
this
.
_register
(
this
.
workspaceContextService
.
onDidChangeWorkbenchState
(()
=>
this
.
onWorkbenchStateChanged
()));
}
public
clearSearchResults
():
void
{
if
(
this
.
searchWidget
)
{
this
.
searchWidget
.
clear
();
}
}
public
focusNextResult
():
void
{
if
(
this
.
preferencesRenderers
)
{
this
.
preferencesRenderers
.
focusNextPreference
(
true
);
}
}
public
focusPreviousResult
():
void
{
if
(
this
.
preferencesRenderers
)
{
this
.
preferencesRenderers
.
focusNextPreference
(
false
);
}
}
public
setInput
(
newInput
:
PreferencesEditorInput
,
options
?:
EditorOptions
):
TPromise
<
void
>
{
this
.
defaultSettingsEditorContextKey
.
set
(
true
);
const
oldInput
=
<
PreferencesEditorInput
>
this
.
input
;
...
...
@@ -959,3 +976,54 @@ const focusSettingsFileEditorCommand = new FocusSettingsFileEditorCommand({
kbOpts
:
{
primary
:
KeyCode
.
DownArrow
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
focusSettingsFileEditorCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
class
ClearSearchResultsCommand
extends
SettingsCommand
{
public
runCommand
(
accessor
:
ServicesAccessor
,
args
:
any
):
void
{
const
preferencesEditor
=
this
.
getPreferencesEditor
(
accessor
);
if
(
preferencesEditor
)
{
preferencesEditor
.
clearSearchResults
();
}
}
}
const
clearSearchResultsCommand
=
new
ClearSearchResultsCommand
({
id
:
SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS
,
precondition
:
CONTEXT_SETTINGS_SEARCH_FOCUS
,
kbOpts
:
{
primary
:
KeyCode
.
Escape
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
clearSearchResultsCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
class
FocusNextSearchResultCommand
extends
SettingsCommand
{
public
runCommand
(
accessor
:
ServicesAccessor
,
args
:
any
):
void
{
const
preferencesEditor
=
this
.
getPreferencesEditor
(
accessor
);
if
(
preferencesEditor
)
{
preferencesEditor
.
focusNextResult
();
}
}
}
const
focusNextSearchResultCommand
=
new
FocusNextSearchResultCommand
({
id
:
SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING
,
precondition
:
CONTEXT_SETTINGS_SEARCH_FOCUS
,
kbOpts
:
{
primary
:
KeyCode
.
Enter
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
focusNextSearchResultCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
class
FocusPreviousSearchResultCommand
extends
SettingsCommand
{
public
runCommand
(
accessor
:
ServicesAccessor
,
args
:
any
):
void
{
const
preferencesEditor
=
this
.
getPreferencesEditor
(
accessor
);
if
(
preferencesEditor
)
{
preferencesEditor
.
focusPreviousResult
();
}
}
}
const
focusPreviousSearchResultCommand
=
new
FocusPreviousSearchResultCommand
({
id
:
SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING
,
precondition
:
CONTEXT_SETTINGS_SEARCH_FOCUS
,
kbOpts
:
{
primary
:
KeyMod
.
Shift
|
KeyCode
.
Enter
}
});
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
focusPreviousSearchResultCommand
.
toCommandAndKeybindingRule
(
KeybindingsRegistry
.
WEIGHT
.
editorContrib
()));
src/vs/workbench/parts/preferences/browser/preferencesWidgets.ts
浏览文件 @
8e09e964
...
...
@@ -399,9 +399,6 @@ export class SearchWidget extends Widget {
private
_onDidChange
:
Emitter
<
string
>
=
this
.
_register
(
new
Emitter
<
string
>
());
public
readonly
onDidChange
:
Event
<
string
>
=
this
.
_onDidChange
.
event
;
private
_onNavigate
:
Emitter
<
boolean
>
=
this
.
_register
(
new
Emitter
<
boolean
>
());
public
readonly
onNavigate
:
Event
<
boolean
>
=
this
.
_onNavigate
.
event
;
private
_onFocus
:
Emitter
<
void
>
=
this
.
_register
(
new
Emitter
<
void
>
());
public
readonly
onFocus
:
Event
<
void
>
=
this
.
_onFocus
.
event
;
...
...
@@ -447,7 +444,6 @@ export class SearchWidget extends Widget {
const
searchInput
=
DOM
.
append
(
this
.
searchContainer
,
DOM
.
$
(
'
div.settings-search-input
'
));
this
.
inputBox
=
this
.
_register
(
this
.
createInputBox
(
searchInput
));
this
.
_register
(
this
.
inputBox
.
onDidChange
(
value
=>
this
.
_onDidChange
.
fire
(
value
)));
this
.
onkeydown
(
this
.
inputBox
.
inputElement
,
(
e
)
=>
this
.
_onKeyDown
(
e
));
}
protected
createInputBox
(
parent
:
HTMLElement
):
InputBox
{
...
...
@@ -504,24 +500,6 @@ export class SearchWidget extends Widget {
return
this
.
inputBox
.
value
=
value
;
}
private
_onKeyDown
(
keyboardEvent
:
IKeyboardEvent
):
void
{
let
handled
=
false
;
switch
(
keyboardEvent
.
keyCode
)
{
case
KeyCode
.
Enter
:
this
.
_onNavigate
.
fire
(
keyboardEvent
.
shiftKey
);
handled
=
true
;
break
;
case
KeyCode
.
Escape
:
this
.
clear
();
handled
=
true
;
break
;
}
if
(
handled
)
{
keyboardEvent
.
preventDefault
();
keyboardEvent
.
stopPropagation
();
}
}
public
dispose
():
void
{
if
(
this
.
options
.
focusKey
)
{
this
.
options
.
focusKey
.
set
(
false
);
...
...
src/vs/workbench/parts/preferences/common/preferences.ts
浏览文件 @
8e09e964
...
...
@@ -91,6 +91,7 @@ export interface IKeybindingsEditor extends IEditor {
activeKeybindingEntry
:
IKeybindingItemEntry
;
search
(
filter
:
string
):
void
;
clearSearchResults
():
void
;
focusKeybindings
():
void
;
defineKeybinding
(
keybindingEntry
:
IKeybindingItemEntry
):
TPromise
<
any
>
;
removeKeybinding
(
keybindingEntry
:
IKeybindingItemEntry
):
TPromise
<
any
>
;
...
...
@@ -118,8 +119,12 @@ export const CONTEXT_KEYBINDINGS_SEARCH_FOCUS = new RawContextKey<boolean>('inKe
export
const
CONTEXT_KEYBINDING_FOCUS
=
new
RawContextKey
<
boolean
>
(
'
keybindingFocus
'
,
false
);
export
const
SETTINGS_EDITOR_COMMAND_SEARCH
=
'
settings.action.search
'
;
export
const
SETTINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS
=
'
settings.action.clearSearchResults
'
;
export
const
SETTINGS_EDITOR_COMMAND_FOCUS_NEXT_SETTING
=
'
settings.action.focusNextSetting
'
;
export
const
SETTINGS_EDITOR_COMMAND_FOCUS_PREVIOUS_SETTING
=
'
settings.action.focusPreviousSetting
'
;
export
const
SETTINGS_EDITOR_COMMAND_FOCUS_FILE
=
'
settings.action.focusSettingsFile
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_SEARCH
=
'
keybindings.editor.searchKeybindings
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_CLEAR_SEARCH_RESULTS
=
'
keybindings.editor.clearSearchResults
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_DEFINE
=
'
keybindings.editor.defineKeybinding
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_REMOVE
=
'
keybindings.editor.removeKeybinding
'
;
export
const
KEYBINDINGS_EDITOR_COMMAND_RESET
=
'
keybindings.editor.resetKeybinding
'
;
...
...
src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts
浏览文件 @
8e09e964
...
...
@@ -343,7 +343,7 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(FocusTerminalFin
},
KEYBINDING_CONTEXT_TERMINAL_FOCUS
),
'
Terminal: Focus Find Widget
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
HideTerminalFindWidgetAction
,
HideTerminalFindWidgetAction
.
ID
,
HideTerminalFindWidgetAction
.
LABEL
,
{
primary
:
KeyCode
.
Escape
,
secondary
:
[
Key
Code
.
Shift
|
KeyCode
.
Escape
]
secondary
:
[
Key
Mod
.
Shift
|
KeyCode
.
Escape
]
},
ContextKeyExpr
.
and
(
KEYBINDING_CONTEXT_TERMINAL_FOCUS
,
KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE
)),
'
Terminal: Hide Find Widget
'
,
category
);
actionRegistry
.
registerWorkbenchAction
(
new
SyncActionDescriptor
(
ShowNextFindTermTerminalFindWidgetAction
,
ShowNextFindTermTerminalFindWidgetAction
.
ID
,
ShowNextFindTermTerminalFindWidgetAction
.
LABEL
,
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
DownArrow
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录