Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
594b7364
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,发现更多精彩内容 >>
提交
594b7364
编写于
8月 03, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adopt EditorAction2 in emmet actions
上级
81e91db4
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
320 addition
and
333 deletion
+320
-333
src/vs/editor/common/editorCommonExtensions.ts
src/vs/editor/common/editorCommonExtensions.ts
+22
-1
src/vs/workbench/parts/emmet/node/actions/balance.ts
src/vs/workbench/parts/emmet/node/actions/balance.ts
+17
-20
src/vs/workbench/parts/emmet/node/actions/base64.ts
src/vs/workbench/parts/emmet/node/actions/base64.ts
+31
-36
src/vs/workbench/parts/emmet/node/actions/editPoints.ts
src/vs/workbench/parts/emmet/node/actions/editPoints.ts
+17
-20
src/vs/workbench/parts/emmet/node/actions/evaluateMath.ts
src/vs/workbench/parts/emmet/node/actions/evaluateMath.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/expandAbbreviation.ts
.../workbench/parts/emmet/node/actions/expandAbbreviation.ts
+23
-27
src/vs/workbench/parts/emmet/node/actions/incrementDecrement.ts
.../workbench/parts/emmet/node/actions/incrementDecrement.ts
+49
-56
src/vs/workbench/parts/emmet/node/actions/matchingPair.ts
src/vs/workbench/parts/emmet/node/actions/matchingPair.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/mergeLines.ts
src/vs/workbench/parts/emmet/node/actions/mergeLines.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/reflectCssValue.ts
src/vs/workbench/parts/emmet/node/actions/reflectCssValue.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/removeTag.ts
src/vs/workbench/parts/emmet/node/actions/removeTag.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/selectItem.ts
src/vs/workbench/parts/emmet/node/actions/selectItem.ts
+17
-20
src/vs/workbench/parts/emmet/node/actions/splitJoinTag.ts
src/vs/workbench/parts/emmet/node/actions/splitJoinTag.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/toggleComment.ts
src/vs/workbench/parts/emmet/node/actions/toggleComment.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/updateImageSize.ts
src/vs/workbench/parts/emmet/node/actions/updateImageSize.ts
+9
-11
src/vs/workbench/parts/emmet/node/actions/updateTag.ts
src/vs/workbench/parts/emmet/node/actions/updateTag.ts
+18
-20
src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts
...orkbench/parts/emmet/node/actions/wrapWithAbbreviation.ts
+17
-20
src/vs/workbench/parts/emmet/node/emmetActions.ts
src/vs/workbench/parts/emmet/node/emmetActions.ts
+37
-25
未找到文件。
src/vs/editor/common/editorCommonExtensions.ts
浏览文件 @
594b7364
...
...
@@ -7,6 +7,7 @@
import
{
illegalArgument
,
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
SyncDescriptor1
,
createSyncDescriptor
}
from
'
vs/platform/instantiation/common/descriptors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
ServicesAccessor
,
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IKeybindings
,
KbExpr
}
from
'
vs/platform/keybinding/common/keybinding
'
;
import
{
ICommandHandler
}
from
'
vs/platform/commands/common/commands
'
;
...
...
@@ -374,17 +375,37 @@ export abstract class EditorAction2 {
return
true
;
}
public
abstract
run
(
accessor
:
ServicesAccessor
,
editor
:
editorCommon
.
ICommonCodeEditor
):
void
;
public
abstract
run
(
accessor
:
ServicesAccessor
,
editor
:
editorCommon
.
ICommonCodeEditor
):
void
|
TPromise
<
void
>
;
}
export
let
EditorKbExpr
:
{
TextFocus
:
KbExpr
;
Focus
:
KbExpr
;
ReadOnly
:
KbExpr
;
Writable
:
KbExpr
;
HasNonEmptySelection
:
KbExpr
;
HasOnlyEmptySelection
:
KbExpr
;
HasMultipleSelections
:
KbExpr
;
HasSingleSelection
:
KbExpr
;
TabMovesFocus
:
KbExpr
;
TabDoesNotMoveFocus
:
KbExpr
;
}
=
{
TextFocus
:
KbExpr
.
has
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
Focus
:
KbExpr
.
has
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_FOCUS
),
ReadOnly
:
KbExpr
.
has
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_READONLY
),
Writable
:
KbExpr
.
not
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_READONLY
),
HasNonEmptySelection
:
KbExpr
.
has
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION
),
HasOnlyEmptySelection
:
KbExpr
.
not
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION
),
HasMultipleSelections
:
KbExpr
.
has
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS
),
HasSingleSelection
:
KbExpr
.
not
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS
),
TabMovesFocus
:
KbExpr
.
has
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS
),
TabDoesNotMoveFocus
:
KbExpr
.
not
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS
),
};
src/vs/workbench/parts/emmet/node/actions/balance.ts
浏览文件 @
594b7364
...
...
@@ -8,32 +8,29 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
BalanceInwardAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.balanceInward
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
balance_inward
'
);
constructor
()
{
super
(
'
editor.emmet.action.balanceInward
'
,
nls
.
localize
(
'
balanceInward
'
,
"
Emmet: Balance (inward)
"
),
'
Emmet: Balance (inward)
'
,
'
balance_inward
'
);
}
}
class
BalanceOutwardAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.balanceOutward
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
balance_outward
'
);
constructor
()
{
super
(
'
editor.emmet.action.balanceOutward
'
,
nls
.
localize
(
'
balanceOutward
'
,
"
Emmet: Balance (outward)
"
),
'
Emmet: Balance (outward)
'
,
'
balance_outward
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
BalanceInwardAction
,
BalanceInwardAction
.
ID
,
nls
.
localize
(
'
balanceInward
'
,
"
Emmet: Balance (inward)
"
),
void
0
,
'
Emmet: Balance (inward)
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
BalanceOutwardAction
,
BalanceOutwardAction
.
ID
,
nls
.
localize
(
'
balanceOutward
'
,
"
Emmet: Balance (outward)
"
),
void
0
,
'
Emmet: Balance (outward)
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
BalanceInwardAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
BalanceOutwardAction
());
src/vs/workbench/parts/emmet/node/actions/base64.ts
浏览文件 @
594b7364
...
...
@@ -7,35 +7,28 @@
import
nls
=
require
(
'
vs/nls
'
);
import
*
as
emmet
from
'
emmet
'
;
import
{
fileExists
}
from
'
vs/base/node/pfs
'
;
import
fs
=
require
(
'
fs
'
);
import
{
dirname
,
join
,
normalize
,
isValidBasename
}
from
'
vs/base/common/paths
'
;
import
{
EmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
EmmetEditorAction
,
EmmetActionContext
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
Action
}
from
'
vs/base/common/actions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ServicesAccessor
,
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IMessageService
,
Severity
}
from
'
vs/platform/message/common/message
'
;
import
{
IQuickOpenService
,
IInputOptions
}
from
'
vs/workbench/services/quickopen/common/quickOpenService
'
;
import
{
IWorkspaceContextService
}
from
'
vs/workbench/services/workspace/common/contextService
'
;
import
{
IFileService
}
from
'
vs/platform/files/common/files
'
;
class
EncodeDecodeDataUrlAction
extends
EmmetEditorAction
{
static
ID
=
'
editor.emmet.action.encodeDecodeDataUrl
'
;
private
imageFilePath
:
string
=
null
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
IWorkspaceContextService
private
workspaceContext
:
IWorkspaceContextService
,
@
IQuickOpenService
private
quickOpenService
:
IQuickOpenService
,
@
IMessageService
private
messageService
:
IMessageService
,
@
IFileService
private
fileService
:
IFileService
)
{
super
(
descriptor
,
editor
,
configurationService
);
constructor
()
{
super
(
'
editor.emmet.action.encodeDecodeDataUrl
'
,
nls
.
localize
(
'
encodeDecodeDataUrl
'
,
"
Emmet: Encode
\\
Decode data:URL image
"
),
'
Emmet: Encode
\\
Decode data:URL image
'
);
}
private
createPath
(
parent
:
string
,
fileName
:
string
):
string
{
...
...
@@ -45,18 +38,22 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
parent
=
dirname
(
parent
);
}
return
join
(
parent
,
fileName
);
};
}
public
runEmmetAction
(
accessor
:
ServicesAccessor
,
ctx
:
EmmetActionContext
)
{
const
workspaceContext
=
accessor
.
get
(
IWorkspaceContextService
);
const
messageService
=
accessor
.
get
(
IMessageService
);
const
quickOpenService
=
accessor
.
get
(
IQuickOpenService
);
public
runEmmetAction
(
_emmet
:
typeof
emmet
)
{
const
currentLine
=
this
.
editorAccessor
.
getCurrentLine
();
const
currentLine
=
ctx
.
editorAccessor
.
getCurrentLine
();
if
(
!
this
.
isDataURI
(
currentLine
))
{
this
.
encodeDecode
(
_emmet
);
this
.
encodeDecode
(
ctx
);
return
;
}
if
(
!
this
.
workspaceContext
.
getWorkspace
())
{
if
(
!
workspaceContext
.
getWorkspace
())
{
const
message
=
nls
.
localize
(
'
noWorkspace
'
,
"
Decoding a data:URL image is only available inside a workspace folder.
"
);
this
.
messageService
.
show
(
Severity
.
Info
,
message
);
messageService
.
show
(
Severity
.
Info
,
message
);
return
;
}
...
...
@@ -65,19 +62,19 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
placeHolder
:
nls
.
localize
(
'
path
'
,
"
File path
"
)
};
const
quickPromise
=
this
.
quickOpenService
.
input
(
options
)
const
quickPromise
=
quickOpenService
.
input
(
options
)
.
then
(
path
=>
{
if
(
!
this
.
isValidInput
(
path
))
{
if
(
!
this
.
isValidInput
(
messageService
,
path
))
{
quickPromise
.
cancel
();
}
this
.
imageFilePath
=
path
;
const
fullpath
=
this
.
createPath
(
this
.
editorAccessor
.
getFilePath
(),
path
);
const
fullpath
=
this
.
createPath
(
ctx
.
editorAccessor
.
getFilePath
(),
path
);
return
fileExists
(
fullpath
);
})
.
then
(
status
=>
{
if
(
!
status
)
{
this
.
encodeDecode
(
_emmet
,
this
.
imageFilePath
);
this
.
encodeDecode
(
ctx
,
this
.
imageFilePath
);
return
;
}
...
...
@@ -85,25 +82,25 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
const
actions
=
[
new
Action
(
'
cancel
'
,
nls
.
localize
(
'
cancel
'
,
"
Cancel
"
),
''
,
true
),
new
Action
(
'
ok
'
,
nls
.
localize
(
'
ok
'
,
"
OK
"
),
''
,
true
,
()
=>
{
this
.
encodeDecode
(
_emmet
,
this
.
imageFilePath
);
this
.
encodeDecode
(
ctx
,
this
.
imageFilePath
);
return
null
;
})
];
this
.
messageService
.
show
(
Severity
.
Warning
,
{
message
,
actions
});
messageService
.
show
(
Severity
.
Warning
,
{
message
,
actions
});
});
}
public
encodeDecode
(
_emmet
:
any
,
filepath
?:
string
)
{
this
.
editorAccessor
.
prompt
=
():
string
=>
{
public
encodeDecode
(
ctx
:
EmmetActionContext
,
filepath
?:
string
)
{
ctx
.
editorAccessor
.
prompt
=
():
string
=>
{
return
filepath
;
};
if
(
!
_emmet
.
run
(
'
encode_decode_data_url
'
,
this
.
editorAccessor
))
{
this
.
noExpansionOccurred
();
if
(
!
ctx
.
emmet
.
run
(
'
encode_decode_data_url
'
,
ctx
.
editorAccessor
))
{
this
.
noExpansionOccurred
(
ctx
.
editor
);
}
}
private
isValidInput
(
input
:
any
):
boolean
{
private
isValidInput
(
messageService
:
IMessageService
,
input
:
any
):
boolean
{
if
(
input
===
undefined
)
{
return
false
;
}
...
...
@@ -124,7 +121,7 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
if
(
!
isValidFilePath
)
{
const
message
=
nls
.
localize
(
'
invalidFileNameError
'
,
"
The name **{0}** is not valid as a file or folder name. Please choose a different name.
"
,
input
);
this
.
messageService
.
show
(
Severity
.
Error
,
message
);
messageService
.
show
(
Severity
.
Error
,
message
);
return
false
;
}
...
...
@@ -136,6 +133,4 @@ class EncodeDecodeDataUrlAction extends EmmetEditorAction {
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
EncodeDecodeDataUrlAction
,
EncodeDecodeDataUrlAction
.
ID
,
nls
.
localize
(
'
encodeDecodeDataUrl
'
,
"
Emmet: Encode
\\
Decode data:URL image
"
),
void
0
,
'
Emmet: Encode
\\
Decode data:URL image
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
EncodeDecodeDataUrlAction
());
src/vs/workbench/parts/emmet/node/actions/editPoints.ts
浏览文件 @
594b7364
...
...
@@ -8,32 +8,29 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
PreviousEditPointAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.previousEditPoint
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
prev_edit_point
'
);
constructor
()
{
super
(
'
editor.emmet.action.previousEditPoint
'
,
nls
.
localize
(
'
previousEditPoint
'
,
"
Emmet: Previous Edit Point
"
),
'
Emmet: Previous Edit Point
'
,
'
prev_edit_point
'
);
}
}
class
NextEditPointAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.nextEditPoint
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
next_edit_point
'
);
constructor
()
{
super
(
'
editor.emmet.action.nextEditPoint
'
,
nls
.
localize
(
'
nextEditPoint
'
,
"
Emmet: Next Edit Point
"
),
'
Emmet: Next Edit Point
'
,
'
next_edit_point
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
PreviousEditPointAction
,
PreviousEditPointAction
.
ID
,
nls
.
localize
(
'
previousEditPoint
'
,
"
Emmet: Previous Edit Point
"
),
void
0
,
'
Emmet: Previous Edit Point
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
NextEditPointAction
,
NextEditPointAction
.
ID
,
nls
.
localize
(
'
nextEditPoint
'
,
"
Emmet: Next Edit Point
"
),
void
0
,
'
Emmet: Next Edit Point
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
PreviousEditPointAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
NextEditPointAction
());
src/vs/workbench/parts/emmet/node/actions/evaluateMath.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
EvaluateMathAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.evaluateMath
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
evaluate_math_expression
'
);
constructor
()
{
super
(
'
editor.emmet.action.evaluateMath
'
,
nls
.
localize
(
'
evaluateMathExpression
'
,
"
Emmet: Evaluate Math Expression
"
),
'
Emmet: Evaluate Math Expression
'
,
'
evaluate_math_expression
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
EvaluateMathAction
,
EvaluateMathAction
.
ID
,
nls
.
localize
(
'
evaluateMathExpression
'
,
"
Emmet: Evaluate Math Expression
"
),
void
0
,
'
Emmet: Evaluate Math Expression
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
EvaluateMathAction
());
src/vs/workbench/parts/emmet/node/actions/expandAbbreviation.ts
浏览文件 @
594b7364
...
...
@@ -8,42 +8,38 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
Editor
ActionDescripto
r
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configurati
on
'
;
import
{
CommonEditorRegistry
,
Editor
KbExp
r
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
Handler
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorComm
on
'
;
import
editorCommon
=
require
(
'
vs/editor/common/editorCommon
'
);
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
KbExpr
}
from
'
vs/platform/keybinding/common/keybinding
'
;
class
ExpandAbbreviationAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.expandAbbreviation
'
;
constructor
(
descriptor
:
editorCommon
.
IEditorActionDescriptorData
,
editor
:
editorCommon
.
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
expand_abbreviation
'
);
constructor
()
{
super
(
'
editor.emmet.action.expandAbbreviation
'
,
nls
.
localize
(
'
expandAbbreviationAction
'
,
"
Emmet: Expand Abbreviation
"
),
'
Emmet: Expand Abbreviation
'
,
'
expand_abbreviation
'
);
this
.
kbOpts
=
{
primary
:
KeyCode
.
Tab
,
kbExpr
:
KbExpr
.
and
(
EditorKbExpr
.
TextFocus
,
EditorKbExpr
.
HasOnlyEmptySelection
,
EditorKbExpr
.
HasSingleSelection
,
EditorKbExpr
.
TabDoesNotMoveFocus
,
KbExpr
.
has
(
'
config.emmet.triggerExpansionOnTab
'
)
)
};
}
protected
noExpansionOccurred
():
void
{
protected
noExpansionOccurred
(
editor
:
ICommonCodeEditor
):
void
{
// forward the tab key back to the editor
this
.
editor
.
trigger
(
'
emmet
'
,
editorCommon
.
Handler
.
Tab
,
{});
editor
.
trigger
(
'
emmet
'
,
Handler
.
Tab
,
{});
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
ExpandAbbreviationAction
,
ExpandAbbreviationAction
.
ID
,
nls
.
localize
(
'
expandAbbreviationAction
'
,
"
Emmet: Expand Abbreviation
"
),
void
0
,
'
Emmet: Expand Abbreviation
'
));
KeybindingsRegistry
.
registerCommandRule
({
id
:
ExpandAbbreviationAction
.
ID
,
weight
:
KeybindingsRegistry
.
WEIGHT
.
editorContrib
(),
when
:
KbExpr
.
and
(
KbExpr
.
has
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_TEXT_FOCUS
),
KbExpr
.
not
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_HAS_NON_EMPTY_SELECTION
),
KbExpr
.
not
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_HAS_MULTIPLE_SELECTIONS
),
KbExpr
.
not
(
editorCommon
.
KEYBINDING_CONTEXT_EDITOR_TAB_MOVES_FOCUS
),
KbExpr
.
has
(
'
config.emmet.triggerExpansionOnTab
'
)
),
primary
:
KeyCode
.
Tab
});
CommonEditorRegistry
.
registerEditorAction2
(
new
ExpandAbbreviationAction
());
src/vs/workbench/parts/emmet/node/actions/incrementDecrement.ts
浏览文件 @
594b7364
...
...
@@ -8,84 +8,77 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
IncrementNumberByOneTenthAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.incrementNumberByOneTenth
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
increment_number_by_01
'
);
constructor
()
{
super
(
'
editor.emmet.action.incrementNumberByOneTenth
'
,
nls
.
localize
(
'
incrementNumberByOneTenth
'
,
"
Emmet: Increment by 0.1
"
),
'
Emmet: Increment by 0.1
'
,
'
increment_number_by_01
'
);
}
}
class
IncrementNumberByOneAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.incrementNumberByOne
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
increment_number_by_1
'
);
constructor
()
{
super
(
'
editor.emmet.action.incrementNumberByOne
'
,
nls
.
localize
(
'
incrementNumberByOne
'
,
"
Emmet: Increment by 1
"
),
'
Emmet: Increment by 1
'
,
'
increment_number_by_1
'
);
}
}
class
IncrementNumberByTenAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.incrementNumberByTen
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
increment_number_by_10
'
);
constructor
()
{
super
(
'
editor.emmet.action.incrementNumberByTen
'
,
nls
.
localize
(
'
incrementNumberByTen
'
,
"
Emmet: Increment by 10
"
),
'
Emmet: Increment by 10
'
,
'
increment_number_by_10
'
);
}
}
class
DecrementNumberByOneTenthAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.decrementNumberByOneTenth
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
decrement_number_by_01
'
);
constructor
()
{
super
(
'
editor.emmet.action.decrementNumberByOneTenth
'
,
nls
.
localize
(
'
decrementNumberByOneTenth
'
,
"
Emmet: Decrement by 0.1
"
),
'
Emmet: Decrement by 0.1
'
,
'
decrement_number_by_01
'
);
}
}
class
DecrementNumberByOneAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.decrementNumberByOne
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
decrement_number_by_1
'
);
constructor
()
{
super
(
'
editor.emmet.action.decrementNumberByOne
'
,
nls
.
localize
(
'
decrementNumberByOne
'
,
"
Emmet: Decrement by 1
"
),
'
Emmet: Decrement by 1
'
,
'
decrement_number_by_1
'
);
}
}
class
DecrementNumberByTenAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.decrementNumberByTen
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
decrement_number_by_10
'
);
constructor
()
{
super
(
'
editor.emmet.action.decrementNumberByTen
'
,
nls
.
localize
(
'
decrementNumberByTen
'
,
"
Emmet: Decrement by 10
"
),
'
Emmet: Decrement by 10
'
,
'
decrement_number_by_10
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
IncrementNumberByOneTenthAction
,
IncrementNumberByOneTenthAction
.
ID
,
nls
.
localize
(
'
incrementNumberByOneTenth
'
,
"
Emmet: Increment by 0.1
"
),
void
0
,
'
Emmet: Increment by 0.1
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
DecrementNumberByOneTenthAction
,
DecrementNumberByOneTenthAction
.
ID
,
nls
.
localize
(
'
decrementNumberByOneTenth
'
,
"
Emmet: Decrement by 0.1
"
),
void
0
,
'
Emmet: Decrement by 0.1
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
IncrementNumberByOneAction
,
IncrementNumberByOneAction
.
ID
,
nls
.
localize
(
'
incrementNumberByOne
'
,
"
Emmet: Increment by 1
"
),
void
0
,
'
Emmet: Increment by 1
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
DecrementNumberByOneAction
,
DecrementNumberByOneAction
.
ID
,
nls
.
localize
(
'
decrementNumberByOne
'
,
"
Emmet: Decrement by 1
"
),
void
0
,
'
Emmet: Decrement by 1
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
IncrementNumberByTenAction
,
IncrementNumberByTenAction
.
ID
,
nls
.
localize
(
'
incrementNumberByTen
'
,
"
Emmet: Increment by 10
"
),
void
0
,
'
Emmet: Increment by 10
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
DecrementNumberByTenAction
,
DecrementNumberByTenAction
.
ID
,
nls
.
localize
(
'
decrementNumberByTen
'
,
"
Emmet: Decrement by 10
"
),
void
0
,
'
Emmet: Decrement by 10
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
IncrementNumberByOneTenthAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
IncrementNumberByOneAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
IncrementNumberByTenAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
DecrementNumberByOneTenthAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
DecrementNumberByOneAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
DecrementNumberByTenAction
());
src/vs/workbench/parts/emmet/node/actions/matchingPair.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
GoToMatchingPairAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.matchingPair
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
matching_pair
'
);
constructor
()
{
super
(
'
editor.emmet.action.matchingPair
'
,
nls
.
localize
(
'
matchingPair
'
,
"
Emmet: Go to Matching Pair
"
),
'
Emmet: Go to Matching Pair
'
,
'
matching_pair
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
GoToMatchingPairAction
,
GoToMatchingPairAction
.
ID
,
nls
.
localize
(
'
matchingPair
'
,
"
Emmet: Go to Matching Pair
"
),
void
0
,
'
Emmet: Go to Matching Pair
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
GoToMatchingPairAction
());
src/vs/workbench/parts/emmet/node/actions/mergeLines.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
MergeLinesAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.mergeLines
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
merge_lines
'
);
constructor
()
{
super
(
'
editor.emmet.action.mergeLines
'
,
nls
.
localize
(
'
mergeLines
'
,
"
Emmet: Merge Lines
"
),
'
Emmet: Merge Lines
'
,
'
merge_lines
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
MergeLinesAction
,
MergeLinesAction
.
ID
,
nls
.
localize
(
'
mergeLines
'
,
"
Emmet: Merge Lines
"
),
void
0
,
'
Emmet: Merge Lines
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
MergeLinesAction
());
src/vs/workbench/parts/emmet/node/actions/reflectCssValue.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
ReflectCSSValueAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.reflectCSSValue
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
reflect_css_value
'
);
constructor
()
{
super
(
'
editor.emmet.action.reflectCSSValue
'
,
nls
.
localize
(
'
reflectCSSValue
'
,
"
Emmet: Reflect CSS Value
"
),
'
Emmet: Reflect CSS Value
'
,
'
reflect_css_value
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
ReflectCSSValueAction
,
ReflectCSSValueAction
.
ID
,
nls
.
localize
(
'
reflectCSSValue
'
,
"
Emmet: Reflect CSS Value
"
),
void
0
,
'
Emmet: Reflect CSS Value
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
ReflectCSSValueAction
());
src/vs/workbench/parts/emmet/node/actions/removeTag.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
RemoveTagAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.removeTag
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
remove_tag
'
);
constructor
()
{
super
(
'
editor.emmet.action.removeTag
'
,
nls
.
localize
(
'
removeTag
'
,
"
Emmet: Remove Tag
"
),
'
Emmet: Remove Tag
'
,
'
remove_tag
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
RemoveTagAction
,
RemoveTagAction
.
ID
,
nls
.
localize
(
'
removeTag
'
,
"
Emmet: Remove Tag
"
),
void
0
,
'
Emmet: Remove Tag
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
RemoveTagAction
());
src/vs/workbench/parts/emmet/node/actions/selectItem.ts
浏览文件 @
594b7364
...
...
@@ -8,32 +8,29 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
SelectPreviousItemAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.selectPreviousItem
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
select_previous_item
'
);
constructor
()
{
super
(
'
editor.emmet.action.selectPreviousItem
'
,
nls
.
localize
(
'
selectPreviousItem
'
,
"
Emmet: Select Previous Item
"
),
'
Emmet: Select Previous Item
'
,
'
select_previous_item
'
);
}
}
class
SelectNextItemAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.selectNextItem
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
select_next_item
'
);
constructor
()
{
super
(
'
editor.emmet.action.selectNextItem
'
,
nls
.
localize
(
'
selectNextItem
'
,
"
Emmet: Select Next Item
"
),
'
Emmet: Select Next Item
'
,
'
select_next_item
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
SelectPreviousItemAction
,
SelectPreviousItemAction
.
ID
,
nls
.
localize
(
'
selectPreviousItem
'
,
"
Emmet: Select Previous Item
"
),
void
0
,
'
Emmet: Select Previous Item
'
));
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
SelectNextItemAction
,
SelectNextItemAction
.
ID
,
nls
.
localize
(
'
selectNextItem
'
,
"
Emmet: Select Next Item
"
),
void
0
,
'
Emmet: Select Next Item
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
SelectPreviousItemAction
());
CommonEditorRegistry
.
registerEditorAction2
(
new
SelectNextItemAction
());
src/vs/workbench/parts/emmet/node/actions/splitJoinTag.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
SplitJoinTagAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.splitJoinTag
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
split_join_tag
'
);
constructor
()
{
super
(
'
editor.emmet.action.splitJoinTag
'
,
nls
.
localize
(
'
splitJoinTag
'
,
"
Emmet: Split/Join Tag
"
),
'
Emmet: Split/Join Tag
'
,
'
split_join_tag
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
SplitJoinTagAction
,
SplitJoinTagAction
.
ID
,
nls
.
localize
(
'
splitJoinTag
'
,
"
Emmet: Split/Join Tag
"
),
void
0
,
'
Emmet: Split/Join Tag
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
SplitJoinTagAction
());
src/vs/workbench/parts/emmet/node/actions/toggleComment.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
ToggleCommentAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.toggleComment
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
toggle_comment
'
);
constructor
()
{
super
(
'
editor.emmet.action.toggleComment
'
,
nls
.
localize
(
'
toggleComment
'
,
"
Emmet: Toggle Comment
"
),
'
Emmet: Toggle Comment
'
,
'
toggle_comment
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
ToggleCommentAction
,
ToggleCommentAction
.
ID
,
nls
.
localize
(
'
toggleComment
'
,
"
Emmet: Toggle Comment
"
),
void
0
,
'
Emmet: Toggle Comment
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
ToggleCommentAction
());
src/vs/workbench/parts/emmet/node/actions/updateImageSize.ts
浏览文件 @
594b7364
...
...
@@ -8,19 +8,17 @@
import
nls
=
require
(
'
vs/nls
'
);
import
{
BasicEmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
class
UpdateImageSizeAction
extends
BasicEmmetEditorAction
{
static
ID
=
'
editor.emmet.action.updateImageSize
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
,
'
update_image_size
'
);
constructor
()
{
super
(
'
editor.emmet.action.updateImageSize
'
,
nls
.
localize
(
'
updateImageSize
'
,
"
Emmet: Update Image Size
"
),
'
Emmet: Update Image Size
'
,
'
update_image_size
'
);
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
UpdateImageSizeAction
,
UpdateImageSizeAction
.
ID
,
nls
.
localize
(
'
updateImageSize
'
,
"
Emmet: Update Image Size
"
),
void
0
,
'
Emmet: Update Image Size
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
UpdateImageSizeAction
());
src/vs/workbench/parts/emmet/node/actions/updateTag.ts
浏览文件 @
594b7364
...
...
@@ -6,41 +6,39 @@
'
use strict
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
EmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
*
as
emmet
from
'
emmet
'
;
import
{
EmmetEditorAction
,
EmmetActionContext
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ServicesAccessor
,
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IQuickOpenService
,
IInputOptions
}
from
'
vs/workbench/services/quickopen/common/quickOpenService
'
;
class
UpdateTagAction
extends
EmmetEditorAction
{
static
ID
=
'
editor.emmet.action.updateTag
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IQuickOpenService
private
quickOpenService
:
IQuickOpenService
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
);
constructor
()
{
super
(
'
editor.emmet.action.updateTag
'
,
nls
.
localize
(
'
updateTag
'
,
"
Emmet: Update Tag
"
)
,
'
Emmet: Update Tag
'
);
}
public
runEmmetAction
(
_emmet
:
typeof
emmet
)
{
public
runEmmetAction
(
accessor
:
ServicesAccessor
,
ctx
:
EmmetActionContext
)
{
const
quickOpenService
=
accessor
.
get
(
IQuickOpenService
);
let
options
:
IInputOptions
=
{
prompt
:
nls
.
localize
(
'
enterTag
'
,
'
Enter Tag
'
),
placeHolder
:
nls
.
localize
(
'
tag
'
,
'
Tag
'
)
};
this
.
quickOpenService
.
input
(
options
).
then
(
tag
=>
{
this
.
wrapAbbreviation
(
_emmet
,
tag
);
quickOpenService
.
input
(
options
).
then
(
tag
=>
{
this
.
wrapAbbreviation
(
ctx
,
tag
);
});
}
private
wrapAbbreviation
(
_emmet
:
typeof
emmet
,
ta
g
)
{
if
(
tag
&&
!
_emmet
.
run
(
'
update_tag
'
,
this
.
editorAccessor
,
tag
))
{
this
.
noExpansionOccurred
();
private
wrapAbbreviation
(
ctx
:
EmmetActionContext
,
tag
:
strin
g
)
{
if
(
tag
&&
!
ctx
.
emmet
.
run
(
'
update_tag
'
,
ctx
.
editorAccessor
,
tag
))
{
this
.
noExpansionOccurred
(
ctx
.
editor
);
}
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
UpdateTagAction
,
UpdateTagAction
.
ID
,
nls
.
localize
(
'
updateTag
'
,
"
Emmet: Update Tag
"
),
void
0
,
'
Emmet: Update Tag
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
UpdateTagAction
());
src/vs/workbench/parts/emmet/node/actions/wrapWithAbbreviation.ts
浏览文件 @
594b7364
...
...
@@ -6,41 +6,38 @@
'
use strict
'
;
import
nls
=
require
(
'
vs/nls
'
);
import
{
EmmetEditorAction
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
*
as
emmet
from
'
emmet
'
;
import
{
EmmetEditorAction
,
EmmetActionContext
}
from
'
vs/workbench/parts/emmet/node/emmetActions
'
;
import
{
CommonEditorRegistry
,
EditorActionDescriptor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IEditorActionDescriptorData
,
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
ServicesAccessor
,
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IQuickOpenService
,
IInputOptions
}
from
'
vs/workbench/services/quickopen/common/quickOpenService
'
;
class
WrapWithAbbreviationAction
extends
EmmetEditorAction
{
static
ID
=
'
editor.emmet.action.wrapWithAbbreviation
'
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IQuickOpenService
private
quickOpenService
:
IQuickOpenService
,
@
IConfigurationService
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
configurationService
);
constructor
()
{
super
(
'
editor.emmet.action.wrapWithAbbreviation
'
,
nls
.
localize
(
'
wrapWithAbbreviationAction
'
,
"
Emmet: Wrap with Abbreviation
"
)
,
'
Emmet: Wrap with Abbreviation
'
);
}
public
runEmmetAction
(
_emmet
:
typeof
emmet
)
{
public
runEmmetAction
(
accessor
:
ServicesAccessor
,
ctx
:
EmmetActionContext
)
{
const
quickOpenService
=
accessor
.
get
(
IQuickOpenService
);
let
options
:
IInputOptions
=
{
prompt
:
nls
.
localize
(
'
enterAbbreviation
'
,
"
Enter Abbreviation
"
),
placeHolder
:
nls
.
localize
(
'
abbreviation
'
,
"
Abbreviation
"
)
};
this
.
quickOpenService
.
input
(
options
).
then
(
abbreviation
=>
{
this
.
wrapAbbreviation
(
_emmet
,
abbreviation
);
quickOpenService
.
input
(
options
).
then
(
abbreviation
=>
{
this
.
wrapAbbreviation
(
ctx
,
abbreviation
);
});
}
private
wrapAbbreviation
(
_emmet
:
typeof
emmet
,
abbreviation
)
{
if
(
abbreviation
&&
!
_emmet
.
run
(
'
wrap_with_abbreviation
'
,
this
.
editorAccessor
,
abbreviation
))
{
this
.
noExpansionOccurred
();
private
wrapAbbreviation
(
ctx
:
EmmetActionContext
,
abbreviation
:
string
)
{
if
(
abbreviation
&&
!
ctx
.
emmet
.
run
(
'
wrap_with_abbreviation
'
,
ctx
.
editorAccessor
,
abbreviation
))
{
this
.
noExpansionOccurred
(
ctx
.
editor
);
}
}
}
CommonEditorRegistry
.
registerEditorAction
(
new
EditorActionDescriptor
(
WrapWithAbbreviationAction
,
WrapWithAbbreviationAction
.
ID
,
nls
.
localize
(
'
wrapWithAbbreviationAction
'
,
"
Emmet: Wrap with Abbreviation
"
),
void
0
,
'
Emmet: Wrap with Abbreviation
'
));
CommonEditorRegistry
.
registerEditorAction2
(
new
WrapWithAbbreviationAction
());
src/vs/workbench/parts/emmet/node/emmetActions.ts
浏览文件 @
594b7364
...
...
@@ -6,9 +6,9 @@
'
use strict
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
I
EditorActionDescriptorData
,
I
CommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorAction
}
from
'
vs/editor/common/editorAction
'
;
import
{
Behaviour
}
from
'
vs/editor/common/editorActionEnablement
'
;
import
{
ICommonCodeEditor
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EditorAction
2
,
ServicesAccessor
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
EditorAccessor
}
from
'
vs/workbench/parts/emmet/node/editorAccessor
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
...
...
@@ -85,33 +85,46 @@ class LazyEmmet {
}
}
export
abstract
class
EmmetEditorAction
extends
EditorAction
{
export
class
EmmetActionContext
{
editor
:
ICommonCodeEditor
;
emmet
:
typeof
emmet
;
editorAccessor
:
EditorAccessor
;
protected
editorAccessor
:
EditorAccessor
;
private
configurationService
:
IConfigurationService
=
null
;
constructor
(
editor
:
ICommonCodeEditor
,
_emmet
:
typeof
emmet
,
editorAccessor
:
EditorAccessor
)
{
this
.
editor
=
editor
;
this
.
emmet
=
_emmet
;
this
.
editorAccessor
=
editorAccessor
;
}
}
export
abstract
class
EmmetEditorAction
extends
EditorAction2
{
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
configurationService
:
IConfigurationService
)
{
super
(
descriptor
,
editor
,
Behaviour
.
Writeable
);
this
.
editorAccessor
=
new
EditorAccessor
(
editor
);
this
.
configurationService
=
configurationService
;
constructor
(
id
:
string
,
label
:
string
,
alias
:
string
)
{
super
(
id
,
label
,
alias
,
true
);
}
abstract
runEmmetAction
(
_emmet
:
typeof
emme
t
);
abstract
runEmmetAction
(
accessor
:
ServicesAccessor
,
ctx
:
EmmetActionContex
t
);
protected
noExpansionOccurred
()
{
protected
noExpansionOccurred
(
editor
:
ICommonCodeEditor
)
{
// default do nothing
}
public
run
():
TPromise
<
void
>
{
if
(
!
this
.
editorAccessor
.
isEmmetEnabledMode
())
{
this
.
noExpansionOccurred
();
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICommonCodeEditor
):
TPromise
<
void
>
{
const
configurationService
=
accessor
.
get
(
IConfigurationService
);
const
instantiationService
=
accessor
.
get
(
IInstantiationService
);
let
editorAccessor
=
new
EditorAccessor
(
editor
);
if
(
!
editorAccessor
.
isEmmetEnabledMode
())
{
this
.
noExpansionOccurred
(
editor
);
return
;
}
return
LazyEmmet
.
withConfiguredEmmet
(
this
.
configurationService
,
(
_emmet
)
=>
{
this
.
editorAccessor
.
onBeforeEmmetAction
();
this
.
runEmmetAction
(
_emmet
);
this
.
editorAccessor
.
onAfterEmmetAction
();
return
LazyEmmet
.
withConfiguredEmmet
(
configurationService
,
(
_emmet
)
=>
{
editorAccessor
.
onBeforeEmmetAction
();
instantiationService
.
invokeFunction
((
accessor
)
=>
{
this
.
runEmmetAction
(
accessor
,
new
EmmetActionContext
(
editor
,
_emmet
,
editorAccessor
));
});
editorAccessor
.
onAfterEmmetAction
();
});
}
}
...
...
@@ -120,15 +133,14 @@ export class BasicEmmetEditorAction extends EmmetEditorAction {
private
emmetActionName
:
string
;
constructor
(
descriptor
:
IEditorActionDescriptorData
,
editor
:
ICommonCodeEditor
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
actionName
:
string
)
{
super
(
descriptor
,
editor
,
configurationService
);
this
.
editorAccessor
=
new
EditorAccessor
(
editor
);
constructor
(
id
:
string
,
label
:
string
,
alias
:
string
,
actionName
:
string
)
{
super
(
id
,
label
,
alias
);
this
.
emmetActionName
=
actionName
;
}
public
runEmmetAction
(
_emmet
:
typeof
emme
t
)
{
if
(
!
_emmet
.
run
(
this
.
emmetActionName
,
this
.
editorAccessor
))
{
this
.
noExpansionOccurred
();
public
runEmmetAction
(
accessor
:
ServicesAccessor
,
ctx
:
EmmetActionContex
t
)
{
if
(
!
ctx
.
emmet
.
run
(
this
.
emmetActionName
,
ctx
.
editorAccessor
))
{
this
.
noExpansionOccurred
(
ctx
.
editor
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录