Skip to content

Commit

Permalink
chore: mark prefixed debug types as deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Jun 13, 2022
1 parent dbc076e commit 1253dab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/build/generate-contributions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ function buildDebuggers() {
const entry = ensureEntryForType(preferred, d);
delete entry.languages;
entries.unshift(entry);
primary.deprecated = `Please use type ${preferred} instead`;
}

entries[0].configurationSnippets.push(...d.configurationSnippets);
Expand Down
3 changes: 3 additions & 0 deletions src/common/contributionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ export const preferredDebugTypes: ReadonlyMap<DebugType, string> = new Map([
[DebugType.Edge, 'msedge'],
]);

export const getPreferredOrDebugType = <T extends DebugType>(t: T) =>
(preferredDebugTypes.get(t) as T) || t;

export const enum DebugType {
ExtensionHost = 'pwa-extensionHost',
Terminal = 'node-terminal',
Expand Down
8 changes: 4 additions & 4 deletions src/ui/configuration/nodeDebugConfigurationProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { injectable } from 'inversify';
import * as path from 'path';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { DebugType } from '../../common/contributionUtils';
import { DebugType, getPreferredOrDebugType } from '../../common/contributionUtils';
import { flatten } from '../../common/objUtils';
import {
AnyNodeConfiguration,
Expand Down Expand Up @@ -80,7 +80,7 @@ export class NodeDynamicDebugConfigurationProvider extends BaseConfigurationProv
*/
protected async getFromNpmScripts(folder?: vscode.WorkspaceFolder): Promise<DynamicConfig[]> {
const openTerminal: AnyResolvingConfiguration = {
type: DebugType.Terminal,
type: getPreferredOrDebugType(DebugType.Terminal),
name: localize('debug.terminal.label', 'JavaScript Debug Terminal'),
request: 'launch',
cwd: folder?.uri.fsPath,
Expand All @@ -98,7 +98,7 @@ export class NodeDynamicDebugConfigurationProvider extends BaseConfigurationProv
const packageManager = await getPackageManager(folder);
return scripts
.map<DynamicConfig>(script => ({
type: DebugType.Terminal,
type: getPreferredOrDebugType(DebugType.Terminal),
name: localize('node.launch.script', 'Run Script: {0}', script.name),
request: 'launch',
command: `${packageManager} run ${script.name}`,
Expand All @@ -122,7 +122,7 @@ export class NodeDynamicDebugConfigurationProvider extends BaseConfigurationProv

return [
{
type: DebugType.Node,
type: getPreferredOrDebugType(DebugType.Node),
name: localize('node.launch.currentFile', 'Run Current File'),
request: 'launch',
program: editor.document.uri.fsPath,
Expand Down

0 comments on commit 1253dab

Please sign in to comment.