Open pengsongkun741 opened 2 years ago
Excuse me, VSCode also uses TSServer, but why is there no such problem? Seeing that this problem has been postponed to the 4.6.0 version of the plan. Can you tell us some information about this problem and see if we can temporarily solve this problem with other solutions, thank you!
Bug Report
I want to implement the code coloring function through TSServer, but I found that when the text contains Chinese, the data obtained is biased. If Chinese is not included, then the function is normal. In the case that the code contains Chinese, each Chinese character will cause the offset of the token to be 1 more than the correct value.
π Search Terms
TsServer Semantic Token Classifications Parsing Chinese error
π Version & Regression Information
TypeScript Version:"4.4.3"
β― Playground Link
This is a problem with the grammar parser and cannot provide code examples
π» Code
This is the Json data communicated with TsServer
Containing Chinese
documentChange:
Request-encodedSemanticClassifications-full:
Response-encodedSemanticClassifications-full:
Does not contain Chinese
documentChange:
Request-encodedSemanticClassifications-full:
Response-encodedSemanticClassifications-full:
As can be seen from the above data, the length of the text sent is consistent with the content of the semantic markup request. However, in the case of including Chinese, the data obtained with semantic markup is biased
π Actual behavior
π Expected behavior