-
Notifications
You must be signed in to change notification settings - Fork 97
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
group built-in document attributes #619
Comments
Built-in attributes are provided by: https://github.com/asciidoctor/asciidoctor-vscode/blob/master/src/features/builtinDocumentAttributeProvider.ts with relies on https://github.com/asciidoctor/asciidoctor-vscode/blob/master/src/features/builtinDocumentAttribute.json AttributeReferenceProvider provides auto-completion when you want to reference an attribute (i.e.
VS code gives you the document (
I think we should use numeric values: |
When the built-in attributes come from builtinDocumentAttributeProvider and the file suggestions come from AsciidocProvider the context check is (current state) made in AsciidocProvider. Should we set the sort prefix on the attributes always (does that do any harm?) or do we need to have the context check in all the places (what I think would make things even harder to reason about)? |
I think that's fine, we can set an arbitrary value on built-in attributes and use a lower (or greater) value on other completion items. |
I'll try to set up a PR in the next few days. |
When trying to set this up, I found that in the context on an include the attributes are provided by If it is of interest to have the grouping for other reasons I could open up thePR, as I made the changes to |
I haven't tested it recently but I think you can show all the auto-completion items (from all the providers) if you explicitly type |
asciidoctor-vscode/src/features/builtinDocumentAttributeProvider.ts Lines 12 to 19 in b65f1c1
The attributes from the json file are only shown, when the line starts with a colon. Actually there are also duplicates then coming from the |
Oh that's right!
Do you have an example? We might need to use a Set to remove duplicates. |
In this case, built-in attributes must come first. Having said that, it does not make sense to display attribute references unless you want to use the value of an attribute in an attribute value:
Anyway, we should hide attribute references if the line only contains |
To clarify, the name is identical but the purpose is not the same so they are not duplicates.
|
I would like to suggest to show only relevant suggestions on include/image/video.
Preferably the file suggestions should appear before the attributes that may be relevant.
@Mogztter suggested
https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes-ref/
then we can decide which group(s) we want to enable on which context
for instance: compliance, localization and numbering attributes don't make much in the context of an include, image, video, link macro.
As far as I understand the workings, those items are provided by AttributeReferenceProvider
I do not have an idea how to check the context there, as the includes check that on their own in AsciidocProvider
I have seen prefixes beeing used to achieve sortOrder, but I don't have an idea on filtering by context. But maybe that is not even necessary when we have a meaningful order.
The text was updated successfully, but these errors were encountered: