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

Move rubocop file watching into the server #1921

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Earlopain
Copy link
Contributor

Motivation

For #1457. Need to figure out how to clear old diagnostics after the config has been changed. Otherwise the user can see stale diagnostics.

Implementation

Automated Tests

Manual Tests

@Earlopain Earlopain marked this pull request as draft April 12, 2024 08:12
@Earlopain Earlopain requested a review from a team as a code owner April 12, 2024 08:13
@Earlopain Earlopain requested review from andyw8 and st0012 April 12, 2024 08:13
@vinistock
Copy link
Member

vinistock commented Apr 12, 2024

To clear old diagnostics, you can just publish an empty array. We do this when files are closed

send_message(

@Earlopain
Copy link
Contributor Author

This isn't really working. Even though the notification is being pushed the diagnostics still remain. In fact, if I remove the call to textDocument/publishDiagnostics diagnostics still disappear when closing the file, so it looks like this isn't really doing anything.

My theory is that since diagnostics are pulled, the client isn't really interested in what the server has to say? Not coming up with much else.

@vinistock
Copy link
Member

I wonder if this isn't a bug in the language server node package. There's no mention in the spec that pull diagnostics can't be cleared by a publish notification. And the documentation for publish explicitly mentions that pushing an empty array will clear previously existing diagnostics. It might be worth asking in https://github.com/microsoft/vscode-languageserver-node.

Another option, which might work (hopefully), is to collect diagnostics after re-creating the RuboCop instance and try to push the violations using the new configuration. Although, we may find ourselves in a similar situation if no diagnostics are collected after the configuration change.

@Earlopain
Copy link
Contributor Author

I'll try to check that out sometime. Gonna dig around a bit beforehand. There are a few references to publishDiagnostics, I might find something

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

Successfully merging this pull request may close these issues.

None yet

2 participants