Skip to content

Bump tree-sitter-cli from 0.20.8 to 0.25.3 #1370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 73 additions & 35 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"vscode-languageserver": "^9.0.1",
"vscode-languageserver-textdocument": "1.0.11",
"vscode-uri": "^3.0.8",
"web-tree-sitter": "^0.20.8"
"web-tree-sitter": "^0.25.3"
},
"devDependencies": {
"@elm-tooling/tree-sitter-elm": "^5.7.0",
"@elm-tooling/tree-sitter-elm": "^5.8.0",
"@types/jest": "^29.5.11",
"@types/node": "^20.10.5",
"@typescript-eslint/eslint-plugin": "^6.15.0",
Expand All @@ -47,7 +47,7 @@
"jest-diff": "^29.7.0",
"jest-mock-extended": "^3.0.5",
"prettier": "^3.1.1",
"tree-sitter-cli": "^0.20.8",
"tree-sitter-cli": "^0.25.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "5.3.3"
Expand All @@ -62,7 +62,7 @@
"watch": "npm run copy-wasm && tsc -watch -p ./",
"lint": "eslint -c .eslintrc.js --ext .ts src",
"lint:fix": "eslint --fix -c .eslintrc.js --ext .ts src",
"build-tree-sitter": "tree-sitter build-wasm ./node_modules/@elm-tooling/tree-sitter-elm",
"build-tree-sitter": "tree-sitter build --wasm ./node_modules/@elm-tooling/tree-sitter-elm",
"test": "jest --coverage",
"generate-toc": "doctoc README.md"
},
Expand Down
4 changes: 2 additions & 2 deletions src/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
InitializeResult,
} from "vscode-languageserver";

import Parser from "web-tree-sitter";
import { Parser, Language } from "web-tree-sitter";
import { CapabilityCalculator } from "./capabilityCalculator";
import { ASTProvider } from "./providers";
import {
Expand Down Expand Up @@ -64,7 +64,7 @@ export function startCommonServer(
connection.console.info(
`Loading Elm tree-sitter syntax from ${pathToWasm}`,
);
const language = await Parser.Language.load(pathToWasm);
const language = await Language.load(pathToWasm);
const parser = container.resolve<Parser>("Parser");
parser.setLanguage(language);

Expand Down
8 changes: 4 additions & 4 deletions src/common/providers/astProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
FileChangeType,
} from "vscode-languageserver";
import { URI } from "vscode-uri";
import Parser, { Edit, Point, SyntaxNode } from "web-tree-sitter";
import Parser, { Edit, Point, Node } from "web-tree-sitter";
import { ElmWorkspaceMatcher } from "../util/elmWorkspaceMatcher";
import {
Position,
Expand All @@ -23,16 +23,16 @@

export class ASTProvider {
private connection: Connection;
private parser: Parser;

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 18)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 18)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 20)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 20)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Cannot use namespace 'Parser' as a type.

Check failure on line 26 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Cannot use namespace 'Parser' as a type.
private documentEvents: TextDocumentEvents;

private treeChangeEvent = new Emitter<{
sourceFile: ISourceFile;
declaration?: SyntaxNode;
declaration?: Node;
}>();
readonly onTreeChange: Event<{
sourceFile: ISourceFile;
declaration?: SyntaxNode;
declaration?: Node;
}> = this.treeChangeEvent.event;

private treeDeleteEvent = new Emitter<{ uri: string }>();
Expand All @@ -41,7 +41,7 @@
private pendingRenames = new Map<string, string>();

constructor() {
this.parser = container.resolve("Parser");

Check warning on line 44 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Unsafe assignment of an `any` value

Check warning on line 44 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Unsafe assignment of an `any` value
this.connection = container.resolve("Connection");
this.documentEvents = container.resolve(TextDocumentEvents);

Expand Down Expand Up @@ -132,7 +132,7 @@
hasContentChanges ? tree : undefined,
);

let changedDeclaration: SyntaxNode | undefined;
let changedDeclaration: Node | undefined;

tree
?.getChangedRanges(newTree)
Expand Down Expand Up @@ -167,7 +167,7 @@
tree = newTree;

const newIds = new Set(
newTree.rootNode.namedChildren.map((n) => n.id).values(),

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 18)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 18)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 18)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 20)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (macOS-latest, 20)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, 20)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 18)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Parameter 'n' implicitly has an 'any' type.

Check failure on line 170 in src/common/providers/astProvider.ts

View workflow job for this annotation

GitHub Actions / build (windows-latest, 20)

Parameter 'n' implicitly has an 'any' type.
);

oldNodes.forEach((node) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Range, TextEdit } from "vscode-languageserver";
import { SyntaxNode } from "web-tree-sitter";
import { Node } from "web-tree-sitter";
import { CodeActionProvider, ICodeAction } from "..";
import { ISourceFile } from "../../../compiler/forest";
import { getSpaces } from "../../util/refactorEditUtils";
Expand Down Expand Up @@ -97,7 +97,7 @@ function getEdits(

function createFields(
fields: [string, Type][],
targetRecord: SyntaxNode,
targetRecord: Node,
checker: TypeChecker,
sourceFile: ISourceFile,
): { [uri: string]: TextEdit[] } {
Expand Down
10 changes: 5 additions & 5 deletions src/common/providers/codeAction/addNewFunctionParameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TreeUtils } from "../../util/treeUtils";
import { Diagnostics } from "../../../compiler/diagnostics";
import { CodeActionProvider, ICodeAction } from "../codeActionProvider";
import { ICodeActionParams } from "../paramsExtensions";
import { SyntaxNode } from "web-tree-sitter";
import { Node } from "web-tree-sitter";

const errorCodes = [Diagnostics.MissingValue.code];
const fixId = "add_new_function_parameter";
Expand Down Expand Up @@ -40,8 +40,8 @@ function getActions(
}

function getActionsForValueDeclaration(
valueDeclaration: SyntaxNode,
nodeAtPosition: SyntaxNode,
valueDeclaration: Node,
nodeAtPosition: Node,
params: ICodeActionParams,
): CodeAction | undefined {
const lastFunctionParameter = valueDeclaration?.firstChild?.lastChild;
Expand Down Expand Up @@ -76,8 +76,8 @@ function getActionsForValueDeclaration(

function getEditsForSignatureUpdate(
params: ICodeActionParams,
nodeAtPosition: SyntaxNode,
valueDeclaration: SyntaxNode,
nodeAtPosition: Node,
valueDeclaration: Node,
): TextEdit[] {
const typeAnnotation = TreeUtils.getTypeAnnotation(valueDeclaration);
const lastParameterType =
Expand Down
9 changes: 5 additions & 4 deletions src/common/providers/codeAction/extractFunctionCodeAction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CodeActionKind, Position, TextEdit } from "vscode-languageserver";
import { SyntaxNode } from "web-tree-sitter";
import { Node } from "web-tree-sitter";
import { RefactorEditUtils } from "../../util/refactorEditUtils";
import { TreeUtils } from "../../util/treeUtils";
import { TFunction } from "../../../compiler/typeInference";
Expand Down Expand Up @@ -87,7 +87,7 @@ CodeActionProvider.registerRefactorAction(refactorName, {
line: rootNode.endPosition.row,
character: 0,
};
let targetScope: SyntaxNode;
let targetScope: Node;
let addTypeAnnotation = true;

switch (actionName) {
Expand Down Expand Up @@ -128,14 +128,15 @@ CodeActionProvider.registerRefactorAction(refactorName, {
break;
}

const args: SyntaxNode[] = [];
const args: Node[] = [];

const nodeParent = node.parent;
const imports = checker.getAllImports(params.sourceFile);

// Get the list of references that won't be visible
node
.descendantsOfType(["value_expr", "record_base_identifier"])
.filter((val) => val !== null)
.forEach((val) => {
if (args.find((arg) => arg.text === val.text)) {
return;
Expand All @@ -152,7 +153,7 @@ CodeActionProvider.registerRefactorAction(refactorName, {
}

// If we find it in the scope we are extracting, it should not be a arg
let scope: SyntaxNode | null = val;
let scope: Node | null = val;
while (scope && scope.id !== nodeParent?.id) {
if (params.sourceFile.symbolLinks?.get(scope)?.get(val.text)) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/common/providers/codeAction/extractTypeAliasCodeAction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CodeActionKind, Position, TextEdit } from "vscode-languageserver";
import { SyntaxNode } from "web-tree-sitter";
import { Node } from "web-tree-sitter";
import { RefactorEditUtils } from "../../util/refactorEditUtils";
import { TreeUtils } from "../../util/treeUtils";
import {
Expand Down Expand Up @@ -118,7 +118,7 @@ CodeActionProvider.registerRefactorAction(refactorName, {
): IRefactorEdit => {
const edits: TextEdit[] = [];

const nodes: SyntaxNode[] = [];
const nodes: Node[] = [];
if (action === "extract_type_alias_partial_type_expr") {
const startNode = TreeUtils.getNamedDescendantForPosition(
params.sourceFile.tree.rootNode,
Expand Down
Loading
Loading