Skip to content

Commit

Permalink
Use normal file path rather than file:// protocol when reading a file…
Browse files Browse the repository at this point in the history
… from disk in the astProvider
  • Loading branch information
antew committed Jul 21, 2019
1 parent 159ec78 commit 096ed2b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/providers/astProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
IConnection,
VersionedTextDocumentIdentifier,
} from "vscode-languageserver";
import { URI } from "vscode-uri";
import Parser, { Point, SyntaxNode, Tree } from "web-tree-sitter";
import { IForest } from "../forest";
import { IImports } from "../imports";
Expand All @@ -31,7 +32,10 @@ export class ASTProvider {
const document: VersionedTextDocumentIdentifier = params.textDocument;
let tree: Tree | undefined = this.forest.getTree(document.uri);
if (tree === undefined) {
const fileContent: string = readFileSync(document.uri, "utf8");
const fileContent: string = readFileSync(
URI.parse(document.uri).fsPath,
"utf8",
);
tree = this.parser.parse(fileContent);
}

Expand Down

0 comments on commit 096ed2b

Please sign in to comment.