Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4685ffaa
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,发现更多精彩内容 >>
提交
4685ffaa
编写于
4月 29, 2016
作者:
J
Joao Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "scale suggest widget with editor's font size"
This reverts commit
50807c9e
.
上级
697cb96a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
49 addition
and
43 deletion
+49
-43
src/vs/editor/contrib/suggest/browser/suggest.css
src/vs/editor/contrib/suggest/browser/suggest.css
+5
-2
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
+44
-41
未找到文件。
src/vs/editor/contrib/suggest/browser/suggest.css
浏览文件 @
4685ffaa
...
...
@@ -6,7 +6,7 @@
/* Suggest */
.monaco-editor
.suggest-widget
{
background-color
:
#F3F3F3
;
font-size
:
90%
;
font-size
:
12px
;
border
:
1px
solid
rgb
(
200
,
200
,
200
);
z-index
:
40
;
}
...
...
@@ -18,6 +18,10 @@
transition
:
left
.05s
ease-in-out
;
}
.monaco-editor.mac
.suggest-widget
{
font-size
:
11px
;
}
.monaco-editor.mac
.suggest-widget
.text
{
line-height
:
1.3em
;
}
...
...
@@ -79,7 +83,6 @@
.monaco-editor
.suggest-widget
.details
>
.monaco-scrollable-element
>
.body
>
.docs
,
.monaco-editor
.suggest-widget
.monaco-list
.monaco-list-row
.docs
{
color
:
#A21B1B
;
font-size
:
0.9em
;
}
.monaco-editor
.suggest-widget
.details
>
.monaco-scrollable-element
>
.body
>
.docs
,
...
...
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
浏览文件 @
4685ffaa
...
...
@@ -120,6 +120,28 @@ class Renderer implements IRenderer<CompletionItem, ISuggestionTemplateData> {
}
}
const
FocusHeight
=
35
;
const
UnfocusedHeight
=
19
;
class
Delegate
implements
IDelegate
<
CompletionItem
>
{
constructor
(
private
listProvider
:
()
=>
List
<
CompletionItem
>
)
{
}
getHeight
(
element
:
CompletionItem
):
number
{
const
focus
=
this
.
listProvider
().
getFocus
()[
0
];
if
(
element
.
suggestion
.
documentationLabel
&&
element
===
focus
)
{
return
FocusHeight
;
}
return
UnfocusedHeight
;
}
getTemplateId
(
element
:
CompletionItem
):
string
{
return
'
suggestion
'
;
}
}
function
computeScore
(
suggestion
:
string
,
currentWord
:
string
,
currentWordLowerCase
:
string
):
number
{
const
suggestionLowerCase
=
suggestion
.
toLowerCase
();
let
score
=
0
;
...
...
@@ -244,7 +266,7 @@ class SuggestionDetails {
}
}
export
class
SuggestWidget
implements
IContentWidget
,
ID
elegate
<
CompletionItem
>
,
ID
isposable
{
export
class
SuggestWidget
implements
IContentWidget
,
IDisposable
{
static
ID
:
string
=
'
editor.widget.suggestWidget
'
;
static
WIDTH
:
number
=
438
;
...
...
@@ -252,7 +274,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
static
LOADING_MESSAGE
:
string
=
nls
.
localize
(
'
suggestWidget.loading
'
,
"
Loading...
"
);
static
NO_SUGGESTIONS_MESSAGE
:
string
=
nls
.
localize
(
'
suggestWidget.noSuggestions
'
,
"
No suggestions.
"
);
allowEditorOverflow
:
boolean
=
true
;
// Editor.IContentWidget.allowEditorOverflow
public
allowEditorOverflow
:
boolean
=
true
;
// Editor.IContentWidget.allowEditorOverflow
private
state
:
State
;
private
isAuto
:
boolean
;
...
...
@@ -271,6 +293,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
private
messageElement
:
HTMLElement
;
private
listElement
:
HTMLElement
;
private
details
:
SuggestionDetails
;
private
delegate
:
IDelegate
<
CompletionItem
>
;
private
list
:
List
<
CompletionItem
>
;
private
editorBlurTimeout
:
TPromise
<
void
>
;
...
...
@@ -278,7 +301,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
private
toDispose
:
IDisposable
[];
private
_onDidVisibilityChange
:
Emitter
<
boolean
>
=
new
Emitter
();
get
onDidVisibilityChange
():
Event
<
boolean
>
{
return
this
.
_onDidVisibilityChange
.
event
;
}
public
get
onDidVisibilityChange
():
Event
<
boolean
>
{
return
this
.
_onDidVisibilityChange
.
event
;
}
constructor
(
private
editor
:
ICodeEditor
,
...
...
@@ -309,7 +332,8 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
let
renderer
:
IRenderer
<
CompletionItem
,
any
>
=
instantiationService
.
createInstance
(
Renderer
,
this
);
this
.
list
=
new
List
(
this
.
listElement
,
this
,
[
renderer
]);
this
.
delegate
=
new
Delegate
(()
=>
this
.
list
);
this
.
list
=
new
List
(
this
.
listElement
,
this
.
delegate
,
[
renderer
]);
this
.
toDispose
=
[
editor
.
addListener2
(
EventType
.
ModelChanged
,
()
=>
this
.
onModelModeChanged
()),
...
...
@@ -617,7 +641,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
selectNextPage
():
boolean
{
public
selectNextPage
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -632,7 +656,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
selectNext
():
boolean
{
public
selectNext
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -647,7 +671,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
selectPreviousPage
():
boolean
{
public
selectPreviousPage
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -662,7 +686,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
selectPrevious
():
boolean
{
public
selectPrevious
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -677,7 +701,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
acceptSelectedSuggestion
():
boolean
{
public
acceptSelectedSuggestion
():
boolean
{
switch
(
this
.
state
)
{
case
State
.
Hidden
:
return
false
;
...
...
@@ -694,7 +718,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
toggleDetails
():
void
{
public
toggleDetails
():
void
{
if
(
this
.
state
===
State
.
Details
)
{
this
.
setState
(
State
.
Open
);
this
.
editor
.
focus
();
...
...
@@ -729,7 +753,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
removeClass
(
this
.
element
,
'
visible
'
);
}
cancel
():
void
{
public
cancel
():
void
{
if
(
this
.
state
===
State
.
Details
)
{
this
.
toggleDetails
();
}
else
{
...
...
@@ -737,7 +761,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
getPosition
():
IContentWidgetPosition
{
public
getPosition
():
IContentWidgetPosition
{
if
(
this
.
state
===
State
.
Hidden
)
{
return
null
;
}
...
...
@@ -748,11 +772,11 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
};
}
getDomNode
():
HTMLElement
{
public
getDomNode
():
HTMLElement
{
return
this
.
element
;
}
getId
():
string
{
public
getId
():
string
{
return
SuggestWidget
.
ID
;
}
...
...
@@ -765,16 +789,16 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
let
height
=
0
;
if
(
this
.
state
===
State
.
Empty
||
this
.
state
===
State
.
Loading
)
{
height
=
this
.
line
Height
;
height
=
Unfocused
Height
;
}
else
if
(
this
.
state
===
State
.
Details
)
{
height
=
12
*
this
.
line
Height
;
height
=
12
*
Unfocused
Height
;
}
else
{
const
focus
=
this
.
list
.
getFocus
()[
0
];
const
focusHeight
=
focus
?
this
.
getHeight
(
focus
)
:
this
.
line
Height
;
const
focusHeight
=
focus
?
this
.
delegate
.
getHeight
(
focus
)
:
Unfocused
Height
;
height
=
focusHeight
;
const
suggestionCount
=
(
this
.
list
.
contentHeight
-
focusHeight
)
/
this
.
line
Height
;
height
+=
Math
.
min
(
suggestionCount
,
11
)
*
this
.
line
Height
;
const
suggestionCount
=
(
this
.
list
.
contentHeight
-
focusHeight
)
/
Unfocused
Height
;
height
+=
Math
.
min
(
suggestionCount
,
11
)
*
Unfocused
Height
;
}
this
.
element
.
style
.
height
=
height
+
'
px
'
;
...
...
@@ -792,28 +816,7 @@ export class SuggestWidget implements IContentWidget, IDelegate<CompletionItem>,
}
}
// IDelegate
private
get
lineHeight
():
number
{
const
{
fontSize
}
=
this
.
editor
.
getConfiguration
();
return
Math
.
floor
(
fontSize
*
1.7
);
}
getHeight
(
element
:
CompletionItem
):
number
{
const
focus
=
this
.
list
.
getFocus
()[
0
];
if
(
element
.
suggestion
.
documentationLabel
&&
element
===
focus
)
{
return
Math
.
floor
(
this
.
lineHeight
*
1.7
);
}
return
this
.
lineHeight
;
}
getTemplateId
(
element
:
CompletionItem
):
string
{
return
'
suggestion
'
;
}
dispose
():
void
{
public
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录