Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c8a9182f
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,发现更多精彩内容 >>
提交
c8a9182f
编写于
4月 18, 2020
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
define find widget codicons
上级
dcd813e6
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
27 addition
and
24 deletion
+27
-24
src/vs/editor/contrib/find/findWidget.ts
src/vs/editor/contrib/find/findWidget.ts
+21
-14
src/vs/workbench/contrib/codeEditor/browser/find/simpleFindReplaceWidget.ts
...ontrib/codeEditor/browser/find/simpleFindReplaceWidget.ts
+6
-10
未找到文件。
src/vs/editor/contrib/find/findWidget.ts
浏览文件 @
c8a9182f
...
@@ -39,7 +39,15 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
...
@@ -39,7 +39,15 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import
{
IStorageKeysSyncRegistryService
}
from
'
vs/platform/userDataSync/common/storageKeys
'
;
import
{
IStorageKeysSyncRegistryService
}
from
'
vs/platform/userDataSync/common/storageKeys
'
;
import
{
Codicon
,
registerIcon
}
from
'
vs/base/browser/ui/codicons/codicons
'
;
import
{
Codicon
,
registerIcon
}
from
'
vs/base/browser/ui/codicons/codicons
'
;
export
const
findSelectionIcon
=
registerIcon
(
'
find-selection
'
,
Codicon
.
selection
);
const
findSelectionIcon
=
registerIcon
(
'
find-selection
'
,
Codicon
.
selection
);
const
findCollapsedIcon
=
registerIcon
(
'
find-collapsed
'
,
Codicon
.
chevronRight
);
const
findExpandedIcon
=
registerIcon
(
'
find-expanded
'
,
Codicon
.
chevronDown
);
export
const
findCloseIcon
=
registerIcon
(
'
find-close
'
,
Codicon
.
close
);
export
const
findReplaceIcon
=
registerIcon
(
'
find-replace
'
,
Codicon
.
replace
);
export
const
findReplaceAllIcon
=
registerIcon
(
'
find-replace-all
'
,
Codicon
.
replaceAll
);
export
const
findPreviousMatchIcon
=
registerIcon
(
'
find-previous-match
'
,
Codicon
.
arrowUp
);
export
const
findNextMatchIcon
=
registerIcon
(
'
find-next-match
'
,
Codicon
.
arrowDown
);
export
interface
IFindController
{
export
interface
IFindController
{
replace
():
void
;
replace
():
void
;
...
@@ -470,8 +478,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
...
@@ -470,8 +478,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
this
.
_replaceAllBtn
.
setEnabled
(
this
.
_isVisible
&&
this
.
_isReplaceVisible
&&
findInputIsNonEmpty
);
this
.
_replaceAllBtn
.
setEnabled
(
this
.
_isVisible
&&
this
.
_isReplaceVisible
&&
findInputIsNonEmpty
);
dom
.
toggleClass
(
this
.
_domNode
,
'
replaceToggled
'
,
this
.
_isReplaceVisible
);
dom
.
toggleClass
(
this
.
_domNode
,
'
replaceToggled
'
,
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-right
'
,
!
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-down
'
,
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
let
canReplace
=
!
this
.
_codeEditor
.
getOption
(
EditorOption
.
readOnly
);
let
canReplace
=
!
this
.
_codeEditor
.
getOption
(
EditorOption
.
readOnly
);
...
@@ -993,7 +999,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
...
@@ -993,7 +999,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Previous button
// Previous button
this
.
_prevBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
_prevBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_PREVIOUS_MATCH_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
PreviousMatchFindAction
),
label
:
NLS_PREVIOUS_MATCH_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
PreviousMatchFindAction
),
className
:
'
codicon codicon-arrow-up
'
,
className
:
findPreviousMatchIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
_codeEditor
.
getAction
(
FIND_IDS
.
PreviousMatchFindAction
).
run
().
then
(
undefined
,
onUnexpectedError
);
this
.
_codeEditor
.
getAction
(
FIND_IDS
.
PreviousMatchFindAction
).
run
().
then
(
undefined
,
onUnexpectedError
);
}
}
...
@@ -1002,7 +1008,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
...
@@ -1002,7 +1008,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Next button
// Next button
this
.
_nextBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
_nextBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_NEXT_MATCH_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
NextMatchFindAction
),
label
:
NLS_NEXT_MATCH_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
NextMatchFindAction
),
className
:
'
codicon codicon-arrow-down
'
,
className
:
findNextMatchIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
_codeEditor
.
getAction
(
FIND_IDS
.
NextMatchFindAction
).
run
().
then
(
undefined
,
onUnexpectedError
);
this
.
_codeEditor
.
getAction
(
FIND_IDS
.
NextMatchFindAction
).
run
().
then
(
undefined
,
onUnexpectedError
);
}
}
...
@@ -1046,7 +1052,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
...
@@ -1046,7 +1052,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Close button
// Close button
this
.
_closeBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
_closeBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_CLOSE_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
CloseFindWidgetCommand
),
label
:
NLS_CLOSE_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
CloseFindWidgetCommand
),
className
:
'
codicon codicon-close
'
,
className
:
findCloseIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
_state
.
change
({
isRevealed
:
false
,
searchScope
:
null
},
false
);
this
.
_state
.
change
({
isRevealed
:
false
,
searchScope
:
null
},
false
);
},
},
...
@@ -1109,7 +1115,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
...
@@ -1109,7 +1115,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Replace one button
// Replace one button
this
.
_replaceBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
_replaceBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_REPLACE_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
ReplaceOneAction
),
label
:
NLS_REPLACE_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
ReplaceOneAction
),
className
:
'
codicon codicon-replace
'
,
className
:
findReplaceIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
_controller
.
replace
();
this
.
_controller
.
replace
();
},
},
...
@@ -1124,7 +1130,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
...
@@ -1124,7 +1130,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
// Replace all button
// Replace all button
this
.
_replaceAllBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
_replaceAllBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_REPLACE_ALL_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
ReplaceAllAction
),
label
:
NLS_REPLACE_ALL_BTN_LABEL
+
this
.
_keybindingLabelFor
(
FIND_IDS
.
ReplaceAllAction
),
className
:
'
codicon codicon-replace-all
'
,
className
:
findReplaceAllIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
_controller
.
replaceAll
();
this
.
_controller
.
replaceAll
();
}
}
...
@@ -1154,8 +1160,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
...
@@ -1154,8 +1160,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas
this
.
_showViewZone
();
this
.
_showViewZone
();
}
}
}));
}));
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-down
'
,
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-right
'
,
!
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
// Widget
// Widget
...
@@ -1298,10 +1302,13 @@ export class SimpleButton extends Widget {
...
@@ -1298,10 +1302,13 @@ export class SimpleButton extends Widget {
public
setExpanded
(
expanded
:
boolean
):
void
{
public
setExpanded
(
expanded
:
boolean
):
void
{
this
.
_domNode
.
setAttribute
(
'
aria-expanded
'
,
String
(
!!
expanded
));
this
.
_domNode
.
setAttribute
(
'
aria-expanded
'
,
String
(
!!
expanded
));
if
(
expanded
)
{
dom
.
removeClasses
(
this
.
_domNode
,
findCollapsedIcon
.
classNames
);
dom
.
addClasses
(
this
.
_domNode
,
findExpandedIcon
.
classNames
);
}
else
{
dom
.
removeClasses
(
this
.
_domNode
,
findExpandedIcon
.
classNames
);
dom
.
addClasses
(
this
.
_domNode
,
findCollapsedIcon
.
classNames
);
}
}
public
toggleClass
(
className
:
string
,
shouldHaveIt
:
boolean
):
void
{
dom
.
toggleClass
(
this
.
_domNode
,
className
,
shouldHaveIt
);
}
}
}
}
...
...
src/vs/workbench/contrib/codeEditor/browser/find/simpleFindReplaceWidget.ts
浏览文件 @
c8a9182f
...
@@ -12,7 +12,7 @@ import { Delayer } from 'vs/base/common/async';
...
@@ -12,7 +12,7 @@ import { Delayer } from 'vs/base/common/async';
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
FindReplaceState
,
FindReplaceStateChangedEvent
}
from
'
vs/editor/contrib/find/findState
'
;
import
{
FindReplaceState
,
FindReplaceStateChangedEvent
}
from
'
vs/editor/contrib/find/findState
'
;
import
{
IMessage
as
InputBoxMessage
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
IMessage
as
InputBoxMessage
}
from
'
vs/base/browser/ui/inputbox/inputBox
'
;
import
{
SimpleButton
}
from
'
vs/editor/contrib/find/findWidget
'
;
import
{
SimpleButton
,
findCloseIcon
,
findNextMatchIcon
,
findPreviousMatchIcon
,
findReplaceIcon
,
findReplaceAllIcon
}
from
'
vs/editor/contrib/find/findWidget
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
editorWidgetBackground
,
inputActiveOptionBorder
,
inputActiveOptionBackground
,
inputBackground
,
inputBorder
,
inputForeground
,
inputValidationErrorBackground
,
inputValidationErrorBorder
,
inputValidationErrorForeground
,
inputValidationInfoBackground
,
inputValidationInfoBorder
,
inputValidationInfoForeground
,
inputValidationWarningBackground
,
inputValidationWarningBorder
,
inputValidationWarningForeground
,
widgetShadow
,
editorWidgetForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
editorWidgetBackground
,
inputActiveOptionBorder
,
inputActiveOptionBackground
,
inputBackground
,
inputBorder
,
inputForeground
,
inputValidationErrorBackground
,
inputValidationErrorBorder
,
inputValidationErrorForeground
,
inputValidationInfoBackground
,
inputValidationInfoBorder
,
inputValidationInfoForeground
,
inputValidationWarningBackground
,
inputValidationWarningBorder
,
inputValidationWarningForeground
,
widgetShadow
,
editorWidgetForeground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
...
@@ -90,8 +90,6 @@ export abstract class SimpleFindReplaceWidget extends Widget {
...
@@ -90,8 +90,6 @@ export abstract class SimpleFindReplaceWidget extends Widget {
}
}
}
}
}));
}));
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-down
'
,
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-right
'
,
!
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
this
.
_domNode
.
appendChild
(
this
.
_toggleReplaceBtn
.
domNode
);
this
.
_domNode
.
appendChild
(
this
.
_toggleReplaceBtn
.
domNode
);
...
@@ -147,7 +145,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
...
@@ -147,7 +145,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
this
.
prevBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
prevBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_PREVIOUS_MATCH_BTN_LABEL
,
label
:
NLS_PREVIOUS_MATCH_BTN_LABEL
,
className
:
'
codicon codicon-arrow-up
'
,
className
:
findPreviousMatchIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
find
(
true
);
this
.
find
(
true
);
}
}
...
@@ -155,7 +153,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
...
@@ -155,7 +153,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
this
.
nextBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
nextBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_NEXT_MATCH_BTN_LABEL
,
label
:
NLS_NEXT_MATCH_BTN_LABEL
,
className
:
'
codicon codicon-arrow-down
'
,
className
:
findNextMatchIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
find
(
false
);
this
.
find
(
false
);
}
}
...
@@ -163,7 +161,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
...
@@ -163,7 +161,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
const
closeBtn
=
this
.
_register
(
new
SimpleButton
({
const
closeBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_CLOSE_BTN_LABEL
,
label
:
NLS_CLOSE_BTN_LABEL
,
className
:
'
codicon codicon-close
'
,
className
:
findCloseIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
hide
();
this
.
hide
();
}
}
...
@@ -221,7 +219,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
...
@@ -221,7 +219,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
this
.
_replaceBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
_replaceBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_REPLACE_BTN_LABEL
,
label
:
NLS_REPLACE_BTN_LABEL
,
className
:
'
codicon codicon-replace
'
,
className
:
findReplaceIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
replaceOne
();
this
.
replaceOne
();
}
}
...
@@ -230,7 +228,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
...
@@ -230,7 +228,7 @@ export abstract class SimpleFindReplaceWidget extends Widget {
// Replace all button
// Replace all button
this
.
_replaceAllBtn
=
this
.
_register
(
new
SimpleButton
({
this
.
_replaceAllBtn
=
this
.
_register
(
new
SimpleButton
({
label
:
NLS_REPLACE_ALL_BTN_LABEL
,
label
:
NLS_REPLACE_ALL_BTN_LABEL
,
className
:
'
codicon codicon-replace-all
'
,
className
:
findReplaceAllIcon
.
classNames
,
onTrigger
:
()
=>
{
onTrigger
:
()
=>
{
this
.
replaceAll
();
this
.
replaceAll
();
}
}
...
@@ -315,8 +313,6 @@ export abstract class SimpleFindReplaceWidget extends Widget {
...
@@ -315,8 +313,6 @@ export abstract class SimpleFindReplaceWidget extends Widget {
this
.
_replaceAllBtn
.
setEnabled
(
this
.
_isVisible
&&
this
.
_isReplaceVisible
&&
findInputIsNonEmpty
);
this
.
_replaceAllBtn
.
setEnabled
(
this
.
_isVisible
&&
this
.
_isReplaceVisible
&&
findInputIsNonEmpty
);
dom
.
toggleClass
(
this
.
_domNode
,
'
replaceToggled
'
,
this
.
_isReplaceVisible
);
dom
.
toggleClass
(
this
.
_domNode
,
'
replaceToggled
'
,
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-right
'
,
!
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
toggleClass
(
'
codicon-chevron-down
'
,
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
this
.
_toggleReplaceBtn
.
setExpanded
(
this
.
_isReplaceVisible
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录