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

autocomplete for attributes #243

Closed
rdmueller opened this issue Apr 6, 2019 · 16 comments
Closed

autocomplete for attributes #243

rdmueller opened this issue Apr 6, 2019 · 16 comments

Comments

@rdmueller
Copy link
Member

would be great if the editor pane would support auto-complete for defined attributes

@ahus1 ahus1 changed the title Future-Feature: autoc-omplete for attributes Future-Feature: autocomplete for attributes Apr 9, 2019
@rdmueller
Copy link
Member Author

I just noticed that there is already autocompletion for available files for include:: and image:: macro.

Is it possible to use this to generate the autocomplete for attribute which are defined in the same file?

To be more specific for this feature:

Imagine you have a file like this

:url1: https://google.com
:url2: https://github.com

Lorem Ipsum
Link to google is {

and as you can see, in the example, it would be great to get with opening the { a list of available attributes from within the file (url1, url2). Perfect would be if their value would also be displayed.

@mojavelinux
Copy link
Member

I 100% support this idea. Keep in mind, you may want to include the built-in (aka predefined) attributes to this list.

@mojavelinux
Copy link
Member

To add to that point, this feature gets us one step closer to an "IDE for writers".

@ahus1
Copy link
Contributor

ahus1 commented May 13, 2019

@mojavelinux Where would I find a list of all predefined attributes?

@rdmueller would it be ok if I would present attributes that are defined in any of the files in the project? Assuming that people work with includes in larger projects, this might make sense?!

@mojavelinux
Copy link
Member

If you've parsed a blank document, these attribute names are available via Document#getAttributes(). Otherwise, they are listed here: https://asciidoctor.org/docs/user-manual/#attribute-catalog

@rdmueller
Copy link
Member Author

@ahus1 : Inthought it would be easier to only display the attributes of the current document to get started. Also, if the value is displayed (which is quite important in my example) this could betricky with the attributes of any document. But if this is easier, go ahead!

@ahus1
Copy link
Contributor

ahus1 commented May 14, 2019

@rdmueller - most of what is needed for a first implementation to auto-complete the variable names from the current and other files is in 071a295 (this includes one or two refactorings that won't be necessary here any more) and 6bdb22c (a little addendum in ).

From there the course can continue to add current values and variable descriptions - but that's a second step.

@bbrenne
Copy link
Contributor

bbrenne commented May 23, 2019

I created a pull request with lexer and highlighting for attributes #260. No auto-complete or "link" for now (there should be 2 auto-complete , one for the reference and one for the declaration (:toc: for example) ).

@bbrenne
Copy link
Contributor

bbrenne commented Jun 21, 2019

#277

@ahus1
Copy link
Contributor

ahus1 commented Jun 23, 2019

@bbrenne - thank you for this PR, I just merged it. It provided documentation for all built-in attributes and autocomplete.
I won't close this issue as find usages and rename is not supported yet. Do you want to give it a try?

@ahus1
Copy link
Contributor

ahus1 commented Jun 23, 2019

@bbrenne - I'm on a train and gave it a try, will commit it soon.

@ahus1 ahus1 changed the title Future-Feature: autocomplete for attributes autocomplete for attributes Jun 23, 2019
@ahus1
Copy link
Contributor

ahus1 commented Jun 23, 2019

Thank you to @bbrenne for contributing this change!

Autocomplete for attributes works now for built-in-attributes when defining them (inside ":").

Autocomplete for attributes that are defined within the projects works (inside "{}")

Built-In attributes have documentation (Alt-Q on Windows).

Renaming of variables and find-usages works as well.

autocomplete-with-docs
doc-in-editor

This is part of pre-release 0.28.4. It is available from GitHub releases and the IntelliJ AsciiDoc EAP repository.

Please give it a try for corner cases and usability. Comment in this ticket with regarding what you experience vs what you expect.

@rdmueller
Copy link
Member Author

Wow. this is all so cool and more than I had imagined!

But I still have to figure out how the documentation Feature (Alt-Q) works. doesn't work for me yet...

@rdmueller
Copy link
Member Author

found it (Help -> find action): my shortcut on windows for Quick Documentation is Ctrl-Q.
works like a charm and is super useful!!!

@rdmueller
Copy link
Member Author

So, I opened up this issue and I am more than happy with the results.
From my point of view, this issue can now be closed

@ahus1
Copy link
Contributor

ahus1 commented Jun 24, 2019

@rdmueller - it was always Ctrl-Q, my mistake. Happy to hear you like it. Kudos to @bbrenne!

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

No branches or pull requests

4 participants