This repository has been archived by the owner on Apr 4, 2023. It is now read-only.
Send replacement spans in response, fixes a whole class of issues #156
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.
Well that was a long journey....
But I think I've managed to fix it.
working.2.mp4
After some long debugging I was able to see that
replacementSpan
s weren't being sent to VSCode. Causing VSCode falling back to defaultSpans which weren't very good. Basically it was falling back to appending the value on the end instead of replacing the word left of the cursor. This problem is 2-fold because VSCode uses the replacement span information to know how to filter-down the results the language server sends. So results in the UI were also bad because of there being no spansThe offset being sent was wrong, I was able to figure out that it was off by 7 characters which coincidently is the same length of the document wrapper, so I have deducted that which gives much better results.
Fixes: styled-components/vscode-styled-components#322
Fixes: microsoft/vscode#134328 (comment)
Fixes: styled-components/vscode-styled-components#325
Fixes: styled-components/vscode-styled-components#302
Fixes: #155
Fixes: #141
Fixes: #153
I need a lie down now
@mjbvz hopefully you can take a look at this