Repository navigation
feat: add Svelte and Vue (SFC) language support - #1289
Conversation
|
@youdie006 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
👋 Thanks for contributing to CodeGraphContext! Since this PR was opened, |
Add .svelte and .vue parsers to the AST indexer. A shared sfc_common helper splits the single-file component into <script>/<template>/<style>, detects lang=ts, and pads the script block so the delegated JavaScript/TypeScript parser line numbers map back to the SFC. svelte.py and vue.py mirror the existing html.py module shape and register in the tree-sitter manager, parser dispatch, graph builder, and pre-scan. Grammars load from tree-sitter-language-pack. Adds SFC parser unit tests. Closes CodeGraphContext#709
714cdb1 to
34a250e
Compare
|
Thanks for the heads-up, @Shashankss1205! Rebased onto the latest |
A non-UTF-8 .vue/.svelte file must degrade to lost bytes, not a lost file; tests/unit/tools/test_parser_encoding_resilience.py enforces this for all language parsers. Co-Authored-By: Claude Fable 5 <[email protected]>
…heck scans every open( call Co-Authored-By: Claude Fable 5 <[email protected]>
Shashankss1205
left a comment
There was a problem hiding this comment.
Reviewed and verified locally — parser + tools suites green after two tiny follow-up commits I pushed to your branch (errors="ignore" on the SFC read/write handles, required by our parser encoding-resilience check). Really nice design delegating to the JS/TS parsers with line padding.
|
Thanks @youdie006 for this contribution — merged! 🎉 Svelte and Vue support is a great addition, and the SFC delegation design is elegant. We'd love to have you contribute back again — feel free to pick up another open issue! |
Summary
.svelteand.vuefiles were not indexed because there were no parsers for them (#709).Fix
Add Svelte and Vue single-file-component support to the AST indexer:
tools/languages/sfc_common.py: splits the SFC into<script>/<template>/<style>, detectslang="ts", and pads the script block with leading blank lines so the delegated JavaScript/TypeScript parser's line numbers map back to the SFC with no per-symbol arithmetic.tools/languages/svelte.py,vue.py: thin parser classes mirroring the existinghtml.pyshape; script extraction delegates to the JS/TS parsers..svelte/.vue-> language), and pre-scan. Grammars load fromtree-sitter-language-pack.Adds SFC parser unit tests (script symbols, TS scripts, dispatch, pre-scan).
Closes #709