Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
feat: status indicator in gutter proof-of-concept
Browse files Browse the repository at this point in the history
  • Loading branch information
Tymek committed Jun 26, 2020
1 parent 73de52f commit eca8a9a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
1 change: 1 addition & 0 deletions images/icons/passing.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/JestExt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class JestExt {

private jestWorkspace: ProjectWorkspace;
private pluginSettings: PluginResourceSettings;
private context: vscode.ExtensionContext;
private workspaceFolder: vscode.WorkspaceFolder;
private instanceSettings: InstanceSettings;

Expand Down Expand Up @@ -82,6 +83,7 @@ export class JestExt {
instanceSettings: InstanceSettings,
coverageCodeLensProvider: CoverageCodeLensProvider
) {
this.context = context;
this.workspaceFolder = workspaceFolder;
this.jestWorkspace = jestWorkspace;
this.channel = outputChannel;
Expand Down Expand Up @@ -503,7 +505,7 @@ export class JestExt {
}

private setupDecorators(): void {
this.passingItStyle = decorations.passingItName();
this.passingItStyle = decorations.passingItName(this.context);
this.failingItStyle = decorations.failingItName();
this.skipItStyle = decorations.skipItName();
this.unknownItStyle = decorations.notRanItName();
Expand Down
23 changes: 9 additions & 14 deletions src/decorations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { window, OverviewRulerLane, DecorationRangeBehavior } from 'vscode';
import {
window,
OverviewRulerLane,
DecorationRangeBehavior,
ExtensionContext,
TextEditorDecorationType,
} from 'vscode';

export function failingItName() {
return window.createTextEditorDecorationType({
Expand Down Expand Up @@ -40,22 +46,11 @@ export function skipItName() {
});
}

export function passingItName() {
export function passingItName(context: ExtensionContext): TextEditorDecorationType {
return window.createTextEditorDecorationType({
overviewRulerColor: 'green',
overviewRulerLane: OverviewRulerLane.Left,
light: {
before: {
color: '#3BB26B',
contentText: '✔ ',
},
},
dark: {
before: {
color: '#2F8F51',
contentText: '✔ ',
},
},
gutterIconPath: context.asAbsolutePath('images/icons/passing.svg'),
rangeBehavior: DecorationRangeBehavior.ClosedClosed,
});
}
Expand Down

0 comments on commit eca8a9a

Please sign in to comment.