Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror-graphql

Package Overview
Dependencies
Maintainers
10
Versions
249
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror-graphql

GraphQL mode and helpers for CodeMirror.

  • 2.0.0-next.2
  • next
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
357K
increased by3.17%
Maintainers
10
Weekly downloads
 
Created

What is codemirror-graphql?

The codemirror-graphql npm package provides a set of tools and utilities to integrate GraphQL syntax highlighting, linting, and autocomplete features into CodeMirror, a versatile text editor implemented in JavaScript for the browser.

What are codemirror-graphql's main functionalities?

Syntax Highlighting

This feature allows you to enable GraphQL syntax highlighting in a CodeMirror editor instance. The code sample demonstrates how to set up a CodeMirror editor with GraphQL mode enabled.

import { GraphQLMode } from 'codemirror-graphql';
import CodeMirror from 'codemirror';

const editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
  mode: 'graphql',
  lineNumbers: true
});

Linting

This feature provides linting capabilities for GraphQL code within a CodeMirror editor. The code sample shows how to enable linting by setting the 'lint' option to true and adding the 'CodeMirror-lint-markers' gutter.

import { GraphQLLint } from 'codemirror-graphql';
import CodeMirror from 'codemirror';

const editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
  mode: 'graphql',
  lint: true,
  gutters: ['CodeMirror-lint-markers']
});

Autocomplete

This feature enables autocomplete functionality for GraphQL code in a CodeMirror editor. The code sample demonstrates how to set up the editor to trigger autocomplete suggestions with the 'Ctrl-Space' key combination.

import { GraphQLHints } from 'codemirror-graphql';
import CodeMirror from 'codemirror';

const editor = CodeMirror.fromTextArea(document.getElementById('editor'), {
  mode: 'graphql',
  extraKeys: { 'Ctrl-Space': 'autocomplete' }
});

Other packages similar to codemirror-graphql

FAQs

Package last updated on 13 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc