Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0fe8e6b9
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,发现更多精彩内容 >>
提交
0fe8e6b9
编写于
5月 31, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
suggest: cleanup
上级
ca44a14a
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
45 deletion
+45
-45
src/vs/editor/contrib/suggest/browser/suggest.ts
src/vs/editor/contrib/suggest/browser/suggest.ts
+12
-12
src/vs/editor/contrib/suggest/browser/suggestModel.ts
src/vs/editor/contrib/suggest/browser/suggestModel.ts
+19
-19
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
+14
-14
未找到文件。
src/vs/editor/contrib/suggest/browser/suggest.ts
浏览文件 @
0fe8e6b9
...
...
@@ -60,11 +60,11 @@ export class SuggestController implements IEditorContribution {
this
.
update
();
}
public
getId
():
string
{
getId
():
string
{
return
SuggestController
.
ID
;
}
public
dispose
():
void
{
dispose
():
void
{
this
.
toDispose
=
dispose
(
this
.
toDispose
);
this
.
triggerCharacterListeners
=
dispose
(
this
.
triggerCharacterListeners
);
...
...
@@ -138,50 +138,50 @@ export class SuggestController implements IEditorContribution {
}
}
public
triggerSuggest
(
triggerCharacter
?:
string
,
groups
?:
ISuggestSupport
[][]):
TPromise
<
boolean
>
{
triggerSuggest
(
triggerCharacter
?:
string
,
groups
?:
ISuggestSupport
[][]):
TPromise
<
boolean
>
{
this
.
model
.
trigger
(
false
,
triggerCharacter
,
false
,
groups
);
this
.
editor
.
focus
();
return
TPromise
.
as
(
false
);
}
public
acceptSelectedSuggestion
():
void
{
acceptSelectedSuggestion
():
void
{
if
(
this
.
widget
)
{
this
.
widget
.
acceptSelectedSuggestion
();
}
}
public
cancelSuggestWidget
():
void
{
cancelSuggestWidget
():
void
{
if
(
this
.
widget
)
{
this
.
widget
.
cancel
();
}
}
public
selectNextSuggestion
():
void
{
selectNextSuggestion
():
void
{
if
(
this
.
widget
)
{
this
.
widget
.
selectNext
();
}
}
public
selectNextPageSuggestion
():
void
{
selectNextPageSuggestion
():
void
{
if
(
this
.
widget
)
{
this
.
widget
.
selectNextPage
();
}
}
public
selectPrevSuggestion
():
void
{
selectPrevSuggestion
():
void
{
if
(
this
.
widget
)
{
this
.
widget
.
selectPrevious
();
}
}
public
selectPrevPageSuggestion
():
void
{
selectPrevPageSuggestion
():
void
{
if
(
this
.
widget
)
{
this
.
widget
.
selectPreviousPage
();
}
}
public
toggleSuggestionDetails
():
void
{
toggleSuggestionDetails
():
void
{
if
(
this
.
widget
)
{
this
.
widget
.
toggleDetails
();
}
...
...
@@ -196,11 +196,11 @@ export class TriggerSuggestAction extends EditorAction {
super
(
descriptor
,
editor
);
}
public
isSupported
():
boolean
{
isSupported
():
boolean
{
return
SuggestRegistry
.
has
(
this
.
editor
.
getModel
())
&&
!
this
.
editor
.
getConfiguration
().
readOnly
;
}
public
run
():
TPromise
<
boolean
>
{
run
():
TPromise
<
boolean
>
{
return
SuggestController
.
getSuggestController
(
this
.
editor
).
triggerSuggest
();
}
}
...
...
src/vs/editor/contrib/suggest/browser/suggestModel.ts
浏览文件 @
0fe8e6b9
...
...
@@ -41,16 +41,16 @@ export interface IAcceptEvent {
class
Context
{
public
lineNumber
:
number
;
public
column
:
number
;
public
isInEditableRange
:
boolean
;
lineNumber
:
number
;
column
:
number
;
isInEditableRange
:
boolean
;
private
isAutoTriggerEnabled
:
boolean
;
public
lineContentBefore
:
string
;
public
lineContentAfter
:
string
;
lineContentBefore
:
string
;
lineContentAfter
:
string
;
public
wordBefore
:
string
;
public
wordAfter
:
string
;
wordBefore
:
string
;
wordAfter
:
string
;
constructor
(
editor
:
ICommonCodeEditor
,
private
auto
:
boolean
)
{
const
model
=
editor
.
getModel
();
...
...
@@ -85,7 +85,7 @@ class Context {
this
.
isAutoTriggerEnabled
=
supports
.
some
(
s
=>
s
.
shouldAutotriggerSuggest
);
}
public
shouldAutoTrigger
():
boolean
{
shouldAutoTrigger
():
boolean
{
if
(
!
this
.
isAutoTriggerEnabled
)
{
// Support disallows it
return
false
;
...
...
@@ -109,7 +109,7 @@ class Context {
return
true
;
}
public
isDifferentContext
(
context
:
Context
):
boolean
{
isDifferentContext
(
context
:
Context
):
boolean
{
if
(
this
.
lineNumber
!==
context
.
lineNumber
)
{
// Line number has changed
return
true
;
...
...
@@ -133,7 +133,7 @@ class Context {
return
false
;
}
public
shouldRetrigger
(
context
:
Context
):
boolean
{
shouldRetrigger
(
context
:
Context
):
boolean
{
if
(
!
startsWith
(
this
.
lineContentBefore
,
context
.
lineContentBefore
)
||
this
.
lineContentAfter
!==
context
.
lineContentAfter
)
{
// Doesn't look like the same line
return
false
;
...
...
@@ -175,16 +175,16 @@ export class SuggestModel implements IDisposable {
private
incomplete
:
boolean
;
private
_onDidCancel
:
Emitter
<
ICancelEvent
>
=
new
Emitter
();
public
get
onDidCancel
():
Event
<
ICancelEvent
>
{
return
this
.
_onDidCancel
.
event
;
}
get
onDidCancel
():
Event
<
ICancelEvent
>
{
return
this
.
_onDidCancel
.
event
;
}
private
_onDidTrigger
:
Emitter
<
ITriggerEvent
>
=
new
Emitter
();
public
get
onDidTrigger
():
Event
<
ITriggerEvent
>
{
return
this
.
_onDidTrigger
.
event
;
}
get
onDidTrigger
():
Event
<
ITriggerEvent
>
{
return
this
.
_onDidTrigger
.
event
;
}
private
_onDidSuggest
:
Emitter
<
ISuggestEvent
>
=
new
Emitter
();
public
get
onDidSuggest
():
Event
<
ISuggestEvent
>
{
return
this
.
_onDidSuggest
.
event
;
}
get
onDidSuggest
():
Event
<
ISuggestEvent
>
{
return
this
.
_onDidSuggest
.
event
;
}
private
_onDidAccept
:
Emitter
<
IAcceptEvent
>
=
new
Emitter
();
public
get
onDidAccept
():
Event
<
IAcceptEvent
>
{
return
this
.
_onDidAccept
.
event
;
}
get
onDidAccept
():
Event
<
IAcceptEvent
>
{
return
this
.
_onDidAccept
.
event
;
}
constructor
(
private
editor
:
ICommonCodeEditor
)
{
this
.
state
=
State
.
Idle
;
...
...
@@ -203,7 +203,7 @@ export class SuggestModel implements IDisposable {
this
.
onEditorConfigurationChange
();
}
public
cancel
(
silent
:
boolean
=
false
,
retrigger
:
boolean
=
false
):
boolean
{
cancel
(
silent
:
boolean
=
false
,
retrigger
:
boolean
=
false
):
boolean
{
const
actuallyCanceled
=
this
.
state
!==
State
.
Idle
;
if
(
this
.
triggerAutoSuggestPromise
)
{
...
...
@@ -229,7 +229,7 @@ export class SuggestModel implements IDisposable {
return
actuallyCanceled
;
}
public
getRequestPosition
():
Position
{
getRequestPosition
():
Position
{
if
(
!
this
.
context
)
{
return
null
;
}
...
...
@@ -296,7 +296,7 @@ export class SuggestModel implements IDisposable {
this
.
trigger
(
this
.
state
===
State
.
Auto
,
undefined
,
true
);
}
public
trigger
(
auto
:
boolean
,
triggerCharacter
?:
string
,
retrigger
:
boolean
=
false
,
groups
?:
ISuggestSupport
[][]):
void
{
trigger
(
auto
:
boolean
,
triggerCharacter
?:
string
,
retrigger
:
boolean
=
false
,
groups
?:
ISuggestSupport
[][]):
void
{
const
model
=
this
.
editor
.
getModel
();
const
characterTriggered
=
!!
triggerCharacter
;
groups
=
groups
||
SuggestRegistry
.
orderedGroups
(
model
);
...
...
@@ -376,7 +376,7 @@ export class SuggestModel implements IDisposable {
}
}
public
accept
(
suggestion
:
ISuggestion
,
overwriteBefore
:
number
,
overwriteAfter
:
number
):
boolean
{
accept
(
suggestion
:
ISuggestion
,
overwriteBefore
:
number
,
overwriteAfter
:
number
):
boolean
{
if
(
this
.
raw
===
null
)
{
return
false
;
}
...
...
@@ -399,7 +399,7 @@ export class SuggestModel implements IDisposable {
}
}
public
dispose
():
void
{
dispose
():
void
{
this
.
cancel
(
true
);
this
.
toDispose
=
dispose
(
this
.
toDispose
);
}
...
...
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
浏览文件 @
0fe8e6b9
...
...
@@ -308,7 +308,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
static
LOADING_MESSAGE
:
string
=
nls
.
localize
(
'
suggestWidget.loading
'
,
"
Loading...
"
);
static
NO_SUGGESTIONS_MESSAGE
:
string
=
nls
.
localize
(
'
suggestWidget.noSuggestions
'
,
"
No suggestions.
"
);
public
allowEditorOverflow
:
boolean
=
true
;
// Editor.IContentWidget.allowEditorOverflow
allowEditorOverflow
:
boolean
=
true
;
// Editor.IContentWidget.allowEditorOverflow
private
state
:
State
;
private
isAuto
:
boolean
;
...
...
@@ -334,7 +334,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
private
toDispose
:
IDisposable
[];
private
_onDidVisibilityChange
:
Emitter
<
boolean
>
=
new
Emitter
();
public
get
onDidVisibilityChange
():
Event
<
boolean
>
{
return
this
.
_onDidVisibilityChange
.
event
;
}
get
onDidVisibilityChange
():
Event
<
boolean
>
{
return
this
.
_onDidVisibilityChange
.
event
;
}
constructor
(
private
editor
:
ICodeEditor
,
...
...
@@ -657,7 +657,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
}
public
selectNextPage
():
boolean
{
selectNextPage
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -672,7 +672,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
}
public
selectNext
():
boolean
{
selectNext
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -687,7 +687,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
}
public
selectPreviousPage
():
boolean
{
selectPreviousPage
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -702,7 +702,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
}
public
selectPrevious
():
boolean
{
selectPrevious
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -713,11 +713,11 @@ export class SuggestWidget implements IContentWidget, IDisposable {
return
!
this
.
isAuto
;
default
:
this
.
list
.
focusPrevious
(
1
,
true
);
return
tru
e
;
return
fals
e
;
}
}
public
acceptSelectedSuggestion
():
boolean
{
acceptSelectedSuggestion
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -736,7 +736,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
}
public
toggleDetails
():
void
{
toggleDetails
():
void
{
if
(
this
.
state
===
State
.
Details
)
{
this
.
setState
(
State
.
Open
);
this
.
editor
.
focus
();
...
...
@@ -771,7 +771,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
removeClass
(
this
.
element
,
'
visible
'
);
}
public
cancel
():
void
{
cancel
():
void
{
if
(
this
.
state
===
State
.
Details
)
{
this
.
toggleDetails
();
}
else
{
...
...
@@ -779,7 +779,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
}
public
getPosition
():
IContentWidgetPosition
{
getPosition
():
IContentWidgetPosition
{
if
(
this
.
state
===
State
.
Hidden
)
{
return
null
;
}
...
...
@@ -790,11 +790,11 @@ export class SuggestWidget implements IContentWidget, IDisposable {
};
}
public
getDomNode
():
HTMLElement
{
getDomNode
():
HTMLElement
{
return
this
.
element
;
}
public
getId
():
string
{
getId
():
string
{
return
SuggestWidget
.
ID
;
}
...
...
@@ -834,7 +834,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
}
public
dispose
():
void
{
dispose
():
void
{
this
.
state
=
null
;
this
.
suggestionSupportsAutoAccept
=
null
;
this
.
currentSuggestionDetails
=
null
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录