From b5109ddd01b14967f73e577667449d0bdbe04b7e Mon Sep 17 00:00:00 2001 From: Philip Langer Date: Thu, 16 May 2024 15:20:19 +0200 Subject: [PATCH 1/4] Fix a few typos --- package.json | 2 +- src/plugin/memory-webview-main.ts | 4 ++-- src/plugin/session-tracker.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 1969593..8e4c893 100644 --- a/package.json +++ b/package.json @@ -288,7 +288,7 @@ "type": "number", "default": 500, "minimum": 500, - "markdownDescription": "Controls the delay in milliseconds after which a Memory Inspector is refrehsed automatically. Only applies when `#memory-inspector.periodicRefresh#` is enabled." + "markdownDescription": "Controls the delay in milliseconds after which a Memory Inspector is refreshed automatically. Only applies when `#memory-inspector.periodicRefresh#` is enabled." }, "memory-inspector.groupings.bytesPerMAU": { "type": "number", diff --git a/src/plugin/memory-webview-main.ts b/src/plugin/memory-webview-main.ts index 9439ca6..e94771a 100644 --- a/src/plugin/memory-webview-main.ts +++ b/src/plugin/memory-webview-main.ts @@ -272,8 +272,8 @@ export class MemoryWebview implements vscode.CustomReadonlyEditorProvider { const sessionId = session?.id; return { sessionId, - canRead: !!this.sessionTracker.hasDebugCapabilitiy(session, 'supportsReadMemoryRequest'), - canWrite: !!this.sessionTracker.hasDebugCapabilitiy(session, 'supportsWriteMemoryRequest'), + canRead: !!this.sessionTracker.hasDebugCapability(session, 'supportsReadMemoryRequest'), + canWrite: !!this.sessionTracker.hasDebugCapability(session, 'supportsWriteMemoryRequest'), stopped: this.sessionTracker.isStopped(session) }; } diff --git a/src/plugin/session-tracker.ts b/src/plugin/session-tracker.ts index 3ca95b4..d10529f 100644 --- a/src/plugin/session-tracker.ts +++ b/src/plugin/session-tracker.ts @@ -158,23 +158,23 @@ export class SessionTracker implements vscode.DebugAdapterTrackerFactory { return !!session && !!this.sessionInfo(session).stopped; } - hasDebugCapabilitiy(session = this.activeSession, capability: DebugCapability): boolean { + hasDebugCapability(session = this.activeSession, capability: DebugCapability): boolean { return !!session && !!this.sessionInfo(session).debugCapabilities?.[capability]; } assertDebugCapability(session = this.assertActiveSession(), capability: DebugCapability, action: string = 'execute action'): vscode.DebugSession { - if (!this.hasDebugCapabilitiy(session, capability)) { + if (!this.hasDebugCapability(session, capability)) { throw new Error(`Cannot ${action}. Session does not have capability '${capability}'.`); } return session; } - hasClientCapabilitiy(session: vscode.DebugSession | undefined, capability: ClientCapability): boolean { + hasClientCapability(session: vscode.DebugSession | undefined, capability: ClientCapability): boolean { return !!session && !!this.sessionInfo(session).clientCapabilities?.[capability]; } assertClientCapability(session = this.assertActiveSession(), capability: ClientCapability, action: string = 'execute action'): vscode.DebugSession { - if (!this.hasClientCapabilitiy(session, capability)) { + if (!this.hasClientCapability(session, capability)) { throw new Error(`Cannot ${action}. Client does not have capability '${capability}'.`); } return session; From 57338e767b1b9a4adfb2882e474ac8b86c116e1f Mon Sep 17 00:00:00 2001 From: Philip Langer Date: Mon, 6 May 2024 13:57:20 +0200 Subject: [PATCH 2/4] Enhances the context data of the context menu * Endianess setting * Bytes per MAU setting * Start address and length of the memory data groups --- src/common/webview-context.ts | 4 +++- src/webview/columns/data-column.tsx | 2 ++ src/webview/components/memory-widget.tsx | 9 ++++++--- src/webview/utils/vscode-contexts.ts | 13 ++++++++++++- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/common/webview-context.ts b/src/common/webview-context.ts index 6ae0afc..3e85652 100644 --- a/src/common/webview-context.ts +++ b/src/common/webview-context.ts @@ -15,7 +15,7 @@ ********************************************************************************/ import { WebviewIdMessageParticipant } from 'vscode-messenger-common'; -import { VariableMetadata } from './memory-range'; +import { Endianness, VariableMetadata } from './memory-range'; import { ReadMemoryArguments } from './messaging'; export interface WebviewContext { @@ -24,6 +24,8 @@ export interface WebviewContext { showAsciiColumn: boolean showVariablesColumn: boolean, showRadixPrefix: boolean, + endianness: Endianness, + bytesPerMau: number, activeReadArguments: Required } diff --git a/src/webview/columns/data-column.tsx b/src/webview/columns/data-column.tsx index c6a8b59..4a929c2 100644 --- a/src/webview/columns/data-column.tsx +++ b/src/webview/columns/data-column.tsx @@ -23,6 +23,7 @@ import { writeMemoryType } from '../../common/messaging'; import type { MemorySizeOptions } from '../components/memory-table'; import { decorationService } from '../decorations/decoration-service'; import { Disposable, FullNodeAttributes } from '../utils/view-types'; +import { createGroupVscodeContext } from '../utils/vscode-contexts'; import { characterWidthInContainer, elementInnerWidth } from '../utils/window'; import { messenger } from '../view-messenger'; import { ColumnContribution, TableRenderOptions } from './column-contribution-service'; @@ -87,6 +88,7 @@ export class EditableDataColumnRow extends React.Component {maus} ; diff --git a/src/webview/components/memory-widget.tsx b/src/webview/components/memory-widget.tsx index 8accd2c..e0829df 100644 --- a/src/webview/components/memory-widget.tsx +++ b/src/webview/components/memory-widget.tsx @@ -67,12 +67,15 @@ export class MemoryWidget extends React.Component candidate.active).map(column => column.contribution.id); + const { messageParticipant, showRadixPrefix, endianness, bytesPerMau, activeReadArguments } = this.props; return createAppVscodeContext({ - messageParticipant: this.props.messageParticipant, - showRadixPrefix: this.props.showRadixPrefix, + messageParticipant, + showRadixPrefix, showAsciiColumn: visibleColumns.includes('ascii'), showVariablesColumn: visibleColumns.includes('variables'), - activeReadArguments: this.props.activeReadArguments + endianness, + bytesPerMau, + activeReadArguments }); } diff --git a/src/webview/utils/vscode-contexts.ts b/src/webview/utils/vscode-contexts.ts index dbbd54d..aa56e3c 100644 --- a/src/webview/utils/vscode-contexts.ts +++ b/src/webview/utils/vscode-contexts.ts @@ -28,7 +28,7 @@ export interface VscodeContext { export type WebviewSection = 'optionsWidget' | 'advancedOptionsOverlay' | 'memoryTable'; export function createVscodeContext(context: C): VscodeContext { - return { 'data-vscode-context': JSON.stringify(includeFlatKeys(context)) }; + return { 'data-vscode-context': JSON.stringify(includeFlatKeys(context), replacerForBigInt) }; } function includeFlatKeys(src: object): Record { @@ -60,8 +60,19 @@ export function createAppVscodeContext(context: Omit Date: Tue, 4 Jun 2024 18:21:58 +0200 Subject: [PATCH 3/4] Fix import Looks like the rebase of #135 causes a compile error. This change fixes the broken import. --- src/common/webview-context.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/webview-context.ts b/src/common/webview-context.ts index 3e85652..c652dc5 100644 --- a/src/common/webview-context.ts +++ b/src/common/webview-context.ts @@ -15,7 +15,8 @@ ********************************************************************************/ import { WebviewIdMessageParticipant } from 'vscode-messenger-common'; -import { Endianness, VariableMetadata } from './memory-range'; +import { Endianness } from './manifest'; +import { VariableMetadata } from './memory-range'; import { ReadMemoryArguments } from './messaging'; export interface WebviewContext { From 122061523a761cd551e928f7a1aadd12ddf89afd Mon Sep 17 00:00:00 2001 From: colin-grant-work Date: Thu, 6 Jun 2024 07:57:07 -0600 Subject: [PATCH 4/4] Move external view types to common (#138) --- src/{plugin => common}/external-views.ts | 0 src/common/messaging.ts | 2 +- src/plugin/memory-storage.ts | 2 +- src/plugin/memory-webview-main.ts | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/{plugin => common}/external-views.ts (100%) diff --git a/src/plugin/external-views.ts b/src/common/external-views.ts similarity index 100% rename from src/plugin/external-views.ts rename to src/common/external-views.ts diff --git a/src/common/messaging.ts b/src/common/messaging.ts index 9b23854..c30d2f5 100644 --- a/src/common/messaging.ts +++ b/src/common/messaging.ts @@ -17,8 +17,8 @@ import type { DebugProtocol } from '@vscode/debugprotocol'; import type { NotificationType, RequestType } from 'vscode-messenger-common'; import { URI } from 'vscode-uri'; -import { VariablesView } from '../plugin/external-views'; import { DebugRequestTypes } from './debug-requests'; +import { VariablesView } from './external-views'; import type { VariableRange, WrittenMemory } from './memory-range'; import { MemoryViewSettings } from './webview-configuration'; import { WebviewContext } from './webview-context'; diff --git a/src/plugin/memory-storage.ts b/src/plugin/memory-storage.ts index 8604036..a19036b 100644 --- a/src/plugin/memory-storage.ts +++ b/src/plugin/memory-storage.ts @@ -17,6 +17,7 @@ import MemoryMap from 'nrf-intel-hex'; import * as vscode from 'vscode'; import { URI, Utils } from 'vscode-uri'; +import { isVariablesContext } from '../common/external-views'; import { IntelHEX } from '../common/intel-hex'; import * as manifest from '../common/manifest'; import { @@ -26,7 +27,6 @@ import { import { toHexStringWithRadixMarker } from '../common/memory-range'; import { ApplyMemoryArguments, ApplyMemoryResult, MemoryOptions, StoreMemoryArguments } from '../common/messaging'; import { isWebviewContext } from '../common/webview-context'; -import { isVariablesContext } from './external-views'; import { MemoryProvider } from './memory-provider'; export const StoreCommandType = `${manifest.PACKAGE_NAME}.store-file`; diff --git a/src/plugin/memory-webview-main.ts b/src/plugin/memory-webview-main.ts index e94771a..92a3b88 100644 --- a/src/plugin/memory-webview-main.ts +++ b/src/plugin/memory-webview-main.ts @@ -17,6 +17,7 @@ import * as vscode from 'vscode'; import { Messenger } from 'vscode-messenger'; import { WebviewIdMessageParticipant } from 'vscode-messenger-common'; +import { isVariablesContext } from '../common/external-views'; import * as manifest from '../common/manifest'; import { VariableRange } from '../common/memory-range'; import { @@ -46,7 +47,6 @@ import { } from '../common/messaging'; import { MemoryViewSettings, ScrollingBehavior } from '../common/webview-configuration'; import { getVisibleColumns, isWebviewVariableContext, WebviewContext } from '../common/webview-context'; -import { isVariablesContext } from './external-views'; import { outputChannelLogger } from './logger'; import { MemoryProvider } from './memory-provider'; import { ApplyCommandType, StoreCommandType } from './memory-storage';