CFiggers / vscode-janet-plus-plus

Janet language support for Visual Studio Code
Other
10 stars 2 forks source link

New local imports not picked up by the LSP #17

Open jangler opened 6 months ago

jangler commented 6 months ago

I added a new module to my local code during a session. Janet++ told me the imported bindings didn't exist. Restarting VS Code fixed the problem.

I'm using the v.1.1.2 prerelease.

jangler commented 6 months ago

This also applies when adding a new binding to an imported module during an editing session.

CFiggers commented 6 months ago

Adding a new import should clear up diagnostic errors for symbols added by that import. I have seen that work before, so this behavior might be either a new regression with v1.1.2 or an inconsistent bug.

If you have a minimal repro that consistently fails to work, that would be helpful.

As for updates to project-local files, a current workaround is to import local files with :fresh true so that the LSP will reload them after you've made changes.

To address this (and a few other issues) more permanently, I'm considering experimenting with throwing away the current environment table with every new flycheck/diagnostic evaluation of user code by the LSP. More experimentation needed.

jangler commented 6 months ago

I think it's an inconsistent bug -- I encountered it multiple times, but not every time I added a new def to an imported module. I'll let you know if I encounter a reproducible case.

CFiggers commented 6 months ago

That would be great, thanks!

CFiggers commented 5 months ago

Hi @jangler —I never got a solid repro on this bug, but with the new way of handling diagnostics in pre-release version 1.1.3 it shouldn't happen any more anyway (we're now throwing the environment table away and starting fresh with every eval, so imports should register changes dynamically). Check it out in the Extension Marketplace and let me know if you have any feedback!

jangler commented 5 months ago

I don't have any active Janet projects, but I'll let you know if I encounter this issue next time I'm working on one!