withastro / compiler

The Astro compiler. Written in Go. Distributed as WASM.
Other
503 stars 59 forks source link

feat(tsx): Return interesting ranges for TSX output #931

Closed Princesseuh closed 11 months ago

Princesseuh commented 11 months ago

Changes

A common issue in the language server is it being hard to map things to the "frontmatter" of the TSX file because, well, we don't know where it is inside the TSX. This PR now returns the start and end of both the frontmatter and the body of the file, which the language server can use to map things.

This is for https://github.com/withastro/language-tools/pull/733

Testing

Added a test

Docs

N/A, I updated the types though

changeset-bot[bot] commented 11 months ago

🦋 Changeset detected

Latest commit: 9bb68490203414c0998297e17bc26840fb7f1863

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ----------------- | ----- | | @astrojs/compiler | Minor |

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

Princesseuh commented 11 months ago

Can we add a new test where we assert the ranges in case we don't have the frontmatter?

Added a test!