Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
27fd58c2
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,发现更多精彩内容 >>
提交
27fd58c2
编写于
12月 18, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine SelectionRangeKind #63935
上级
4dd31e92
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
31 addition
and
20 deletion
+31
-20
src/vs/editor/contrib/smartSelect/bracketSelections.ts
src/vs/editor/contrib/smartSelect/bracketSelections.ts
+6
-6
src/vs/editor/contrib/smartSelect/wordSelections.ts
src/vs/editor/contrib/smartSelect/wordSelections.ts
+6
-6
src/vs/vscode.proposed.d.ts
src/vs/vscode.proposed.d.ts
+14
-2
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+1
-2
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
...ench/test/electron-browser/api/extHostApiCommands.test.ts
+2
-2
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
...test/electron-browser/api/extHostLanguageFeatures.test.ts
+2
-2
未找到文件。
src/vs/editor/contrib/smartSelect/bracketSelections.ts
浏览文件 @
27fd58c2
...
@@ -108,8 +108,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
...
@@ -108,8 +108,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
}
}
const
innerBracket
=
Range
.
fromPositions
(
bracket
.
range
.
getEndPosition
(),
closing
!
.
getStartPosition
());
const
innerBracket
=
Range
.
fromPositions
(
bracket
.
range
.
getEndPosition
(),
closing
!
.
getStartPosition
());
const
outerBracket
=
Range
.
fromPositions
(
bracket
.
range
.
getStartPosition
(),
closing
!
.
getEndPosition
());
const
outerBracket
=
Range
.
fromPositions
(
bracket
.
range
.
getStartPosition
(),
closing
!
.
getEndPosition
());
bucket
.
push
({
range
:
innerBracket
,
kind
:
'
block.bracket
'
});
bucket
.
push
({
range
:
innerBracket
,
kind
:
'
statement.brackets
'
});
bucket
.
push
({
range
:
outerBracket
,
kind
:
'
block.bracket
'
});
bucket
.
push
({
range
:
outerBracket
,
kind
:
'
statement.brackets.full
'
});
BracketSelectionRangeProvider
.
_addBracketLeading
(
model
,
outerBracket
,
bucket
);
BracketSelectionRangeProvider
.
_addBracketLeading
(
model
,
outerBracket
,
bucket
);
}
}
}
}
...
@@ -128,8 +128,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
...
@@ -128,8 +128,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
const
startLine
=
bracket
.
startLineNumber
;
const
startLine
=
bracket
.
startLineNumber
;
const
column
=
model
.
getLineFirstNonWhitespaceColumn
(
startLine
);
const
column
=
model
.
getLineFirstNonWhitespaceColumn
(
startLine
);
if
(
column
!==
0
&&
column
!==
bracket
.
startColumn
)
{
if
(
column
!==
0
&&
column
!==
bracket
.
startColumn
)
{
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
startLine
,
column
),
bracket
.
getEndPosition
()),
kind
:
'
block.bracket
.leading
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
startLine
,
column
),
bracket
.
getEndPosition
()),
kind
:
'
statement.brackets
.leading
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
startLine
,
1
),
bracket
.
getEndPosition
()),
kind
:
'
block.bracket.leading
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
startLine
,
1
),
bracket
.
getEndPosition
()),
kind
:
'
statement.brackets.leading.full
'
});
}
}
// xxxxxxxx
// xxxxxxxx
...
@@ -140,8 +140,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
...
@@ -140,8 +140,8 @@ export class BracketSelectionRangeProvider implements SelectionRangeProvider {
if
(
aboveLine
>
0
)
{
if
(
aboveLine
>
0
)
{
const
column
=
model
.
getLineFirstNonWhitespaceColumn
(
aboveLine
);
const
column
=
model
.
getLineFirstNonWhitespaceColumn
(
aboveLine
);
if
(
column
===
bracket
.
startColumn
&&
column
!==
model
.
getLineLastNonWhitespaceColumn
(
aboveLine
))
{
if
(
column
===
bracket
.
startColumn
&&
column
!==
model
.
getLineLastNonWhitespaceColumn
(
aboveLine
))
{
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
aboveLine
,
column
),
bracket
.
getEndPosition
()),
kind
:
'
block.bracket
.leading
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
aboveLine
,
column
),
bracket
.
getEndPosition
()),
kind
:
'
statement.brackets
.leading
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
aboveLine
,
1
),
bracket
.
getEndPosition
()),
kind
:
'
block.bracket.leading
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
new
Position
(
aboveLine
,
1
),
bracket
.
getEndPosition
()),
kind
:
'
statement.brackets.leading.full
'
});
}
}
}
}
}
}
...
...
src/vs/editor/contrib/smartSelect/wordSelections.ts
浏览文件 @
27fd58c2
...
@@ -21,7 +21,7 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider {
...
@@ -21,7 +21,7 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider {
private
_addWordRanges
(
bucket
:
SelectionRange
[],
model
:
ITextModel
,
pos
:
Position
):
void
{
private
_addWordRanges
(
bucket
:
SelectionRange
[],
model
:
ITextModel
,
pos
:
Position
):
void
{
const
word
=
model
.
getWordAtPosition
(
pos
);
const
word
=
model
.
getWordAtPosition
(
pos
);
if
(
word
)
{
if
(
word
)
{
bucket
.
push
({
range
:
new
Range
(
pos
.
lineNumber
,
word
.
startColumn
,
pos
.
lineNumber
,
word
.
endColumn
),
kind
:
'
s
imple
.word
'
});
bucket
.
push
({
range
:
new
Range
(
pos
.
lineNumber
,
word
.
startColumn
,
pos
.
lineNumber
,
word
.
endColumn
),
kind
:
'
s
tatement
.word
'
});
}
}
}
}
...
@@ -98,15 +98,15 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider {
...
@@ -98,15 +98,15 @@ export class WordSelectionRangeProvider implements SelectionRangeProvider {
if
(
type
===
StandardTokenType
.
String
)
{
if
(
type
===
StandardTokenType
.
String
)
{
// just assume that quotation marks are length=1
// just assume that quotation marks are length=1
bucket
.
push
({
range
:
Range
.
fromPositions
(
left
.
delta
(
0
,
1
),
right
.
delta
(
0
,
-
1
)),
kind
:
'
s
imple
.string
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
left
.
delta
(
0
,
1
),
right
.
delta
(
0
,
-
1
)),
kind
:
'
s
tatement
.string
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
left
,
right
),
kind
:
'
s
imple.string
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
left
,
right
),
kind
:
'
s
tatement.string.full
'
});
}
else
{
}
else
{
bucket
.
push
({
range
:
Range
.
fromPositions
(
left
,
right
),
kind
:
'
s
imple
.comment
'
});
bucket
.
push
({
range
:
Range
.
fromPositions
(
left
,
right
),
kind
:
'
s
tatement
.comment
'
});
}
}
}
}
private
_addLineRanges
(
bucket
:
SelectionRange
[],
model
:
ITextModel
,
pos
:
Position
):
void
{
private
_addLineRanges
(
bucket
:
SelectionRange
[],
model
:
ITextModel
,
pos
:
Position
):
void
{
bucket
.
push
({
range
:
new
Range
(
pos
.
lineNumber
,
model
.
getLineFirstNonWhitespaceColumn
(
pos
.
lineNumber
),
pos
.
lineNumber
,
model
.
getLineLastNonWhitespaceColumn
(
pos
.
lineNumber
)),
kind
:
'
s
imple
.line
'
});
bucket
.
push
({
range
:
new
Range
(
pos
.
lineNumber
,
model
.
getLineFirstNonWhitespaceColumn
(
pos
.
lineNumber
),
pos
.
lineNumber
,
model
.
getLineLastNonWhitespaceColumn
(
pos
.
lineNumber
)),
kind
:
'
s
tatement
.line
'
});
bucket
.
push
({
range
:
new
Range
(
pos
.
lineNumber
,
model
.
getLineMinColumn
(
pos
.
lineNumber
),
pos
.
lineNumber
,
model
.
getLineMaxColumn
(
pos
.
lineNumber
)),
kind
:
'
s
imple.line
'
});
bucket
.
push
({
range
:
new
Range
(
pos
.
lineNumber
,
model
.
getLineMinColumn
(
pos
.
lineNumber
),
pos
.
lineNumber
,
model
.
getLineMaxColumn
(
pos
.
lineNumber
)),
kind
:
'
s
tatement.line.full
'
});
}
}
}
}
src/vs/vscode.proposed.d.ts
浏览文件 @
27fd58c2
...
@@ -20,10 +20,22 @@ declare module 'vscode' {
...
@@ -20,10 +20,22 @@ declare module 'vscode' {
export
class
SelectionRangeKind
{
export
class
SelectionRangeKind
{
/**
* Empty Kind.
*/
static
readonly
Empty
:
SelectionRangeKind
;
static
readonly
Empty
:
SelectionRangeKind
;
/**
* The statment kind, its value is `statement`, possible extensions can be
* `statement.if` etc
*/
static
readonly
Statement
:
SelectionRangeKind
;
static
readonly
Statement
:
SelectionRangeKind
;
static
readonly
Expression
:
SelectionRangeKind
;
static
readonly
Block
:
SelectionRangeKind
;
/**
* The declaration kind, its value is `declaration`, possible extensions can be
* `declaration.function`, `declaration.class` etc.
*/
static
readonly
Declaration
:
SelectionRangeKind
;
readonly
value
:
string
;
readonly
value
:
string
;
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
27fd58c2
...
@@ -1042,8 +1042,7 @@ export class SelectionRangeKind {
...
@@ -1042,8 +1042,7 @@ export class SelectionRangeKind {
static
readonly
Empty
=
new
SelectionRangeKind
(
''
);
static
readonly
Empty
=
new
SelectionRangeKind
(
''
);
static
readonly
Statement
=
SelectionRangeKind
.
Empty
.
append
(
'
statement
'
);
static
readonly
Statement
=
SelectionRangeKind
.
Empty
.
append
(
'
statement
'
);
static
readonly
Expression
=
SelectionRangeKind
.
Empty
.
append
(
'
expression
'
);
static
readonly
Declaration
=
SelectionRangeKind
.
Empty
.
append
(
'
declaration
'
);
static
readonly
Block
=
SelectionRangeKind
.
Empty
.
append
(
'
block
'
);
readonly
value
:
string
;
readonly
value
:
string
;
...
...
src/vs/workbench/test/electron-browser/api/extHostApiCommands.test.ts
浏览文件 @
27fd58c2
...
@@ -773,8 +773,8 @@ suite('ExtHostLanguageFeatureCommands', function () {
...
@@ -773,8 +773,8 @@ suite('ExtHostLanguageFeatureCommands', function () {
disposables
.
push
(
extHost
.
registerSelectionRangeProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
SelectionRangeProvider
>
{
disposables
.
push
(
extHost
.
registerSelectionRangeProvider
(
nullExtensionDescription
,
defaultSelector
,
<
vscode
.
SelectionRangeProvider
>
{
provideSelectionRanges
()
{
provideSelectionRanges
()
{
return
[
return
[
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Block
,
new
types
.
Range
(
0
,
10
,
0
,
18
)),
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Empty
,
new
types
.
Range
(
0
,
10
,
0
,
18
)),
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Block
,
new
types
.
Range
(
0
,
2
,
0
,
20
))
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Empty
,
new
types
.
Range
(
0
,
2
,
0
,
20
))
];
];
}
}
}));
}));
...
...
src/vs/workbench/test/electron-browser/api/extHostLanguageFeatures.test.ts
浏览文件 @
27fd58c2
...
@@ -1230,8 +1230,8 @@ suite('ExtHostLanguageFeatures', function () {
...
@@ -1230,8 +1230,8 @@ suite('ExtHostLanguageFeatures', function () {
disposables
.
push
(
extHost
.
registerSelectionRangeProvider
(
defaultExtension
,
defaultSelector
,
<
vscode
.
SelectionRangeProvider
>
{
disposables
.
push
(
extHost
.
registerSelectionRangeProvider
(
defaultExtension
,
defaultSelector
,
<
vscode
.
SelectionRangeProvider
>
{
provideSelectionRanges
()
{
provideSelectionRanges
()
{
return
[
return
[
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Block
,
new
types
.
Range
(
0
,
10
,
0
,
18
)),
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Empty
,
new
types
.
Range
(
0
,
10
,
0
,
18
)),
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Block
,
new
types
.
Range
(
0
,
2
,
0
,
20
))
new
types
.
SelectionRange
(
types
.
SelectionRangeKind
.
Empty
,
new
types
.
Range
(
0
,
2
,
0
,
20
))
];
];
}
}
}));
}));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录