fix: highlight parameter types in function signatures#2
Merged
Conversation
… GRANT, ALTER, DROP Adds paren_group_typed — a variant of paren_group that includes storage_types — and wires it into comment_on and general_statement. Types such as TEXT, INTERVAL, and INT are now highlighted inside parentheses in statements like: COMMENT ON FUNCTION f(TEXT, INT) IS '...'; GRANT EXECUTE ON FUNCTION f(TEXT, INT) TO role; ALTER FUNCTION f(TEXT, INT) OWNER TO role; DROP FUNCTION f(TEXT, INT); Using a paren-scoped pattern avoids false positives on bare type keywords that appear as SQL keywords elsewhere (e.g. TEXT in CREATE TEXT SEARCH CONFIGURATION).
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.
Summary
paren_group_typed— a variant ofparen_groupthat includes#storage_types— and wires it intocomment_onandgeneral_statementTEXT,INTERVAL,INTare now highlighted inside parentheses inCOMMENT ON FUNCTION,GRANT,REVOKE,ALTER FUNCTION,DROP FUNCTION, etc.TEXTinCREATE TEXT SEARCH CONFIGURATION)Test plan
npm test)tests/comment-on-dollar-quote.test.sql— new assertions verify types highlighted inCOMMENT ON FUNCTION f(TEXT, INTERVAL, INT)signature, and thatIS '...'/IS $$...$$content remains unhighlightedtests/grant-function-signature.test.sql— new file coveringGRANT,REVOKE,ALTER FUNCTION,DROP FUNCTIONwith type signatures