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 - npm Package Compare versions

Comparing version 6.5.0 to 6.6.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 6.6.0 (2023-02-13)
### New features
Syntax-driven language data queries now support sublanguages, which make it possible to return different data for specific parts of the tree produced by a single language.
## 6.5.0 (2023-02-07)

@@ -2,0 +8,0 @@

44

dist/index.d.ts

@@ -1,5 +0,5 @@

import { NodeProp, Parser, Tree, TreeFragment, SyntaxNode, NodeType } from '@lezer/common';
import { NodeProp, SyntaxNode, Parser, Tree, TreeFragment, NodeType } from '@lezer/common';
import { LRParser, ParserConfig } from '@lezer/lr';
import * as _codemirror_state from '@codemirror/state';
import { Facet, Extension, EditorState, StateField, Range } from '@codemirror/state';
import { Facet, EditorState, Extension, StateField, Range } from '@codemirror/state';
import { EditorView, DecorationSet, Command, KeyBinding, ViewUpdate, BlockInfo, Decoration } from '@codemirror/view';

@@ -34,2 +34,40 @@ import { Highlighter, Tag } from '@lezer/highlight';

/**
Some languages need to return different [language
data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) for some parts of their
tree. Sublanguages, registered by adding a [node
prop](https://codemirror.net/6/docs/ref/#language.sublanguageProp) to the language's top syntax
node, provide a mechanism to do this.
(Note that when using nested parsing, where nested syntax is
parsed by a different parser and has its own top node type, you
don't need a sublanguage.)
*/
interface Sublanguage {
/**
Determines whether the data provided by this sublanguage should
completely replace the regular data or be added to it (with
higher-precedence). The default is `"extend"`.
*/
type?: "replace" | "extend";
/**
A predicate that returns whether the node at the queried
position is part of the sublanguage.
*/
test: (node: SyntaxNode, state: EditorState) => boolean;
/**
The language data facet that holds the sublanguage's data.
You'll want to use
[`defineLanguageFacet`](https://codemirror.net/6/docs/ref/#language.defineLanguageFacet) to create
this.
*/
facet: Facet<{
[name: string]: any;
}>;
}
/**
Syntax node prop used to register sublangauges. Should be added to
the top level node type for the language.
*/
declare const sublanguageProp: NodeProp<Sublanguage[]>;
/**
A language object manages parsing and per-language

@@ -1123,2 +1161,2 @@ [metadata](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt). Parse data is

export { Config, HighlightStyle, IndentContext, LRLanguage, Language, LanguageDescription, LanguageSupport, MatchResult, ParseContext, StreamLanguage, StreamParser, StringStream, TagStyle, TreeIndentContext, bracketMatching, bracketMatchingHandle, codeFolding, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldGutter, foldInside, foldKeymap, foldNodeProp, foldService, foldState, foldable, foldedRanges, forceParsing, getIndentUnit, getIndentation, highlightingFor, indentNodeProp, indentOnInput, indentRange, indentService, indentString, indentUnit, language, languageDataProp, matchBrackets, syntaxHighlighting, syntaxParserRunning, syntaxTree, syntaxTreeAvailable, toggleFold, unfoldAll, unfoldCode, unfoldEffect };
export { Config, HighlightStyle, IndentContext, LRLanguage, Language, LanguageDescription, LanguageSupport, MatchResult, ParseContext, StreamLanguage, StreamParser, StringStream, Sublanguage, TagStyle, TreeIndentContext, bracketMatching, bracketMatchingHandle, codeFolding, continuedIndent, defaultHighlightStyle, defineLanguageFacet, delimitedIndent, ensureSyntaxTree, flatIndent, foldAll, foldCode, foldEffect, foldGutter, foldInside, foldKeymap, foldNodeProp, foldService, foldState, foldable, foldedRanges, forceParsing, getIndentUnit, getIndentation, highlightingFor, indentNodeProp, indentOnInput, indentRange, indentService, indentString, indentUnit, language, languageDataProp, matchBrackets, sublanguageProp, syntaxHighlighting, syntaxParserRunning, syntaxTree, syntaxTreeAvailable, toggleFold, unfoldAll, unfoldCode, unfoldEffect };

2

package.json
{
"name": "@codemirror/language",
"version": "6.5.0",
"version": "6.6.0",
"description": "Language support infrastructure for the CodeMirror code editor",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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