From 3cd248e0f3bc528fc444d9bd10c180c8eb7f05f8 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Tue, 20 Sep 2022 09:06:54 -0700 Subject: [PATCH] Rename debugger uiMessages to strings, and document in package.json Fix #153842 --- .../debug/browser/breakpointEditorContribution.ts | 4 ++-- .../workbench/contrib/debug/browser/breakpointsView.ts | 4 ++-- src/vs/workbench/contrib/debug/common/debug.ts | 6 +++--- src/vs/workbench/contrib/debug/common/debugSchemas.ts | 10 ++++++++++ src/vs/workbench/contrib/debug/common/debugger.ts | 4 ++-- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts index 830a95a92d23f..b900d70c0d91a 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.ts @@ -15,7 +15,7 @@ import { IModelDecorationOptions, TrackedRangeStickiness, ITextModel, OverviewRu import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; import { IContextMenuService } from 'vs/platform/contextview/browser/contextView'; -import { IDebugService, IBreakpoint, CONTEXT_BREAKPOINT_WIDGET_VISIBLE, BreakpointWidgetContext, IBreakpointEditorContribution, IBreakpointUpdateData, IDebugConfiguration, State, IDebugSession, DebuggerUiMessage } from 'vs/workbench/contrib/debug/common/debug'; +import { IDebugService, IBreakpoint, CONTEXT_BREAKPOINT_WIDGET_VISIBLE, BreakpointWidgetContext, IBreakpointEditorContribution, IBreakpointUpdateData, IDebugConfiguration, State, IDebugSession, DebuggerString } from 'vs/workbench/contrib/debug/common/debug'; import { IDialogService } from 'vs/platform/dialogs/common/dialogs'; import { BreakpointWidget } from 'vs/workbench/contrib/debug/browser/breakpointWidget'; import { IDisposable, dispose, disposeIfDisposable } from 'vs/base/common/lifecycle'; @@ -86,7 +86,7 @@ function getBreakpointDecorationOptions(accessor: ServicesAccessor, model: IText let langId: string | undefined; unverifiedMessage = debugService.getModel().getSessions().map(s => { const dbg = debugService.getAdapterManager().getDebugger(s.configuration.type); - const message = dbg?.uiMessages?.[DebuggerUiMessage.UnverifiedBreakpoints]; + const message = dbg?.strings?.[DebuggerString.UnverifiedBreakpoints]; if (message) { if (!langId) { // Lazily compute this, only if needed for some debug adapter diff --git a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts index 58e653531b834..414b1b2494eff 100644 --- a/src/vs/workbench/contrib/debug/browser/breakpointsView.ts +++ b/src/vs/workbench/contrib/debug/browser/breakpointsView.ts @@ -45,7 +45,7 @@ import { IEditorPane } from 'vs/workbench/common/editor'; import { IViewDescriptorService } from 'vs/workbench/common/views'; import * as icons from 'vs/workbench/contrib/debug/browser/debugIcons'; import { DisassemblyView } from 'vs/workbench/contrib/debug/browser/disassemblyView'; -import { BREAKPOINTS_VIEW_ID, BREAKPOINT_EDITOR_CONTRIBUTION_ID, CONTEXT_BREAKPOINTS_EXIST, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_BREAKPOINT_INPUT_FOCUSED, CONTEXT_BREAKPOINT_ITEM_TYPE, CONTEXT_BREAKPOINT_SUPPORTS_CONDITION, CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_IN_DEBUG_MODE, DebuggerUiMessage, DEBUG_SCHEME, IBaseBreakpoint, IBreakpoint, IBreakpointEditorContribution, IDataBreakpoint, IDebugModel, IDebugService, IEnablement, IExceptionBreakpoint, IFunctionBreakpoint, IInstructionBreakpoint, State } from 'vs/workbench/contrib/debug/common/debug'; +import { BREAKPOINTS_VIEW_ID, BREAKPOINT_EDITOR_CONTRIBUTION_ID, CONTEXT_BREAKPOINTS_EXIST, CONTEXT_BREAKPOINTS_FOCUSED, CONTEXT_BREAKPOINT_INPUT_FOCUSED, CONTEXT_BREAKPOINT_ITEM_TYPE, CONTEXT_BREAKPOINT_SUPPORTS_CONDITION, CONTEXT_DEBUGGERS_AVAILABLE, CONTEXT_IN_DEBUG_MODE, DebuggerString, DEBUG_SCHEME, IBaseBreakpoint, IBreakpoint, IBreakpointEditorContribution, IDataBreakpoint, IDebugModel, IDebugService, IEnablement, IExceptionBreakpoint, IFunctionBreakpoint, IInstructionBreakpoint, State } from 'vs/workbench/contrib/debug/common/debug'; import { Breakpoint, DataBreakpoint, ExceptionBreakpoint, FunctionBreakpoint, InstructionBreakpoint } from 'vs/workbench/contrib/debug/common/debugModel'; import { DisassemblyViewInput } from 'vs/workbench/contrib/debug/common/disassemblyViewInput'; import { ACTIVE_GROUP, IEditorService, SIDE_GROUP } from 'vs/workbench/services/editor/common/editorService'; @@ -284,7 +284,7 @@ export class BreakpointsView extends ViewPane { const currentType = this.debugService.getViewModel().focusedSession?.configuration.type; const dbg = currentType ? this.debugService.getAdapterManager().getDebugger(currentType) : undefined; - const message = dbg?.uiMessages && dbg.uiMessages[DebuggerUiMessage.UnverifiedBreakpoints]; + const message = dbg?.strings?.[DebuggerString.UnverifiedBreakpoints]; const debuggerHasUnverifiedBps = message && this.debugService.getModel().getBreakpoints().filter(bp => { if (bp.verified || !bp.enabled) { return false; diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index dbd8289acf06f..11c3f051a43d8 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -163,7 +163,7 @@ export interface IDebugger { export interface IDebuggerMetadata { label: string; type: string; - uiMessages?: { [key in DebuggerUiMessage]: string }; + strings?: { [key in DebuggerString]: string }; interestedInLanguage(languageId: string): boolean; } @@ -786,7 +786,7 @@ export interface IDebuggerContribution extends IPlatformSpecificAdapterContribut variables?: { [key: string]: string }; when?: string; deprecated?: string; - uiMessages?: { [key in DebuggerUiMessage]: string }; + strings?: { [key in DebuggerString]: string }; } export interface IBreakpointContribution { @@ -862,7 +862,7 @@ export interface IConfigurationManager { resolveConfigurationByProviders(folderUri: uri | undefined, type: string | undefined, debugConfiguration: any, token: CancellationToken): Promise; } -export enum DebuggerUiMessage { +export enum DebuggerString { UnverifiedBreakpoints = 'unverifiedBreakpoints' } diff --git a/src/vs/workbench/contrib/debug/common/debugSchemas.ts b/src/vs/workbench/contrib/debug/common/debugSchemas.ts index 26575ff3b88fe..7363af0723c12 100644 --- a/src/vs/workbench/contrib/debug/common/debugSchemas.ts +++ b/src/vs/workbench/contrib/debug/common/debugSchemas.ts @@ -106,6 +106,16 @@ export const debuggersExtPoint = extensionsRegistry.ExtensionsRegistry.registerE type: 'string' } } + }, + strings: { + description: nls.localize('vscode.extension.contributes.debuggers.strings', "UI strings contributed by this debug adapter."), + type: 'object', + properties: { + unverifiedBreakpoints: { + description: nls.localize('vscode.extension.contributes.debuggers.strings.unverifiedBreakpoints', "When there are unverified breakpoints in a language supported by this debug adapter, this message will appear on the breakpoint hover and in the breakpoints view. Markdown and command links are supported."), + type: 'string' + } + } } } } diff --git a/src/vs/workbench/contrib/debug/common/debugger.ts b/src/vs/workbench/contrib/debug/common/debugger.ts index f7041e2099a37..4cdb2d5c41a93 100644 --- a/src/vs/workbench/contrib/debug/common/debugger.ts +++ b/src/vs/workbench/contrib/debug/common/debugger.ts @@ -147,8 +147,8 @@ export class Debugger implements IDebugger, IDebuggerMetadata { return !this.debuggerWhen || this.contextKeyService.contextMatchesRules(this.debuggerWhen); } - get uiMessages() { - return this.debuggerContribution.uiMessages; + get strings() { + return this.debuggerContribution.strings ?? (this.debuggerContribution as any).uiMessages; } interestedInLanguage(languageId: string): boolean {