-
Notifications
You must be signed in to change notification settings - Fork 591
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
[Rust] Refactor path matching #3854
Conversation
Move some context to related ones and add section headers. This commit does not claim to be an accurate grouping, but some grouping for now is better than none. Additionally, the `statements-block` context was replaced with a `block` context that pops after matching, following the plural vs singular naming convention.
Rewrite type and identifier matching to fix problems with properly highlighting function calls. Not all cases are implemented yet, but this is a significant improvement over the previous situation. - The generics meta scope doesn't cover the preceding identifier anymore. - `meta.path` now spans the entire path, including the last segment. - The explicit `types` context is used in a couple more newly introduced contexts, i.e. for variable type declarations and `type` variables. A test file concerning identifier paths and function calls has been added. Some plural-vs-singular renaming has also been done, but not to all contexts.
ba69306
to
20ff4fa
Compare
Looks fine generally, I don't approve the |
Those in the test cases? They don't matter. I actually got used to add those final scope suffixes everywhere. |
I also came to like them because they indicate that a scope test tests the "full" scope name, i.e. it breaks when you add more to a scope but don't update the tests. It's also no extra effort for me to add them initially because PackageDev does all the work. |
See the individual commits for details.
In this PR, I have rewritten path matching in Rust to
support.function
scopes in function callsf32::from(…)
)meta.path
span the entire "path", as specified in the scope naming docsmeta.generic
not span the type it is being generic overpunctuation.accessor
for sub-path accessFixes a few outstanding issues from #2305 (such as #2305 (comment), highlighting of
union
as a function name, which is a soft-keyword).In addition, the syntax definition file has been restructured a bit by organizing related contexts in sections.