VSC shows errors for lines that are deleted even after a save

  • Platform information:OPenhabian 2.5.3
  • Hardware: _Pi4
  • Issue of the topic: VSC shows errors for lines in files that have been deleted even after saving ths file. Restarting VSC does eliminate the errors. I’ve noticed that VSC seems to loose state from time to time with PIO and C++ code and there is a clear button that seems to just reset all the error and check again. Is there a similar way to freshen it up for OH?

I also get this message when attempting to use the error message to navigate to the coding error

Hey @MickPB

I can only imagine that some caching is going on there.
You are using the remote lsp and we have (state now) no programmatical influence on the behavior.

What our vcscode extension does with remote LSP:

  • Start a connection to your openHAB instance on LSP port
  • That’s it
  • Everything else is in the background (done by standard lsp packages available from Microsoft

What we could try in the future is to reconnect on purpose.
This may help solve the problem since you say that restarting helps out.

About your last picture:

This is a known issue which remains unadressed currently due to the same situation.
The error reponse is send from your remote LSP server with the corresponding paths from your openHAB environment.
That’s the reason vscode doesn’t know those paths and the files.

Thank you for filling me in on this.
Beggers should should not be picky but this is happens as often as every 5-10 minutes. I have done programming before and am comfortable around most aspects of home automation in general but I’ve never programmed with the object / state model before, I am having a tough time with the syntax and it is really discouraging and confusing to find out that I’ve tried 2-3 things and continue to get same error only to discover that I really need to restart VSC again.
Maybe if there was a list of these common issues I could see that I am near the top of the mountain but feel like I am sliding down currently. Is there a list of know issues that I am not finding? Is there a way I could do something to help figure out the issue with VSC and LSP?

I have a list for common erros on my todo list for a long while,
but didn’t invest the time for it yet to be honest.

I can’t tell you or anyone much about the LSP stuff built inside the extension.
None of the LSP contributions were made by myself and i am not really familiar with it.
Due to the increasing problems it causes i started digging into it a bit and was able to fix some small problems.

As said above, we could add something similar like PIO which stops the remote connection and starts it again.

AS you can see here:

There is no stop method implemented currently.
So we would have to add that method (or call) and Build some kind of BUtton in the status bar,
which runs the stop and start methods.

We could also think about doing this via a configurable interval in the future.

When you are fimiliar with programming and you are not feared of typescript, i am always glad for any help and imrovements for the extension. :smiley:

A bit of humor - If your waiting for me to understand that - I can almost ensure you all the other problems of the world will also be solved when I have this understood. Thanks for working on this.

Also - cannot say for sure but if anyone else reads this, I removed and reinstall the OH extension in VSC and it seems to work quite a bit better.

No i don’t wait or expect you to look at this file for the first time and understand it then. :slightly_smiling_face:

The important part is also written in the post.
We should have the ability to do something about this.