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

Don't show a source if diagnostic doesn't have a source #2119

Merged
merged 16 commits into from
Nov 26, 2022
Merged

Don't show a source if diagnostic doesn't have a source #2119

merged 16 commits into from
Nov 26, 2022

Conversation

Sainan
Copy link
Contributor

@Sainan Sainan commented Nov 18, 2022

Looks better & it's the same as what VS Code does.

plugin/core/views.py Outdated Show resolved Hide resolved
@rchl
Copy link
Member

rchl commented Nov 20, 2022

Needs some more work to address various places that show that info.

For example the diagnostics quick panel shows some stray : in the list and somewhat weirdly spaced (or unwanted) : in the annotation below the list:

Screenshot 2022-11-20 at 15 01 48

Hover info also missing space in that case:

Screenshot 2022-11-20 at 15 07 53

For reference, diagnostics panel looks like this without source but with code.

Screenshot 2022-11-20 at 15 02 11

plugin/core/views.py Outdated Show resolved Hide resolved
@rchl
Copy link
Member

rchl commented Nov 20, 2022

I would probably go with a much simpler solution that uses server name (configuration.name) when source is missing. As you can see from my previous comment, your approach is riddled with edge cases because source is entangled with other diagnostic properties.

@Sainan
Copy link
Contributor Author

Sainan commented Nov 20, 2022

I'd like to get this behaviour right because there is no need to show a source and getting this behaviour to be closer to VS Code would be better for overall "LSP compliance" I suppose.

Gonna dump some comparisons between LSP 1.20 and VS Code here to highlight the differences.

no "source" or "code"
image
image

"code", no "source"
image
image

"source" and "code"
image
image

I'll try my best to patch this into the LSP plugin.

@rchl
Copy link
Member

rchl commented Nov 20, 2022

I'll try my best to patch this into the LSP plugin.

Then maybe LSP should follow VSCode here and use parenthesis for code since it perhaps wouldn't be so clear otherwise when there is code but not source.

@Sainan
Copy link
Contributor Author

Sainan commented Nov 20, 2022

Using parenthesis now. Only caveat is that the link in the diagnostics panel includes the parenthesis:
image
image

@rchl

This comment was marked as resolved.

@rchl
Copy link
Member

rchl commented Nov 20, 2022

Using parenthesis now. Only caveat is that the link in the diagnostics panel includes the parenthesis:

You should be able to adjust the syntax file to address that.

@Sainan
Copy link
Contributor Author

Sainan commented Nov 20, 2022

There should be some contrast between the message and the source/code part since now it looks like part of the sentence.

but the source/code part does appear to be slightly darker? So I didn't introduce this issue.

@Sainan
Copy link
Contributor Author

Sainan commented Nov 20, 2022

You should be able to adjust the syntax file to address that.

I don't know what this means. For context, before I patched this plugin, I had no experience with Python or the Sublime API, and I'm still just verifying my changes by opening the .sublime-package in 7zip, replacing the files, and restarting ST.

@rchl
Copy link
Member

rchl commented Nov 20, 2022

You should be able to adjust the syntax file to address that.

I don't know what this means.

Actually it's a phantom so it's even easier to change. I'll make a comment in relevant place.

plugin/core/views.py Outdated Show resolved Hide resolved
plugin/core/windows.py Outdated Show resolved Hide resolved
plugin/core/views.py Outdated Show resolved Hide resolved
plugin/core/views.py Show resolved Hide resolved
plugin/core/views.py Outdated Show resolved Hide resolved
plugin/core/views.py Outdated Show resolved Hide resolved
plugin/core/views.py Outdated Show resolved Hide resolved
@rchl
Copy link
Member

rchl commented Nov 20, 2022

Screenshot 2022-11-20 at 19 41 37

Ignoring the part in red, the annotations on the right of diagnostics don't look very readable with parenthesis. We can't use HTML in that area so we can't adjust contrast here. I wonder whether presenting in this place specifically (or even in every place) should have space before (...

@Sainan
Copy link
Contributor Author

Sainan commented Nov 20, 2022

Ignoring the part in red, the annotations on the right of diagnostics don't look very readable with parenthesis. We can't use HTML in that area so we can't adjust contrast here. I wonder whether presenting in this place specifically (or even in every place) should have space before (...

Before & after my changes
image
image

@rchl
Copy link
Member

rchl commented Nov 20, 2022

Ignoring the part in red, the annotations on the right of diagnostics don't look very readable with parenthesis. We can't use HTML in that area so we can't adjust contrast here. I wonder whether presenting in this place specifically (or even in every place) should have space before (...

You can ignore that part for now. We'll maybe tweak it later.

@rchl rchl merged commit 658fcfe into sublimelsp:main Nov 26, 2022
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.

3 participants