All Projects → kumarharsh → Graphql For Vscode

kumarharsh / Graphql For Vscode

Licence: mit
GraphQL syntax highlighting, linting, auto-complete, and more!

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Graphql For Vscode

CodeView
Android Library to make it easy to create an Code editor or IDE that support any languages and themes, with auto complete, auto indenting, snippets and more features
Stars: ✭ 254 (-4.15%)
Mutual labels:  syntax-highlighting, snippets, autocomplete
Vscode Smarty
Smarty syntax highlight extension for Visual Studio Code
Stars: ✭ 10 (-96.23%)
Mutual labels:  vscode, snippets, syntax-highlighting
Processing Vscode
A Visual Studio Code extension for the programming language Processing
Stars: ✭ 141 (-46.79%)
Mutual labels:  vscode, snippets, syntax-highlighting
sublime-PICO-8
PICO-8 plugin for the Sublime Text 3 editor.
Stars: ✭ 42 (-84.15%)
Mutual labels:  syntax-highlighting, snippets, autocomplete
Vscode Vlang
V Language extension for Visual Studio Code.
Stars: ✭ 190 (-28.3%)
Mutual labels:  vscode, snippets, syntax-highlighting
sora-editor
A cool code editor library on Android with syntax-highlighting and auto-completion. (aka CodeEditor)
Stars: ✭ 580 (+118.87%)
Mutual labels:  syntax-highlighting, autocomplete
ZenScript
Visual Studio Code extension/Language Server for ZenScript, includes highlight, code snippet and language server(WIP). Works with 👇
Stars: ✭ 29 (-89.06%)
Mutual labels:  syntax-highlighting, snippets
atom-perl6-editor-tools
A collection of useful Perl 6 editor tools
Stars: ✭ 19 (-92.83%)
Mutual labels:  snippets, linter
vim-stylus
A better vim plugin for stylus, including proper and up-to-date syntax highligting, indentation and autocomplete
Stars: ✭ 49 (-81.51%)
Mutual labels:  syntax-highlighting, autocomplete
network tech
Cisco config syntax and snippets for Sublime Text
Stars: ✭ 82 (-69.06%)
Mutual labels:  syntax-highlighting, snippets
opentype-feature-bundle
Syntax highlighting and snippets for OpenType feature development in TextMate/Sublime Text
Stars: ✭ 35 (-86.79%)
Mutual labels:  syntax-highlighting, snippets
vscode-LaTeX-support
LaTeX language support for Visual Studio Code
Stars: ✭ 17 (-93.58%)
Mutual labels:  syntax-highlighting, snippets
Sublime-GameMaker-Studio-Language-Bundle
A sublime bundle for GameMaker Language (GML)
Stars: ✭ 32 (-87.92%)
Mutual labels:  syntax-highlighting, snippets
Vscode Stylelint
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 260 (-1.89%)
Mutual labels:  linter, vscode
linden-scripting-language
Linden Scripting Language (LSL / Second Life) files for your editor.
Stars: ✭ 53 (-80%)
Mutual labels:  syntax-highlighting, snippets
torchlight-laravel
A Laravel client for Torchlight - the syntax highlighting API.
Stars: ✭ 64 (-75.85%)
Mutual labels:  syntax-highlighting, vscode
vscode-angular-html
Angular syntax highlighting for HTML templates
Stars: ✭ 35 (-86.79%)
Mutual labels:  syntax-highlighting, vscode
GDL-sublime
📝 A Sublime Text package for the programming language GDL (Geometric Description Language)
Stars: ✭ 25 (-90.57%)
Mutual labels:  syntax-highlighting, snippets
Graphqurl
curl for GraphQL with autocomplete, subscriptions and GraphiQL. Also a dead-simple universal javascript GraphQL client.
Stars: ✭ 3,012 (+1036.6%)
Mutual labels:  graphql, autocomplete
Mongoke
Instant Graphql for MongoDb (active branch is golang, rewrite in process)
Stars: ✭ 203 (-23.4%)
Mutual labels:  graphql, schema

Logo

Graphql For VSCode

Latest Release Installs Rating


VSCode extension for GraphQL schema authoring & consumption.

A preview of the extension

What's in the Box?

  • Go to Definition: Just F12 or Ctrl+Click on any graphql type, and you'll jump right to it's definition.

    Go to Definition

  • Autocomplete: Uses the @playlyfe/gql library to read your whole graphql schema definitions and provide you with autocomplete support while writing & editing your .gql files.

    Autocomplete

  • Schema Validation: The extension also validates your schema, so that you catch errors early.

  • Linting: This extension uses a similar method as used by the Codemirror graphql project for linting.

  • Great Syntax Highlighting: Now, your graphql queries, mutations and gql files will look as beautiful as the rest of your code with an awesome syntax highlighter. It works not just with your .gql/.graphql schema files, but also within your code - supports syntax highlighting within:

    • Javascript
    • Typescript
    • Vue
    • Ruby
    • Cucumber
    • ReasonML/OCaml
    • Markdown fenced code-blocks
    • (Submit a PR to support your language!)
  • Snippets: Some commonly used snippets are provided which help while writing mutations and queries, such as defining types, interfaces and input types.

Setting it Up

  1. Ensure that you have the @playlyfe/gql library (v2.x) installed and available to this extension. If you've installed the library in a folder other than the workspace root, then add the path to the node_modules directory as a setting:

    {
      "graphqlForVSCode.nodePath": "ui/node_modules"
    }
    
  2. Ensure you have watchman installed and available in your path. Watchman watches your gql files and provides up-to-date suggestions. For users on Windows, get the latest build mentioned in this issue and add the location of watchman.exe to your environment path.

  3. Create a .gqlconfig file (required by the @playlyfe/gql package).

    A minimal example:

    The .gqlconfig is a JSON file with only one required key: schema.files which is the path to your *.gql files relative to your workspace root.

    /* .gqlconfig */
    {
      schema: {
        files: 'schemas/**/*.gql'
      }
    }
    

    You can use the string files: "**/*.gql" instead if you want to find any .gql file recursively in the workspace dir.

    To see the full configuration, check out the GQL project's docs.

  4. To enable autocomplete support within your code, add these lines to your .gqlconfig file. The query section of the config contains an array of file config with matchers. You can add more files by directing the EmbeddedQueryParser to run when your code within the startTag and endTag matches:

    /* .gqlconfig */
    {
      schema: {
        files: "schemas/**/*.gql"
      },
      query: {
        files: [ /* define file paths which you'd like the gql parser to watch and give autocomplete suggestions for */
          {
            match: ['src/**/*.ts', 'src/**/*.tsx'], // match multiple extensions
            parser: ['EmbeddedQueryParser', { startTag: 'gql`', endTag: '`' }], // parse any query inside gql template literal
          },
          {
            match: 'ui/src/**/*.js', // for js
            parser: ['EmbeddedQueryParser', { startTag: 'Relay\\.QL`', endTag: '`' }], // parse Relay syntax
            isRelay: true,
          },
          {
            match: 'features/**/*.feature', // for gherkin
            parser: ['EmbeddedQueryParser', { startTag: 'graphql request\\s+"""', endTag: '"""' }],
          },
          {
            "match": "lib/**/*.rb", // sample config you might use for Ruby-aware highlighting (inside `<<-GRAPHQL` heredocs)
            "parser": ["EmbeddedQueryParser", { "startTag": "<<-GRAPHQL", "endTag": "GRAPHQL" }]
          },
          {
            match: 'fixtures/**/*.gql',
            parser: 'QueryParser',
          },
        ],
      },
    }
    

    Again, refer to GQL docs for details about configuring your .gqlconfig file.

Using remote schemas

If you are using a schema that is not in your client's project, you'll need to download it so it's available for @playlyfe/gql. After downloading, you need to reference these schemas in your .gqlconfig.

One way to do this is to use graphql-cli:

{
  "scripts": {
    "gql:fetch-schema": "graphql get-schema --project prod"
  } 
}

You will also need a .graphqlconfig.yml configuration file so that graphql-cli knows where to download the schema from (specified by the --project prod argument to the command):

# .graphqlconfig.yml
projects:
  prod:
    schemaPath: schema/schema.graphql
    extensions:
      endpoints:
        default: https://prod.my-graphql-api.com/graphql

Thereafter, you can fetch changes to the graphql schema by running the command:

# download schema
yarn gql:fetch-schema

Future Plans

  • Tests: Figure out tests.

Contributing

  • If you have a suggestion or a problem, please open an issue.
  • If you'd like to improve the extension:
    • If you've made any improvements to the extension, send a Pull Request!
    • The instructions to run and debug the extension are here

Hacking

If you're making changes to the extension, then run yarn dev inside this directory, then just press F5 to launch the Extension Development Host instance of vscode. Whenever you make a change, press Reload to reload the EDH instance.

Major Contributors

  • Mayank Agarwal - added autocomplete, goto definition, schema validation support

Changelog

  • Latest changes are available on the releases page.
  • Older changelogs can be found here.

Happy Querying!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].