fix(csharp): stop tuple-typed properties losing their name to the method branch - #1967
Open
AmirF194 wants to merge 2 commits into
Open
fix(csharp): stop tuple-typed properties losing their name to the method branch#1967AmirF194 wants to merge 2 commits into
AmirF194 wants to merge 2 commits into
Conversation
…hod branch
_extract_base_name_and_type split Roslyn's "Name : Type" property names by
checking for a literal '(' anywhere in the raw string. A C# tuple type is
written with parentheses ("(int X, string Y)"), so a tuple-typed property
tripped that guard and fell into the method branch instead, which kept the
trailing " :" as part of the reported name (e.g. "Position :"). Since
find_symbol defaults to exact name-path matching, such a property becomes
unfindable by its real name.
The guard now only checks for '(' in the identifier segment before the
first " : ", not the whole string, so a parenthesis inside the type
annotation no longer affects branch selection.
AmirF194
force-pushed
the
fix/csharp-tuple-property-name-corruption
branch
from
September 3, 2026 13:26
12eda18 to
37feb03
Compare
opcode81
requested changes
Sep 3, 2026
Contributor
There was a problem hiding this comment.
Since the modified method _extract_base_name_and_type is called by _normalize_symbol_name, the change must invalidate the high-level symbol cache by incrementing this version. See docstring of _normalize_symbol_name in base class.
Contributor
Author
There was a problem hiding this comment.
Good catch, missed that this changes what the cache stores. Bumped normalize_symbol_name_version to 2 in _document_symbols_cache_fingerprint, pushed as 8f2406d.
_normalize_symbol_name's output changed in this PR, and _document_symbols_cache_fingerprint gates the cache that stores its result; leaving the version at 1 would keep serving the old, corrupted names to anyone with an existing on-disk cache.
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.
Checklist
CONTRIBUTING.mdregarding the scope of PRs.CHANGELOG.md, which concisely describes the change._extract_base_name_and_typesplits Roslyn's"Name : Type"property names by checking for(anywhere in the raw string. A C# tuple type is written with parens, e.g.(int X, string Y), so a tuple-typed property tripped that check and fell into the method branch instead, keeping the trailing" :"in the reported name ("Position :"instead of"Position"). Sincefind_symboldefaults to exact name matching, such a property becomes unfindable by its real name.Narrowed the
(check to the segment before the first" : ", so a parenthesis inside the type no longer affects branch selection. Checked it doesn't regress a method that returns a tuple or takes tuple-typed parameters, both of which still have(before that segment.Added
TestCSharpExtractBaseNameAndType. The new test fails without the change ("Position :") and passes with it.poe lintandcodespellare clean. I didn't capture a live Roslyn trace for the tuple case specifically, the expected"Name : Type"format is the same pattern the existing tests already confirm live for non-tuple properties, plus standard C# tuple syntax, so this rests on that plus the language spec rather than an observed wire capture.