Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
徽霖
Vscode
提交
a1bd86cc
V
Vscode
项目概览
徽霖
/
Vscode
通知
9
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,发现更多精彩内容 >>
提交
a1bd86cc
编写于
1月 24, 2020
作者:
P
Pine Wu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Simple StatusBar for suggest
上级
38549a60
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
97 addition
and
7 deletion
+97
-7
src/vs/editor/common/config/editorOptions.ts
src/vs/editor/common/config/editorOptions.ts
+11
-0
src/vs/editor/contrib/suggest/media/suggest.css
src/vs/editor/contrib/suggest/media/suggest.css
+43
-0
src/vs/editor/contrib/suggest/media/suggestStatusBar.css
src/vs/editor/contrib/suggest/media/suggestStatusBar.css
+9
-0
src/vs/editor/contrib/suggest/suggestController.ts
src/vs/editor/contrib/suggest/suggestController.ts
+1
-1
src/vs/editor/contrib/suggest/suggestWidget.ts
src/vs/editor/contrib/suggest/suggestWidget.ts
+29
-6
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+4
-0
未找到文件。
src/vs/editor/common/config/editorOptions.ts
浏览文件 @
a1bd86cc
...
...
@@ -2668,6 +2668,10 @@ export interface ISuggestOptions {
* Show snippet-suggestions.
*/
showSnippets
?:
boolean
;
/**
* Controls the visibility of the status bar at the bottom of the suggest widget.
*/
hideStatusBar
?:
boolean
;
}
export
type
InternalSuggestOptions
=
Readonly
<
Required
<
ISuggestOptions
>>
;
...
...
@@ -2709,6 +2713,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
showFolders
:
true
,
showTypeParameters
:
true
,
showSnippets
:
true
,
hideStatusBar
:
true
};
super
(
EditorOption
.
suggest
,
'
suggest
'
,
defaults
,
...
...
@@ -2893,6 +2898,11 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
type
:
'
boolean
'
,
default
:
true
,
markdownDescription
:
nls
.
localize
(
'
editor.suggest.showSnippets
'
,
"
When enabled IntelliSense shows `snippet`-suggestions.
"
)
},
'
editor.suggest.hideStatusBar
'
:
{
type
:
'
boolean
'
,
default
:
true
,
markdownDescription
:
nls
.
localize
(
'
editor.suggest.hideStatusBar
'
,
"
Controls the visibility of the status bar at the bottom of the suggest widget.
"
)
}
}
);
...
...
@@ -2937,6 +2947,7 @@ class EditorSuggest extends BaseEditorOption<EditorOption.suggest, InternalSugge
showFolders
:
EditorBooleanOption
.
boolean
(
input
.
showFolders
,
this
.
defaultValue
.
showFolders
),
showTypeParameters
:
EditorBooleanOption
.
boolean
(
input
.
showTypeParameters
,
this
.
defaultValue
.
showTypeParameters
),
showSnippets
:
EditorBooleanOption
.
boolean
(
input
.
showSnippets
,
this
.
defaultValue
.
showSnippets
),
hideStatusBar
:
EditorBooleanOption
.
boolean
(
input
.
hideStatusBar
,
this
.
defaultValue
.
hideStatusBar
),
};
}
}
...
...
src/vs/editor/contrib/suggest/media/suggest.css
浏览文件 @
a1bd86cc
...
...
@@ -111,6 +111,49 @@
font-weight
:
bold
;
}
/** Status Bar **/
.monaco-editor
.suggest-widget
>
.tree
{
margin-bottom
:
18px
;
}
.monaco-editor
.suggest-widget
>
.suggest-status-bar
{
visibility
:
hidden
;
position
:
absolute
;
left
:
0
;
box-sizing
:
border-box
;
display
:
flex
;
flex-flow
:
row
nowrap
;
justify-content
:
space-between
;
width
:
100%
;
font-size
:
80%
;
border-left-width
:
1px
;
border-left-style
:
solid
;
border-right-width
:
1px
;
border-right-style
:
solid
;
border-bottom-width
:
1px
;
border-bottom-style
:
solid
;
padding
:
1px
8px
1px
4px
;
box-shadow
:
0
-.5px
3px
#ddd
;
}
.monaco-editor
.suggest-widget
>
.suggest-status-bar
span
{
opacity
:
0.7
;
}
.monaco-editor
.suggest-widget.list-right.docs-side
>
.suggest-status-bar
{
left
:
auto
;
right
:
0
;
}
.monaco-editor
.suggest-widget.docs-side
>
.suggest-status-bar
{
width
:
50%
;
}
/** ReadMore Icon styles **/
.monaco-editor
.suggest-widget
.details
>
.monaco-scrollable-element
>
.body
>
.header
>
.codicon-close
,
...
...
src/vs/editor/contrib/suggest/media/suggestStatusBar.css
0 → 100644
浏览文件 @
a1bd86cc
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
/* Suggest widget*/
.monaco-editor
.suggest-widget.with-status-bar
.suggest-status-bar
{
visibility
:
visible
;
}
src/vs/editor/contrib/suggest/suggestController.ts
浏览文件 @
a1bd86cc
...
...
@@ -43,7 +43,7 @@ import { SuggestRangeHighlighter } from 'vs/editor/contrib/suggest/suggestRangeH
* Stop suggest widget from disappearing when clicking into other areas
* For development purpose only
*/
const
_sticky
=
fals
e
;
const
_sticky
=
tru
e
;
class
LineSuffix
{
...
...
src/vs/editor/contrib/suggest/suggestWidget.ts
浏览文件 @
a1bd86cc
...
...
@@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import
'
vs/css!./media/suggest
'
;
import
'
vs/css!./media/suggestStatusBar
'
;
import
'
vs/base/browser/ui/codiconLabel/codiconLabel
'
;
// The codicon symbol styles are defined here and must be loaded
import
'
vs/editor/contrib/documentSymbols/outlineTree
'
;
// The codicon symbol colors are defined here and must be loaded
import
*
as
nls
from
'
vs/nls
'
;
...
...
@@ -479,6 +480,9 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
private
element
:
HTMLElement
;
private
messageElement
:
HTMLElement
;
private
listElement
:
HTMLElement
;
private
statusBarElement
:
HTMLElement
;
private
statusBarLeftSpan
:
HTMLSpanElement
;
private
statusBarRightSpan
:
HTMLSpanElement
;
private
details
:
SuggestionDetails
;
private
list
:
List
<
CompletionItem
>
;
private
listHeight
?:
number
;
...
...
@@ -542,6 +546,17 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
messageElement
=
append
(
this
.
element
,
$
(
'
.message
'
));
this
.
listElement
=
append
(
this
.
element
,
$
(
'
.tree
'
));
const
applyStatusBarStyle
=
()
=>
toggleClass
(
this
.
element
,
'
with-status-bar
'
,
!
this
.
editor
.
getOption
(
EditorOption
.
suggest
).
hideStatusBar
);
applyStatusBarStyle
();
this
.
statusBarElement
=
append
(
this
.
element
,
$
(
'
.suggest-status-bar
'
));
this
.
statusBarLeftSpan
=
append
(
this
.
statusBarElement
,
$
(
'
span
'
));
this
.
statusBarRightSpan
=
append
(
this
.
statusBarElement
,
$
(
'
span
'
));
this
.
statusBarLeftSpan
.
innerText
=
'
Enter to insert, Tab to replace
'
;
this
.
statusBarRightSpan
.
innerText
=
'
Read more... (⌃Space)
'
;
this
.
details
=
instantiationService
.
createInstance
(
SuggestionDetails
,
this
.
element
,
this
,
this
.
editor
,
markdownRenderer
,
triggerKeybindingLabel
);
const
applyIconStyle
=
()
=>
toggleClass
(
this
.
element
,
'
no-icons
'
,
!
this
.
editor
.
getOption
(
EditorOption
.
suggest
).
showIcons
);
...
...
@@ -582,7 +597,12 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
toDispose
.
add
(
this
.
list
.
onSelectionChange
(
e
=>
this
.
onListSelection
(
e
)));
this
.
toDispose
.
add
(
this
.
list
.
onFocusChange
(
e
=>
this
.
onListFocus
(
e
)));
this
.
toDispose
.
add
(
this
.
editor
.
onDidChangeCursorSelection
(()
=>
this
.
onCursorSelectionChanged
()));
this
.
toDispose
.
add
(
this
.
editor
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
hasChanged
(
EditorOption
.
suggest
))
{
applyIconStyle
();
}
}));
this
.
toDispose
.
add
(
this
.
editor
.
onDidChangeConfiguration
(
e
=>
{
if
(
e
.
hasChanged
(
EditorOption
.
suggest
))
{
applyStatusBarStyle
();
applyIconStyle
();
}
}));
this
.
suggestWidgetVisible
=
SuggestContext
.
Visible
.
bindTo
(
contextKeyService
);
this
.
suggestWidgetMultipleSuggestions
=
SuggestContext
.
MultipleSuggestions
.
bindTo
(
contextKeyService
);
...
...
@@ -661,12 +681,14 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
const
backgroundColor
=
theme
.
getColor
(
editorSuggestWidgetBackground
);
if
(
backgroundColor
)
{
this
.
listElement
.
style
.
backgroundColor
=
backgroundColor
.
toString
();
this
.
statusBarElement
.
style
.
backgroundColor
=
backgroundColor
.
toString
();
this
.
details
.
element
.
style
.
backgroundColor
=
backgroundColor
.
toString
();
this
.
messageElement
.
style
.
backgroundColor
=
backgroundColor
.
toString
();
}
const
borderColor
=
theme
.
getColor
(
editorSuggestWidgetBorder
);
if
(
borderColor
)
{
this
.
listElement
.
style
.
borderColor
=
borderColor
.
toString
();
this
.
statusBarElement
.
style
.
borderColor
=
borderColor
.
toString
();
this
.
details
.
element
.
style
.
borderColor
=
borderColor
.
toString
();
this
.
messageElement
.
style
.
borderColor
=
borderColor
.
toString
();
this
.
detailsBorderColor
=
borderColor
.
toString
();
...
...
@@ -759,7 +781,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
switch
(
state
)
{
case
State
.
Hidden
:
hide
(
this
.
messageElement
,
this
.
details
.
element
,
this
.
listElement
);
hide
(
this
.
messageElement
,
this
.
details
.
element
,
this
.
listElement
,
this
.
statusBarElement
);
this
.
hide
();
this
.
listHeight
=
0
;
if
(
stateChanged
)
{
...
...
@@ -769,7 +791,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
break
;
case
State
.
Loading
:
this
.
messageElement
.
textContent
=
SuggestWidget
.
LOADING_MESSAGE
;
hide
(
this
.
listElement
,
this
.
details
.
element
);
hide
(
this
.
listElement
,
this
.
details
.
element
,
this
.
statusBarElement
);
show
(
this
.
messageElement
);
removeClass
(
this
.
element
,
'
docs-side
'
);
this
.
show
();
...
...
@@ -777,7 +799,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
break
;
case
State
.
Empty
:
this
.
messageElement
.
textContent
=
SuggestWidget
.
NO_SUGGESTIONS_MESSAGE
;
hide
(
this
.
listElement
,
this
.
details
.
element
);
hide
(
this
.
listElement
,
this
.
details
.
element
,
this
.
statusBarElement
);
show
(
this
.
messageElement
);
removeClass
(
this
.
element
,
'
docs-side
'
);
this
.
show
();
...
...
@@ -785,7 +807,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
break
;
case
State
.
Open
:
hide
(
this
.
messageElement
);
show
(
this
.
listElement
);
show
(
this
.
listElement
,
this
.
statusBarElement
);
this
.
show
();
break
;
case
State
.
Frozen
:
...
...
@@ -795,7 +817,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
break
;
case
State
.
Details
:
hide
(
this
.
messageElement
);
show
(
this
.
details
.
element
,
this
.
listElement
);
show
(
this
.
details
.
element
,
this
.
listElement
,
this
.
statusBarElement
);
this
.
show
();
break
;
}
...
...
@@ -1119,6 +1141,7 @@ export class SuggestWidget implements IContentWidget, IListVirtualDelegate<Compl
this
.
element
.
style
.
lineHeight
=
`
${
this
.
unfocusedHeight
}
px`
;
this
.
listElement
.
style
.
height
=
`
${
height
}
px`
;
this
.
statusBarElement
.
style
.
top
=
`
${
height
}
px`
;
this
.
list
.
layout
(
height
);
return
height
;
}
...
...
src/vs/monaco.d.ts
浏览文件 @
a1bd86cc
...
...
@@ -3657,6 +3657,10 @@ declare namespace monaco.editor {
* Show snippet-suggestions.
*/
showSnippets
?:
boolean
;
/**
* Controls the visibility of the status bar at the bottom of the suggest widget.
*/
hideStatusBar
?:
boolean
;
}
export
type
InternalSuggestOptions
=
Readonly
<
Required
<
ISuggestOptions
>>
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录