New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add auto-refresh capabilities for memory inspector windows #115
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
"prepare": "yarn build", | ||
"clean": "git clean -f -x ./node_modules ./dist", | ||
"build": "webpack --mode production && yarn lint", | ||
"watch": "webpack -w", | ||
"watch": "webpack -w --mode development ", | ||
"lint": "eslint . --ext .ts,.tsx", | ||
"package": "vsce package --yarn", | ||
"serve": "serve --cors -p 3333" | ||
|
@@ -78,6 +78,7 @@ | |
{ | ||
"command": "memory-inspector.show", | ||
"title": "Show Memory Inspector", | ||
"icon": "$(file-binary)", | ||
"category": "Memory" | ||
}, | ||
{ | ||
|
@@ -248,11 +249,32 @@ | |
"off" | ||
], | ||
"enumDescriptions": [ | ||
"Refresh memory views when when debugger stops (e.g. a breakpoint is hit)", | ||
"Memory view data is manually refreshed by user" | ||
"Refresh Memory Inspector when the debugger stops (e.g. a breakpoint is hit)", | ||
"Do not automatically refresh when the debugger stops" | ||
], | ||
"default": "on", | ||
"description": "Refresh memory views when debugger stops" | ||
"description": "Refresh Memory Inspectors when the debugger stops" | ||
}, | ||
"memory-inspector.periodicRefresh": { | ||
"type": "string", | ||
"enum": [ | ||
"always", | ||
"while running", | ||
"off" | ||
], | ||
"markdownEnumDescriptions": [ | ||
"Always refresh automatically after the configured `#memory-inspector.periodicRefreshInterval#`", | ||
"Refresh automatically after the configured `#memory-inspector.periodicRefreshInterval#` while the CPU is running", | ||
"Do not automatically refresh after the configured delay" | ||
], | ||
"default": "off", | ||
"description": "Refresh Memory Inspectors after the configured delay" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's include the link to the other preference here as well. That'll be easier for users to click on and make the connection more obvious. |
||
}, | ||
"memory-inspector.periodicRefreshInterval": { | ||
"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 set to `on`." | ||
}, | ||
"memory-inspector.groupings.bytesPerMAU": { | ||
"type": "number", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,9 @@ 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 { MemoryViewSettings } from '../webview/utils/view-types'; | ||
import { DebugRequestTypes } from './debug-requests'; | ||
import type { VariableRange, WrittenMemory } from './memory-range'; | ||
import { MemoryViewSettings } from './webview-configuration'; | ||
import { WebviewContext } from './webview-context'; | ||
|
||
// convenience types for easier readability and better semantics | ||
|
@@ -42,6 +42,12 @@ export interface SessionContext { | |
sessionId?: string; | ||
canRead: boolean; | ||
canWrite: boolean; | ||
stopped?: boolean; | ||
} | ||
|
||
export interface ViewState { | ||
active: boolean; | ||
visible: boolean; | ||
Comment on lines
+48
to
+50
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This interface is passed around, but I don't see that its values are ever used? |
||
} | ||
|
||
// Notifications | ||
|
@@ -51,6 +57,7 @@ export const resetMemoryViewSettingsType: NotificationType<void> = { method: 're | |
export const setTitleType: NotificationType<string> = { method: 'setTitle' }; | ||
export const memoryWrittenType: NotificationType<WrittenMemory> = { method: 'memoryWritten' }; | ||
export const sessionContextChangedType: NotificationType<SessionContext> = { method: 'sessionContextChanged' }; | ||
export const viewStateChangedType: NotificationType<ViewState> = { method: 'viewStateChanged' }; | ||
|
||
// Requests | ||
export const setOptionsType: RequestType<MemoryOptions, void> = { method: 'setOptions' }; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2024 EclipseSource and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
import { WebviewIdMessageParticipant } from 'vscode-messenger-common'; | ||
import { Endianness, GroupsPerRowOption, PeriodicRefresh, RefreshOnStop } from './manifest'; | ||
import { Radix } from './memory-range'; | ||
|
||
/** The memory display configuration that can be specified for the memory widget. */ | ||
export interface MemoryDisplayConfiguration { | ||
bytesPerMau: number; | ||
mausPerGroup: number; | ||
groupsPerRow: GroupsPerRowOption; | ||
endianness: Endianness; | ||
scrollingBehavior: ScrollingBehavior; | ||
addressPadding: AddressPadding; | ||
addressRadix: Radix; | ||
showRadixPrefix: boolean; | ||
refreshOnStop: RefreshOnStop; | ||
periodicRefresh: PeriodicRefresh; | ||
periodicRefreshInterval: number; | ||
} | ||
|
||
export type ScrollingBehavior = 'Paginate' | 'Grow' | 'Auto-Append'; | ||
|
||
export type AddressPadding = 'Minimal' | number; | ||
|
||
export interface ColumnVisibilityStatus { | ||
visibleColumns: string[]; | ||
} | ||
|
||
/** All settings related to memory view that can be specified for the webview from the extension "main". */ | ||
export interface MemoryViewSettings extends ColumnVisibilityStatus, MemoryDisplayConfiguration { | ||
title: string | ||
messageParticipant: WebviewIdMessageParticipant; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/******************************************************************************** | ||
* Copyright (C) 2022 Ericsson, Arm and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
|
||
import * as vscode from 'vscode'; | ||
import * as manifest from '../common/manifest'; | ||
import { isSessionEvent, SessionEvent, SessionTracker } from './session-tracker'; | ||
|
||
export class ContextTracker { | ||
public static ReadKey = `${manifest.PACKAGE_NAME}.canRead`; | ||
public static WriteKey = `${manifest.PACKAGE_NAME}.canWrite`; | ||
|
||
constructor(protected sessionTracker: SessionTracker) { | ||
this.sessionTracker.onSessionEvent(event => this.onSessionEvent(event)); | ||
} | ||
|
||
onSessionEvent(event: SessionEvent): void { | ||
if (isSessionEvent('active', event)) { | ||
vscode.commands.executeCommand('setContext', ContextTracker.ReadKey, !!event.session?.debugCapabilities?.supportsReadMemoryRequest); | ||
vscode.commands.executeCommand('setContext', ContextTracker.WriteKey, !!event.session?.debugCapabilities?.supportsWriteMemoryRequest); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.