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 0.19.2 to 0.19.3

8

CHANGELOG.md

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

## 0.19.3 (2021-09-13)
### Bug fixes
Fix an issue where a parse that skipped content with `skipUntilInView` would in some cases not be restarted when the range came into view.
## 0.19.2 (2021-08-11)

@@ -27,2 +33,4 @@

`Language.parseString` no longer exists. You can just call `.parser.parse(...)` instead.
### New features

@@ -29,0 +37,0 @@

2

dist/index.d.ts

@@ -159,3 +159,3 @@ import { NodeProp, NodeType, Parser, Tree, TreeFragment, Input, PartialParse, SyntaxNode } from '@lezer/common';

work (in which case
[`skipUntilInView`](https://codemirror.net/6/docs/ref/#language.EditorParseContext.skipUntilInView)
[`skipUntilInView`](https://codemirror.net/6/docs/ref/#language.ParseContext.skipUntilInView)
should be called to make sure the parser is restarted when the

@@ -162,0 +162,0 @@ skipped region becomes visible).

@@ -232,3 +232,3 @@ import { NodeProp, Tree, TreeFragment, Parser, NodeType } from '@lezer/common';

work (in which case
[`skipUntilInView`](https://codemirror.net/6/docs/ref/#language.EditorParseContext.skipUntilInView)
[`skipUntilInView`](https://codemirror.net/6/docs/ref/#language.ParseContext.skipUntilInView)
should be called to make sure the parser is restarted when the

@@ -271,3 +271,3 @@ skipped region becomes visible).

upto = undefined;
if (this.tree != Tree.empty && (upto == null ? this.treeLen == this.state.doc.length : this.treeLen >= upto)) {
if (this.tree != Tree.empty && this.isDone(upto !== null && upto !== void 0 ? upto : this.state.doc.length)) {
this.takeTree();

@@ -358,2 +358,4 @@ return true;

updateViewport(viewport) {
if (this.viewport.from == viewport.from && this.viewport.to == viewport.to)
return false;
this.viewport = viewport;

@@ -368,3 +370,6 @@ let startLen = this.skipped.length;

}
return this.skipped.length < startLen;
if (this.skipped.length >= startLen)
return false;
this.reset();
return true;
}

@@ -428,2 +433,9 @@ /**

/**
@internal
*/
isDone(upto) {
let frags = this.fragments;
return this.treeLen >= upto && frags.length && frags[0].from == 0 && frags[0].to >= upto;
}
/**
Get the context for the current parse, or `null` if no editor

@@ -492,8 +504,4 @@ parse is in progress.

let cx = this.view.state.field(Language.state).context;
if (update.viewportChanged) {
if (cx.updateViewport(update.view.viewport))
cx.reset();
if (this.view.viewport.to > cx.treeLen)
this.scheduleWork();
}
if (cx.updateViewport(update.view.viewport) || this.view.viewport.to > cx.treeLen)
this.scheduleWork();
if (update.docChanged) {

@@ -509,7 +517,5 @@ if (this.view.hasFocus)

return;
let { state } = this.view, field = state.field(Language.state), frags = field.context.fragments;
if (field.tree == field.context.tree && field.context.treeLen >= state.doc.length &&
frags.length && frags[0].from == 0 && frags[0].to >= state.doc.length)
return;
this.working = requestIdle(this.work, { timeout: 500 /* Pause */ });
let { state } = this.view, field = state.field(Language.state);
if (field.tree != field.context.tree || !field.context.isDone(state.doc.length))
this.working = requestIdle(this.work, { timeout: 500 /* Pause */ });
}

@@ -845,20 +851,3 @@ work(deadline) {

function syntaxIndentation(cx, ast, pos) {
let tree = ast.resolveInner(pos);
// Enter previous nodes that end in empty error terms, which means
// they were broken off by error recovery, so that indentation
// works even if the constructs haven't been finished.
for (let scan = tree, scanPos = pos;;) {
let last = scan.childBefore(scanPos);
if (!last)
break;
if (last.type.isError && last.from == last.to) {
tree = scan;
scanPos = last.from;
}
else {
scan = last;
scanPos = scan.to + 1;
}
}
return indentFrom(tree, pos, cx);
return indentFrom(ast.resolveInner(pos).enterUnfinishedNodesBefore(pos), pos, cx);
}

@@ -865,0 +854,0 @@ function ignoreClosed(cx) {

{
"name": "@codemirror/language",
"version": "0.19.2",
"version": "0.19.3",
"description": "Language support infrastructure for the CodeMirror code editor",

@@ -32,3 +32,3 @@ "scripts": {

"@codemirror/view": "^0.19.0",
"@lezer/common": "^0.15.0",
"@lezer/common": "^0.15.5",
"@lezer/lr": "^0.15.0"

@@ -35,0 +35,0 @@ },

Sorry, the diff of this file is not supported yet

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