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

support autocompletion/hinting #51

Open
Morriz opened this issue Feb 26, 2023 · 6 comments · May be fixed by #117
Open

support autocompletion/hinting #51

Morriz opened this issue Feb 26, 2023 · 6 comments · May be fixed by #117
Assignees

Comments

@Morriz
Copy link

Morriz commented Feb 26, 2023

Like the title says. I don't know how that is done best for extensions, but I've seen it done via published openapi definitions.

@alixander
Copy link
Contributor

alixander commented Feb 26, 2023

i'm not sure either but i always thought we'd need an LSP for it (which we'll definitely want to do). like when the editor is trying to autocomplete a "shapes" value, i don't think it'd be able to know to pull from list of shape values for autocomplete with just openapi definitions.

@Morriz
Copy link
Author

Morriz commented Feb 26, 2023

Yeah, nested structures could not be mapped with openapi alone I guess. But I guess it is not rocket science to set up a language server. Probably tedious work.

@alixander
Copy link
Contributor

yeup, i'll leave this open as it eventually will be vscode task, but we have one for LSP in d2: terrastruct/d2#104

@BarryNolte
Copy link
Collaborator

When I have time, I'll setup a branch that has the framework for an LSP on the client side. The hard part is going to be the "error tolerant parser" on the server side :)

https://code.visualstudio.com/api/language-extensions/language-server-extension-guide

@BarryNolte
Copy link
Collaborator

BarryNolte commented Jul 7, 2023

@alixander and @gavin-ts

I have branches in both D2 and D2-VSCODE called LanguageServer that have a working language server. Please check them out. Have the following working:

  1. Errors shown without a preview being created
  2. Import links can be opened, "foo: @BarryNolte " will underline "barrynolte" and allow for a ctrl+click to open "barrynolte.d2".
  3. Rename works, so if you have multiple "x: ...", "x.style...", etc, you can rename "x" and and have it change everywhere.
  4. Find All References works.

Check it out.

I'll try to work on autocomplete for styles if I can figure out what to trigger it on.

@gavin-ts
Copy link
Contributor

So these would be the 2 PRs right? We can create these to review/work on

terrastruct/d2@master...BarryNolte:d2:LanguageServer

master...BarryNolte:d2-vscode:LanguageServer

@BarryNolte BarryNolte linked a pull request Aug 8, 2023 that will close this issue
@BarryNolte BarryNolte self-assigned this Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants