diff --git a/NEWS.md b/NEWS.md index 5eb64256..a014d34d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -26,6 +26,8 @@ * `webR.installPackages()` now correctly handles both `string` and `string[]` arguments for package names and binary repositories (#437). +* Resolved several syntax highlighting and code completion issues in the webR application. + # webR 0.3.3 ## New features diff --git a/flake.nix b/flake.nix index a43d907f..47eb92aa 100644 --- a/flake.nix +++ b/flake.nix @@ -26,7 +26,7 @@ # cd src; prefetch-npm-deps package-lock.json srcNpmDeps = pkgs.fetchNpmDeps { src = "${self}/src"; - hash = "sha256-Qb3A25+y6X2Ky0qznfJHPjubkziYcESntXsF7wyDw1w="; + hash = "sha256-x8eIcRezS58dDDj6gxNFvFjnad2L3snxVWgnj2CLTHw="; }; inherit system; diff --git a/src/package-lock.json b/src/package-lock.json index 8be588db..85e51b73 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -17,6 +17,7 @@ "classnames": "^2.2.6", "codemirror": "^6.0.1", "codemirror-lang-r": "^0.1.0-2", + "lezer-r": "^0.1.1", "lightningcss": "^1.21.5", "prop-types": "^15.7.2", "react": "^18.2.0", @@ -5557,9 +5558,9 @@ } }, "node_modules/lezer-r": { - "version": "0.1.0-5", - "resolved": "https://registry.npmjs.org/lezer-r/-/lezer-r-0.1.0-5.tgz", - "integrity": "sha512-4I2JAhoHyy9sfJq8n7+4jRDEGjO3Wo+qCGUzfTrxEDEI3dpnEqigmxnjMa7MrejpirvenrO0MmsY2gtbxkQeLg==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/lezer-r/-/lezer-r-0.1.1.tgz", + "integrity": "sha512-bIBHtedC6VtdYpsj7q6OO/CiU7rQkNOUJPi3EmqlpxW/Vv/R8jJI6Lr8jRqsSqZZD5GslLsYdrx3mXvvDv3xAg==", "dependencies": { "@lezer/highlight": "^1.0.0", "@lezer/lr": "^1.0.0" diff --git a/src/package.json b/src/package.json index a98bb87c..2135e5ba 100644 --- a/src/package.json +++ b/src/package.json @@ -63,6 +63,7 @@ "classnames": "^2.2.6", "codemirror": "^6.0.1", "codemirror-lang-r": "^0.1.0-2", + "lezer-r": "^0.1.1", "lightningcss": "^1.21.5", "prop-types": "^15.7.2", "react": "^18.2.0", diff --git a/src/repl/components/Editor.tsx b/src/repl/components/Editor.tsx index 92a98500..4a714c26 100644 --- a/src/repl/components/Editor.tsx +++ b/src/repl/components/Editor.tsx @@ -158,7 +158,7 @@ export function Editor({ if (from === to && !context.explicit) { return null; } - await completionMethods.current.assignLineBuffer(line); + await completionMethods.current.assignLineBuffer(line.replace(/\)+$/, "")); await completionMethods.current.assignToken(text); await completionMethods.current.assignStart(from + 1); await completionMethods.current.assignEnd(to + 1); @@ -168,7 +168,7 @@ export function Editor({ if (!val) { throw new Error('Missing values in completion result.'); } - return { label: val }; + return { label: val, boost: val.endsWith("=") ? 10 : 0 }; }); return { from: from, options };