Skip to content

Debug exact RSpec examples - #147

Open
AlexKovynev wants to merge 2 commits into
microsoft:mainfrom
AlexKovynev:rspec-debugging
Open

Debug exact RSpec examples#147
AlexKovynev wants to merge 2 commits into
microsoft:mainfrom
AlexKovynev:rspec-debugging

Conversation

@AlexKovynev

Copy link
Copy Markdown
Contributor

No description provided.

@ozzafar Oz Zafar (ozzafar) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for splitting this out and preserving the first debugger stop without automatic continuation. Two correctness issues still need fixing before this can reliably debug the exact requested example: shell quoting for the generated file:line target, and prioritizing an exact example-name match over suffix-only matches. Please see the inline reproductions and add regression coverage for both. The branch also needs updating against current main.

Comment thread src/debuggingExecutor.ts Outdated
while (args.length < 2) {
args.push(undefined);
}
args[2] = `${rspecCommand} ${fileFullPath}:${line}`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Preserve file:line as one shell argument. This interpolation does not quote the target. With /repo/with spaces/spec/example_spec.rb and line 6, the generated command is rspec /repo/with spaces/spec/example_spec.rb:6; the shell receives /repo/with and spaces/spec/example_spec.rb:6 as separate arguments. Ruby LSP uses configuration.program verbatim and starts its debugger command with shell: true, so the adapter does not repair this path. Please use the separate command/file contract where appropriate or correctly quote/escape the whole target, with regression coverage for spaces and shell-sensitive characters.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes added please check

Comment thread src/debuggingExecutor.ts Outdated
Comment on lines +91 to +94
function codeLensCommandMatchesTest(command: vscode.Command | undefined, testName: string): boolean {
return command?.arguments?.some(argument =>
typeof argument === 'string' && (argument === testName || argument.endsWith(testName))
) ?? false;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Give exact example names priority over suffix matches. Both saves and also saves match a request for saves. findDebugCodeLens then sorts both by range size rather than prioritizing the exact name or the requested position. With equal one-character CodeLens ranges and also saves first, it selects that different example even when the target position is on the saves definition. Please rank exact matches ahead of suffix matches and handle ambiguity explicitly instead of silently choosing another example. Add a regression using these two names.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

changes added please check

@AlexKovynev

AlexKovynev commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Oz Zafar (@ozzafar) i am fix some please check and a last PR i can add a changes also.
#149

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