Skip to content

Commit

Permalink
Add inline deprecated styling to suggest widget
Browse files Browse the repository at this point in the history
  • Loading branch information
kamranayub committed Jul 24, 2019
1 parent 3422bb0 commit 4a2b010
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/vs/editor/common/model/intervalTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const enum ClassName {
EditorErrorDecoration = 'squiggly-error',
EditorUnnecessaryDecoration = 'squiggly-unnecessary',
EditorUnnecessaryInlineDecoration = 'squiggly-inline-unnecessary',
EditorDeprecatedInlineDecoration = 'squiggly-inline-deprecated'
EditorDeprecatedInlineDecoration = 'inline-deprecated'
}

export const enum NodeColor {
Expand Down
7 changes: 7 additions & 0 deletions src/vs/editor/contrib/suggest/media/suggest.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@
font-weight: bold;
}

.monaco-editor .suggest-widget .monaco-list .monaco-list-row .inline-deprecated {
text-decoration: none; /* override normal inline behavior due to HTML structure */
}
.monaco-editor .suggest-widget .monaco-list .monaco-list-row .inline-deprecated span {
text-decoration: line-through;
}

/** Icon styles **/

.monaco-editor .suggest-widget .details > .monaco-scrollable-element > .body > .header > .close,
Expand Down
5 changes: 5 additions & 0 deletions src/vs/editor/contrib/suggest/suggestWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { createMatches } from 'vs/base/common/filters';
import * as strings from 'vs/base/common/strings';
import { Event, Emitter } from 'vs/base/common/event';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ClassName } from 'vs/editor/common/model/intervalTree';
import { IDisposable, dispose, toDisposable, DisposableStore, Disposable } from 'vs/base/common/lifecycle';
import { addClass, append, $, hide, removeClass, show, toggleClass, getDomNodePagePosition, hasClass, addDisposableListener } from 'vs/base/browser/dom';
import { IListVirtualDelegate, IListEvent, IListRenderer, IListMouseEvent } from 'vs/base/browser/ui/list/list';
Expand Down Expand Up @@ -196,6 +197,10 @@ class Renderer implements IListRenderer<CompletionItem, ISuggestionTemplateData>
];
}

if (suggestion.label && suggestion.deprecated) {
labelOptions.extraClasses = (labelOptions.extraClasses || []).concat([ClassName.EditorDeprecatedInlineDecoration]);
}

data.iconLabel.setLabel(suggestion.label, undefined, labelOptions);
data.typeLabel.textContent = (suggestion.detail || '').replace(/\n.*$/m, '');

Expand Down

0 comments on commit 4a2b010

Please sign in to comment.