Skip to content

Commit

Permalink
Merge pull request #113 from antew/readfile-use-fspath
Browse files Browse the repository at this point in the history
ASTProvider - Use normal file path rather than file:// protocol when reading a file
  • Loading branch information
razzeee authored Jul 30, 2019
2 parents 49ba666 + 096ed2b commit 645fa84
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 645fa84

Please sign in to comment.