Skip to content

Updated @volar/source-map/README based on PR(#207)#247

Closed
alamhubb wants to merge 2 commits into
volarjs:masterfrom
alamhubb:master
Closed

Updated @volar/source-map/README based on PR(#207)#247
alamhubb wants to merge 2 commits into
volarjs:masterfrom
alamhubb:master

Conversation

@alamhubb
Copy link
Copy Markdown
Contributor

Hello, I'm trying to develop a custom syntax lsp plugin based on ts recently, using volar.js, which is really great, saving me a lot of work and letting me learn a lot.

I'm learning about the functions of the code mapping related parts, and I found that the document description in

https://github.com/volarjs/volar.js/blob/master/packages/source-map/README.md

and the code implementation in

https://github.com/volarjs/volar.js/blob/master/packages/source-map/lib/sourceMap.ts are inconsistent, so I tried to synchronize this document

There is also a about

* findMatchingStartEnd(

* findMatchingStartEnd I am a little confused about this method. I see that in this method, when fallbackToAnyMatch = true is judged, it will break if it matches one, but the non-fallbackToAnyMatch code block above does not break. What is the reason?
I am also curious about the situation where there will be a start and end position of the source code, corresponding to the start and end positions of multiple generated codes.

@alamhubb alamhubb changed the title Updated documentation based on PR(#207) Updated @volar/source-map/README based on PR(#207) Nov 18, 2024
@alamhubb alamhubb closed this Nov 18, 2024
@johnsoncodehk
Copy link
Copy Markdown
Member

johnsoncodehk commented Dec 13, 2024

@alamhubb Sorry for the delay, would you like to reopen this PR? never mind, I see #248. :)

* findMatchingStartEnd I am a little confused about this method. I see that in this method, when fallbackToAnyMatch = true is judged, it will break if it matches one, but the non-fallbackToAnyMatch code block above does not break. What is the reason?

The mapping between virtual code and source code may be discrete or continuous. Some functions should only be mapped in a continuous range (such as formatting). fallbackToAnyMatch is used to control whether to try to map start/end to a discrete mapping range when a continuous mapping range cannot be successfully mapped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants