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.8 to 0.19.9

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## 0.19.9 (2022-03-30)
### Bug fixes
Make sure nodes that end at the end of a partial parse aren't treated as valid fold targets.
Fix an issue where the parser sometimes wouldn't reuse parsing work done in the background on transactions.
## 0.19.8 (2022-03-03)

@@ -2,0 +10,0 @@

2

dist/index.d.ts

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

*/
declare function syntaxParserRunning(view: EditorView): boolean | (() => void);
declare function syntaxParserRunning(view: EditorView): boolean;
/**

@@ -162,0 +162,0 @@ A parse context provided to parsers working on the editor content.

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

var _a;
/**

@@ -292,3 +293,3 @@ Node prop stored in a grammar's top syntax node to provide the

*/
work(time, upto) {
work(until, upto) {
if (upto != null && upto >= this.state.doc.length)

@@ -302,3 +303,6 @@ upto = undefined;

var _a;
let endTime = Date.now() + time;
if (typeof until == "number") {
let endTime = Date.now() + until;
until = () => Date.now() > endTime;
}
if (!this.parse)

@@ -321,3 +325,3 @@ this.parse = this.startParse();

}
if (Date.now() > endTime)
if (until())
return false;

@@ -477,3 +481,3 @@ }

apply(tr) {
if (!tr.docChanged)
if (!tr.docChanged && this.tree == this.context.tree)
return this;

@@ -520,2 +524,4 @@ let newCx = this.context.changes(tr.changes, tr.state);

};
const isInputPending = typeof navigator != "undefined" && ((_a = navigator.scheduling) === null || _a === void 0 ? void 0 : _a.isInputPending)
? () => navigator.scheduling.isInputPending() : null;
const parseWorker = /*@__PURE__*/ViewPlugin.fromClass(class ParseWorker {

@@ -563,5 +569,7 @@ constructor(view) {

return;
let time = Math.min(this.chunkBudget, 100 /* Slice */, deadline ? Math.max(25 /* MinSlice */, deadline.timeRemaining() - 5) : 1e9);
let endTime = Date.now() + Math.min(this.chunkBudget, 100 /* Slice */, deadline && !isInputPending ? Math.max(25 /* MinSlice */, deadline.timeRemaining() - 5) : 1e9);
let viewportFirst = field.context.treeLen < vpTo && state.doc.length > vpTo + 1000;
let done = field.context.work(time, vpTo + (viewportFirst ? 0 : 100000 /* MaxParseAhead */));
let done = field.context.work(() => {
return isInputPending && isInputPending() || Date.now() > endTime;
}, vpTo + (viewportFirst ? 0 : 100000 /* MaxParseAhead */));
this.chunkBudget -= Date.now() - now;

@@ -591,3 +599,3 @@ if (done || this.chunkBudget <= 0) {

isWorking() {
return this.working || this.workScheduled > 0;
return !!(this.working || this.workScheduled > 0);
}

@@ -1130,3 +1138,3 @@ }, {

let prop = cur.type.prop(foldNodeProp);
if (prop) {
if (prop && (cur.to < tree.length - 50 || tree.length == state.doc.length || !isUnfinished(cur))) {
let value = prop(cur, state);

@@ -1139,2 +1147,6 @@ if (value && value.from <= end && value.from >= start && value.to > end)

}
function isUnfinished(node) {
let ch = node.lastChild;
return ch && ch.to == node.to && ch.type.isError;
}
/**

@@ -1141,0 +1153,0 @@ Check whether the given line is foldable. First asks any fold

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

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

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