-
Notifications
You must be signed in to change notification settings - Fork 23
Add support for Apollo Connectors Mapping Syntax #230
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
You can download the latest build of the extension for this PR here: To install the extension, download the file, unzip it and install it in VS Code by selecting "Install from VSIX..." in the Extensions view. Alternatively, run code --install-extension vscode-apollo-0.0.0-build-1752596687.pr-230.commit-a561ce6.vsix --force from the command line. For older builds, please see the edit history of this comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be honest, I don't really understand how this works, but your demo looked great! Added a few questions/comments
"1": | ||
name: "string.unquoted.NamedPathSelection.alias" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So can each of these sections get their own colors? I'd love to have one color for the "output" name (alias in this case) and another for things that are inputs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they can!
Open a text editor and execute the "Developer: inspect editor tokens and scopes" command
that will give you this pop-up:
And then you can move your cursor around and see what tokens things in other languages have, as an inspiration.
You see that GraphQL uses string.unquoted
and variable
as highlighting scopes here, but I also see that the alias
is never applied because variable.KeyPath.key.identifier
seems to have a higher priority somehow.
I'll debug that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing! A couple more notes on what we might want to add in future iterations:
$
and@
as well as an identifier following $, like$args
,$this
, etc. are sort of our keywords? They're special, at very least, and might be worth highlighting separately.- Anything in
$()
or as an argument to a method is sort of a different language mode. We call them literals, but they can also have some expressions within them. So${ blah: $.blah }
and$({ blah: $.blah })
are both valid, and look very similar, but do different things. It'd be nice to highlight that difference somehow (effectively, just the presence of the parens causes it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lennyburdette then I'm undoing that change and we go back to this:
Honestly I don't know if I can do a lot to visually highlight that difference more, apart from adding a full other "sub-language", which I'd rather avoid as this would become even more unmaintainable 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we just color parens differently than {}
for now, since parens always represent entering literal mode? We could do something special with semantic tokens or something if we really want in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @
and $
stuff looks great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we just color parens differently than {} for now, since parens always represent entering literal mode? We could do something special with semantic tokens or something if we really want in the future
We'll need to test that out in the non-VSCode editors. VSCode pretty much ignores everything else and applies its "bracket pair coloring" logic over the top of configured bracket pairs (which we want to have so it highlights start and end).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then maybe it's just fine 😅. Certainly shouldn't block getting the highlighting of the rest of the language out there
…5..2c7ee28f 2c7ee28f fix formatting that breaks syntax highlighting (#69) git-subtree-dir: sampleWorkspace/connectors-community git-subtree-split: 2c7ee28fc66a882f82bf7d3f2aea0a32eda35fba
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about the implementation, but I'm thrilled to have syntax highlighting!
My only note stylistically is I feel like the identifier on the left side of a :
and the value on the right should have their colors swapped. In the screenshot, it makes sense to be that the short form is the same as the property side of objects (in headers
). But in the long form, it seems like the key side should match the keys in objects and the value side should match the literal value $("blah")
.
If that doesn't make sense, happy to huddle on it!


@@ -0,0 +1,10 @@ | |||
--- | |||
name: New Connector |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentionally a full clone of that repo? Should we trim out some bits like this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a subtree as that's the easiest way to keep those in sync.
git subtree pull --prefix sampleWorkspace/connectors-community https://github.com/apollographql/connectors-community.git main --squash
There are ways of syncing with subfolders of subtrees, but honestly that didn't seem to be worth the added complexity.
No description provided.