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

interperet nothin -> false in client config response handling #696

Merged
merged 6 commits into from
May 24, 2020

Conversation

ZacLN
Copy link
Contributor

@ZacLN ZacLN commented May 13, 2020

julia-vscode/julia-vscode#1184 (comment)
This ignores the SL/DF-Options constructors that have been recently - ths seems like an LSP specific interface so shouldn't really sit in those packages.

@ZacLN ZacLN added the bug label May 13, 2020
@ZacLN ZacLN requested a review from davidanthoff May 13, 2020 06:32
@davidanthoff davidanthoff added this to the Current milestone May 13, 2020
davidanthoff
davidanthoff previously approved these changes May 13, 2020
Copy link
Member

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, @non-Jedi, do you also want to take a look?

@@ -103,9 +103,8 @@ function request_julia_config(server::LanguageServerInstance)
]))

server.format_options = DocumentFormat.FormatOptions(response[1:11]...)
server.runlinter = something(response[22], true)
server.runlinter = something(response[22], false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well crap. Is it just this setting that vscode sends null for false on, or is it all of them? I'll go reread the spec, but this smells like a spec-violation on the part of vscode.

@non-Jedi
Copy link
Member

Per the spec, a null value means that the client is unable to provide a setting which is semantically different from providing a false value.

If the client can’t provide a configuration setting for a given scope then null need to be present in the returned array.

Also note that this change by itself doesn't solve julia-vscode/julia-vscode#1184 since that issue is about "julia.lint.call" rather than "julia.lint.run".

So:

  1. Is this a reported, known issue on the vs-code side?
  2. Is there no way to workaround this in the vs-code plugin itself? It would be really nice if we didn't have to hurt spec-compliant clients because vs-code isn't complying with the spec.

@non-Jedi
Copy link
Member

One option that wouldn't break defaults for non-vscode clients would be to change all boolean config fields to be Ints instead with any value other than 0 being equivalent to true.

@ZacLN
Copy link
Contributor Author

ZacLN commented May 13, 2020

This still needs to be verified by another vscode user I think.

@ZacLN
Copy link
Contributor Author

ZacLN commented May 13, 2020

Also note that this change by itself doesn't solve julia-vscode/julia-vscode#1184 since that issue is about "julia.lint.call" rather than "julia.lint.run".

Thanks - I hadn't pushed a commit

@non-Jedi
Copy link
Member

This still needs to be verified by another vscode user I think.

Are you unable to replicate it locally?

@ZacLN
Copy link
Contributor Author

ZacLN commented May 13, 2020

I see this behaviour on my vscode setup, not sure anyone else has confirmed it on theirs? (specifically the returning of nulls instead of false)

@ZacLN
Copy link
Contributor Author

ZacLN commented May 18, 2020

I'd rather we changed it to "on"/"off" to be a bit more transparent - is that ok with you?

@non-Jedi
Copy link
Member

That's fine with me.

@davidanthoff
Copy link
Member

I'd rather we changed it to "on"/"off" to be a bit more transparent

Should we maybe first check with the MS guys whether there is some other way around this? If our current understanding of the situation is correct, I agree that "on/off" is a better option, but this is frustrating that one can't just use a bool and be done with it... Maybe we could even convince them to just change the implementation and fix this?

Changing all of these settings to "on/off" is also annoying because every user who adjusted those settings will have to update...

@marius311
Copy link

Just want to confirm that for me this PR fixes the inability to turn linting off that I mentioned on Slack and is mentioned in julia-vscode/julia-vscode#1184.

Would be great to get a fix in if possible, since this is a real "paper cut" bug I think alot of new users would probably hit.

@ZacLN
Copy link
Contributor Author

ZacLN commented May 21, 2020

OK, this definitely looks like a bug on the vscode side of things. I'm going to close this and put forward a pair of PRs for LanguageServer and julia-vscode that would move these configurations from bools to "on"/"off".

This feels like something that should be addressed rather quickly and I don't have a sense of how quickly changes would make their way through upstream. It's then an easy change to revert back when the bug is addressed. Thoughts?

@non-Jedi
Copy link
Member

non-Jedi commented May 21, 2020

@ZacLN why not just use this branch to do a release for vscode (and fix the obviously super obnoxious ux of not being able to turn off configuration options) and then wait and see if the upstream bug is quickly fixed before you next want to do a real LanguageServer.jl release? That way we potentially avoid people having to redo their config.

@ZacLN
Copy link
Contributor Author

ZacLN commented May 21, 2020

I'm amenable to that, @davidanthoff ?

@davidanthoff
Copy link
Member

Yes, I would much prefer that we stick with bool and true/false, and my understanding is that this PR here works around the bug in VS Code, right? So I would go with that strategy for now.

Normally up stream is super fast in addressing stuff. I'm sure if we were to open a PR ourselves that fixes the problem, it could be shipped very quickly. Also, because this is a bug in the vscode-languageclient npm package, we might not even have to wait for a VS Code release, I think they can release a bug fix release of that package independently from VS Code releases.

Also very much agree that we should ship this ASAP!

davidanthoff
davidanthoff previously approved these changes May 23, 2020
Copy link
Member

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s merge this, just to fix this for now and so that we can push out a new release soon.

@ZacLN
Copy link
Contributor Author

ZacLN commented May 24, 2020

I think @non-Jedi's proposal was that we use this branch in the snapshot for a julia-vscode release rather than merging this

@davidanthoff
Copy link
Member

I don’t think we can ship a branch, there is a fair bit of tooling in place on the extension side that assumes we ship master, and with our regular releases it would be painful to work around that.

Can we put the content of this branch behind an if clause that checks InitializeParams. clientInfo.name so that we only use this implementation if the client is VS Code? Presumably VS Code sends that field?

But in any case, we should ship something ASAP, right now users on the released version can’t change any of these settings and we also have crash reports because somewhere there is a call to a method with the wrong number of args in the currently shipping version.

@ZacLN let me know if you want me to do something about this PR if you are busy!

@ZacLN
Copy link
Contributor Author

ZacLN commented May 24, 2020

OK, I've amended as above

Copy link
Member

@davidanthoff davidanthoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah!

@davidanthoff davidanthoff merged commit 9e8c24c into master May 24, 2020
@davidanthoff davidanthoff deleted the configfix branch May 24, 2020 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants