Closed wurikiji closed 1 year ago
Same problems here
@TypedGoRoute<LoginRoute>(path: LoginRoute.path)
class LoginRoute extends GoRouteData {
const LoginRoute({this.fromPage});
final String? fromPage;
@override
Widget build(BuildContext context, GoRouterState state) =>
LoginScreen(from: fromPage);
}
In the above example, @TypedGoRoute
is parsed as marker_annotation
, which is correct. But the rest is parsed as function_signature
.
(marker_annotation @ name: (identifier))
(function_signature name: (identifier)
(type_parameters <
(type_parameter (type_identifier))
>)
(formal_parameter_list (
(ERROR
(formal_parameter name: (identifier))
: (type_identifier) . (type_identifier)
(ERROR ) class (identifier) (identifier))
(identifier))
(optional_formal_parameters {
(ERROR (const_builtin)
(function_type (type_identifier) Function
(parameter_type_list (
(optional_parameter_types
(named_parameter_types {
(typed_identifier (type_identifier) . (type_identifier) (identifier))
}))
)))
;
(final_builtin final)
(type_identifier)
(nullable_type ?)
(identifier) ;)
(formal_parameter
name: (marker_annotation @ name: (identifier))
(ERROR (type_identifier) (identifier)
(formal_parameter_list (
(formal_parameter name: (type_identifier) (identifier))
,
(formal_parameter name: (type_identifier) (identifier))
))
=> (identifier) ()
(identifier))
: (identifier) })
)))
Fixed the issues in the latest commit https://github.com/UserNobody14/tree-sitter-dart/commit/b55b90fe7d504b324d0357d69dc7eed631a3996b
Also renamed marker_annotation
to annotation
, not sure why it was named the former in the first place
It works for me now, thx for the quick fix! @TimWhiting
But does these lines duplicated?
Thanks for the catch, I just deduplicated those highlights. I think neovim maintains a separate highlights with neovim specific things though.
Oh, I don't know it's actually effect since I don't use neovim, I just thought that is for the test 😂
Anyway, thanks for the work!
For above code,
should capture an annotation.
But, tree-sitter parses
@Hypen
as a (marker_annotation) and()
as a record type definition.Are there any solutions to capture this pattern?