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

do not duplicate attributes on include suggestion #620

Closed
eiswind opened this issue Aug 14, 2022 · 4 comments
Closed

do not duplicate attributes on include suggestion #620

eiswind opened this issue Aug 14, 2022 · 4 comments
Labels

Comments

@eiswind
Copy link
Contributor

eiswind commented Aug 14, 2022

In asciidoc.provider.ts

const globalVariableDefinitions = documentText.match(/:\S+:.*/g)

leads to duplicate entries in the suggestions when i define an attribute in the same file.

:srcdir: ../two

include::{srcdir}/

Bildschirmfoto vom 2022-08-14 16-28-08

and further down it appears again (coming from a different provider)

Bildschirmfoto vom 2022-08-14 16-28-22

@ggrossetie
Copy link
Member

We should not use a regular expression. Instead, we should use Asciidoctor.js to parse the AsciiDoc document using the header_only option. Then, we can retrieve attributes using: Document#getAttributes

@ggrossetie
Copy link
Member

It might be because attributeReferenceProvider will return it as well:

export class AttributeReferenceProvider {

We should probably remove const globalVariableDefinitions = documentText.match(/:\S+:.*/g).

I think we should revise our completion item providers to make sure that we don't return the same items more than once.

@eiswind
Copy link
Contributor Author

eiswind commented Aug 15, 2022

That's the case. The duplicate comes from AttributeReferenceProvider.

@ggrossetie
Copy link
Member

It should be better in the latest version. Feel free to open a new issue if we can improve it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants