-
Notifications
You must be signed in to change notification settings - Fork 13
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
Enhances the context data of the context menu #135
Conversation
Not opposed to the change, but at the moment, it doesn't look like there's a consumer for the new data? |
@colin-grant-work Wow that fast! I wasn't even finished updating the comment yet :-)
The requirement is to prepare for external context menus that would need this context information (e.g. to properly react to context menu on a specific memory data group). A context menu item that'll likely come soon is to add data breakpoints, which also needs the start and end address of a selected group. But I'll better let @jreineckearm give the full picture on the future requirements that necessitate this change. |
I think I mistook a repo watch generated email for a review request email - sorry! |
* Endianess setting * Bytes per MAU setting * Start address and length of the memory data groups
@@ -90,6 +91,7 @@ export class EditableDataColumnRow extends React.Component<EditableDataColumnRow | |||
style={style} | |||
key={startAddress.toString(16)} | |||
onDoubleClick={this.setGroupEdit} | |||
{...createGroupVscodeContext(startAddress, toOffset(startAddress, endAddress, this.props.options.bytesPerMau * 8))} |
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.
*8
looked a bit off initially. But realized later that most internal calculations are still based on bits....
export function createVariableVscodeContext(variable: BigIntVariableRange): VscodeContext { | ||
const { name, type, value, isPointer } = variable; | ||
return createVscodeContext({ variable: { name, type, value, isPointer } }); | ||
} | ||
|
||
function replacerForBigInt(_: string, value: unknown): unknown { | ||
if (typeof value === 'bigint') { |
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.
Can we always be sure that bigint
is only used for 64-bit handling?
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.
At the moment bigint seems to be used only for memory addresses and memory data. As BigInt
is not serializable directly, my intention with this replacer was that we can pass BigInt
values directly into the context without worrying about that and have a consistent formatting of those values for extenders (hexadecimal).
Alternatively, we can also limit this formatting to the specific fields we currently know to be passed into the context, which would be fine too, if you prefer.
@haydar-metin confirmed that what is specified in this PR is sufficient to be used and extended for #102. So we consider this to be ready for final review. Thank you! |
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.
Thanks for verifying the set of new context data to be sufficient!
Thank you both @colin-grant-work and @jreineckearm for your review! |
Looks like the rebase of eclipse-cdt-cloud#135 causes a compile error. This change fixes the broken import.
Looks like the rebase of #135 causes a compile error. This change fixes the broken import.
What it does
Extends the VS Code context to augment the information available to context menus. In particular:
How to test
The easiest way to test this is to print out the arguments of a context menu command, e.g. in memory-webview-main.ts:112:
And observe the data in the
ctx
object. Here is a break down of what it currently contains.Context menu somewhere in the upper part of the memory inspector (now contains `endianness` and `bytesPerMau`)
Context menu on a specific group in the memory data (now contains start and size of the group)
Context menu on a specific variable (already contained this information before this PR)
Review checklist
Reminder for reviewers