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

Valid scoped bindings are autocompleted to matching top-level bindings #19

Open
jangler opened this issue Jan 12, 2024 · 1 comment
Open
Assignees

Comments

@jangler
Copy link

jangler commented Jan 12, 2024

For instance, I have a local variable called retry. When I write the name of the variable and press enter, it's auto-expanded to render-texture-ready? from jaylib. Top-level bindings don't seem to have this problem.

@CFiggers
Copy link
Owner

At present, Janet LSP (the embedded language server that provides both autocompletion and diagnostic errors for Janet++) is too simple to provide any autocompletion or hover documentation on scoped variables at all.

You can test this yourself:

  1. Declare any function or variable inside of a top-level do block

  2. Try to trigger autocomplete or hover documentation on that variable

=> It won't work

The reason for this is simple. Janet LSP is not a full-fledged static analyzer for Janet—it merely uses a Janet runtime to evaluate forms and return parser/compiler errors as raised by Janet itself.

Since Janet itself scopes variables properly (as you would expect it to—def'ing a variable inside a do block at the REPL will not add that variable to the top-level environment either) Janet LSP does not have the ability to recognize scoped symbols and return them to autocomplete requests.

Better behavior on this is definitely something I'd like to see and will at some point work towards. That said, this one might sit open for a while (feel free to hack on Janet LSP directly—it's written in Janet!).

@CFiggers CFiggers self-assigned this Jan 12, 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

No branches or pull requests

2 participants