Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b385bb8f
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,发现更多精彩内容 >>
提交
b385bb8f
编写于
9月 11, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #51119
上级
3c2dbc17
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
122 addition
and
75 deletion
+122
-75
src/vs/editor/common/controller/cursorWordOperations.ts
src/vs/editor/common/controller/cursorWordOperations.ts
+33
-18
src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts
...editor/contrib/wordOperations/test/wordOperations.test.ts
+86
-54
src/vs/editor/contrib/wordOperations/wordOperations.ts
src/vs/editor/contrib/wordOperations/wordOperations.ts
+1
-1
src/vs/editor/contrib/wordPartOperations/test/wordPartOperations.test.ts
...ontrib/wordPartOperations/test/wordPartOperations.test.ts
+2
-2
未找到文件。
src/vs/editor/common/controller/cursorWordOperations.ts
浏览文件 @
b385bb8f
...
...
@@ -39,7 +39,8 @@ const enum WordType {
export
const
enum
WordNavigationType
{
WordStart
=
0
,
WordEnd
=
1
WordStartFast
=
1
,
WordEnd
=
2
}
export
class
WordOperations
{
...
...
@@ -161,9 +162,11 @@ export class WordOperations {
public
static
moveWordLeft
(
wordSeparators
:
WordCharacterClassifier
,
model
:
ICursorSimpleModel
,
position
:
Position
,
wordNavigationType
:
WordNavigationType
):
Position
{
let
lineNumber
=
position
.
lineNumber
;
let
column
=
position
.
column
;
let
movedToPreviousLine
=
false
;
if
(
column
===
1
)
{
if
(
lineNumber
>
1
)
{
movedToPreviousLine
=
true
;
lineNumber
=
lineNumber
-
1
;
column
=
model
.
getLineMaxColumn
(
lineNumber
);
}
...
...
@@ -172,29 +175,41 @@ export class WordOperations {
let
prevWordOnLine
=
WordOperations
.
_findPreviousWordOnLine
(
wordSeparators
,
model
,
new
Position
(
lineNumber
,
column
));
if
(
wordNavigationType
===
WordNavigationType
.
WordStart
)
{
if
(
prevWordOnLine
&&
prevWordOnLine
.
wordType
===
WordType
.
Separator
)
{
if
(
prevWordOnLine
.
end
-
prevWordOnLine
.
start
===
1
&&
prevWordOnLine
.
nextCharClass
===
WordCharacterClass
.
Regular
)
{
// Skip over a word made up of one single separator and followed by a regular character
prevWordOnLine
=
WordOperations
.
_findPreviousWordOnLine
(
wordSeparators
,
model
,
new
Position
(
lineNumber
,
prevWordOnLine
.
start
+
1
));
if
(
prevWordOnLine
&&
!
movedToPreviousLine
)
{
// Special case for Visual Studio compatibility:
// when starting in the trim whitespace at the end of a line,
// go to the end of the last word
const
lastWhitespaceColumn
=
model
.
getLineLastNonWhitespaceColumn
(
lineNumber
);
if
(
lastWhitespaceColumn
<
column
)
{
return
new
Position
(
lineNumber
,
prevWordOnLine
.
end
+
1
);
}
}
if
(
prevWordOnLine
)
{
column
=
prevWordOnLine
.
start
+
1
;
}
else
{
column
=
1
;
}
}
else
{
if
(
prevWordOnLine
&&
column
<=
prevWordOnLine
.
end
+
1
)
{
return
new
Position
(
lineNumber
,
prevWordOnLine
?
prevWordOnLine
.
start
+
1
:
1
);
}
if
(
wordNavigationType
===
WordNavigationType
.
WordStartFast
)
{
if
(
prevWordOnLine
&&
prevWordOnLine
.
wordType
===
WordType
.
Separator
&&
prevWordOnLine
.
end
-
prevWordOnLine
.
start
===
1
&&
prevWordOnLine
.
nextCharClass
===
WordCharacterClass
.
Regular
)
{
// Skip over a word made up of one single separator and followed by a regular character
prevWordOnLine
=
WordOperations
.
_findPreviousWordOnLine
(
wordSeparators
,
model
,
new
Position
(
lineNumber
,
prevWordOnLine
.
start
+
1
));
}
if
(
prevWordOnLine
)
{
column
=
prevWordOnLine
.
end
+
1
;
}
else
{
column
=
1
;
}
return
new
Position
(
lineNumber
,
prevWordOnLine
?
prevWordOnLine
.
start
+
1
:
1
);
}
return
new
Position
(
lineNumber
,
column
);
// We are stopping at the ending of words
if
(
prevWordOnLine
&&
column
<=
prevWordOnLine
.
end
+
1
)
{
prevWordOnLine
=
WordOperations
.
_findPreviousWordOnLine
(
wordSeparators
,
model
,
new
Position
(
lineNumber
,
prevWordOnLine
.
start
+
1
));
}
return
new
Position
(
lineNumber
,
prevWordOnLine
?
prevWordOnLine
.
end
+
1
:
1
);
}
public
static
moveWordRight
(
wordSeparators
:
WordCharacterClassifier
,
model
:
ICursorSimpleModel
,
position
:
Position
,
wordNavigationType
:
WordNavigationType
):
Position
{
...
...
src/vs/editor/contrib/wordOperations/test/wordOperations.test.ts
浏览文件 @
b385bb8f
...
...
@@ -44,16 +44,16 @@ suite('WordOperations', () => {
function
runEditorCommand
(
editor
:
ICodeEditor
,
command
:
EditorCommand
):
void
{
command
.
runEditorCommand
(
null
,
editor
,
null
);
}
function
move
WordLeft
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
function
cursor
WordLeft
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
runEditorCommand
(
editor
,
inSelectionMode
?
_cursorWordLeftSelect
:
_cursorWordLeft
);
}
function
move
WordStartLeft
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
function
cursor
WordStartLeft
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
runEditorCommand
(
editor
,
inSelectionMode
?
_cursorWordStartLeftSelect
:
_cursorWordStartLeft
);
}
function
move
WordEndLeft
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
function
cursor
WordEndLeft
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
runEditorCommand
(
editor
,
inSelectionMode
?
_cursorWordEndLeftSelect
:
_cursorWordEndLeft
);
}
function
move
WordRight
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
function
cursor
WordRight
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
runEditorCommand
(
editor
,
inSelectionMode
?
_cursorWordRightSelect
:
_cursorWordRight
);
}
function
moveWordEndRight
(
editor
:
ICodeEditor
,
inSelectionMode
:
boolean
=
false
):
void
{
...
...
@@ -81,7 +81,7 @@ suite('WordOperations', () => {
runEditorCommand
(
editor
,
_deleteWordEndRight
);
}
test
(
'
move word left
'
,
()
=>
{
test
(
'
cursorWordLeft - simple
'
,
()
=>
{
const
EXPECTED
=
[
'
|
\t
|My |First |Line
\t
'
,
'
|
\t
|My |Second |Line
'
,
...
...
@@ -93,7 +93,7 @@ suite('WordOperations', () => {
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1000
,
1000
),
ed
=>
move
WordLeft
(
ed
),
ed
=>
cursor
WordLeft
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
1
))
);
...
...
@@ -101,7 +101,7 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
move word left
selection
'
,
()
=>
{
test
(
'
cursorWordLeft - with
selection
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -110,18 +110,18 @@ suite('WordOperations', () => {
'
1
'
,
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
5
,
2
));
move
WordLeft
(
editor
,
true
);
cursor
WordLeft
(
editor
,
true
);
assert
.
deepEqual
(
editor
.
getSelection
(),
new
Selection
(
5
,
2
,
5
,
1
));
});
});
test
(
'
issue #832: moveWordLeft
'
,
()
=>
{
test
(
'
cursorWordLeft - issue #832
'
,
()
=>
{
const
EXPECTED
=
[
'
| |/* |Just |some |more |text |a|+= |3 |+|5-|3 |+ |7 |*/
'
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1000
,
1000
),
ed
=>
move
WordLeft
(
ed
),
ed
=>
cursor
WordLeft
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
1
))
);
...
...
@@ -129,13 +129,30 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
moveWordStartLeft
'
,
()
=>
{
const
EXPECTED
=
[
'
| |/* |Just |some |more |text |a|+= |3 |+|5-|3 |+ |7 |*/
'
].
join
(
'
\n
'
);
test
(
'
cursorWordLeft - issue #48046: Word selection doesn
\'
t work as usual
'
,
()
=>
{
const
EXPECTED
=
[
'
|deep.|object.|property
'
,
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1
,
21
),
ed
=>
cursorWordLeft
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
1
))
);
const
actual
=
serializePipePositions
(
text
,
actualStops
);
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
cursorWordStartLeft
'
,
()
=>
{
// This is the behaviour observed in Visual Studio, please do not touch test
const
EXPECTED
=
[
'
| |/* |Just |some |more |text |a|+= |3 |+|5|-|3 |+ |7 |*/|
'
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1000
,
1000
),
ed
=>
move
WordStartLeft
(
ed
),
ed
=>
cursor
WordStartLeft
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
1
))
);
...
...
@@ -143,13 +160,28 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
moveWordEndLeft
'
,
()
=>
{
test
(
'
cursorWordStartLeft - issue #51119: regression makes VS compatibility impossible
'
,
()
=>
{
// This is the behaviour observed in Visual Studio, please do not touch test
const
EXPECTED
=
[
'
|this|.|is|.|a|.|test
'
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1000
,
1000
),
ed
=>
cursorWordStartLeft
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
1
))
);
const
actual
=
serializePipePositions
(
text
,
actualStops
);
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
cursorWordEndLeft
'
,
()
=>
{
const
EXPECTED
=
[
'
| /*| Just| some| more| text| a|+=| 3| +|5|-|3| +| 7| */|
'
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1000
,
1000
),
ed
=>
move
WordEndLeft
(
ed
),
ed
=>
cursor
WordEndLeft
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
1
))
);
...
...
@@ -157,7 +189,7 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
move word right
'
,
()
=>
{
test
(
'
cursorWordRight - simple
'
,
()
=>
{
const
EXPECTED
=
[
'
\t
My| First| Line|
\t
|
'
,
'
\t
My| Second| Line|
'
,
...
...
@@ -169,7 +201,7 @@ suite('WordOperations', () => {
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1
,
1
),
ed
=>
move
WordRight
(
ed
),
ed
=>
cursor
WordRight
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
5
,
2
))
);
...
...
@@ -177,7 +209,7 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
move word right
selection
'
,
()
=>
{
test
(
'
cursorWordRight -
selection
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -186,12 +218,12 @@ suite('WordOperations', () => {
'
1
'
,
],
{},
(
editor
,
_
)
=>
{
editor
.
setPosition
(
new
Position
(
1
,
1
));
move
WordRight
(
editor
,
true
);
cursor
WordRight
(
editor
,
true
);
assert
.
deepEqual
(
editor
.
getSelection
(),
new
Selection
(
1
,
1
,
1
,
8
));
});
});
test
(
'
issue #832: moveWordRight
'
,
()
=>
{
test
(
'
cursorWordRight - issue #832
'
,
()
=>
{
const
EXPECTED
=
[
'
/*| Just| some| more| text| a|+=| 3| +5|-3| +| 7| */| |
'
,
].
join
(
'
\n
'
);
...
...
@@ -199,7 +231,7 @@ suite('WordOperations', () => {
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1
,
1
),
ed
=>
move
WordRight
(
ed
),
ed
=>
cursor
WordRight
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
50
))
);
...
...
@@ -207,7 +239,7 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
issue #41199: moveWordRight
'
,
()
=>
{
test
(
'
cursorWordRight - issue #41199
'
,
()
=>
{
const
EXPECTED
=
[
'
console|.log|(err|)|
'
,
].
join
(
'
\n
'
);
...
...
@@ -215,7 +247,7 @@ suite('WordOperations', () => {
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1
,
1
),
ed
=>
move
WordRight
(
ed
),
ed
=>
cursor
WordRight
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
17
))
);
...
...
@@ -223,31 +255,32 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
issue #48046: Word selection doesn
\'
t work as usual
'
,
()
=>
{
test
(
'
moveWordEndRight
'
,
()
=>
{
const
EXPECTED
=
[
'
|deep.|object.|property
'
,
'
/*| Just| some| more| text| a|+=| 3| +5|-3| +| 7| */| |
'
,
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1
,
2
1
),
ed
=>
moveWord
Lef
t
(
ed
),
new
Position
(
1
,
1
),
ed
=>
moveWord
EndRigh
t
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
1
))
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
50
))
);
const
actual
=
serializePipePositions
(
text
,
actualStops
);
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
moveWordEndRight
'
,
()
=>
{
test
(
'
moveWordStartRight
'
,
()
=>
{
// This is the behaviour observed in Visual Studio, please do not touch test
const
EXPECTED
=
[
'
/*| Just| some| more| text| a|+=| 3| +5|-3| +| 7| */|
|
'
,
'
|/* |Just |some |more |text |a|+= |3 |+|5|-|3 |+ |7 |*/
|
'
,
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1
,
1
),
ed
=>
moveWord
End
Right
(
ed
),
ed
=>
moveWord
Start
Right
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
50
))
);
...
...
@@ -255,23 +288,22 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
moveWordStartRight
'
,
()
=>
{
const
EXPECTED
=
[
'
|/* |Just |some |more |text |a|+= |3 |+|5|-|3 |+ |7 |*/ |
'
,
].
join
(
'
\n
'
);
test
(
'
issue #51119: cursorWordStartRight regression makes VS compatibility impossible
'
,
()
=>
{
// This is the behaviour observed in Visual Studio, please do not touch test
const
EXPECTED
=
[
'
this|.|is|.|a|.|test|
'
].
join
(
'
\n
'
);
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
new
Position
(
1
,
1
),
ed
=>
moveWordStartRight
(
ed
),
ed
=>
ed
.
getPosition
(),
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
50
))
ed
=>
ed
.
getPosition
().
equals
(
new
Position
(
1
,
15
))
);
const
actual
=
serializePipePositions
(
text
,
actualStops
);
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
delete
word l
eft for non-empty selection
'
,
()
=>
{
test
(
'
delete
WordL
eft for non-empty selection
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -287,7 +319,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word l
eft for cursor at beginning of document
'
,
()
=>
{
test
(
'
delete
WordL
eft for cursor at beginning of document
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -303,7 +335,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word l
eft for cursor at end of whitespace
'
,
()
=>
{
test
(
'
delete
WordL
eft for cursor at end of whitespace
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -319,7 +351,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word l
eft for cursor just behind a word
'
,
()
=>
{
test
(
'
delete
WordL
eft for cursor just behind a word
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -335,7 +367,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word l
eft for cursor inside of a word
'
,
()
=>
{
test
(
'
delete
WordL
eft for cursor inside of a word
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -351,7 +383,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word r
ight for non-empty selection
'
,
()
=>
{
test
(
'
delete
WordR
ight for non-empty selection
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -367,7 +399,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word r
ight for cursor at end of document
'
,
()
=>
{
test
(
'
delete
WordR
ight for cursor at end of document
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -383,7 +415,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word r
ight for cursor at beggining of whitespace
'
,
()
=>
{
test
(
'
delete
WordR
ight for cursor at beggining of whitespace
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -399,7 +431,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word r
ight for cursor just before a word
'
,
()
=>
{
test
(
'
delete
WordR
ight for cursor just before a word
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -415,7 +447,7 @@ suite('WordOperations', () => {
});
});
test
(
'
delete
word r
ight for cursor inside of a word
'
,
()
=>
{
test
(
'
delete
WordR
ight for cursor inside of a word
'
,
()
=>
{
withTestCodeEditor
([
'
\t
My First Line
\t
'
,
'
\t
My Second Line
'
,
...
...
@@ -431,7 +463,7 @@ suite('WordOperations', () => {
});
});
test
(
'
issue #832: deleteWordLeft
'
,
()
=>
{
test
(
'
deleteWordLeft - issue #832
'
,
()
=>
{
const
EXPECTED
=
[
'
| |/* |Just |some |text |a|+= |3 |+|5 |*/|
'
,
].
join
(
'
\n
'
);
...
...
@@ -479,7 +511,7 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
issue #24947
'
,
()
=>
{
test
(
'
deleteWordLeft -
issue #24947
'
,
()
=>
{
withTestCodeEditor
([
'
{
'
,
'
}
'
...
...
@@ -508,7 +540,7 @@ suite('WordOperations', () => {
});
});
test
(
'
issue #832: deleteWordRight
'
,
()
=>
{
test
(
'
deleteWordRight - issue #832
'
,
()
=>
{
const
EXPECTED
=
'
|/*| Just| some| text| a|+=| 3| +|5|-|3| */| |
'
;
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
...
...
@@ -522,7 +554,7 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
issue #3882: deleteWordRight
'
,
()
=>
{
test
(
'
deleteWordRight - issue #3882
'
,
()
=>
{
withTestCodeEditor
([
'
public void Add( int x,
'
,
'
int y )
'
...
...
@@ -533,7 +565,7 @@ suite('WordOperations', () => {
});
});
test
(
'
issue #3882: deleteWordStartRight
'
,
()
=>
{
test
(
'
deleteWordStartRight - issue #3882
'
,
()
=>
{
withTestCodeEditor
([
'
public void Add( int x,
'
,
'
int y )
'
...
...
@@ -544,7 +576,7 @@ suite('WordOperations', () => {
});
});
test
(
'
issue #3882: deleteWordEndRight
'
,
()
=>
{
test
(
'
deleteWordEndRight - issue #3882
'
,
()
=>
{
withTestCodeEditor
([
'
public void Add( int x,
'
,
'
int y )
'
...
...
@@ -583,7 +615,7 @@ suite('WordOperations', () => {
assert
.
deepEqual
(
actual
,
EXPECTED
);
});
test
(
'
issue #3882 (1): Ctrl+Delete removing entire line when used at the end of line
'
,
()
=>
{
test
(
'
deleteWordRight -
issue #3882 (1): Ctrl+Delete removing entire line when used at the end of line
'
,
()
=>
{
withTestCodeEditor
([
'
A line with text.
'
,
'
And another one
'
...
...
@@ -594,7 +626,7 @@ suite('WordOperations', () => {
});
});
test
(
'
issue #3882 (2): Ctrl+Delete removing entire line when used at the end of line
'
,
()
=>
{
test
(
'
deleteWordLeft -
issue #3882 (2): Ctrl+Delete removing entire line when used at the end of line
'
,
()
=>
{
withTestCodeEditor
([
'
A line with text.
'
,
'
And another one
'
...
...
src/vs/editor/contrib/wordOperations/wordOperations.ts
浏览文件 @
b385bb8f
...
...
@@ -123,7 +123,7 @@ export class CursorWordLeft extends WordLeftCommand {
constructor
()
{
super
({
inSelectionMode
:
false
,
wordNavigationType
:
WordNavigationType
.
WordStart
,
wordNavigationType
:
WordNavigationType
.
WordStart
Fast
,
id
:
'
cursorWordLeft
'
,
precondition
:
null
});
...
...
src/vs/editor/contrib/wordPartOperations/test/wordPartOperations.test.ts
浏览文件 @
b385bb8f
...
...
@@ -52,7 +52,7 @@ suite('WordPartOperations', () => {
});
test
(
'
issue #53899: move word part left whitespace
'
,
()
=>
{
const
EXPECTED
=
'
|myvar| |=| |
\'
|demonstration| |of| |selection| |with| |space
\'
'
;
const
EXPECTED
=
'
|myvar| |=| |
\'
|demonstration| |of| |selection| |with| |space
|
\'
'
;
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
...
...
@@ -66,7 +66,7 @@ suite('WordPartOperations', () => {
});
test
(
'
issue #53899: move word part left underscores
'
,
()
=>
{
const
EXPECTED
=
'
|myvar| |=| |
\'
|demonstration|_____of| |selection| |with| |space
\'
'
;
const
EXPECTED
=
'
|myvar| |=| |
\'
|demonstration|_____of| |selection| |with| |space
|
\'
'
;
const
[
text
,]
=
deserializePipePositions
(
EXPECTED
);
const
actualStops
=
testRepeatedActionAndExtractPositions
(
text
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录