Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
e0d75419
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,发现更多精彩内容 >>
提交
e0d75419
编写于
5月 10, 2016
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixes #4101: [html] Why editor.action.smartSelect is not working in html file?
上级
5caae080
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
11 addition
and
87 deletion
+11
-87
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+0
-16
src/vs/editor/contrib/smartSelect/common/smartSelect.ts
src/vs/editor/contrib/smartSelect/common/smartSelect.ts
+2
-5
src/vs/editor/contrib/smartSelect/common/tokenSelectionSupport.ts
...ditor/contrib/smartSelect/common/tokenSelectionSupport.ts
+9
-2
src/vs/languages/css/common/css.ts
src/vs/languages/css/common/css.ts
+0
-7
src/vs/languages/css/common/cssWorker.ts
src/vs/languages/css/common/cssWorker.ts
+0
-28
src/vs/languages/html/common/html.ts
src/vs/languages/html/common/html.ts
+0
-7
src/vs/languages/html/common/htmlWorker.ts
src/vs/languages/html/common/htmlWorker.ts
+0
-8
src/vs/languages/less/common/less.ts
src/vs/languages/less/common/less.ts
+0
-7
src/vs/languages/sass/common/sass.ts
src/vs/languages/sass/common/sass.ts
+0
-7
未找到文件。
src/vs/editor/common/modes.ts
浏览文件 @
e0d75419
...
...
@@ -226,11 +226,6 @@ export interface IMode {
*/
outlineSupport
?:
IOutlineSupport
;
/**
* Optional adapter to support logical selection.
*/
logicalSelectionSupport
?:
ILogicalSelectionSupport
;
/**
* Optional adapter to support formatting.
*/
...
...
@@ -503,17 +498,6 @@ export interface IOutlineSupport {
outlineGroupLabel
?:
{
[
name
:
string
]:
string
;
};
}
/**
* Interface used to compute a hierachry of logical ranges.
*/
export
interface
ILogicalSelectionEntry
{
type
:
string
;
range
:
editorCommon
.
IRange
;
}
export
interface
ILogicalSelectionSupport
{
getRangesToPosition
(
resource
:
URI
,
position
:
editorCommon
.
IPosition
):
TPromise
<
ILogicalSelectionEntry
[]
>
;
}
/**
* Interface used to format a model
*/
...
...
src/vs/editor/contrib/smartSelect/common/smartSelect.ts
浏览文件 @
e0d75419
...
...
@@ -14,8 +14,7 @@ import {EditorAction} from 'vs/editor/common/editorAction';
import
{
Behaviour
}
from
'
vs/editor/common/editorActionEnablement
'
;
import
{
EventType
,
ICommonCodeEditor
,
ICursorPositionChangedEvent
,
IEditorActionDescriptorData
,
IEditorRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
CommonEditorRegistry
,
ContextKey
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ILogicalSelectionEntry
}
from
'
vs/editor/common/modes
'
;
import
{
TokenSelectionSupport
}
from
'
./tokenSelectionSupport
'
;
import
{
TokenSelectionSupport
,
ILogicalSelectionEntry
}
from
'
./tokenSelectionSupport
'
;
// --- selection state machine
...
...
@@ -55,7 +54,6 @@ class SmartSelect extends EditorAction {
var
selection
=
this
.
editor
.
getSelection
();
var
model
=
this
.
editor
.
getModel
();
var
selectionSupport
=
model
.
getMode
().
logicalSelectionSupport
||
this
.
_tokenSelectionSupport
;
// forget about current state
if
(
state
)
{
...
...
@@ -66,8 +64,7 @@ class SmartSelect extends EditorAction {
var
promise
:
TPromise
<
void
>
=
TPromise
.
as
(
null
);
if
(
!
state
)
{
promise
=
selectionSupport
.
getRangesToPosition
(
model
.
getAssociatedResource
(),
selection
.
getStartPosition
()).
then
((
elements
:
ILogicalSelectionEntry
[])
=>
{
promise
=
this
.
_tokenSelectionSupport
.
getRangesToPosition
(
model
.
getAssociatedResource
(),
selection
.
getStartPosition
()).
then
((
elements
:
ILogicalSelectionEntry
[])
=>
{
if
(
arrays
.
isFalsyOrEmpty
(
elements
))
{
return
;
...
...
src/vs/editor/contrib/smartSelect/common/tokenSelectionSupport.ts
浏览文件 @
e0d75419
...
...
@@ -8,11 +8,18 @@ import URI from 'vs/base/common/uri';
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IModel
,
IPosition
,
IRange
}
from
'
vs/editor/common/editorCommon
'
;
import
{
ILogicalSelectionEntry
,
ILogicalSelectionSupport
}
from
'
vs/editor/common/modes
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
Node
,
build
,
find
}
from
'
./tokenTree
'
;
export
class
TokenSelectionSupport
implements
ILogicalSelectionSupport
{
/**
* Interface used to compute a hierachry of logical ranges.
*/
export
interface
ILogicalSelectionEntry
{
type
:
string
;
range
:
IRange
;
}
export
class
TokenSelectionSupport
{
private
_modelService
:
IModelService
;
...
...
src/vs/languages/css/common/css.ts
浏览文件 @
e0d75419
...
...
@@ -283,7 +283,6 @@ export class CSSMode extends AbstractMode {
public
inplaceReplaceSupport
:
Modes
.
IInplaceReplaceSupport
;
public
configSupport
:
Modes
.
IConfigurationSupport
;
public
referenceSupport
:
Modes
.
IReferenceSupport
;
public
logicalSelectionSupport
:
Modes
.
ILogicalSelectionSupport
;
public
extraInfoSupport
:
Modes
.
IExtraInfoSupport
;
public
occurrencesSupport
:
Modes
.
IOccurrencesSupport
;
public
outlineSupport
:
Modes
.
IOutlineSupport
;
...
...
@@ -339,7 +338,6 @@ export class CSSMode extends AbstractMode {
// this.referenceSupport = new ReferenceSupport(this.getId(), {
// tokens: [cssTokenTypes.TOKEN_PROPERTY + '.css', cssTokenTypes.TOKEN_VALUE + '.css', cssTokenTypes.TOKEN_SELECTOR_TAG + '.css'],
// findReferences: (resource, position, /*unused*/includeDeclaration) => this.findReferences(resource, position)});
this
.
logicalSelectionSupport
=
this
;
this
.
outlineSupport
=
this
;
// this.declarationSupport = new DeclarationSupport(this.getId(), {
// tokens: [cssTokenTypes.TOKEN_VALUE + '.css'],
...
...
@@ -413,11 +411,6 @@ export class CSSMode extends AbstractMode {
return
this
.
_worker
((
w
)
=>
w
.
findReferences
(
resource
,
position
));
}
static
$getRangesToPosition
=
OneWorkerAttr
(
CSSMode
,
CSSMode
.
prototype
.
getRangesToPosition
);
public
getRangesToPosition
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
WinJS
.
TPromise
<
Modes
.
ILogicalSelectionEntry
[]
>
{
return
this
.
_worker
((
w
)
=>
w
.
getRangesToPosition
(
resource
,
position
));
}
static
$getOutline
=
OneWorkerAttr
(
CSSMode
,
CSSMode
.
prototype
.
getOutline
);
public
getOutline
(
resource
:
URI
):
WinJS
.
TPromise
<
Modes
.
IOutlineEntry
[]
>
{
return
this
.
_worker
((
w
)
=>
w
.
getOutline
(
resource
));
...
...
src/vs/languages/css/common/cssWorker.ts
浏览文件 @
e0d75419
...
...
@@ -210,34 +210,6 @@ export class CSSWorker {
}
public
getRangesToPosition
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
ILogicalSelectionEntry
[]
>
{
return
this
.
languageService
.
join
().
then
(()
=>
{
let
model
=
this
.
resourceService
.
get
(
resource
),
offset
=
model
.
getOffsetFromPosition
(
position
),
styleSheet
=
this
.
languageService
.
getStylesheet
(
resource
),
path
=
nodes
.
getNodePath
(
styleSheet
,
offset
),
result
:
Modes
.
ILogicalSelectionEntry
[]
=
[];
for
(
let
i
=
0
;
i
<
path
.
length
;
i
++
)
{
let
node
=
path
[
i
];
if
(
node
.
offset
===
-
1
||
node
.
length
===
-
1
)
{
continue
;
}
if
(
node
.
parent
&&
node
.
parent
.
offset
===
node
.
offset
&&
node
.
parent
.
length
===
node
.
length
)
{
continue
;
}
result
.
push
({
type
:
'
node
'
,
range
:
this
.
_range
(
node
,
model
)
});
}
return
result
;
});
}
public
getOutline
(
resource
:
URI
):
winjs
.
TPromise
<
Modes
.
IOutlineEntry
[]
>
{
return
this
.
languageService
.
join
().
then
(()
=>
{
...
...
src/vs/languages/html/common/html.ts
浏览文件 @
e0d75419
...
...
@@ -294,7 +294,6 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
public
extraInfoSupport
:
Modes
.
IExtraInfoSupport
;
public
occurrencesSupport
:
Modes
.
IOccurrencesSupport
;
public
referenceSupport
:
Modes
.
IReferenceSupport
;
public
logicalSelectionSupport
:
Modes
.
ILogicalSelectionSupport
;
public
formattingSupport
:
Modes
.
IFormattingSupport
;
public
parameterHintsSupport
:
Modes
.
IParameterHintsSupport
;
public
suggestSupport
:
Modes
.
ISuggestSupport
;
...
...
@@ -325,7 +324,6 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
this
.
referenceSupport
=
new
ReferenceSupport
(
this
.
getId
(),
{
tokens
:
[
'
invalid
'
],
findReferences
:
(
resource
,
position
,
includeDeclaration
)
=>
this
.
findReferences
(
resource
,
position
,
includeDeclaration
)});
this
.
logicalSelectionSupport
=
this
;
this
.
parameterHintsSupport
=
new
ParameterHintsSupport
(
this
.
getId
(),
{
triggerCharacters
:
[
'
(
'
,
'
,
'
],
...
...
@@ -495,11 +493,6 @@ export class HTMLMode<W extends htmlWorker.HTMLWorker> extends AbstractMode impl
return
this
.
_worker
((
w
)
=>
w
.
findReferences
(
resource
,
position
,
includeDeclaration
));
}
static
$getRangesToPosition
=
OneWorkerAttr
(
HTMLMode
,
HTMLMode
.
prototype
.
getRangesToPosition
);
public
getRangesToPosition
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
ILogicalSelectionEntry
[]
>
{
return
this
.
_worker
((
w
)
=>
w
.
getRangesToPosition
(
resource
,
position
));
}
static
$findDeclaration
=
OneWorkerAttr
(
HTMLMode
,
HTMLMode
.
prototype
.
findDeclaration
);
public
findDeclaration
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
IReference
>
{
return
this
.
_worker
((
w
)
=>
w
.
findDeclaration
(
resource
,
position
));
...
...
src/vs/languages/html/common/htmlWorker.ts
浏览文件 @
e0d75419
...
...
@@ -166,14 +166,6 @@ export class HTMLWorker {
});
}
public
getRangesToPosition
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
ILogicalSelectionEntry
[]
>
{
return
this
.
_delegateToModeAtPosition
(
resource
,
position
,
(
isEmbeddedMode
,
model
)
=>
{
if
(
isEmbeddedMode
&&
model
.
getMode
().
logicalSelectionSupport
)
{
return
model
.
getMode
().
logicalSelectionSupport
.
getRangesToPosition
(
model
.
getAssociatedResource
(),
position
);
}
});
}
public
findDeclaration
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
IReference
>
{
return
this
.
_delegateToModeAtPosition
(
resource
,
position
,
(
isEmbeddedMode
,
model
)
=>
{
if
(
isEmbeddedMode
&&
model
.
getMode
().
declarationSupport
)
{
...
...
src/vs/languages/less/common/less.ts
浏览文件 @
e0d75419
...
...
@@ -181,7 +181,6 @@ export class LESSMode extends Monarch.MonarchMode implements Modes.IExtraInfoSup
public
inplaceReplaceSupport
:
Modes
.
IInplaceReplaceSupport
;
public
configSupport
:
Modes
.
IConfigurationSupport
;
public
referenceSupport
:
Modes
.
IReferenceSupport
;
public
logicalSelectionSupport
:
Modes
.
ILogicalSelectionSupport
;
public
extraInfoSupport
:
Modes
.
IExtraInfoSupport
;
public
declarationSupport
:
Modes
.
IDeclarationSupport
;
public
outlineSupport
:
Modes
.
IOutlineSupport
;
...
...
@@ -211,7 +210,6 @@ export class LESSMode extends Monarch.MonarchMode implements Modes.IExtraInfoSup
this
.
referenceSupport
=
new
ReferenceSupport
(
this
.
getId
(),
{
tokens
:
[
lessTokenTypes
.
TOKEN_PROPERTY
+
'
.less
'
,
lessTokenTypes
.
TOKEN_VALUE
+
'
.less
'
,
'
variable.less
'
,
lessTokenTypes
.
TOKEN_SELECTOR
+
'
.class.less
'
,
lessTokenTypes
.
TOKEN_SELECTOR
+
'
.id.less
'
,
'
selector.less
'
],
findReferences
:
(
resource
,
position
,
/*unused*/
includeDeclaration
)
=>
this
.
findReferences
(
resource
,
position
)});
this
.
logicalSelectionSupport
=
this
;
this
.
declarationSupport
=
new
DeclarationSupport
(
this
.
getId
(),
{
tokens
:
[
'
variable.less
'
,
lessTokenTypes
.
TOKEN_SELECTOR
+
'
.class.less
'
,
lessTokenTypes
.
TOKEN_SELECTOR
+
'
.id.less
'
,
'
selector.less
'
],
findDeclaration
:
(
resource
,
position
)
=>
this
.
findDeclaration
(
resource
,
position
)});
...
...
@@ -267,11 +265,6 @@ export class LESSMode extends Monarch.MonarchMode implements Modes.IExtraInfoSup
return
this
.
_worker
((
w
)
=>
w
.
suggest
(
resource
,
position
));
}
static
$getRangesToPosition
=
OneWorkerAttr
(
LESSMode
,
LESSMode
.
prototype
.
getRangesToPosition
);
public
getRangesToPosition
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
ILogicalSelectionEntry
[]
>
{
return
this
.
_worker
((
w
)
=>
w
.
getRangesToPosition
(
resource
,
position
));
}
static
$computeInfo
=
OneWorkerAttr
(
LESSMode
,
LESSMode
.
prototype
.
computeInfo
);
public
computeInfo
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
IComputeExtraInfoResult
>
{
return
this
.
_worker
((
w
)
=>
w
.
computeInfo
(
resource
,
position
));
...
...
src/vs/languages/sass/common/sass.ts
浏览文件 @
e0d75419
...
...
@@ -283,7 +283,6 @@ export class SASSMode extends Monarch.MonarchMode implements Modes.IExtraInfoSup
public
inplaceReplaceSupport
:
Modes
.
IInplaceReplaceSupport
;
public
configSupport
:
Modes
.
IConfigurationSupport
;
public
referenceSupport
:
Modes
.
IReferenceSupport
;
public
logicalSelectionSupport
:
Modes
.
ILogicalSelectionSupport
;
public
extraInfoSupport
:
Modes
.
IExtraInfoSupport
;
public
outlineSupport
:
Modes
.
IOutlineSupport
;
public
declarationSupport
:
Modes
.
IDeclarationSupport
;
...
...
@@ -313,7 +312,6 @@ export class SASSMode extends Monarch.MonarchMode implements Modes.IExtraInfoSup
this
.
referenceSupport
=
new
ReferenceSupport
(
this
.
getId
(),
{
tokens
:
[
sassTokenTypes
.
TOKEN_PROPERTY
+
'
.sass
'
,
sassTokenTypes
.
TOKEN_VALUE
+
'
.sass
'
,
'
variable.decl.sass
'
,
'
variable.ref.sass
'
,
'
support.function.name.sass
'
,
sassTokenTypes
.
TOKEN_PROPERTY
+
'
.sass
'
,
sassTokenTypes
.
TOKEN_SELECTOR
+
'
.sass
'
],
findReferences
:
(
resource
,
position
,
/*unused*/
includeDeclaration
)
=>
this
.
findReferences
(
resource
,
position
)});
this
.
logicalSelectionSupport
=
this
;
this
.
declarationSupport
=
new
DeclarationSupport
(
this
.
getId
(),
{
tokens
:
[
'
variable.decl.sass
'
,
'
variable.ref.sass
'
,
'
support.function.name.sass
'
,
sassTokenTypes
.
TOKEN_PROPERTY
+
'
.sass
'
,
sassTokenTypes
.
TOKEN_SELECTOR
+
'
.sass
'
],
findDeclaration
:
(
resource
,
position
)
=>
this
.
findDeclaration
(
resource
,
position
)});
...
...
@@ -369,11 +367,6 @@ export class SASSMode extends Monarch.MonarchMode implements Modes.IExtraInfoSup
return
this
.
_worker
((
w
)
=>
w
.
suggest
(
resource
,
position
));
}
static
$getRangesToPosition
=
OneWorkerAttr
(
SASSMode
,
SASSMode
.
prototype
.
getRangesToPosition
);
public
getRangesToPosition
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
ILogicalSelectionEntry
[]
>
{
return
this
.
_worker
((
w
)
=>
w
.
getRangesToPosition
(
resource
,
position
));
}
static
$computeInfo
=
OneWorkerAttr
(
SASSMode
,
SASSMode
.
prototype
.
computeInfo
);
public
computeInfo
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
winjs
.
TPromise
<
Modes
.
IComputeExtraInfoResult
>
{
return
this
.
_worker
((
w
)
=>
w
.
computeInfo
(
resource
,
position
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录