Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
fc5dd2f4
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,发现更多精彩内容 >>
提交
fc5dd2f4
编写于
10月 05, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
suggest
💄
上级
ec0195d1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
26 deletion
+18
-26
src/vs/editor/contrib/suggest/suggestWidget.ts
src/vs/editor/contrib/suggest/suggestWidget.ts
+17
-25
src/vs/editor/contrib/suggest/suggestWidgetDetails.ts
src/vs/editor/contrib/suggest/suggestWidgetDetails.ts
+1
-1
未找到文件。
src/vs/editor/contrib/suggest/suggestWidget.ts
浏览文件 @
fc5dd2f4
...
...
@@ -82,10 +82,10 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
private
isAddedAsContentWidget
:
boolean
=
false
;
private
isAuto
:
boolean
=
false
;
private
loadingTimeout
:
IDisposable
=
Disposable
.
None
;
private
currentSuggestionDetails
:
CancelablePromise
<
void
>
|
null
=
null
;
private
focusedItem
:
CompletionItem
|
null
;
private
currentSuggestionDetails
?:
CancelablePromise
<
void
>
;
private
focusedItem
?:
CompletionItem
;
private
ignoreFocusEvents
:
boolean
=
false
;
private
completionModel
:
CompletionModel
|
null
=
nul
l
;
private
completionModel
?:
CompletionMode
l
;
private
element
:
HTMLElement
;
private
messageElement
:
HTMLElement
;
...
...
@@ -121,7 +121,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
private
firstFocusInCurrentList
:
boolean
=
false
;
private
preferDocPositionTop
:
boolean
=
false
;
private
docsPositionPreviousWidgetY
:
number
|
null
=
null
;
private
docsPositionPreviousWidgetY
?:
number
;
private
explainMode
:
boolean
=
false
;
private
readonly
_onDetailsKeydown
=
new
Emitter
<
IKeyboardEvent
>
();
...
...
@@ -139,12 +139,8 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
@
IInstantiationService
instantiationService
:
IInstantiationService
,
)
{
const
markdownRenderer
=
this
.
_disposables
.
add
(
new
MarkdownRenderer
(
editor
,
modeService
,
openerService
));
const
kbToggleDetails
=
keybindingService
.
lookupKeybinding
(
'
toggleSuggestionDetails
'
)?.
getLabel
()
??
''
;
this
.
isAuto
=
false
;
this
.
focusedItem
=
null
;
this
.
element
=
$
(
'
.editor-widget.suggest-widget
'
);
this
.
_disposables
.
add
(
addDisposableListener
(
this
.
element
,
'
click
'
,
e
=>
{
if
(
e
.
target
===
this
.
element
)
{
...
...
@@ -313,8 +309,8 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
if
(
!
e
.
elements
.
length
)
{
if
(
this
.
currentSuggestionDetails
)
{
this
.
currentSuggestionDetails
.
cancel
();
this
.
currentSuggestionDetails
=
null
;
this
.
focusedItem
=
null
;
this
.
currentSuggestionDetails
=
undefined
;
this
.
focusedItem
=
undefined
;
}
this
.
editor
.
setAriaOptions
({
activeDescendant
:
undefined
});
...
...
@@ -331,10 +327,8 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
firstFocusInCurrentList
=
!
this
.
focusedItem
;
if
(
item
!==
this
.
focusedItem
)
{
if
(
this
.
currentSuggestionDetails
)
{
this
.
currentSuggestionDetails
.
cancel
();
this
.
currentSuggestionDetails
=
null
;
}
this
.
currentSuggestionDetails
?.
cancel
();
this
.
currentSuggestionDetails
=
undefined
;
this
.
focusedItem
=
item
;
...
...
@@ -396,7 +390,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
if
(
stateChanged
)
{
this
.
list
.
splice
(
0
,
this
.
list
.
length
);
}
this
.
focusedItem
=
null
;
this
.
focusedItem
=
undefined
;
break
;
case
State
.
Loading
:
this
.
messageElement
.
textContent
=
SuggestWidget
.
LOADING_MESSAGE
;
...
...
@@ -404,7 +398,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
show
(
this
.
messageElement
);
this
.
element
.
classList
.
remove
(
'
docs-side
'
);
this
.
show
();
this
.
focusedItem
=
null
;
this
.
focusedItem
=
undefined
;
break
;
case
State
.
Empty
:
this
.
messageElement
.
textContent
=
SuggestWidget
.
NO_SUGGESTIONS_MESSAGE
;
...
...
@@ -412,7 +406,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
show
(
this
.
messageElement
);
this
.
element
.
classList
.
remove
(
'
docs-side
'
);
this
.
show
();
this
.
focusedItem
=
null
;
this
.
focusedItem
=
undefined
;
break
;
case
State
.
Open
:
hide
(
this
.
messageElement
);
...
...
@@ -446,14 +440,12 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
showSuggestions
(
completionModel
:
CompletionModel
,
selectionIndex
:
number
,
isFrozen
:
boolean
,
isAuto
:
boolean
):
void
{
this
.
preferDocPositionTop
=
false
;
this
.
docsPositionPreviousWidgetY
=
null
;
this
.
docsPositionPreviousWidgetY
=
undefined
;
this
.
loadingTimeout
.
dispose
();
if
(
this
.
currentSuggestionDetails
)
{
this
.
currentSuggestionDetails
.
cancel
();
this
.
currentSuggestionDetails
=
null
;
}
this
.
currentSuggestionDetails
?.
cancel
();
this
.
currentSuggestionDetails
=
undefined
;
if
(
this
.
completionModel
!==
completionModel
)
{
this
.
completionModel
=
completionModel
;
...
...
@@ -476,7 +468,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
setState
(
State
.
Empty
);
}
this
.
completionModel
=
null
;
this
.
completionModel
=
undefined
;
}
else
{
...
...
@@ -494,7 +486,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
telemetryService
.
publicLog
(
'
suggestWidget
'
,
{
...
stats
});
}
this
.
focusedItem
=
null
;
this
.
focusedItem
=
undefined
;
this
.
list
.
splice
(
0
,
this
.
list
.
length
,
this
.
completionModel
.
items
);
if
(
isFrozen
)
{
...
...
@@ -771,7 +763,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
// Fixes #27649
// Check if the Y changed to the top of the cursor and keep the widget flagged to prefer top
if
(
this
.
docsPositionPreviousWidgetY
&&
if
(
this
.
docsPositionPreviousWidgetY
!==
undefined
&&
this
.
docsPositionPreviousWidgetY
<
widgetY
&&
!
this
.
preferDocPositionTop
)
{
...
...
src/vs/editor/contrib/suggest/suggestWidgetDetails.ts
浏览文件 @
fc5dd2f4
...
...
@@ -15,7 +15,7 @@ import { MarkdownString } from 'vs/base/common/htmlContent';
import
{
Codicon
}
from
'
vs/base/common/codicons
'
;
import
{
Emitter
,
Event
}
from
'
vs/base/common/event
'
;
export
function
canExpandCompletionItem
(
item
:
CompletionItem
|
null
):
boolean
{
export
function
canExpandCompletionItem
(
item
:
CompletionItem
|
undefined
):
boolean
{
return
!!
item
&&
Boolean
(
item
.
completion
.
documentation
||
item
.
completion
.
detail
&&
item
.
completion
.
detail
!==
item
.
completion
.
label
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录