rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
160 stars 46 forks source link

Language Server loses context and starts spitting errors during debugging sessions #322

Closed luis-soares-sky closed 3 years ago

luis-soares-sky commented 3 years ago

While running a debug session in VS Code, the editor will often lose context of the project, and only one file (or set of files) will be considered.

The most recent time this happened, I happened to open a file inside a folder that's not included in bsconfig's files (it's within a build/ folder). While I'm not sure if it's related at all, I looked at the BrighterScript Language Server, and this was the output:

[01:33:41 PM] Loading 0 plugins for cwd "/Users/luis.soares/dev/my-project"
[01:33:41 PM] Parsing files
[01:33:47 PM] Validating project
[01:33:47 PM] Found 843 errors
[Error - 1:34:01 PM] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed with message: Cannot read property 'getCodeActions' of undefined
  Code: -32603 

(...and 8 more occurrances of the error above...)

[Error - 1:42:41 PM] Request textDocument/codeAction failed.
  Message: Request textDocument/codeAction failed with message: Cannot read property 'getCodeActions' of undefined
  Code: -32603 
[01:42:41 PM] Loading 0 plugins for cwd "/Users/luis.soares/dev/my-project/build/components/framework/utils"
[01:42:41 PM] Parsing files
[01:42:41 PM] Validating project

At 1:42 PM was when I opened the "external" file. Once I made changes to a file inside the project while it was running, errors started popping up as if it were the only file in the project (file not included anywhere else, non-declared methods, etc).

Restarting the language server solves the errors, but they pop back up under the right conditions (can't figure those out, but it always happens during debug).

luis-soares-sky commented 3 years ago

Sorry, opened on the wrong repo. Closing this one in favor of https://github.com/rokucommunity/vscode-brightscript-language/issues/294

elsassph commented 3 years ago

No that's the right place.

TwitchBronBron commented 3 years ago

This has been fixed in vscode-brightscript-language@2.17.1