Minor format tweak and off-by-one fix #472
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Firstly, thank you for developing this plugin, and for all the work you've obviously put in to the rewrite. v3 is great ❤️
This PR just makes a minor tweak and fixes an off-by-one error.
The off-by-one is for the
[row, col]
display.ctx.item.pos
seems to be(1, 0)
indexed, so the+1
should be on the column, not the row.The tweak is for the formatting of an item's "source". Currently there are three different ways this is displayed:
What I've done is change the LSP format strings to be more like the diagnostics one. This is what looks the nicest imo, but I don't really have a strong opinion here so if you feel differently then I don't mind changing it.
I've also changed the diagnostic formatting, so that the brackets around the code are also highlighted as a comment. Currently the brackets are shown as normal text, which looks a bit off to me, but again it's not a big deal and I wouldn't mind changing/reverting it.
These changes seem to work for me, but the code is quite complicated and I don't really understand much of what's going on - so it's very possible I've done something very wrong or missed something. Please feel free to fix/change anything if needed.