Skip to content

highlighting source lines that are attributed to machine code#992

Open
omarArm wants to merge 1 commit into
mainfrom
highlightSourceFiles
Open

highlighting source lines that are attributed to machine code#992
omarArm wants to merge 1 commit into
mainfrom
highlightSourceFiles

Conversation

@omarArm
Copy link
Copy Markdown
Collaborator

@omarArm omarArm commented May 13, 2026

Fixes

Changes

Note: We can agree on what colour to choose for highlighting, that wouldn't be a major change

Screenshots

image

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new source-file highlighting feature that queries debug adapter breakpoint locations and decorates source lines with generated machine-code mappings.

Changes:

  • Introduces SourceFileHighlighting and unit tests.
  • Activates the feature during desktop extension activation.
  • Extends the VS Code Jest mock with Range and editor decoration APIs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
src/features/source-file-highlighting/source-file-highlighting.ts Implements executable-line lookup and editor decorations.
src/features/source-file-highlighting/source-file-highlighting.test.ts Adds tests for breakpoint-location requests and decoration behavior.
src/desktop/extension.ts Wires the new highlighting feature into extension activation.
__mocks__/vscode.js Adds mock support for ranges and text editor decoration APIs.
Comments suppressed due to low confidence (1)

src/features/source-file-highlighting/source-file-highlighting.ts:38

  • This callback starts an async operation without awaiting or catching it. If breakpointLocations rejects (for example because the active adapter does not support the request), the rejection is unhandled and can surface as an extension error; handle/log the promise rejection at this boundary.
        vscode.window.onDidChangeActiveTextEditor(editor => {
            this.handleOnDidChangeActiveTextEditor(editor);
        });

Comment on lines +36 to +38
vscode.window.onDidChangeActiveTextEditor(editor => {
this.handleOnDidChangeActiveTextEditor(editor);
});

private registerToTrackerEvents(): void {
const onDidChangeActiveDebugSessionDisposable = vscode.debug.onDidChangeActiveDebugSession(session => {
this.activeDebugSession = session;
Comment on lines +44 to +53
});
this.context.subscriptions.push(onDidChangeActiveDebugSessionDisposable);
}

private async handleOnDidChangeActiveTextEditor(editor: vscode.TextEditor | undefined): Promise<void> {
if (!editor || !this.activeDebugSession) {
return;
}
const breakpointLocations = await this.getBreakpointLocations(editor);
if (!breakpointLocations) {
Comment on lines +23 to +28
private executableLineDecorator = vscode.window.createTextEditorDecorationType({
// turn it red for testing
backgroundColor: 'rgba(222, 199, 199, 0.3)',
// only highlight the margin of the line to avoid obscuring code
isWholeLine: true,
});
Comment on lines +24 to +27
// turn it red for testing
backgroundColor: 'rgba(222, 199, 199, 0.3)',
// only highlight the margin of the line to avoid obscuring code
isWholeLine: true,
@qltysh
Copy link
Copy Markdown

qltysh Bot commented May 13, 2026

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
src/desktop/extension.ts100.0%
New Coverage rating: A
src/features/source-file-highlighting/source-file-highlighting.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants