Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
e1fa9403
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,发现更多精彩内容 >>
提交
e1fa9403
编写于
9月 28, 2020
作者:
T
turara
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add keybinding shortcut for "Preserve case" replace option
Resolves #107208
上级
f05e467e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
53 addition
and
5 deletion
+53
-5
src/vs/base/browser/ui/findinput/replaceInput.ts
src/vs/base/browser/ui/findinput/replaceInput.ts
+3
-1
src/vs/editor/contrib/find/findController.ts
src/vs/editor/contrib/find/findController.ts
+18
-2
src/vs/editor/contrib/find/findModel.ts
src/vs/editor/contrib/find/findModel.ts
+4
-0
src/vs/editor/contrib/find/findWidget.ts
src/vs/editor/contrib/find/findWidget.ts
+4
-0
src/vs/workbench/contrib/codeEditor/browser/find/simpleFindReplaceWidget.ts
...ontrib/codeEditor/browser/find/simpleFindReplaceWidget.ts
+1
-0
src/vs/workbench/contrib/search/browser/search.contribution.ts
...s/workbench/contrib/search/browser/search.contribution.ts
+9
-2
src/vs/workbench/contrib/search/browser/searchActions.ts
src/vs/workbench/contrib/search/browser/searchActions.ts
+7
-0
src/vs/workbench/contrib/search/browser/searchView.ts
src/vs/workbench/contrib/search/browser/searchView.ts
+5
-0
src/vs/workbench/contrib/search/browser/searchWidget.ts
src/vs/workbench/contrib/search/browser/searchWidget.ts
+1
-0
src/vs/workbench/contrib/search/common/constants.ts
src/vs/workbench/contrib/search/common/constants.ts
+1
-0
未找到文件。
src/vs/base/browser/ui/findinput/replaceInput.ts
浏览文件 @
e1fa9403
...
...
@@ -28,6 +28,7 @@ export interface IReplaceInputOptions extends IReplaceInputStyles {
readonly
flexibleWidth
?:
boolean
;
readonly
flexibleMaxHeight
?:
number
;
readonly
appendPreserveCaseLabel
?:
string
;
readonly
history
?:
string
[];
}
...
...
@@ -128,6 +129,7 @@ export class ReplaceInput extends Widget {
this
.
inputValidationErrorBackground
=
options
.
inputValidationErrorBackground
;
this
.
inputValidationErrorForeground
=
options
.
inputValidationErrorForeground
;
const
appendPreserveCaseLabel
=
options
.
appendPreserveCaseLabel
||
''
;
const
history
=
options
.
history
||
[];
const
flexibleHeight
=
!!
options
.
flexibleHeight
;
const
flexibleWidth
=
!!
options
.
flexibleWidth
;
...
...
@@ -161,7 +163,7 @@ export class ReplaceInput extends Widget {
}));
this
.
preserveCase
=
this
.
_register
(
new
PreserveCaseCheckbox
({
appendTitle
:
''
,
appendTitle
:
appendPreserveCaseLabel
,
isChecked
:
false
,
inputActiveOptionBorder
:
this
.
inputActiveOptionBorder
,
inputActiveOptionForeground
:
this
.
inputActiveOptionForeground
,
...
...
src/vs/editor/contrib/find/findController.ts
浏览文件 @
e1fa9403
...
...
@@ -12,7 +12,7 @@ import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import
{
EditorAction
,
EditorCommand
,
ServicesAccessor
,
registerEditorAction
,
registerEditorCommand
,
registerEditorContribution
,
MultiEditorAction
,
registerMultiEditorAction
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
IEditorContribution
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
CONTEXT_FIND_INPUT_FOCUSED
,
CONTEXT_FIND_WIDGET_VISIBLE
,
FIND_IDS
,
FindModelBoundToEditorModel
,
ToggleCaseSensitiveKeybinding
,
ToggleRegexKeybinding
,
ToggleSearchScopeKeybinding
,
ToggleWholeWordKeybinding
,
CONTEXT_REPLACE_INPUT_FOCUSED
}
from
'
vs/editor/contrib/find/findModel
'
;
import
{
CONTEXT_FIND_INPUT_FOCUSED
,
CONTEXT_FIND_WIDGET_VISIBLE
,
FIND_IDS
,
FindModelBoundToEditorModel
,
ToggleCaseSensitiveKeybinding
,
Toggle
PreserveCaseKeybinding
,
Toggle
RegexKeybinding
,
ToggleSearchScopeKeybinding
,
ToggleWholeWordKeybinding
,
CONTEXT_REPLACE_INPUT_FOCUSED
}
from
'
vs/editor/contrib/find/findModel
'
;
import
{
FindOptionsWidget
}
from
'
vs/editor/contrib/find/findOptionsWidget
'
;
import
{
FindReplaceState
,
FindReplaceStateChangedEvent
,
INewFindReplaceState
}
from
'
vs/editor/contrib/find/findState
'
;
import
{
FindWidget
,
IFindController
}
from
'
vs/editor/contrib/find/findWidget
'
;
...
...
@@ -224,7 +224,9 @@ export class CommonFindController extends Disposable implements IEditorContribut
public
togglePreserveCase
():
void
{
this
.
_state
.
change
({
preserveCase
:
!
this
.
_state
.
preserveCase
},
false
);
this
.
highlightFindOptions
();
if
(
!
this
.
_state
.
isRevealed
)
{
this
.
highlightFindOptions
();
}
}
public
toggleSearchScope
():
void
{
...
...
@@ -858,6 +860,20 @@ registerEditorCommand(new FindCommand({
}
}));
registerEditorCommand
(
new
FindCommand
({
id
:
FIND_IDS
.
TogglePreserveCaseCommand
,
precondition
:
undefined
,
handler
:
x
=>
x
.
togglePreserveCase
(),
kbOpts
:
{
weight
:
KeybindingWeight
.
EditorContrib
+
5
,
kbExpr
:
EditorContextKeys
.
focus
,
primary
:
TogglePreserveCaseKeybinding
.
primary
,
mac
:
TogglePreserveCaseKeybinding
.
mac
,
win
:
TogglePreserveCaseKeybinding
.
win
,
linux
:
TogglePreserveCaseKeybinding
.
linux
}
}));
registerEditorCommand
(
new
FindCommand
({
id
:
FIND_IDS
.
ReplaceOneAction
,
precondition
:
CONTEXT_FIND_WIDGET_VISIBLE
,
...
...
src/vs/editor/contrib/find/findModel.ts
浏览文件 @
e1fa9403
...
...
@@ -47,6 +47,10 @@ export const ToggleSearchScopeKeybinding: IKeybindings = {
primary
:
KeyMod
.
Alt
|
KeyCode
.
KEY_L
,
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyCode
.
KEY_L
}
};
export
const
TogglePreserveCaseKeybinding
:
IKeybindings
=
{
primary
:
KeyMod
.
Alt
|
KeyCode
.
KEY_P
,
mac
:
{
primary
:
KeyMod
.
CtrlCmd
|
KeyMod
.
Alt
|
KeyCode
.
KEY_P
}
};
export
const
FIND_IDS
=
{
StartFindAction
:
'
actions.find
'
,
...
...
src/vs/editor/contrib/find/findWidget.ts
浏览文件 @
e1fa9403
...
...
@@ -353,6 +353,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
if
(
e
.
matchCase
)
{
this
.
_findInput
.
setCaseSensitive
(
this
.
_state
.
matchCase
);
}
if
(
e
.
preserveCase
)
{
this
.
_replaceInput
.
setPreserveCase
(
this
.
_state
.
preserveCase
);
}
if
(
e
.
searchScope
)
{
if
(
this
.
_state
.
searchScope
)
{
this
.
_toggleSelectionFind
.
checked
=
true
;
...
...
@@ -1087,6 +1090,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
this
.
_replaceInput
=
this
.
_register
(
new
ContextScopedReplaceInput
(
null
,
undefined
,
{
label
:
NLS_REPLACE_INPUT_LABEL
,
placeholder
:
NLS_REPLACE_INPUT_PLACEHOLDER
,
appendPreserveCaseLabel
:
this
.
_keybindingLabelFor
(
FIND_IDS
.
TogglePreserveCaseCommand
),
history
:
[],
flexibleHeight
,
flexibleWidth
,
...
...
src/vs/workbench/contrib/codeEditor/browser/find/simpleFindReplaceWidget.ts
浏览文件 @
e1fa9403
...
...
@@ -140,6 +140,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
this
.
_findInput
.
setRegex
(
this
.
_state
.
isRegex
);
this
.
_findInput
.
setWholeWords
(
this
.
_state
.
wholeWord
);
this
.
_findInput
.
setCaseSensitive
(
this
.
_state
.
matchCase
);
this
.
_replaceInput
.
setPreserveCase
(
this
.
_state
.
preserveCase
);
this
.
findFirst
();
}));
...
...
src/vs/workbench/contrib/search/browser/search.contribution.ts
浏览文件 @
e1fa9403
...
...
@@ -10,7 +10,7 @@ import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import
*
as
platform
from
'
vs/base/common/platform
'
;
import
{
dirname
}
from
'
vs/base/common/resources
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
ToggleCaseSensitiveKeybinding
,
ToggleRegexKeybinding
,
ToggleWholeWordKeybinding
}
from
'
vs/editor/contrib/find/findModel
'
;
import
{
ToggleCaseSensitiveKeybinding
,
Toggle
PreserveCaseKeybinding
,
Toggle
RegexKeybinding
,
ToggleWholeWordKeybinding
}
from
'
vs/editor/contrib/find/findModel
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
ICommandAction
,
MenuId
,
MenuRegistry
,
SyncActionDescriptor
}
from
'
vs/platform/actions/common/actions
'
;
import
{
CommandsRegistry
,
ICommandHandler
}
from
'
vs/platform/commands/common/commands
'
;
...
...
@@ -31,7 +31,7 @@ import { Extensions as ViewExtensions, IViewsRegistry, IViewContainersRegistry,
import
{
getMultiSelectedResources
}
from
'
vs/workbench/contrib/files/browser/files
'
;
import
{
ExplorerFolderContext
,
ExplorerRootContext
,
FilesExplorerFocusCondition
,
IExplorerService
,
VIEWLET_ID
as
VIEWLET_ID_FILES
}
from
'
vs/workbench/contrib/files/common/files
'
;
import
{
registerContributions
as
replaceContributions
}
from
'
vs/workbench/contrib/search/browser/replaceContributions
'
;
import
{
clearHistoryCommand
,
ClearSearchResultsAction
,
CloseReplaceAction
,
CollapseDeepestExpandedLevelAction
,
copyAllCommand
,
copyMatchCommand
,
copyPathCommand
,
FocusNextInputAction
,
FocusNextSearchResultAction
,
FocusPreviousInputAction
,
FocusPreviousSearchResultAction
,
focusSearchListCommand
,
getSearchView
,
openSearchView
,
OpenSearchViewletAction
,
RefreshAction
,
RemoveAction
,
ReplaceAction
,
ReplaceAllAction
,
ReplaceAllInFolderAction
,
ReplaceInFilesAction
,
toggleCaseSensitiveCommand
,
toggleRegexCommand
,
toggleWholeWordCommand
,
FindInFilesCommand
,
ToggleSearchOnTypeAction
,
ExpandAllAction
}
from
'
vs/workbench/contrib/search/browser/searchActions
'
;
import
{
clearHistoryCommand
,
ClearSearchResultsAction
,
CloseReplaceAction
,
CollapseDeepestExpandedLevelAction
,
copyAllCommand
,
copyMatchCommand
,
copyPathCommand
,
FocusNextInputAction
,
FocusNextSearchResultAction
,
FocusPreviousInputAction
,
FocusPreviousSearchResultAction
,
focusSearchListCommand
,
getSearchView
,
openSearchView
,
OpenSearchViewletAction
,
RefreshAction
,
RemoveAction
,
ReplaceAction
,
ReplaceAllAction
,
ReplaceAllInFolderAction
,
ReplaceInFilesAction
,
toggleCaseSensitiveCommand
,
toggle
PreserveCaseCommand
,
toggle
RegexCommand
,
toggleWholeWordCommand
,
FindInFilesCommand
,
ToggleSearchOnTypeAction
,
ExpandAllAction
}
from
'
vs/workbench/contrib/search/browser/searchActions
'
;
import
{
SearchView
}
from
'
vs/workbench/contrib/search/browser/searchView
'
;
import
{
registerContributions
as
searchWidgetContributions
}
from
'
vs/workbench/contrib/search/browser/searchWidget
'
;
import
*
as
Constants
from
'
vs/workbench/contrib/search/common/constants
'
;
...
...
@@ -642,6 +642,13 @@ KeybindingsRegistry.registerCommandAndKeybindingRule(Object.assign({
handler
:
toggleRegexCommand
},
ToggleRegexKeybinding
));
KeybindingsRegistry
.
registerCommandAndKeybindingRule
(
Object
.
assign
({
id
:
Constants
.
TogglePreserveCaseId
,
weight
:
KeybindingWeight
.
WorkbenchContrib
,
when
:
Constants
.
SearchViewFocusedKey
,
handler
:
togglePreserveCaseCommand
},
TogglePreserveCaseKeybinding
));
KeybindingsRegistry
.
registerCommandAndKeybindingRule
({
id
:
Constants
.
AddCursorsAtSearchResults
,
weight
:
KeybindingWeight
.
WorkbenchContrib
,
...
...
src/vs/workbench/contrib/search/browser/searchActions.ts
浏览文件 @
e1fa9403
...
...
@@ -83,6 +83,13 @@ export const toggleRegexCommand = (accessor: ServicesAccessor) => {
}
};
export
const
togglePreserveCaseCommand
=
(
accessor
:
ServicesAccessor
)
=>
{
const
searchView
=
getSearchView
(
accessor
.
get
(
IViewsService
));
if
(
searchView
)
{
searchView
.
togglePreserveCase
();
}
};
export
class
FocusNextInputAction
extends
Action
{
static
readonly
ID
=
'
search.focus.nextInputBox
'
;
...
...
src/vs/workbench/contrib/search/browser/searchView.ts
浏览文件 @
e1fa9403
...
...
@@ -1160,6 +1160,11 @@ export class SearchView extends ViewPane {
this
.
triggerQueryChange
();
}
togglePreserveCase
():
void
{
this
.
searchWidget
.
replaceInput
.
setPreserveCase
(
!
this
.
searchWidget
.
replaceInput
.
getPreserveCase
());
this
.
triggerQueryChange
();
}
setSearchParameters
(
args
:
IFindInFilesArgs
=
{}):
void
{
if
(
typeof
args
.
isCaseSensitive
===
'
boolean
'
)
{
this
.
searchWidget
.
searchInput
.
setCaseSensitive
(
args
.
isCaseSensitive
);
...
...
src/vs/workbench/contrib/search/browser/searchWidget.ts
浏览文件 @
e1fa9403
...
...
@@ -393,6 +393,7 @@ export class SearchWidget extends Widget {
this
.
replaceInput
=
this
.
_register
(
new
ContextScopedReplaceInput
(
replaceBox
,
this
.
contextViewService
,
{
label
:
nls
.
localize
(
'
label.Replace
'
,
'
Replace: Type replace term and press Enter to preview or Escape to cancel
'
),
placeholder
:
nls
.
localize
(
'
search.replace.placeHolder
'
,
"
Replace
"
),
appendPreserveCaseLabel
:
appendKeyBindingLabel
(
''
,
this
.
keyBindingService
.
lookupKeybinding
(
Constants
.
TogglePreserveCaseId
),
this
.
keyBindingService
),
history
:
options
.
replaceHistory
,
flexibleHeight
:
true
,
flexibleMaxHeight
:
SearchWidget
.
INPUT_MAX_HEIGHT
...
...
src/vs/workbench/contrib/search/common/constants.ts
浏览文件 @
e1fa9403
...
...
@@ -26,6 +26,7 @@ export const CloseReplaceWidgetActionId = 'closeReplaceInFilesWidget';
export
const
ToggleCaseSensitiveCommandId
=
'
toggleSearchCaseSensitive
'
;
export
const
ToggleWholeWordCommandId
=
'
toggleSearchWholeWord
'
;
export
const
ToggleRegexCommandId
=
'
toggleSearchRegex
'
;
export
const
TogglePreserveCaseId
=
'
toggleSearchPreserveCase
'
;
export
const
AddCursorsAtSearchResults
=
'
addCursorsAtSearchResults
'
;
export
const
RevealInSideBarForSearchResults
=
'
search.action.revealInSideBar
'
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录