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

Better code completion providers #729

Open
timdmackey opened this issue May 3, 2023 · 0 comments
Open

Better code completion providers #729

timdmackey opened this issue May 3, 2023 · 0 comments

Comments

@timdmackey
Copy link

Like many others, I've come to love the code completion abilities provided by previous Shopify extensions for VSCode. It's really nice to be able to type something as simple as "ca⇥" and have VSCode output a complete case tag/block.

With that in mind, I've been playing around with the language server in theme-check with the goal of implementing more extensive code completion. I have a long way to go, but I just finished my first proof of concept for context-sensitive tag completion. As you can see in the screen recording below, tags will autocomplete correctly both as regular tags, and as inline tags inside of a liquid block!

2023-05-02 17 04 47

This is my first time diving into the Language Server Protocol, and it's got me really excited for the possibilities. The extensions I've built in the past have been based on simpler Textmate grammars (as have other Liquid extensions), which provide a lot of functionality but aren't nearly as flexible as using Language Server Protocol. For example, the context-sensitive completion that I illustrated above just isn't possible with the older style of extension—in order to support both types of tags, the list of code completions that the user sees would have duplicates of ever single tag. Using Language Server is way better!

If anyone at Shopify wants to know specifics of how I'm implementing this, I'd be happy to share. For now I'm going to continue working on it, since even if it never gets published it will still make my own theme development way smoother!

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

No branches or pull requests

1 participant