-
-
Notifications
You must be signed in to change notification settings - Fork 26
Recognize GraphQL strings passed to JavaScript functions #109
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
Conversation
77922f8 to
afbcfb4
Compare
Some JavaScript GraphQL frameworks use well-known functions rather than
tagged template literals. This change introduces basic support for these
cases via a new `g:graphql_javascript_functions` variable (["graphql"]).
This is implemented as a bit of a hack on top of the existing tagged
template support to avoid introducing new syntax regions:
Tagged template: graphql`
Function name: graphql(`
Syntax pattern: (graphql|graphql\()`
This is a good-enough place to start, and the overall approach gives us
room to iterate later if we want to revisit the implementation.
afbcfb4 to
90667bf
Compare
|
@jparise, thanks for your work on this plugin! I was testing this specific feature and noticed that when using I then noticed that in the README and the tests you omit the closing parenthesis and use it like Not sure if this is a bug or if I'm missing something. |
These were missing from #109 but weren't causing any functional problems.
I'm not able to reproduce this error highlighting (which might be due to us having some configuration or plugin differences), but I'll take another look at the regular expressions to see if there are any improvements I can make. The function-highlighting approach I'm using here is admittedly a bit of a kludge.
This was an oversight that I just fixed in f2e7754, but they shouldn't have been causing any functional problems on their own. |
Thank you! This is helpful. I don't have a solution yet but it's useful to see what you're seeing. Embedding GraphQL inside of JavaScript has proven to be the most complicated aspect of maintaining this plugin. Also, we support vim's built-in |
Our previous function-matching approach (#109) was implemented on top of the existing tag-matching patterns. This had the downside of including the function name and initial parenthesis in the region match. Instead, use dedicated syntax regions to specifically match the string template argument passed to our named GraphQL-aware functions.
Our previous function-matching approach (#109) was implemented on top of the existing tag-matching patterns. This had the downside of including the function name and initial parenthesis in the region match. Instead, use dedicated syntax regions to specifically match the string template argument passed to our named GraphQL-aware functions for both JavaScript and TypeScript.
Our previous function-matching approach (#109) was implemented on top of the existing tag-matching patterns. This had the downside of including the function name and initial parenthesis in the region match. Instead, use dedicated syntax regions to specifically match the string template argument passed to our named GraphQL-aware functions for both JavaScript and TypeScript.



Some JavaScript GraphQL frameworks use well-known functions rather than tagged template literals. This change introduces basic support for these cases via a new
g:graphql_javascript_functionsvariable (["graphql"]).This is implemented as a bit of a hack on top of the existing tagged template support to avoid introducing new syntax regions:
This is a good-enough place to start, and the overall approach gives us room to iterate later if we want to revisit the implementation.
Resolves #96