Skip to content

Commit

Permalink
Retire debug codelens (#950)
Browse files Browse the repository at this point in the history
* removed debugCodeLens and settings

* clean up more snapshot and debug codeLens settings
  • Loading branch information
connectdotz committed Nov 21, 2022
1 parent ae5583d commit 9942dee
Show file tree
Hide file tree
Showing 16 changed files with 9 additions and 560 deletions.
8 changes: 0 additions & 8 deletions README.md
Expand Up @@ -54,7 +54,6 @@ Content
- [Details](#details)
- [jestCommandLine](#jestcommandline)
- [rootPath](#rootpath)
- [debugCodeLens.showWhenTestStateIn](#debugcodelensshowwhenteststatein)
- [coverageFormatter](#coverageformatter)
- [coverageColors](#coveragecolors)
- [autoRun](#autorun)
Expand Down Expand Up @@ -264,9 +263,6 @@ Users can use the following settings to tailor the extension for their environme
|showCoverageOnLoad|Show code coverage when extension starts|false|`"jest.showCoverageOnLoad": true`|
|[coverageFormatter](#coverageFormatter)|Determine the coverage overlay style|"DefaultFormatter"|`"jest.coverageFormatter": "GutterFormatter"`|
|[coverageColors](#coverageColors)|Coverage indicator color override|undefined|`"jest.coverageColors": { "uncovered": "rgba(255,99,71, 0.2)", "partially-covered": "rgba(255,215,0, 0.2)"}`|
|**Debug**|
|enableCodeLens 💼|Whether codelens for debugging should show|true|`"jest.enableCodeLens": false`|
|[debugCodeLens.showWhenTestStateIn](#debugcodelensshowwhenteststatein) 💼|Show the debug CodeLens for the tests with the specified status. (window)|["fail", "unknown"]|`"jest.debugCodeLens.showWhenTestStateIn":["fail", "pass", "unknown"]`|
|**Misc**|
|debugMode|Enable debug mode to diagnose plugin issues. (see developer console)|false|`"jest.debugMode": true`|
|disabledWorkspaceFolders 💼|Disabled workspace folders names in multiroot environment|[]|`"jest.disabledWorkspaceFolders": ["package-a", "package-b"]`|
Expand All @@ -282,10 +278,6 @@ It is recommended not to add the following options as they are managed by the ex

If your project doesn't live in the root of your repository, you may want to customize the `jest.rootPath` setting to enlighten the extension as to where to look. For instance: `"jest.rootPath": "src/client-app"` will direct the extension to use the `src/client-app` folder as the root for Jest.

##### debugCodeLens.showWhenTestStateIn

Possible status are: `[ "fail", "pass", "skip", "unknown"]`. Please note that this is a window level setting, i.e. its value will apply for all workspaces.

##### coverageFormatter

There are 2 formatters to choose from:
Expand Down
27 changes: 0 additions & 27 deletions src/DebugCodeLens/DebugCodeLens.ts

This file was deleted.

90 changes: 0 additions & 90 deletions src/DebugCodeLens/DebugCodeLensProvider.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/DebugCodeLens/TestState.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/DebugCodeLens/index.ts

This file was deleted.

18 changes: 7 additions & 11 deletions src/JestExt/core.ts
Expand Up @@ -10,15 +10,20 @@ import {
import { testIdString, IdStringType, escapeRegExp, emptyTestStats } from '../helpers';
import { CoverageMapProvider, CoverageCodeLensProvider } from '../Coverage';
import { updateDiagnostics, updateCurrentDiagnostics, resetDiagnostics } from '../diagnostics';
import { DebugCodeLensProvider, DebugTestIdentifier } from '../DebugCodeLens';
import { DebugConfigurationProvider } from '../DebugConfigurationProvider';
import { TestStats } from '../types';
import { CoverageOverlay } from '../Coverage/CoverageOverlay';
import { resultsWithoutAnsiEscapeSequence } from '../TestResults/TestResult';
import { CoverageMapData } from 'istanbul-lib-coverage';
import { Logging } from '../logging';
import { createProcessSession, ProcessSession } from './process-session';
import { JestExtContext, JestSessionEvents, JestExtSessionContext, JestRunEvent } from './types';
import {
JestExtContext,
JestSessionEvents,
JestExtSessionContext,
JestRunEvent,
DebugTestIdentifier,
} from './types';
import * as messaging from '../messaging';
import { extensionName, SupportedLanguageIds } from '../appGlobals';
import { createJestExtContext, getExtensionResourceSettings, prefixWorkspace } from './helper';
Expand All @@ -43,7 +48,6 @@ export class JestExt {
coverageOverlay: CoverageOverlay;

testResultProvider: TestResultProvider;
debugCodeLensProvider: DebugCodeLensProvider;
debugConfigurationProvider: DebugConfigurationProvider;
coverageCodeLensProvider: CoverageCodeLensProvider;

Expand All @@ -66,7 +70,6 @@ export class JestExt {
constructor(
vscodeContext: vscode.ExtensionContext,
workspaceFolder: vscode.WorkspaceFolder,
debugCodeLensProvider: DebugCodeLensProvider,
debugConfigurationProvider: DebugConfigurationProvider,
coverageCodeLensProvider: CoverageCodeLensProvider
) {
Expand All @@ -78,7 +81,6 @@ export class JestExt {
this.failDiagnostics = vscode.languages.createDiagnosticCollection(
`Jest (${workspaceFolder.name})`
);
this.debugCodeLensProvider = debugCodeLensProvider;
this.coverageCodeLensProvider = coverageCodeLensProvider;

this.coverageMapProvider = new CoverageMapProvider();
Expand Down Expand Up @@ -313,7 +315,6 @@ export class JestExt {
return;
}

this.updateDecorators();
updateCurrentDiagnostics(sortedResults.fail, this.failDiagnostics, editor);
}

Expand Down Expand Up @@ -350,11 +351,6 @@ export class JestExt {
return this.startSession(true);
}

updateDecorators(): void {
// Debug CodeLens
this.debugCodeLensProvider.didChange();
}

private isSupportedDocument(document: vscode.TextDocument | undefined): boolean {
if (!document) {
return false;
Expand Down
1 change: 0 additions & 1 deletion src/JestExt/helper.ts
Expand Up @@ -122,7 +122,6 @@ export const getExtensionResourceSettings = (uri: vscode.Uri): PluginResourceSet
pathToConfig: config.get<string>('pathToConfig'),
jestCommandLine: config.get<string>('jestCommandLine'),
pathToJest: config.get<string>('pathToJest'),
restartJestOnSnapshotUpdate: config.get<boolean>('restartJestOnSnapshotUpdate'),
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
rootPath: path.join(uri.fsPath, config.get<string>('rootPath')!),
runAllTestsFirst,
Expand Down
3 changes: 2 additions & 1 deletion src/JestExt/types.ts
Expand Up @@ -4,9 +4,9 @@ import * as vscode from 'vscode';
import { LoggingFactory } from '../logging';
import { PluginResourceSettings } from '../Settings';
import { ProcessSession } from './process-session';
import { DebugTestIdentifier } from '../DebugCodeLens';
import { JestProcessInfo } from '../JestProcessManagement';
import { JestOutputTerminal } from './output-terminal';
import { TestIdentifier } from '../TestResults';

export enum WatchMode {
None = 'none',
Expand Down Expand Up @@ -52,6 +52,7 @@ export interface JestExtProcessContextRaw extends JestExtContext {
}
export type JestExtProcessContext = Readonly<JestExtProcessContextRaw>;

export type DebugTestIdentifier = string | TestIdentifier;
export type DebugFunction = (
document: vscode.TextDocument | string,
...ids: DebugTestIdentifier[]
Expand Down
7 changes: 0 additions & 7 deletions src/Settings/index.ts
@@ -1,4 +1,3 @@
import { TestState } from '../DebugCodeLens';
import { CoverageColors } from '../Coverage/CoverageOverlay';
import { ProjectWorkspace } from 'jest-editor-support';
import { AutoRun } from '../JestExt/auto-run';
Expand Down Expand Up @@ -42,7 +41,6 @@ export interface PluginResourceSettings {
jestCommandLine?: string;
pathToConfig?: string;
pathToJest?: string;
restartJestOnSnapshotUpdate?: boolean;
rootPath: string;
runAllTestsFirst?: boolean;
showCoverageOnLoad: boolean;
Expand All @@ -57,11 +55,6 @@ export interface PluginResourceSettings {
}

export interface PluginWindowSettings {
debugCodeLens: {
enabled: boolean;
showWhenTestStateIn: TestState[];
};
enableSnapshotPreviews?: boolean;
disabledWorkspaceFolders: string[];
}

Expand Down
1 change: 0 additions & 1 deletion src/extension.ts
Expand Up @@ -21,7 +21,6 @@ const addSubscriptions = (context: vscode.ExtensionContext): void => {
...statusBar.register((folder: string) => extensionManager.getByName(folder)),
...extensionManager.register(),
vscode.languages.registerCodeLensProvider(languages, extensionManager.coverageCodeLensProvider),
vscode.languages.registerCodeLensProvider(languages, extensionManager.debugCodeLensProvider),
...tiContextManager.registerCommands()
);
};
Expand Down
15 changes: 0 additions & 15 deletions src/extensionManager.ts
@@ -1,6 +1,5 @@
import * as vscode from 'vscode';
import { JestExt } from './JestExt';
import { DebugCodeLensProvider, TestState } from './DebugCodeLens';
import { DebugConfigurationProvider } from './DebugConfigurationProvider';
import { PluginWindowSettings } from './Settings';
import { statusBar } from './StatusBar';
Expand All @@ -21,13 +20,6 @@ export function getExtensionWindowSettings(): PluginWindowSettings {
const config = vscode.workspace.getConfiguration('jest');

return {
debugCodeLens: {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
enabled: config.get<boolean>('enableCodeLens')!,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
showWhenTestStateIn: config.get<TestState[]>('debugCodeLens.showWhenTestStateIn')!,
},
enableSnapshotPreviews: config.get<boolean>('enableSnapshotPreviews'),
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
disabledWorkspaceFolders: config.get<string[]>('disabledWorkspaceFolders')!,
};
Expand Down Expand Up @@ -75,7 +67,6 @@ const CommandPrefix: Record<CommandType, string> = {
};
export type StartWizardFunc = (options?: StartWizardOptions) => ReturnType<typeof startWizard>;
export class ExtensionManager {
debugCodeLensProvider: DebugCodeLensProvider;
debugConfigurationProvider: DebugConfigurationProvider;
coverageCodeLensProvider: CoverageCodeLensProvider;
startWizard: StartWizardFunc;
Expand All @@ -90,7 +81,6 @@ export class ExtensionManager {
this.commonPluginSettings = getExtensionWindowSettings();

this.debugConfigurationProvider = new DebugConfigurationProvider();
this.debugCodeLensProvider = new DebugCodeLensProvider(this.getByDocUri);
this.coverageCodeLensProvider = new CoverageCodeLensProvider(this.getByDocUri);
this.startWizard = (options?: StartWizardOptions) =>
startWizard(this.debugConfigurationProvider, context, options);
Expand All @@ -116,10 +106,6 @@ export class ExtensionManager {
return;
}
this.commonPluginSettings = settings;
const { debugCodeLens } = settings;
this.debugCodeLensProvider.showWhenTestStateIn = debugCodeLens.enabled
? debugCodeLens.showWhenTestStateIn
: [];
settings.disabledWorkspaceFolders.forEach(this.unregisterWorkspaceByName, this);

//register workspace folder not in the disable list
Expand All @@ -137,7 +123,6 @@ export class ExtensionManager {
const jestExt = new JestExt(
this.context,
workspaceFolder,
this.debugCodeLensProvider,
this.debugConfigurationProvider,
this.coverageCodeLensProvider
);
Expand Down
29 changes: 0 additions & 29 deletions tests/DebugCodeLens/DebugCodeLens.test.ts

This file was deleted.

0 comments on commit 9942dee

Please sign in to comment.