Repository navigation
fix: expand * only on real star tokens and quote non-ASCII names minimally - #932
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mally The code action resolved the file whenever the cursor's line contained a *, including /* comments, count(*) and multiplications. It now scans the line and only resolves when the cursor is on a * of a select list or on its qualifier, also inside a one-line function body. Names with characters that aren't ASCII are no longer quoted: Postgres accepts them unquoted and doesn't fold them.
Collaborator
Author
|
Shouldn't this be in server/features/expand_star? |
This was referenced Oct 26, 2026
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.
Stacked on #887.
Two details of the expand
*code action from the analysis of #887.Needless quotes
quote_identifieronly treated ASCII as plain. Postgres' lexer accepts any byte ≥ 0x80 in unquoted identifiers (ident_start/ident_continscan.l) and only folds ASCII letters, so names whose only non-lower-case characters aren't ASCII read the same without quotes. Upper-case ASCII letters and keywords other than unreserved ones are still quoted.When the file is resolved
Editors ask for code actions on every cursor move, and the action resolved the whole file whenever the cursor's line contained a
*:/* comments */,count(*),a * band'*'included. On long files that is a full walk per cursor move, on top of the lint code actions.expand_star::is_at_starscans the cursor's line and only says yes when the cursor is on a*token, or its qualifier, that followsSELECT,,,.,RETURNING,DISTINCT,ALL, a)(DISTINCT ON (...)), or nothing on that line (a*on a line of its own). In a function body on the line (as '...'oras $f$...$f$) it looks at the body. If the line doesn't scan on its own, like a line inside a multi-line string, any*still counts, as before. The resolver still decides whether there's something to expand, so this only skips walks.Tests
is_at_starfor*,t.*,schema.t.*with the cursor on the qualifier,RETURNING *, a*alone on a line,count(*), multiplication, comments, string literals, and one-line function bodies.*over a table with non-ASCII column names, and no action oncount(*)or inside a comment.Not covered
The walk itself isn't cached on this branch; the cached walk for hover, inlay hints and semantic tokens is in #930 (on top of #888), and the code action can use it once both are in.