Skip to content

Instantly share code, notes, and snippets.

@hoop33
Created January 17, 2018 16:02
Show Gist options
  • Save hoop33/b0a33cf8fdcf4d64689f58efed75c15e to your computer and use it in GitHub Desktop.
Save hoop33/b0a33cf8fdcf4d64689f58efed75c15e to your computer and use it in GitHub Desktop.
.ctags entries for GraphQL
--langdef=graphql
--langmap=graphql:.graphql
--regex-graphql=/^type[ \t]+([^{]+){/\1/t,type/
--regex-graphql=/^input[ \t]+([^{]+){/\1/i,input/
--regex-graphql=/^[ \t]*([a-zA-Z]+)\(/\1/f,func/
@pl12133
Copy link

pl12133 commented Feb 13, 2018

Good list @hoop33! I tried this but it didn't quite catch everything in my project, so I created my own with a few more keywords in it and used the Name regex from the GraphQL Working Draft:

--langdef=graphql
--langmap=graphql:.graphql
--regex-graphql=/^[ \t]*enum[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/e,enum/
--regex-graphql=/^[ \t]*query[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/q,query/
--regex-graphql=/^[ \t]*fragment[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/f,fragment/
--regex-graphql=/^[ \t]*type[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/t,type/
--regex-graphql=/^[ \t]*input[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/i,input/
--regex-graphql=/^[ \t]*mutation[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/m,mutation/

@jszwedko
Copy link

I added --regex-graphql=/^[ \t]*interface[ \t]+([_A-Za-z][_0-9A-Za-z]*)/\1/i,interface/ to also tag interfaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment