Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
39da581b
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,发现更多精彩内容 >>
提交
39da581b
编写于
12月 24, 2018
作者:
C
Chris Ganga
提交者:
Matt Bierner
12月 23, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enable strict null check for find controller (#65553)
上级
ff49f585
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
24 addition
and
23 deletion
+24
-23
src/tsconfig.strictNullChecks.json
src/tsconfig.strictNullChecks.json
+1
-0
src/vs/editor/contrib/find/findController.ts
src/vs/editor/contrib/find/findController.ts
+4
-4
src/vs/editor/contrib/find/test/findController.test.ts
src/vs/editor/contrib/find/test/findController.test.ts
+19
-19
未找到文件。
src/tsconfig.strictNullChecks.json
浏览文件 @
39da581b
...
...
@@ -240,6 +240,7 @@
"./vs/editor/contrib/find/replacePattern.ts"
,
"./vs/editor/contrib/find/simpleFindWidget.ts"
,
"./vs/editor/contrib/find/test/find.test.ts"
,
"./vs/editor/contrib/find/test/findController.test.ts"
,
"./vs/editor/contrib/find/test/replacePattern.test.ts"
,
"./vs/editor/contrib/folding/folding.ts"
,
"./vs/editor/contrib/folding/foldingDecorations.ts"
,
...
...
src/vs/editor/contrib/find/findController.ts
浏览文件 @
39da581b
...
...
@@ -437,7 +437,7 @@ export class StartFindAction extends EditorAction {
});
}
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
void
{
public
run
(
accessor
:
ServicesAccessor
|
null
,
editor
:
ICodeEditor
):
void
{
let
controller
=
CommonFindController
.
get
(
editor
);
if
(
controller
)
{
controller
.
start
({
...
...
@@ -488,7 +488,7 @@ export class StartFindWithSelectionAction extends EditorAction {
}
}
export
abstract
class
MatchFindAction
extends
EditorAction
{
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
void
{
public
run
(
accessor
:
ServicesAccessor
|
null
,
editor
:
ICodeEditor
):
void
{
let
controller
=
CommonFindController
.
get
(
editor
);
if
(
controller
&&
!
this
.
_run
(
controller
))
{
controller
.
start
({
...
...
@@ -551,7 +551,7 @@ export class PreviousMatchFindAction extends MatchFindAction {
}
export
abstract
class
SelectionMatchFindAction
extends
EditorAction
{
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
void
{
public
run
(
accessor
:
ServicesAccessor
|
null
,
editor
:
ICodeEditor
):
void
{
let
controller
=
CommonFindController
.
get
(
editor
);
if
(
!
controller
)
{
return
;
...
...
@@ -641,7 +641,7 @@ export class StartFindReplaceAction extends EditorAction {
});
}
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
void
{
public
run
(
accessor
:
ServicesAccessor
|
null
,
editor
:
ICodeEditor
):
void
{
if
(
!
editor
.
hasModel
()
||
editor
.
getConfiguration
().
readOnly
)
{
return
;
}
...
...
src/vs/editor/contrib/find/test/findController.test.ts
浏览文件 @
39da581b
...
...
@@ -51,8 +51,8 @@ export class TestFindController extends CommonFindController {
}
}
function
from
Range
(
rng
:
Range
):
number
[]
{
return
[
rng
.
startLineNumber
,
rng
.
startColumn
,
rng
.
endLineNumber
,
rng
.
endColumn
];
function
from
Selection
(
slc
:
Selection
|
null
):
number
[]
{
return
[
slc
!
.
startLineNumber
,
slc
!
.
startColumn
,
slc
!
.
endLineNumber
,
slc
!
.
endColumn
];
}
suite
(
'
FindController
'
,
()
=>
{
...
...
@@ -68,7 +68,7 @@ suite('FindController', () => {
getInteger
:
(
key
:
string
)
=>
undefined
,
store
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
return
Promise
.
resolve
();
},
remove
:
(
key
)
=>
void
0
}
as
IStorageService
);
}
as
any
);
if
(
platform
.
isMacintosh
)
{
serviceCollection
.
set
(
IClipboardService
,
<
any
>
{
...
...
@@ -122,7 +122,7 @@ suite('FindController', () => {
nextMatchFindAction.run(null, editor);
assert.equal(findState.searchString, 'ABC');
assert.deepEqual(from
Range
(editor.getSelection()), [1, 1, 1, 4]);
assert.deepEqual(from
Selection
(editor.getSelection()), [1, 1, 1, 4]);
findController.dispose();
});
...
...
@@ -175,14 +175,14 @@ suite('FindController', () => {
findState
.
change
({
searchString
:
'
ABC
'
},
true
);
// The first ABC is highlighted.
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
1
,
1
,
1
,
4
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
1
,
1
,
1
,
4
]);
// I hit Esc to exit the Find dialog.
findController
.
closeFindWidget
();
findController
.
hasFocus
=
false
;
// The cursor is now at end of the first line, with ABC on that line highlighted.
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
1
,
1
,
1
,
4
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
1
,
1
,
1
,
4
]);
// I hit delete to remove it and change the text to XYZ.
editor
.
pushUndoStop
();
...
...
@@ -195,10 +195,10 @@ suite('FindController', () => {
// ABC
// XYZ
// ABC
assert
.
equal
(
editor
.
getModel
().
getLineContent
(
1
),
'
XYZ
'
);
assert
.
equal
(
editor
.
getModel
()
!
.
getLineContent
(
1
),
'
XYZ
'
);
// The cursor is at end of the first line.
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
1
,
4
,
1
,
4
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
1
,
4
,
1
,
4
]);
// I hit F3 to "Find Next" to find the next occurrence of ABC, but instead it searches for XYZ.
nextMatchFindAction
.
run
(
null
,
editor
);
...
...
@@ -224,10 +224,10 @@ suite('FindController', () => {
});
nextMatchFindAction
.
run
(
null
,
editor
);
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
1
,
26
,
1
,
29
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
1
,
26
,
1
,
29
]);
nextMatchFindAction
.
run
(
null
,
editor
);
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
1
,
8
,
1
,
11
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
1
,
8
,
1
,
11
]);
findController
.
dispose
();
});
...
...
@@ -250,10 +250,10 @@ suite('FindController', () => {
startFindAction
.
run
(
null
,
editor
);
nextMatchFindAction
.
run
(
null
,
editor
);
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
2
,
9
,
2
,
13
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
2
,
9
,
2
,
13
]);
nextMatchFindAction
.
run
(
null
,
editor
);
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
1
,
9
,
1
,
13
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
1
,
9
,
1
,
13
]);
findController
.
dispose
();
});
...
...
@@ -330,7 +330,7 @@ suite('FindController', () => {
findController
.
getState
().
change
({
searchString
:
'
\\
b
\\
s{3}
\\
b
'
,
replaceString
:
'
'
,
isRegex
:
true
},
false
);
findController
.
moveToNextMatch
();
assert
.
deepEqual
(
editor
.
getSelections
()
.
map
(
fromRange
),
[
assert
.
deepEqual
(
editor
.
getSelections
()
!
.
map
(
fromSelection
),
[
[
1
,
39
,
1
,
42
]
]);
...
...
@@ -357,7 +357,7 @@ suite('FindController', () => {
findController
.
getState
().
change
({
searchString
:
'
^
'
,
replaceString
:
'
x
'
,
isRegex
:
true
},
false
);
findController
.
moveToNextMatch
();
assert
.
deepEqual
(
editor
.
getSelections
()
.
map
(
fromRange
),
[
assert
.
deepEqual
(
editor
.
getSelections
()
!
.
map
(
fromSelection
),
[
[
2
,
1
,
2
,
1
]
]);
...
...
@@ -388,7 +388,7 @@ suite('FindController', () => {
// cmd+f3
nextSelectionMatchFindAction
.
run
(
null
,
editor
);
assert
.
deepEqual
(
editor
.
getSelections
()
.
map
(
fromRange
),
[
assert
.
deepEqual
(
editor
.
getSelections
()
!
.
map
(
fromSelection
),
[
[
3
,
1
,
3
,
9
]
]);
...
...
@@ -419,7 +419,7 @@ suite('FindController', () => {
// cmd+f3
nextSelectionMatchFindAction
.
run
(
null
,
editor
);
assert
.
deepEqual
(
editor
.
getSelections
()
.
map
(
fromRange
),
[
assert
.
deepEqual
(
editor
.
getSelections
()
!
.
map
(
fromSelection
),
[
[
3
,
1
,
3
,
9
]
]);
...
...
@@ -443,7 +443,7 @@ suite('FindController query options persistence', () => {
getInteger
:
(
key
:
string
)
=>
undefined
,
store
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
return
Promise
.
resolve
();
},
remove
:
(
key
)
=>
void
0
}
as
IStorageService
);
}
as
any
);
test
(
'
matchCase
'
,
()
=>
{
withTestCodeEditor
([
...
...
@@ -464,7 +464,7 @@ suite('FindController query options persistence', () => {
// I type ABC.
findState
.
change
({
searchString
:
'
ABC
'
},
true
);
// The second ABC is highlighted as matchCase is true.
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
2
,
1
,
2
,
4
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
2
,
1
,
2
,
4
]);
findController
.
dispose
();
});
...
...
@@ -491,7 +491,7 @@ suite('FindController query options persistence', () => {
// I type AB.
findState
.
change
({
searchString
:
'
AB
'
},
true
);
// The second AB is highlighted as wholeWord is true.
assert
.
deepEqual
(
from
Range
(
editor
.
getSelection
()),
[
2
,
1
,
2
,
3
]);
assert
.
deepEqual
(
from
Selection
(
editor
.
getSelection
()),
[
2
,
1
,
2
,
3
]);
findController
.
dispose
();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录