Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
c5ab3210
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,发现更多精彩内容 >>
提交
c5ab3210
编写于
11月 27, 2020
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
https://github.com/microsoft/vscode/issues/110554
上级
444f79cc
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
28 deletion
+37
-28
src/vs/editor/contrib/suggest/suggestWidget.ts
src/vs/editor/contrib/suggest/suggestWidget.ts
+37
-28
未找到文件。
src/vs/editor/contrib/suggest/suggestWidget.ts
浏览文件 @
c5ab3210
...
@@ -152,43 +152,51 @@ export class SuggestWidget implements IDisposable {
...
@@ -152,43 +152,51 @@ export class SuggestWidget implements IDisposable {
this
.
_contentWidget
=
new
SuggestContentWidget
(
this
,
editor
);
this
.
_contentWidget
=
new
SuggestContentWidget
(
this
,
editor
);
this
.
_persistedSize
=
new
PersistedWidgetSize
(
_storageService
,
editor
);
this
.
_persistedSize
=
new
PersistedWidgetSize
(
_storageService
,
editor
);
let
persistedSize
:
dom
.
Dimension
|
undefined
;
class
ResizeState
{
let
currentSize
:
dom
.
Dimension
|
undefined
;
constructor
(
let
persistHeight
=
false
;
readonly
persistedSize
:
dom
.
Dimension
|
undefined
,
let
persistWidth
=
false
;
readonly
currentSize
:
dom
.
Dimension
,
public
persistHeight
=
false
,
public
persistWidth
=
false
,
)
{
}
}
let
state
:
ResizeState
|
undefined
;
this
.
_disposables
.
add
(
this
.
element
.
onDidWillResize
(()
=>
{
this
.
_disposables
.
add
(
this
.
element
.
onDidWillResize
(()
=>
{
this
.
_contentWidget
.
lockPreference
();
this
.
_contentWidget
.
lockPreference
();
persistedSize
=
this
.
_persistedSize
.
restore
();
state
=
new
ResizeState
(
this
.
_persistedSize
.
restore
(),
this
.
element
.
size
);
currentSize
=
this
.
element
.
size
;
}));
}));
this
.
_disposables
.
add
(
this
.
element
.
onDidResize
(
e
=>
{
this
.
_disposables
.
add
(
this
.
element
.
onDidResize
(
e
=>
{
this
.
_resize
(
e
.
dimension
.
width
,
e
.
dimension
.
height
);
this
.
_resize
(
e
.
dimension
.
width
,
e
.
dimension
.
height
);
persistHeight
=
persistHeight
||
!!
e
.
north
||
!!
e
.
south
;
if
(
state
)
{
persistWidth
=
persistWidth
||
!!
e
.
east
||
!!
e
.
west
;
state
.
persistHeight
=
state
.
persistHeight
||
!!
e
.
north
||
!!
e
.
south
;
if
(
e
.
done
)
{
state
.
persistWidth
=
state
.
persistWidth
||
!!
e
.
east
||
!!
e
.
west
;
}
if
(
!
e
.
done
)
{
return
;
}
if
(
state
)
{
// only store width or height value that have changed and also
// only store width or height value that have changed and also
// only store changes that are above a certain threshold
// only store changes that are above a certain threshold
const
threshold
=
Math
.
floor
(
this
.
getLayoutInfo
().
itemHeight
/
2
);
const
{
itemHeight
,
defaultSize
}
=
this
.
getLayoutInfo
();
const
threshold
=
Math
.
round
(
itemHeight
/
2
);
let
{
width
,
height
}
=
this
.
element
.
size
;
let
{
width
,
height
}
=
this
.
element
.
size
;
if
(
persistedSize
&&
currentSize
)
{
if
(
!
state
.
persistHeight
||
Math
.
abs
(
state
.
currentSize
.
height
-
height
)
<=
threshold
)
{
if
(
!
persistHeight
||
Math
.
abs
(
currentSize
.
height
-
height
)
<=
threshold
)
{
height
=
state
.
persistedSize
?.
height
??
defaultSize
.
height
;
height
=
persistedSize
.
height
;
}
}
if
(
!
state
.
persistWidth
||
Math
.
abs
(
state
.
currentSize
.
width
-
width
)
<=
threshold
)
{
if
(
!
persistWidth
||
Math
.
abs
(
currentSize
.
width
-
width
)
<=
threshold
)
{
width
=
state
.
persistedSize
?.
width
??
defaultSize
.
width
;
width
=
persistedSize
.
width
;
}
}
}
this
.
_persistedSize
.
store
(
new
dom
.
Dimension
(
width
,
height
));
this
.
_persistedSize
.
store
(
new
dom
.
Dimension
(
width
,
height
));
// reset working state
this
.
_contentWidget
.
unlockPreference
();
persistedSize
=
undefined
;
currentSize
=
undefined
;
persistHeight
=
false
;
persistWidth
=
false
;
}
}
// reset working state
this
.
_contentWidget
.
unlockPreference
();
state
=
undefined
;
}));
}));
this
.
_messageElement
=
dom
.
append
(
this
.
element
.
domNode
,
dom
.
$
(
'
.message
'
));
this
.
_messageElement
=
dom
.
append
(
this
.
element
.
domNode
,
dom
.
$
(
'
.message
'
));
...
@@ -738,7 +746,7 @@ export class SuggestWidget implements IDisposable {
...
@@ -738,7 +746,7 @@ export class SuggestWidget implements IDisposable {
if
(
this
.
_state
===
State
.
Empty
||
this
.
_state
===
State
.
Loading
)
{
if
(
this
.
_state
===
State
.
Empty
||
this
.
_state
===
State
.
Loading
)
{
// showing a message only
// showing a message only
height
=
info
.
itemHeight
+
info
.
borderHeight
;
height
=
info
.
itemHeight
+
info
.
borderHeight
;
width
=
230
;
width
=
info
.
defaultSize
.
width
/
2
;
this
.
element
.
enableSashes
(
false
,
false
,
false
,
false
);
this
.
element
.
enableSashes
(
false
,
false
,
false
,
false
);
this
.
element
.
minSize
=
this
.
element
.
maxSize
=
new
dom
.
Dimension
(
width
,
height
);
this
.
element
.
minSize
=
this
.
element
.
maxSize
=
new
dom
.
Dimension
(
width
,
height
);
this
.
_contentWidget
.
setPreference
(
ContentWidgetPositionPreference
.
BELOW
);
this
.
_contentWidget
.
setPreference
(
ContentWidgetPositionPreference
.
BELOW
);
...
@@ -749,7 +757,7 @@ export class SuggestWidget implements IDisposable {
...
@@ -749,7 +757,7 @@ export class SuggestWidget implements IDisposable {
// width math
// width math
const
maxWidth
=
bodyBox
.
width
-
info
.
borderHeight
-
2
*
info
.
horizontalPadding
;
const
maxWidth
=
bodyBox
.
width
-
info
.
borderHeight
-
2
*
info
.
horizontalPadding
;
if
(
width
===
undefined
)
{
if
(
width
===
undefined
)
{
width
=
430
;
width
=
info
.
defaultSize
.
width
;
}
}
if
(
width
>
maxWidth
)
{
if
(
width
>
maxWidth
)
{
width
=
maxWidth
;
width
=
maxWidth
;
...
@@ -758,7 +766,7 @@ export class SuggestWidget implements IDisposable {
...
@@ -758,7 +766,7 @@ export class SuggestWidget implements IDisposable {
// height math
// height math
const
fullHeight
=
info
.
statusBarHeight
+
this
.
_list
.
contentHeight
+
info
.
borderHeight
;
const
fullHeight
=
info
.
statusBarHeight
+
this
.
_list
.
contentHeight
+
info
.
borderHeight
;
const
preferredHeight
=
info
.
statusBarHeight
+
12
*
info
.
itemHeight
+
info
.
borderH
eight
;
const
preferredHeight
=
info
.
defaultSize
.
h
eight
;
const
minHeight
=
info
.
itemHeight
+
info
.
statusBarHeight
;
const
minHeight
=
info
.
itemHeight
+
info
.
statusBarHeight
;
const
editorBox
=
dom
.
getDomNodePagePosition
(
this
.
editor
.
getDomNode
());
const
editorBox
=
dom
.
getDomNodePagePosition
(
this
.
editor
.
getDomNode
());
const
cursorBox
=
this
.
editor
.
getScrolledVisiblePosition
(
this
.
editor
.
getPosition
());
const
cursorBox
=
this
.
editor
.
getScrolledVisiblePosition
(
this
.
editor
.
getPosition
());
...
@@ -842,7 +850,8 @@ export class SuggestWidget implements IDisposable {
...
@@ -842,7 +850,8 @@ export class SuggestWidget implements IDisposable {
borderHeight
,
borderHeight
,
typicalHalfwidthCharacterWidth
:
fontInfo
.
typicalHalfwidthCharacterWidth
,
typicalHalfwidthCharacterWidth
:
fontInfo
.
typicalHalfwidthCharacterWidth
,
verticalPadding
:
22
,
verticalPadding
:
22
,
horizontalPadding
:
14
horizontalPadding
:
14
,
defaultSize
:
new
dom
.
Dimension
(
430
,
statusBarHeight
+
12
*
itemHeight
+
borderHeight
)
};
};
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录