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

@codemirror/language

Package Overview
Dependencies
Maintainers
2
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemirror/language

Language support infrastructure for the CodeMirror code editor

  • 6.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
279K
decreased by-80.62%
Maintainers
2
Weekly downloads
 
Created

What is @codemirror/language?

The @codemirror/language package is part of the CodeMirror ecosystem, which provides a versatile text editor implemented in JavaScript for the browser. This specific package focuses on language support, offering tools and functionality to parse, analyze, and display code written in various programming languages. It allows for syntax highlighting, code parsing for autocompletion, and other language-specific features within the CodeMirror editor.

What are @codemirror/language's main functionalities?

Syntax Highlighting

This feature allows for syntax highlighting of JavaScript code within the CodeMirror editor. By importing the JavaScript language support from the package and applying it as an extension to the editor, the code within the editor is automatically highlighted according to the syntax of JavaScript.

import {javascript} from '@codemirror/lang-javascript';

let myEditor = new EditorView({
  doc: 'function myScript(){\n  console.log(\"Hello, world!\");\n}',
  extensions: [javascript()]
});

Code Parsing for Autocompletion

This code sample demonstrates how to enable autocompletion for JavaScript code. By combining the JavaScript language support with the autocomplete extension from CodeMirror, the editor can suggest completions based on the current context in the code, enhancing the coding experience.

import {javascript} from '@codemirror/lang-javascript';
import {autocomplete, startCompletion} from '@codemirror/autocomplete';

let myEditor = new EditorView({
  doc: 'console.',
  extensions: [javascript(), autocomplete(), EditorView.updateListener.of(update => {
    if (update.changes) startCompletion(myEditor);
  })]
});

Other packages similar to @codemirror/language

Keywords

FAQs

Package last updated on 24 Oct 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