feature: cross-language parsing support for the server
- Dominant language
- TypeScript
- Stars
- 16.9k
- Forks
- 1.9k
- Avg merge
- 22h 45m
- Merged PRs (30d)
- 70
Description
it should be a standalone, runtime agnostic library that acts as a canonical reference implementation for reliably parsing various language ASTs across languages. if someone wants to add wide-reaching LSP/general AST support for a language, they would add it here. same with adding new template tag/other delimiter patterns.
the library should, given a content string and URI, be able to detect whether the extension is a supported language, and respond with an array of something like [this CachedContent type](https://graphiql-test.netlify.app/typedoc/modules/graphql_language_service_types.html#cachedcontent):
```ts
type CachedContent = {
range: Range,
content: string // raw embedded graphql string, don't need to parse this yet
}
type parseEmbeddedGraphQL = (content: string, uri: string) => Promise
```
we should use https://github.com/tree-sitter/tree-sitter as per many recommendations
we can use node.js or WASM bindings, for usage in language server at first, and monaco mode eventually.
we could also add this to graphql-config, to allow it to consume a wide range of languages performantly, and then be able to `project.loadDocuments()` across a wide range of languages
Contributor guide
Assessment
This issue has not been assessed yet.