Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 2 commits into from

Conversation

alamhubb
Copy link
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
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