Skip to content

Commit 78851b5

Browse files
Cleanup
1 parent 797fb52 commit 78851b5

File tree

7 files changed

+10
-23
lines changed

7 files changed

+10
-23
lines changed

src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,8 @@ class Widget {
431431
firstLineMinLeft = visibleRange.left;
432432
}
433433
}
434+
435+
// Left-align widgets that should appear :before content
434436
if (this._affinity === PositionAffinity.LeftOfInjectedText &&
435437
this._viewRange.startColumn === 1) {
436438
firstLineMinLeft = 0;

src/vs/editor/browser/widget/codeEditorWidget.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,12 +1359,6 @@ export class CodeEditorWidget extends Disposable implements editorBrowser.ICodeE
13591359
const opts = this._resolveDecorationOptions(typeKey, !!decorationOption.hoverMessage);
13601360
if (decorationOption.hoverMessage) {
13611361
opts.hoverMessage = decorationOption.hoverMessage;
1362-
1363-
if (decorationOption.renderOptions?.before ||
1364-
decorationOption.renderOptions?.dark?.before ||
1365-
decorationOption.renderOptions?.light?.before) {
1366-
opts.hoverMessageBefore = true;
1367-
}
13681362
}
13691363

13701364
newModelDecorations.push({ range: decorationOption.range, options: opts });

src/vs/editor/common/model.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ export interface IModelDecorationOptions {
100100
* Array of MarkdownString to render as the decoration message.
101101
*/
102102
hoverMessage?: IMarkdownString | IMarkdownString[] | null;
103-
/**
104-
* If true, hover message will be left-aligned to the beforecontent on the line
105-
*/
106-
hoverMessageBefore?: boolean | null;
107103
/**
108104
* Should the decoration expand to encompass a whole line.
109105
*/

src/vs/editor/contrib/hover/browser/contentHover.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ export class ContentHoverController extends Disposable {
139139

140140
this._hoverOperation.cancel();
141141

142-
// console.log(`--- HOVER CHANGE s-line: ${anchor.range.startLineNumber} s-col: ${anchor.range.startColumn} e-line: ${anchor.range.endLineNumber} e-col: ${anchor.range.endColumn}`);
143-
144142
if (this._widget.position) {
145143
// The range might have changed, but the hover is visible
146144
// Instead of hiding it completely, filter out messages that are still in the new range and
@@ -227,7 +225,7 @@ export class ContentHoverController extends Disposable {
227225
}
228226
}
229227

230-
const isBefore = messages.some(m => m.isBeforeContent);
228+
const isBeforeContent = messages.some(m => m.isBeforeContent);
231229

232230
if (statusBar.hasContent) {
233231
fragment.appendChild(statusBar.hoverElement);
@@ -261,7 +259,7 @@ export class ContentHoverController extends Disposable {
261259
showAtRange,
262260
this._editor.getOption(EditorOption.hover).above,
263261
this._computer.shouldFocus,
264-
isBefore,
262+
isBeforeContent,
265263
disposables
266264
));
267265
} else {
@@ -309,7 +307,7 @@ class ContentHoverVisibleData {
309307
public readonly showAtRange: Range,
310308
public readonly preferAbove: boolean,
311309
public readonly stoleFocus: boolean,
312-
public readonly isBefore: boolean,
310+
public readonly isBeforeContent: boolean,
313311
public readonly disposables: DisposableStore
314312
) { }
315313
}
@@ -380,7 +378,8 @@ export class ContentHoverWidget extends Disposable implements IContentWidget {
380378
preferAbove = true;
381379
}
382380

383-
const affinity = this._visibleData.isBefore ? PositionAffinity.LeftOfInjectedText : undefined;
381+
// :before content can align left of the text content
382+
const affinity = this._visibleData.isBeforeContent ? PositionAffinity.LeftOfInjectedText : undefined;
384383

385384
return {
386385
position: this._visibleData.showAtPosition,

src/vs/editor/contrib/hover/browser/hoverTypes.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ export interface IHoverPart {
2727
*/
2828
readonly forceShowAtRange?: boolean;
2929

30+
/**
31+
* If true, the hover item should appear before content
32+
*/
3033
readonly isBeforeContent?: boolean;
3134
/**
3235
* Is this hover part still valid for this new anchor?

src/vs/editor/contrib/hover/browser/markdownHoverParticipant.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ export class MarkdownHoverParticipant implements IEditorHoverParticipant<Markdow
9393
continue;
9494
}
9595

96-
// if (d.options.hoverMessageBefore) {
97-
// isBeforeContent = true;
98-
// }
9996
if (d.options.beforeContentClassName) {
10097
isBeforeContent = true;
10198
}

src/vs/monaco.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,10 +1496,6 @@ declare namespace monaco.editor {
14961496
* Array of MarkdownString to render as the decoration message.
14971497
*/
14981498
hoverMessage?: IMarkdownString | IMarkdownString[] | null;
1499-
/**
1500-
* If true, hover message will be left-aligned to the beforecontent on the line
1501-
*/
1502-
hoverMessageBefore?: boolean | null;
15031499
/**
15041500
* Should the decoration expand to encompass a whole line.
15051501
*/

0 commit comments

Comments
 (0)