Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed function highlighting #65

Merged

Conversation

matthewnitschke
Copy link
Contributor

Highlighting functions was fairly inconsistent, and utilized the not supported @method selector

This PR reworks highlights.scm queries for functions, support different syntax highlighting for methods and properties, as well as function definitions and invocations

Before

before

After

after

Comment on lines +14 to +15
(((identifier) @function (#match? @function "^_?[a-z]"))
. (selector . (argument_part))) @function
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the pattern both nvim and zed are utilizing to delineate between constructors and function calls

(expression_statement
(selector
(unconditional_assignable_selector
(identifier) @function))
Copy link
Contributor Author

@matthewnitschke matthewnitschke Apr 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, I'm not worrying about annotating the differences between @function and @function.method

probably will look at this later, if it's considered beneficial

@@ -167,6 +190,7 @@
(const_builtin)
(part_of_builtin)
(rethrow_builtin)
(void_type)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

void is not really a type in dart, and most existing highlighting treats it as a keyword (thinking mostly the LSP syntax highlighting the vscode implements)

@TimWhiting TimWhiting merged commit 1aef5a6 into UserNobody14:master Apr 7, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants