Repository navigation
Respect parser whitespace in completions - #2904
Open
pradeep-ramola wants to merge 1 commit into
Open
pradeep-ramola wants to merge 1 commit into
pradeep-ramola wants to merge 1 commit into
Conversation
Match completion word boundaries with the whitespace predicate used by command-line splitting. Cover cursor boundaries, trailing whitespace, and option-value completions without changing tokenization or ranking. Fix dotnet#2903
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2903.
Summary
Use
char.IsWhiteSpaceto find the word around the completion cursor, matchingCommandLineParser.SplitCommandLinerather than recognizing only ASCII spaces.Tabs and other whitespace currently leave multiple parsed tokens in
WordToComplete; this also causesParseResult.GetCompletions()to throw while trying to find that joined string in the token list. Trailing whitespace now correctly produces an empty word, and words at explicitly selected cursor positions are bounded by the same separators as parsing.Testing
Windows, SDK
12.0.100-alpha.1.26571.102:net472suite: 956 passed, four existing skips.net10.0target suite: 960 passed, seven existing skips. This ran on the available .NET 12 preview runtime usingDOTNET_ROLL_FORWARD=MajorandDOTNET_ROLL_FORWARD_TO_PRERELEASE=1, not a native .NET 10 runtime.VSTEST_ARTIFACTS_DIRECTORYfallback notice.dotnet format whitespace --verify-no-changes --no-restorepasses for the changed production file. Checking the two existing test files reports formatting issues on unchanged lines, with no diagnostics in the added test blocks; unrelated formatting is left untouched.git diff --checkpasses.Prepared with AI assistance; implementation and regressions were validated locally. No claims about other platforms or native .NET 10 execution.