Closed with-heart closed 3 months ago
Latest commit: e501f8c955d4e800ca2206025beeb30e229e720c
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The accurateErrors
fixture from remark-shiki-twoslash
is failing, but I'm not entirely sure why. After removing all the noise, here's the diff:
- <data-lsp lsp='const todo: Readonly<Todo>' >todo</data-lsp>.<data-err><data-lsp lsp='(property) title: any' >title</data-lsp></data-err>
+ <data-lsp lsp='const todo: Readonly<Todo>' >todo</data-lsp>.<data-lsp lsp='(property) title: any' >title</data-lsp>
It shows that it's not rendering title
in todo.title = 'Hello'
as an error, but if I drop that fixture in a twoslash block in a local app using these these changes (with remark-shiki-twoslash
), title
is highlighted just fine:
Any ideas?
Oof, not sure when I'll find time to dig into this properly - this section of code is super gnarly and not an area I fully grok anymore
This PR resolves #144 by creating a new function that checks whether each token is within the range of an error (
e.character
toe.character + e.length
). Checking the range produces the correct results (T[Key]
is highlighted as an error):This function replaces
findTokenFunc
only when handling errors (lsp responses + queries still usefindTokenFunc
).I also added
isTokenWithinErrorRangeDebug
which is similar tofindTokenFuncDebug
for any future debugging needs.