pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/codemirror/language

GitHub - codemirror/language: Language support infrastructure for the CodeMirror code editor · GitHub
Skip to content

codemirror/language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

452 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@codemirror/language NPM version

[ WEBSITE | DOCS | ISSUES | FORUM | CHANGELOG ]

This package implements the language support infrastructure for the CodeMirror code editor.

The project page has more information, a number of examples and the documentation.

This code is released under an MIT license.

We aim to be an inclusive, welcoming community. To make that explicit, we have a code of conduct that applies to communication around the project.

Usage

Setting up a language from a Lezer parser looks like this:

import {parser} from "@lezer/json"
import {LRLanguage, continuedIndent, indentNodeProp,
        foldNodeProp, foldInside} from "@codemirror/language"

export const jsonLanguage = LRLanguage.define({
  name: "json",
  parser: parser.configure({
    props: [
      indentNodeProp.add({
        Object: continuedIndent({except: /^\s*\}/}),
        Array: continuedIndent({except: /^\s*\]/})
      }),
      foldNodeProp.add({
        "Object Array": foldInside
      })
    ]
  }),
  languageData: {
    closeBrackets: {brackets: ["[", "{", '"']},
    indentOnInput: /^\s*[\}\]]$/
  }
})

Often, you'll also use this package just to access some specific language-related features, such as accessing the editor's syntax tree...

import {syntaxTree} from "@codemirror/language"

const tree = syntaxTree(view)

... or computing the appriate indentation at a given point.

import {getIndentation} from "@codemirror/language"

console.log(getIndentation(view.state, view.state.selection.main.head))

About

Language support infrastructure for the CodeMirror code editor

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy