@@ -42,7 +42,7 @@ export class SuggestDetailsWidget {
42
42
private readonly _markdownRenderer : MarkdownRenderer ;
43
43
private _renderDisposeable ?: IDisposable ;
44
44
private _borderWidth : number = 1 ;
45
- private _size = new dom . Dimension ( 330 , 50 ) ;
45
+ private _size = new dom . Dimension ( 330 , 0 ) ;
46
46
47
47
constructor (
48
48
private readonly _editor : ICodeEditor ,
@@ -101,15 +101,19 @@ export class SuggestDetailsWidget {
101
101
this . _close . style . width = lineHeightPx ;
102
102
}
103
103
104
- private _lineHeight ( ) : number {
105
- return this . _editor . getOption ( EditorOption . suggestLineHeight ) || this . _editor . getOption ( EditorOption . fontInfo ) . lineHeight ;
104
+ getLayoutInfo ( ) {
105
+ const lineHeight = this . _editor . getOption ( EditorOption . suggestLineHeight ) || this . _editor . getOption ( EditorOption . fontInfo ) . lineHeight ;
106
+ const borderWidth = this . _borderWidth ;
107
+ const borderHeight = borderWidth * 2 ;
108
+ return { lineHeight, borderWidth, borderHeight } ;
106
109
}
107
110
111
+
108
112
renderLoading ( ) : void {
109
113
this . _type . textContent = nls . localize ( 'loading' , "Loading..." ) ;
110
114
this . _docs . textContent = '' ;
111
115
this . domNode . classList . remove ( 'no-docs' ) ;
112
- this . layout ( this . size . width , this . _lineHeight ( ) * 2 ) ;
116
+ this . layout ( this . size . width , this . getLayoutInfo ( ) . lineHeight * 2 ) ;
113
117
this . _onDidChangeContents . fire ( this ) ;
114
118
}
115
119
@@ -174,7 +178,7 @@ export class SuggestDetailsWidget {
174
178
} ;
175
179
176
180
this . _body . scrollTop = 0 ;
177
- this . layout ( this . _size . width , this . _lineHeight ( ) * ( 2 + ( documentation ? 5 : 0 ) ) ) ;
181
+ this . layout ( this . _size . width , this . getLayoutInfo ( ) . lineHeight * ( 2 + ( documentation ? 5 : 0 ) ) ) ;
178
182
this . _onDidChangeContents . fire ( this ) ;
179
183
}
180
184
@@ -295,27 +299,28 @@ export class SuggestDetailsOverlay implements IOverlayWidget {
295
299
296
300
_placeAtAnchor ( anchorBox : dom . IDomNodePagePosition , size : dom . Dimension ) {
297
301
const bodyBox = dom . getClientArea ( document . body ) ;
298
- const borderHeight = 2 * this . widget . borderWidth ;
302
+
303
+ const { borderWidth, borderHeight, lineHeight } = this . widget . getLayoutInfo ( ) ;
299
304
300
305
let maxSizeTop : dom . Dimension ;
301
306
let maxSizeBottom : dom . Dimension ;
302
- let minSize = new dom . Dimension ( 220 , this . _editor . getOption ( EditorOption . suggestLineHeight ) || this . _editor . getOption ( EditorOption . fontInfo ) . lineHeight ) ;
307
+ let minSize = new dom . Dimension ( 220 , 2 * lineHeight ) ;
303
308
304
309
let left = 0 ;
305
310
let top = anchorBox . top ;
306
311
let bottom = anchorBox . top + anchorBox . height - borderHeight ;
307
312
308
313
// position: EAST, west, south
309
314
let width = bodyBox . width - ( anchorBox . left + anchorBox . width ) ;
310
- left = - this . widget . borderWidth + anchorBox . left + anchorBox . width ;
315
+ left = - borderWidth + anchorBox . left + anchorBox . width ;
311
316
maxSizeTop = new dom . Dimension ( bodyBox . width - ( anchorBox . left + anchorBox . width ) , bodyBox . height - anchorBox . top ) ;
312
317
maxSizeBottom = maxSizeTop . with ( undefined , anchorBox . top + anchorBox . height ) ;
313
318
314
319
// position: east, WEST, south
315
320
if ( anchorBox . left > width ) {
316
321
// pos = SuggestDetailsPosition.West;
317
322
width = anchorBox . left ;
318
- left = Math . max ( 0 , anchorBox . left - ( size . width + this . widget . borderWidth ) ) ;
323
+ left = Math . max ( 0 , anchorBox . left - ( size . width + borderWidth ) ) ;
319
324
maxSizeTop = new dom . Dimension ( anchorBox . left , bodyBox . height - anchorBox . top ) ;
320
325
maxSizeBottom = maxSizeTop . with ( undefined , maxSizeBottom . height ) ;
321
326
}
@@ -324,7 +329,7 @@ export class SuggestDetailsOverlay implements IOverlayWidget {
324
329
if ( anchorBox . width > width * 1.3 && bodyBox . height - ( anchorBox . top + anchorBox . height ) > anchorBox . height ) {
325
330
width = anchorBox . width ;
326
331
left = anchorBox . left ;
327
- top = - this . widget . borderWidth + anchorBox . top + anchorBox . height ;
332
+ top = - borderWidth + anchorBox . top + anchorBox . height ;
328
333
maxSizeTop = new dom . Dimension ( anchorBox . width - borderHeight , bodyBox . height - ( anchorBox . top + anchorBox . height ) ) ;
329
334
maxSizeBottom = maxSizeTop . with ( undefined , anchorBox . top ) ;
330
335
minSize = minSize . with ( maxSizeTop . width ) ;
0 commit comments