Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Only enable diagnostics and fix settings change detection - #298

Merged
Jake Bailey (jakebailey) merged 3 commits into
microsoft:masterfrom
jakebailey:diagnostics-simple
Oct 23, 2018
Merged

Jake Bailey (jakebailey) merged 3 commits into
microsoft:masterfrom
jakebailey:diagnostics-simple

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Fixes #242.

#289 causes a few issues to do with parser-generated diagnostics, and there are more diagnostics I wasn't aware of coming from ErrorSink. This is a simplified PR that does the minimum to enable diagnostics (ignoring "Unspecified" at publish time) and fixes the setting change bug.

We'll have to revisit where diagnostics should be stored to access via code actions in a different PR. There are only two diagnostics that actually come out of the server which can be disabled with python.analysis.disabled for now.

I'll close #289 in favor of this one.

@jakebailey Jake Bailey (jakebailey) changed the title Only enable diagnostics and fix settings change detection [WIP] Only enable diagnostics and fix settings change detection Oct 22, 2018
@MikhailArkhipov

Copy link
Copy Markdown

Test would be good. Like declare a variable, observer squiggly, change file, squiggly goes away, change back, it reappears. Alexander Sher (@AlexanderSher) - do we have something like this for unresolved imports?

@jakebailey

Copy link
Copy Markdown
Member Author

There are a few tests in LanguageServerTests already which do checks on the diagnostics. I can just add another one for the settings change.

@jakebailey

Jake Bailey (jakebailey) commented Oct 22, 2018 •

Copy link
Copy Markdown
Member Author

Okay, maybe not as simple as I thought. The test helper SendDidChangeConfiguration only accepts completion options, then reimplements part of DidChangeConfiguration, specifically the part that I'm trying to test... So I'll have to do some extra work to actually give the server a proper config change message to run the real code.

Eh, it's overloaded. Could still be improved.

@jakebailey Jake Bailey (jakebailey) changed the title [WIP] Only enable diagnostics and fix settings change detection Only enable diagnostics and fix settings change detection Oct 22, 2018
@jakebailey

Copy link
Copy Markdown
Member Author

I've added a test which changes the settings and re-checks the diagnostics. The overall diagnostic testing code and settings editing code is really strange, though, and could probably be improved.

All of the "work" for changing settings is actually done in ServerBase at the RPC method level on the JToken. It'd be nice if all of that hand-written JToken decoding was done automatically so that the tests could actually call it...

@jakebailey
Jake Bailey (jakebailey) merged commit 48c406e into microsoft:master Oct 23, 2018
@jakebailey
Jake Bailey (jakebailey) deleted the diagnostics-simple branch February 14, 2019 20:12
Jake Bailey (jakebailey) added a commit to jakebailey/python-language-server that referenced this pull request Nov 1, 2019
)

Fixes microsoft#242.

microsoft#289 causes a few issues to do with parser-generated diagnostics, and there are more diagnostics I wasn't aware of coming from ErrorSink. This is a simplified PR that does the minimum to enable diagnostics (ignoring "Unspecified" at publish time) and fixes the setting change bug.

We'll have to revisit where diagnostics should be stored to access via code actions in a different PR. There are only two diagnostics that actually come out of the server which can be disabled with `python.analysis.disabled` for now.

I'll close microsoft#289 in favor of this one.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show warning for undeclared variables

2 participants