jparise / vim-graphql

A Vim plugin that provides GraphQL file detection, syntax highlighting, and indentation.
MIT License
487 stars 25 forks source link

Syntax highlighting for XML-like tags (in Vue SFCs) #106

Closed Charl13 closed 1 month ago

Charl13 commented 1 month ago

Hi,

First off, much appreciation for your work on this plugin.

Question, is it possible to have syntax highlighting in Vue SFCs when GQL is defined in XML-like tags?

For example, <gql>, <page-query> or <query>?

Thanks in advance

jparise commented 1 month ago

26 added support for GraphQL syntax within JavaScript template strings within Vue templates.

It looks like we'd need to build on top of something that provides the Vue SFC syntax, such as https://github.com/posva/vim-vue (which appears to be unmaintained). I don't use Vue myself so I'm just making an education guess / assumption here.

I don't think it would be the right decision to add first-class Vue SFC syntax support directly to vim-graphql to support this use case, but if it could be made simple enough, I'm open to considering it.

Charl13 commented 1 month ago

I don't think it would be the right decision to add first-class Vue SFC syntax support directly to vim-graphql to support this use case, but if it could be made simple enough, I'm open to considering it.

You're probably right. After some digging I found out that vuejs/language-tools provides that first-class Vue SFC syntax support through LSP. Parsing Vue SFCs seems a lot easier in Typescript because of the tools made available by the community.

It's even mentioned there in https://github.com/vuejs/language-tools/issues/358.