提交 dcd813e6 编写于 作者: M Martin Aeschlimann

use Codicon.lightBulb

上级 3237fbc6
......@@ -13,6 +13,7 @@ import { IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrow
import { Range } from 'vs/editor/common/core/range';
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { Codicon } from 'vs/base/browser/ui/codicons/codicons';
export interface IDiffLinesChange {
readonly originalStartLineNumber: number;
......@@ -57,7 +58,7 @@ export class InlineDiffMargin extends Disposable {
this._marginDomNode.style.zIndex = '10';
this._diffActions = document.createElement('div');
this._diffActions.className = 'codicon codicon-lightbulb lightbulb-glyph';
this._diffActions.className = Codicon.lightBulb.classNames + ' lightbulb-glyph';
this._diffActions.style.position = 'absolute';
const lineHeight = editor.getOption(EditorOption.lineHeight);
const lineFeed = editor.getModel()!.getEOL();
......
......@@ -19,6 +19,7 @@ import { registerThemingParticipant, IColorTheme, ICssStyleCollector } from 'vs/
import { editorLightBulbForeground, editorLightBulbAutoFixForeground } from 'vs/platform/theme/common/colorRegistry';
import { Gesture } from 'vs/base/browser/touch';
import type { CodeActionTrigger } from 'vs/editor/contrib/codeAction/types';
import { Codicon } from 'vs/base/browser/ui/codicons/codicons';
namespace LightBulbState {
......@@ -63,7 +64,7 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
) {
super();
this._domNode = document.createElement('div');
this._domNode.className = 'codicon codicon-lightbulb';
this._domNode.className = Codicon.lightBulb.classNames;
this._editor.addContentWidget(this);
......@@ -121,8 +122,8 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
}
}));
this._updateLightBulbTitle();
this._register(this._keybindingService.onDidUpdateKeybindings(this._updateLightBulbTitle, this));
this._updateLightBulbTitleAndIcon();
this._register(this._keybindingService.onDidUpdateKeybindings(this._updateLightBulbTitleAndIcon, this));
}
dispose(): void {
......@@ -184,7 +185,6 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
position: { lineNumber: effectiveLineNumber, column: 1 },
preference: LightBulbWidget._posPref
});
dom.toggleClass(this._domNode, 'codicon-lightbulb-autofix', actions.hasAutoFix);
this._editor.layoutContentWidget(this);
}
......@@ -197,11 +197,15 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
private set state(value) {
this._state = value;
this._updateLightBulbTitle();
this._updateLightBulbTitleAndIcon();
}
private _updateLightBulbTitle(): void {
private _updateLightBulbTitleAndIcon(): void {
if (this.state.type === LightBulbState.Type.Showing && this.state.actions.hasAutoFix) {
// update icon
dom.removeClasses(this._domNode, Codicon.lightBulb.classNames);
dom.addClasses(this._domNode, Codicon.lightbulbAutofix.classNames);
const preferredKb = this._keybindingService.lookupKeybinding(this._preferredFixActionId);
if (preferredKb) {
this.title = nls.localize('prefferedQuickFixWithKb', "Show Fixes. Preferred Fix Available ({0})", preferredKb.getLabel());
......@@ -209,6 +213,10 @@ export class LightBulbWidget extends Disposable implements IContentWidget {
}
}
// update icon
dom.removeClasses(this._domNode, Codicon.lightbulbAutofix.classNames);
dom.addClasses(this._domNode, Codicon.lightBulb.classNames);
const kb = this._keybindingService.lookupKeybinding(this._quickFixActionId);
if (kb) {
this.title = nls.localize('quickFixWithKb', "Show Fixes ({0})", kb.getLabel());
......@@ -228,7 +236,7 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
const editorLightBulbForegroundColor = theme.getColor(editorLightBulbForeground);
if (editorLightBulbForegroundColor) {
collector.addRule(`
.monaco-editor .contentWidgets .codicon-lightbulb {
.monaco-editor .contentWidgets ${Codicon.lightBulb.cssSelector} {
color: ${editorLightBulbForegroundColor};
}`);
}
......@@ -237,7 +245,7 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
const editorLightBulbAutoFixForegroundColor = theme.getColor(editorLightBulbAutoFixForeground);
if (editorLightBulbAutoFixForegroundColor) {
collector.addRule(`
.monaco-editor .contentWidgets .codicon-lightbulb-autofix {
.monaco-editor .contentWidgets ${Codicon.lightbulbAutofix.cssSelector} {
color: ${editorLightBulbAutoFixForegroundColor};
}`);
}
......
......@@ -49,6 +49,7 @@ import { editorLightBulbForeground, editorLightBulbAutoFixForeground } from 'vs/
import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IViewDescriptorService } from 'vs/workbench/common/views';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { Codicon } from 'vs/base/browser/ui/codicons/codicons';
function createResourceMarkersIterator(resourceMarkers: ResourceMarkers): Iterable<ITreeElement<TreeElement>> {
return Iterable.map(resourceMarkers.markers, m => {
......@@ -887,7 +888,7 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
const editorLightBulbForegroundColor = theme.getColor(editorLightBulbForeground);
if (editorLightBulbForegroundColor) {
collector.addRule(`
.monaco-workbench .markers-panel-container .codicon-lightbulb {
.monaco-workbench .markers-panel-container ${Codicon.lightBulb.cssSelector} {
color: ${editorLightBulbForegroundColor};
}`);
}
......@@ -896,7 +897,7 @@ registerThemingParticipant((theme: IColorTheme, collector: ICssStyleCollector) =
const editorLightBulbAutoFixForegroundColor = theme.getColor(editorLightBulbAutoFixForeground);
if (editorLightBulbAutoFixForegroundColor) {
collector.addRule(`
.monaco-workbench .markers-panel-container .codicon-lightbulb-autofix {
.monaco-workbench .markers-panel-container ${Codicon.lightbulbAutofix.cssSelector} {
color: ${editorLightBulbAutoFixForegroundColor};
}`);
}
......
......@@ -26,6 +26,7 @@ import { Event, Emitter } from 'vs/base/common/event';
import { DropdownMenuActionViewItem } from 'vs/base/browser/ui/dropdown/dropdown';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
import { IViewsService } from 'vs/workbench/common/views';
import { Codicon } from 'vs/base/browser/ui/codicons/codicons';
export class ShowProblemsPanelAction extends Action {
......@@ -443,7 +444,7 @@ export class MarkersFilterActionViewItem extends BaseActionViewItem {
export class QuickFixAction extends Action {
public static readonly ID: string = 'workbench.actions.problems.quickfix';
private static readonly CLASS: string = 'markers-panel-action-quickfix codicon-lightbulb';
private static readonly CLASS: string = 'markers-panel-action-quickfix ' + Codicon.lightBulb.classNames;
private static readonly AUTO_FIX_CLASS: string = QuickFixAction.CLASS + ' autofixable';
private readonly _onShowQuickFixes = this._register(new Emitter<void>());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册