Skip to content

Commit

Permalink
fix abs path ast
Browse files Browse the repository at this point in the history
  • Loading branch information
pizza-777 committed Sep 8, 2023
1 parent c6a821e commit 611478b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "solidity-support",
"displayName": "Everscale Solidity Support",
"description": "Everscale Solidity Language for Visual Studio Code",
"version": "1.4.46",
"version": "1.4.47",
"keywords": [
"solidity",
"ton-solidity",
Expand Down
5 changes: 5 additions & 0 deletions src/ast.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ function searchPath(absolutePath) {
if (fs.existsSync(_path)) {
return _path;
}
const basePath = vscode.workspace.workspaceFolders[0].uri.fsPath;
const fromRoot = path.resolve(basePath, absolutePath).toLowerCase()// useful for win
if (fs.existsSync(fromRoot)) {
return fromRoot;
}
return ifBroxus(absolutePath);
}

Expand Down
11 changes: 8 additions & 3 deletions src/ast/findNodeByPosition.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const path = require("path");
const vscode = require("vscode")

function findNodeByPosition(ast, position, document) {
for (let i = 0; i < ast.length; i++) {
Expand Down Expand Up @@ -62,11 +63,15 @@ function inRange(astPosition, position) {
return false;
}

function pathsAreEqual(path1, path2) {
function pathsAreEqual(path1, path2) {
const basePath = vscode.workspace.workspaceFolders[0].uri.fsPath;
//useful for win
if (path.resolve(basePath, path1).toLowerCase() === path2.toLowerCase()){
return true;
}
path1 = path.resolve(path1);
path2 = path.resolve(path2);
if (process.platform == "win32")
return path1.toLowerCase() === path2.toLowerCase();

return path1 === path2;
}

Expand Down

0 comments on commit 611478b

Please sign in to comment.