Debug exact RSpec examples - #147
Conversation
Oz Zafar (ozzafar)
left a comment
There was a problem hiding this comment.
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.
| while (args.length < 2) { | ||
| args.push(undefined); | ||
| } | ||
| args[2] = `${rspecCommand} ${fileFullPath}:${line}`; |
There was a problem hiding this comment.
[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.
There was a problem hiding this comment.
changes added please check
| function codeLensCommandMatchesTest(command: vscode.Command | undefined, testName: string): boolean { | ||
| return command?.arguments?.some(argument => | ||
| typeof argument === 'string' && (argument === testName || argument.endsWith(testName)) | ||
| ) ?? false; |
There was a problem hiding this comment.
[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.
There was a problem hiding this comment.
changes added please check
|
Oz Zafar (@ozzafar) i am fix some please check and a last PR i can add a changes also. |
No description provided.