Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
49696e87
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
49696e87
编写于
10月 30, 2020
作者:
P
Peng Lyu
提交者:
GitHub
10月 30, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #109767 from microsoft/rebornix/revertFix#47400
revert fix#47400
上级
3f5f7475
923a59ee
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
18 addition
and
27 deletion
+18
-27
src/vs/editor/contrib/find/findController.ts
src/vs/editor/contrib/find/findController.ts
+11
-20
src/vs/editor/contrib/find/test/findController.test.ts
src/vs/editor/contrib/find/test/findController.test.ts
+7
-7
未找到文件。
src/vs/editor/contrib/find/findController.ts
浏览文件 @
49696e87
...
...
@@ -30,18 +30,14 @@ import { IStorageKeysSyncRegistryService } from 'vs/platform/userDataSync/common
const
SEARCH_STRING_MAX_LENGTH
=
524288
;
export
function
getSelectionSearchString
(
editor
:
ICodeEditor
,
seedSearchStringFromSelection
:
'
single
'
|
'
multiple
'
=
'
single
'
):
string
|
null
{
export
function
getSelectionSearchString
(
editor
:
ICodeEditor
):
string
|
null
{
if
(
!
editor
.
hasModel
())
{
return
null
;
}
const
selection
=
editor
.
getSelection
();
// if selection spans multiple lines, default search string to empty
if
(
(
seedSearchStringFromSelection
===
'
single
'
&&
selection
.
startLineNumber
===
selection
.
endLineNumber
)
||
seedSearchStringFromSelection
===
'
multiple
'
)
{
if
(
selection
.
startLineNumber
===
selection
.
endLineNumber
)
{
if
(
selection
.
isEmpty
())
{
const
wordAtPosition
=
editor
.
getConfiguredWordAtPosition
(
selection
.
getStartPosition
());
if
(
wordAtPosition
)
{
...
...
@@ -65,7 +61,7 @@ export const enum FindStartFocusAction {
export
interface
IFindStartOptions
{
forceRevealReplace
:
boolean
;
seedSearchStringFromSelection
:
'
none
'
|
'
single
'
|
'
multiple
'
;
seedSearchStringFromSelection
:
boolean
;
seedSearchStringFromGlobalClipboard
:
boolean
;
shouldFocus
:
FindStartFocusAction
;
shouldAnimate
:
boolean
;
...
...
@@ -126,7 +122,7 @@ export class CommonFindController extends Disposable implements IEditorContribut
if
(
shouldRestartFind
)
{
this
.
_start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
none
'
,
seedSearchStringFromSelection
:
false
&&
this
.
_editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
false
,
...
...
@@ -282,8 +278,8 @@ export class CommonFindController extends Disposable implements IEditorContribut
isRevealed
:
true
};
if
(
opts
.
seedSearchStringFromSelection
===
'
single
'
)
{
let
selectionSearchString
=
getSelectionSearchString
(
this
.
_editor
,
opts
.
seedSearchStringFromSelection
);
if
(
opts
.
seedSearchStringFromSelection
)
{
let
selectionSearchString
=
getSelectionSearchString
(
this
.
_editor
);
if
(
selectionSearchString
)
{
if
(
this
.
_state
.
isRegex
)
{
stateChanges
.
searchString
=
strings
.
escapeRegExpCharacters
(
selectionSearchString
);
...
...
@@ -291,11 +287,6 @@ export class CommonFindController extends Disposable implements IEditorContribut
stateChanges
.
searchString
=
selectionSearchString
;
}
}
}
else
if
(
opts
.
seedSearchStringFromSelection
===
'
multiple
'
&&
!
opts
.
updateSearchScope
)
{
let
selectionSearchString
=
getSelectionSearchString
(
this
.
_editor
,
opts
.
seedSearchStringFromSelection
);
if
(
selectionSearchString
)
{
stateChanges
.
searchString
=
selectionSearchString
;
}
}
if
(
!
stateChanges
.
searchString
&&
opts
.
seedSearchStringFromGlobalClipboard
)
{
...
...
@@ -502,7 +493,7 @@ export class StartFindAction extends MultiEditorAction {
if
(
controller
)
{
await
controller
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
?
'
single
'
:
'
none
'
,
seedSearchStringFromSelection
:
editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
,
seedSearchStringFromGlobalClipboard
:
editor
.
getOption
(
EditorOption
.
find
).
globalFindClipboard
,
shouldFocus
:
FindStartFocusAction
.
FocusFindInput
,
shouldAnimate
:
true
,
...
...
@@ -537,7 +528,7 @@ export class StartFindWithSelectionAction extends EditorAction {
if
(
controller
)
{
await
controller
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
multiple
'
,
seedSearchStringFromSelection
:
true
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
true
,
...
...
@@ -555,7 +546,7 @@ export abstract class MatchFindAction extends EditorAction {
if
(
controller
&&
!
this
.
_run
(
controller
))
{
await
controller
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
(
controller
.
getState
().
searchString
.
length
===
0
)
&&
editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
?
'
single
'
:
'
multiple
'
,
seedSearchStringFromSelection
:
(
controller
.
getState
().
searchString
.
length
===
0
)
&&
editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
,
seedSearchStringFromGlobalClipboard
:
true
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
true
,
...
...
@@ -668,7 +659,7 @@ export abstract class SelectionMatchFindAction extends EditorAction {
if
(
!
this
.
_run
(
controller
))
{
await
controller
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
?
'
single
'
:
'
none
'
,
seedSearchStringFromSelection
:
editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
true
,
...
...
@@ -774,7 +765,7 @@ export class StartFindReplaceAction extends MultiEditorAction {
if
(
controller
)
{
await
controller
.
start
({
forceRevealReplace
:
true
,
seedSearchStringFromSelection
:
seedSearchStringFromSelection
?
'
single
'
:
'
none
'
,
seedSearchStringFromSelection
:
seedSearchStringFromSelection
,
seedSearchStringFromGlobalClipboard
:
editor
.
getOption
(
EditorOption
.
find
).
seedSearchStringFromSelection
,
shouldFocus
:
shouldFocus
,
shouldAnimate
:
true
,
...
...
src/vs/editor/contrib/find/test/findController.test.ts
浏览文件 @
49696e87
...
...
@@ -272,7 +272,7 @@ suite('FindController', async () => {
findController
.
setSearchString
(
testRegexString
);
await
findController
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
none
'
,
seedSearchStringFromSelection
:
false
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
FocusFindInput
,
shouldAnimate
:
false
,
...
...
@@ -298,7 +298,7 @@ suite('FindController', async () => {
let
findController
=
editor
.
registerAndInstantiateContribution
(
TestFindController
.
ID
,
TestFindController
);
await
findController
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
none
'
,
seedSearchStringFromSelection
:
false
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
false
,
...
...
@@ -524,9 +524,9 @@ suite('FindController query options persistence', async () => {
],
{
serviceCollection
:
serviceCollection
,
find
:
{
autoFindInSelection
:
'
always
'
,
globalFindClipboard
:
false
}
},
async
(
editor
)
=>
{
// clipboardState = '';
let
findController
=
editor
.
registerAndInstantiateContribution
(
TestFindController
.
ID
,
TestFindController
);
const
findConfig
:
IFindStartOptions
=
{
const
findConfig
=
{
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
none
'
,
seedSearchStringFromSelection
:
false
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
false
,
...
...
@@ -558,7 +558,7 @@ suite('FindController query options persistence', async () => {
await
findController
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
none
'
,
seedSearchStringFromSelection
:
false
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
false
,
...
...
@@ -582,7 +582,7 @@ suite('FindController query options persistence', async () => {
await
findController
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
none
'
,
seedSearchStringFromSelection
:
false
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
false
,
...
...
@@ -607,7 +607,7 @@ suite('FindController query options persistence', async () => {
await
findController
.
start
({
forceRevealReplace
:
false
,
seedSearchStringFromSelection
:
'
none
'
,
seedSearchStringFromSelection
:
false
,
seedSearchStringFromGlobalClipboard
:
false
,
shouldFocus
:
FindStartFocusAction
.
NoFocusChange
,
shouldAnimate
:
false
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录