Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
2461331b
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,发现更多精彩内容 >>
提交
2461331b
编写于
2月 08, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
suggest: fix details issue
上级
4581ae3b
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
33 addition
and
61 deletion
+33
-61
src/vs/base/browser/ui/list/listWidget.ts
src/vs/base/browser/ui/list/listWidget.ts
+4
-4
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
+29
-57
未找到文件。
src/vs/base/browser/ui/list/listWidget.ts
浏览文件 @
2461331b
...
...
@@ -218,7 +218,7 @@ export class List<T> implements IDisposable {
if
(
this
.
length
===
0
)
return
;
const
selection
=
this
.
selection
.
get
();
let
index
=
selection
.
length
>
0
?
selection
[
0
]
+
n
:
0
;
this
.
se
lection
.
set
(
loop
?
index
%
this
.
length
:
Math
.
min
(
index
,
this
.
length
-
1
));
this
.
se
tSelection
(
loop
?
index
%
this
.
length
:
Math
.
min
(
index
,
this
.
length
-
1
));
}
selectPrevious
(
n
=
1
,
loop
=
false
):
void
{
...
...
@@ -226,7 +226,7 @@ export class List<T> implements IDisposable {
const
selection
=
this
.
selection
.
get
();
let
index
=
selection
.
length
>
0
?
selection
[
0
]
-
n
:
0
;
if
(
loop
&&
index
<
0
)
index
=
this
.
length
+
(
index
%
this
.
length
);
this
.
se
lection
.
set
(
Math
.
max
(
index
,
0
));
this
.
se
tSelection
(
Math
.
max
(
index
,
0
));
}
setFocus
(...
indexes
:
number
[]):
void
{
...
...
@@ -238,7 +238,7 @@ export class List<T> implements IDisposable {
if
(
this
.
length
===
0
)
return
;
const
focus
=
this
.
focus
.
get
();
let
index
=
focus
.
length
>
0
?
focus
[
0
]
+
n
:
0
;
this
.
focus
.
set
(
loop
?
index
%
this
.
length
:
Math
.
min
(
index
,
this
.
length
-
1
));
this
.
setFocus
(
loop
?
index
%
this
.
length
:
Math
.
min
(
index
,
this
.
length
-
1
));
}
focusPrevious
(
n
=
1
,
loop
=
false
):
void
{
...
...
@@ -246,7 +246,7 @@ export class List<T> implements IDisposable {
const
focus
=
this
.
focus
.
get
();
let
index
=
focus
.
length
>
0
?
focus
[
0
]
-
n
:
0
;
if
(
loop
&&
index
<
0
)
index
=
this
.
length
+
(
index
%
this
.
length
);
this
.
focus
.
set
(
Math
.
max
(
index
,
0
));
this
.
setFocus
(
Math
.
max
(
index
,
0
));
}
focusNextPage
():
void
{
...
...
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
浏览文件 @
2461331b
...
...
@@ -64,8 +64,6 @@ class CompletionItem {
support
:
ISuggestSupport
;
container
:
ISuggestResult
;
private
_resolveDetails
:
TPromise
<
CompletionItem
>
;
constructor
(
public
group
:
CompletionGroup
,
suggestion
:
ISuggestion
,
container
:
ISuggestResult2
)
{
this
.
id
=
String
(
CompletionItem
.
_idPool
++
);
this
.
support
=
container
.
support
;
...
...
@@ -73,22 +71,16 @@ class CompletionItem {
this
.
container
=
container
;
}
resolveDetails
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
TPromise
<
CompletionItem
>
{
if
(
this
.
_resolveDetails
)
{
return
this
.
_resolveDetails
;
resolveDetails
(
resource
:
URI
,
position
:
EditorCommon
.
IPosition
):
TPromise
<
ISuggestion
>
{
if
(
!
this
.
support
||
typeof
this
.
support
.
getSuggestionDetails
!==
'
function
'
)
{
return
TPromise
.
as
(
this
.
suggestion
)
;
}
if
(
!
this
.
support
||
typeof
this
.
support
.
getSuggestionDetails
!==
'
function
'
)
{
return
this
.
_resolveDetails
=
TPromise
.
as
(
this
);
return
this
.
support
.
getSuggestionDetails
(
resource
,
position
,
this
.
suggestion
);
}
return
this
.
_resolveDetails
=
this
.
support
.
getSuggestionDetails
(
resource
,
position
,
this
.
suggestion
)
.
then
(
value
=>
this
.
suggestion
=
assign
(
this
.
suggestion
,
value
),
err
=>
isPromiseCanceledError
(
err
)
?
this
.
_resolveDetails
=
null
:
onUnexpectedError
(
err
)
)
.
then
(()
=>
this
);
updateDetails
(
value
:
ISuggestion
):
void
{
this
.
suggestion
=
assign
(
this
.
suggestion
,
value
);
}
}
...
...
@@ -425,7 +417,7 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
private
shouldShowEmptySuggestionList
:
boolean
;
private
suggestionSupportsAutoAccept
:
IKeybindingContextKey
<
boolean
>
;
private
loadingTimeout
:
number
;
private
currentSuggestionDetails
:
TPromise
<
CompletionItem
>
;
private
currentSuggestionDetails
:
TPromise
<
void
>
;
private
focusedItem
:
CompletionItem
;
private
completionModel
:
CompletionModel
;
...
...
@@ -534,6 +526,11 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
}
private
onListFocus
(
e
:
IFocusChangeEvent
<
CompletionItem
>
):
void
{
if
(
this
.
currentSuggestionDetails
)
{
this
.
currentSuggestionDetails
.
cancel
();
this
.
currentSuggestionDetails
=
null
;
}
if
(
!
e
.
elements
.
length
)
{
return
;
}
...
...
@@ -546,26 +543,24 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
const
index
=
e
.
indexes
[
0
];
this
.
resolveDetails
(
item
,
index
);
this
.
suggestionSupportsAutoAccept
.
set
(
!
(
<
CompletionItem
>
item
).
suggestion
.
noAutoAccept
);
if
(
this
.
focusedItem
)
{
const
index
=
this
.
completionModel
.
items
.
indexOf
(
this
.
focusedItem
);
if
(
index
>
-
1
)
this
.
list
.
splice
(
index
,
1
,
this
.
focusedItem
);
this
.
focusedItem
=
null
;
}
if
(
item
)
{
this
.
suggestionSupportsAutoAccept
.
set
(
item
.
suggestion
.
noAutoAccept
);
this
.
focusedItem
=
item
;
this
.
list
.
splice
(
index
,
1
,
item
);
this
.
list
.
setFocus
(
index
);
}
this
.
updateWidgetHeight
();
this
.
list
.
reveal
(
index
);
if
(
item
)
{
const
resource
=
this
.
editor
.
getModel
().
getAssociatedResource
();
const
position
=
this
.
model
.
getRequestPosition
()
||
this
.
editor
.
getPosition
();
this
.
currentSuggestionDetails
=
item
.
resolveDetails
(
resource
,
position
)
.
then
(
details
=>
{
item
.
updateDetails
(
details
);
this
.
list
.
setFocus
(
index
);
this
.
updateWidgetHeight
();
this
.
list
.
reveal
(
index
);
}
})
.
then
(
null
,
err
=>
!
isPromiseCanceledError
(
err
)
&&
onUnexpectedError
(
err
))
.
then
(()
=>
this
.
currentSuggestionDetails
=
null
);
}
private
onModelModeChanged
():
void
{
...
...
@@ -741,29 +736,6 @@ export class SuggestWidget implements EditorBrowser.IContentWidget, IDisposable
}
}
private
resolveDetails
(
item
:
CompletionItem
,
index
:
number
):
void
{
if
(
this
.
currentSuggestionDetails
)
{
this
.
currentSuggestionDetails
.
cancel
();
}
this
.
currentSuggestionDetails
=
item
.
resolveDetails
(
this
.
editor
.
getModel
().
getAssociatedResource
(),
this
.
model
.
getRequestPosition
()
||
this
.
editor
.
getPosition
()
);
this
.
currentSuggestionDetails
.
then
(()
=>
{
this
.
currentSuggestionDetails
=
undefined
;
if
(
item
===
this
.
focusedItem
)
{
this
.
list
.
splice
(
index
,
1
,
item
);
this
.
list
.
setFocus
(
index
);
this
.
updateWidgetHeight
();
}
},
err
=>
!
isPromiseCanceledError
(
err
)
&&
onUnexpectedError
(
err
)
);
}
public
selectNextPage
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录