Skip to content

Commit

Permalink
Update lezer-r and fix code completion in webR app
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Jun 21, 2024
1 parent ab4ed14 commit 6e7ac09
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/repl/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 };
Expand Down

0 comments on commit 6e7ac09

Please sign in to comment.