Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4cacd327
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,发现更多精彩内容 >>
提交
4cacd327
编写于
6月 04, 2018
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #50856
上级
27d6c490
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
3 deletion
+26
-3
src/vs/editor/contrib/rename/rename.ts
src/vs/editor/contrib/rename/rename.ts
+26
-3
未找到文件。
src/vs/editor/contrib/rename/rename.ts
浏览文件 @
4cacd327
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
'
use strict
'
;
'
use strict
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
*
as
nls
from
'
vs/nls
'
;
import
{
illegalArgument
}
from
'
vs/base/common/errors
'
;
import
{
illegalArgument
,
onUnexpectedError
}
from
'
vs/base/common/errors
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
KeyMod
,
KeyCode
}
from
'
vs/base/common/keyCodes
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
RawContextKey
,
IContextKey
,
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
RawContextKey
,
IContextKey
,
IContextKeyService
,
ContextKeyExpr
}
from
'
vs/platform/contextkey/common/contextkey
'
;
...
@@ -20,7 +20,7 @@ import RenameInputField from './renameInputField';
...
@@ -20,7 +20,7 @@ import RenameInputField from './renameInputField';
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
asWinJsPromise
}
from
'
vs/base/common/async
'
;
import
{
WorkspaceEdit
,
RenameProviderRegistry
,
RenameProvider
,
RenameLocation
}
from
'
vs/editor/common/modes
'
;
import
{
WorkspaceEdit
,
RenameProviderRegistry
,
RenameProvider
,
RenameLocation
}
from
'
vs/editor/common/modes
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
import
{
Position
,
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
alert
}
from
'
vs/base/browser/ui/aria/aria
'
;
import
{
alert
}
from
'
vs/base/browser/ui/aria/aria
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
MessageController
}
from
'
vs/editor/contrib/message/messageController
'
;
import
{
MessageController
}
from
'
vs/editor/contrib/message/messageController
'
;
...
@@ -28,6 +28,8 @@ import { EditorState, CodeEditorStateFlag } from 'vs/editor/browser/core/editorS
...
@@ -28,6 +28,8 @@ import { EditorState, CodeEditorStateFlag } from 'vs/editor/browser/core/editorS
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
KeybindingsRegistry
}
from
'
vs/platform/keybinding/common/keybindingsRegistry
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
import
{
IBulkEditService
}
from
'
vs/editor/browser/services/bulkEditService
'
;
import
{
IBulkEditService
}
from
'
vs/editor/browser/services/bulkEditService
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
{
ICodeEditorService
}
from
'
vs/editor/browser/services/codeEditorService
'
;
class
RenameSkeleton
{
class
RenameSkeleton
{
...
@@ -130,6 +132,10 @@ class RenameController implements IEditorContribution {
...
@@ -130,6 +132,10 @@ class RenameController implements IEditorContribution {
const
position
=
this
.
editor
.
getPosition
();
const
position
=
this
.
editor
.
getPosition
();
const
skeleton
=
new
RenameSkeleton
(
this
.
editor
.
getModel
(),
position
);
const
skeleton
=
new
RenameSkeleton
(
this
.
editor
.
getModel
(),
position
);
if
(
!
skeleton
.
hasProvider
())
{
return
undefined
;
}
let
loc
:
RenameLocation
;
let
loc
:
RenameLocation
;
try
{
try
{
loc
=
await
skeleton
.
resolveRenameLocation
();
loc
=
await
skeleton
.
resolveRenameLocation
();
...
@@ -230,7 +236,24 @@ export class RenameAction extends EditorAction {
...
@@ -230,7 +236,24 @@ export class RenameAction extends EditorAction {
});
});
}
}
public
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
TPromise
<
void
>
{
runCommand
(
accessor
:
ServicesAccessor
,
args
:
[
URI
,
IPosition
]):
void
|
TPromise
<
void
>
{
const
editorService
=
accessor
.
get
(
ICodeEditorService
);
const
[
uri
,
pos
]
=
args
||
[
undefined
,
undefined
];
if
(
URI
.
isUri
(
uri
)
&&
Position
.
isIPosition
(
pos
))
{
return
editorService
.
openCodeEditor
({
resource
:
uri
},
editorService
.
getActiveCodeEditor
()).
then
(
editor
=>
{
editor
.
setPosition
(
pos
);
editor
.
invokeWithinContext
(
accessor
=>
{
this
.
reportTelemetry
(
accessor
,
editor
);
return
this
.
run
(
accessor
,
editor
);
});
},
onUnexpectedError
);
}
return
super
.
runCommand
(
accessor
,
args
);
}
run
(
accessor
:
ServicesAccessor
,
editor
:
ICodeEditor
):
TPromise
<
void
>
{
let
controller
=
RenameController
.
get
(
editor
);
let
controller
=
RenameController
.
get
(
editor
);
if
(
controller
)
{
if
(
controller
)
{
return
controller
.
run
();
return
controller
.
run
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录