Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
66bb8ff9
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,发现更多精彩内容 >>
提交
66bb8ff9
编写于
8月 18, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ISuggestion#extraEdits, #6874
上级
5f53f7c7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
12 deletion
+22
-12
src/vs/editor/common/core/editOperation.ts
src/vs/editor/common/core/editOperation.ts
+8
-9
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+1
-0
src/vs/editor/contrib/suggest/browser/suggestController.ts
src/vs/editor/contrib/suggest/browser/suggestController.ts
+13
-3
未找到文件。
src/vs/editor/common/core/editOperation.ts
浏览文件 @
66bb8ff9
...
@@ -5,12 +5,11 @@
...
@@ -5,12 +5,11 @@
'
use strict
'
;
'
use strict
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
Range
}
from
'
vs/editor/common/core/range
'
;
import
{
IIdentifiedSingleEditOperation
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IIdentifiedSingleEditOperation
,
IRange
,
IPosition
}
from
'
vs/editor/common/editorCommon
'
;
import
{
Position
}
from
'
vs/editor/common/core/position
'
;
export
class
EditOperation
{
export
class
EditOperation
{
public
static
insert
(
position
:
Position
,
text
:
string
):
IIdentifiedSingleEditOperation
{
public
static
insert
(
position
:
I
Position
,
text
:
string
):
IIdentifiedSingleEditOperation
{
return
{
return
{
identifier
:
null
,
identifier
:
null
,
range
:
new
Range
(
position
.
lineNumber
,
position
.
column
,
position
.
lineNumber
,
position
.
column
),
range
:
new
Range
(
position
.
lineNumber
,
position
.
column
,
position
.
lineNumber
,
position
.
column
),
...
@@ -19,28 +18,28 @@ export class EditOperation {
...
@@ -19,28 +18,28 @@ export class EditOperation {
};
};
}
}
public
static
delete
(
range
:
Range
):
IIdentifiedSingleEditOperation
{
public
static
delete
(
range
:
I
Range
):
IIdentifiedSingleEditOperation
{
return
{
return
{
identifier
:
null
,
identifier
:
null
,
range
:
range
,
range
:
Range
.
lift
(
range
)
,
text
:
null
,
text
:
null
,
forceMoveMarkers
:
true
forceMoveMarkers
:
true
};
};
}
}
public
static
replace
(
range
:
Range
,
text
:
string
):
IIdentifiedSingleEditOperation
{
public
static
replace
(
range
:
I
Range
,
text
:
string
):
IIdentifiedSingleEditOperation
{
return
{
return
{
identifier
:
null
,
identifier
:
null
,
range
:
range
,
range
:
Range
.
lift
(
range
)
,
text
:
text
,
text
:
text
,
forceMoveMarkers
:
false
forceMoveMarkers
:
false
};
};
}
}
public
static
replaceMove
(
range
:
Range
,
text
:
string
):
IIdentifiedSingleEditOperation
{
public
static
replaceMove
(
range
:
I
Range
,
text
:
string
):
IIdentifiedSingleEditOperation
{
return
{
return
{
identifier
:
null
,
identifier
:
null
,
range
:
range
,
range
:
Range
.
lift
(
range
)
,
text
:
text
,
text
:
text
,
forceMoveMarkers
:
true
forceMoveMarkers
:
true
};
};
...
...
src/vs/editor/common/modes.ts
浏览文件 @
66bb8ff9
...
@@ -367,6 +367,7 @@ export interface ISuggestion {
...
@@ -367,6 +367,7 @@ export interface ISuggestion {
noAutoAccept
?:
boolean
;
noAutoAccept
?:
boolean
;
overwriteBefore
?:
number
;
overwriteBefore
?:
number
;
overwriteAfter
?:
number
;
overwriteAfter
?:
number
;
extraEdits
?:
editorCommon
.
ISingleEditOperation
[];
}
}
/**
/**
...
...
src/vs/editor/contrib/suggest/browser/suggestController.ts
浏览文件 @
66bb8ff9
...
@@ -13,6 +13,7 @@ import { ICommonCodeEditor, IEditorContribution, EditorContextKeys, ModeContextK
...
@@ -13,6 +13,7 @@ import { ICommonCodeEditor, IEditorContribution, EditorContextKeys, ModeContextK
import
{
editorAction
,
ServicesAccessor
,
EditorAction
,
EditorCommand
,
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
editorAction
,
ServicesAccessor
,
EditorAction
,
EditorCommand
,
CommonEditorRegistry
}
from
'
vs/editor/common/editorCommonExtensions
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
EditorBrowserRegistry
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
EditorBrowserRegistry
}
from
'
vs/editor/browser/editorBrowserExtensions
'
;
import
{
EditOperation
}
from
'
vs/editor/common/core/editOperation
'
;
import
{
getSnippetController
,
CodeSnippet
}
from
'
vs/editor/contrib/snippet/common/snippet
'
;
import
{
getSnippetController
,
CodeSnippet
}
from
'
vs/editor/contrib/snippet/common/snippet
'
;
import
{
Context
as
SuggestContext
}
from
'
vs/editor/contrib/suggest/common/suggest
'
;
import
{
Context
as
SuggestContext
}
from
'
vs/editor/contrib/suggest/common/suggest
'
;
import
{
SuggestModel
}
from
'
../common/suggestModel
'
;
import
{
SuggestModel
}
from
'
../common/suggestModel
'
;
...
@@ -61,12 +62,21 @@ export class SuggestController implements IEditorContribution {
...
@@ -61,12 +62,21 @@ export class SuggestController implements IEditorContribution {
private
onDidSelectItem
(
item
:
CompletionItem
):
void
{
private
onDidSelectItem
(
item
:
CompletionItem
):
void
{
if
(
item
)
{
if
(
item
)
{
const
{
insertText
,
overwriteBefore
,
overwriteAfter
}
=
item
.
suggestion
;
const
{
insertText
,
overwriteBefore
,
overwriteAfter
,
extraEdits
}
=
item
.
suggestion
;
const
columnDelta
=
this
.
editor
.
getPosition
().
column
-
this
.
model
.
getTriggerPosition
().
column
;
const
columnDelta
=
this
.
editor
.
getPosition
().
column
-
this
.
model
.
getTriggerPosition
().
column
;
getSnippetController
(
this
.
editor
).
run
(
new
CodeSnippet
(
insertText
),
if
(
Array
.
isArray
(
extraEdits
))
{
this
.
editor
.
pushUndoStop
();
this
.
editor
.
executeEdits
(
'
suggestController.extraEdits
'
,
extraEdits
.
map
(
edit
=>
EditOperation
.
replace
(
edit
.
range
,
edit
.
text
)));
this
.
editor
.
pushUndoStop
();
}
getSnippetController
(
this
.
editor
).
run
(
new
CodeSnippet
(
insertText
),
overwriteBefore
+
columnDelta
,
overwriteBefore
+
columnDelta
,
overwriteAfter
);
overwriteAfter
,
undefined
);
}
}
this
.
model
.
cancel
();
this
.
model
.
cancel
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录