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

Annotations with qualifier and braces are not handled. #42

Open
Animeshz opened this issue Feb 9, 2021 · 4 comments · May be fixed by #43
Open

Annotations with qualifier and braces are not handled. #42

Animeshz opened this issue Feb 9, 2021 · 4 comments · May be fixed by #43
Labels
help wanted Extra attention is needed

Comments

@Animeshz
Copy link
Contributor

Animeshz commented Feb 9, 2021

Looking at the sources,

match: '@(?:file|property|field|get|set|receiver|param|setparam|delegate)\s*:\s*?[a-zA-Z_]\w*'

begin: '@[a-zA-Z_]\w*\s*(\()'

match: '@[a-zA-Z_]\w*'

Neither of them seem to handle annotations used such as:

@set:Option(option = "verbose", description = "Sets verbosity of output.")

i.e. ones which are prefixed with the qualifier (@qualifier:).

@Animeshz
Copy link
Contributor Author

Animeshz commented Feb 9, 2021

Also I guess its better to use the storage.type.annotation.kotlin according to the docs, and also used for the Java.

It also has predefined highlighting available from the github's primer defined scopes.

@nishtahir
Copy link
Owner

I'm not sure I agree that storage.type is the right scope for this. According to the docs that you linked they describe storage type as

type — the type of something, class, function, int, var, etc.

The Kotlin docs describe annotations as

Annotations are means of attaching metadata to code. To declare an annotation, put the annotation modifier in front of a class:

Which seems to fit the description of the meta scope in my view

meta — the meta scope is generally used to markup larger parts of the document. For example the entire line which declares a function would be meta.function and the subsets would be storage.type, entity.name.function, variable.parameter etc. and only the latter would be styled. Sometimes the meta part of the scope will be used only to limit the more general element that is styled, most of the time meta scopes are however used in scope selectors for activation of bundle items. For example in Objective-C there is a meta scope for the interface declaration of a class and the implementation, allowing the same tab-triggers to expand differently, depending on context.

In my opinion the keyword annotation is a storage type whereas annotations themselves should be meta

@Animeshz
Copy link
Contributor Author

O.O The VSCode java uses something like this and that.

It gives the whole annotation scope of meta: "name": "meta.declaration.annotation.java",
whereas the @ symbol and the name of annotation, punctuation and storage respectively:

"beginCaptures": {
    "2": {
        "name": "punctuation.definition.annotation.java"
        },
        "3": {
            "name": "storage.type.annotation.java"
        },

Similar one for scss @media queries or @mixins 👀.

@Animeshz
Copy link
Contributor Author

Also dart-grammar applies storage scope it for whole the annotation 🤔.

@nishtahir nishtahir added the help wanted Extra attention is needed label Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants