microsoft / vscode-languageserver-node

Language server protocol implementation for VSCode. This allows implementing language services in JS/TS running on node.js
MIT License
1.41k stars 320 forks source link

fix “Semantic tokens that are not in ascending order will not be highlighted” #1467

Closed imbant closed 2 months ago

imbant commented 2 months ago

Hi. This PR is to fix this issue.

The problem is that when push() is called out of order, _data does not collect the input token correctly.

So I add a non-delta-encoded data attribute _dataNonDelta, which is used when the push() function is called in non-character stream order; it is eventually delta-encoded in build() or buildEdits().I hope this change doesn't affect any places that previously output _data.

If push() is called in order, we still use _data and it works the same as before.

For the implementation of _sortAndDeltaEncode, I refer to the vscode source code here

imbant commented 2 months ago

@microsoft-github-policy-service agree

dbaeumer commented 2 months ago

Thanks for the PR. Highly appreciated. See my minor review comments.

imbant commented 2 months ago

Thanks for the review. I will resolve it later

imbant commented 2 months ago

@dbaeumer Hi. Please see my latest commit. Thanks.