diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea8f9b..9a0d661 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 0.0.14 + +Fixes for code completion. + ## 0.0.13 Nile integration. diff --git a/package-lock.json b/package-lock.json index 37399e6..f8e775a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "cairo-ls", - "version": "0.0.13", + "version": "0.0.14", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cairo-ls", - "version": "0.0.13", + "version": "0.0.14", "hasInstallScript": true, "license": "EPL-2.0", "devDependencies": { diff --git a/package.json b/package.json index 199e70a..fe954a5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Cairo and StarkNet language support for VS Code", "author": "Eric Lau", "license": "EPL-2.0", - "version": "0.0.13", + "version": "0.0.14", "preview": true, "icon": "images/logo.png", "repository": { diff --git a/server/src/server.ts b/server/src/server.ts index 5dc30c8..aaf9f24 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -981,13 +981,14 @@ async function getAllCairoFilesStartingWith(uri: string, prefix: string) : Promi const withoutFileExtension = fileFullPath.substring(0, fileFullPath.lastIndexOf(".cairo")); const relativePathWithoutExt = relativize(withoutFileExtension, searchPath); - // if (isPartOfAnotherSearchPath(fileFullPath, searchPath, packageSearchPathsArray)) { - // connection.console.log(`Skipping path since it is part of another search path: ${relativePathWithoutExt}`); - // else - if (relativePathWithoutExt.includes('.')) { + if (isPartOfAnotherSearchPath(fileFullPath, searchPath, packageSearchPathsArray)) { + connection.console.log(`Skipping path since it is part of another search path: ${relativePathWithoutExt}`); + } else if (relativePathWithoutExt.includes('.')) { // filter out paths that have "." since those are not proper cairo paths // e.g. "cairo-contracts/env/lib/python3.9/site-packages/starkware/cairo/common/bitwise" is part of a venv, not really a contract path in the current search path connection.console.log(`Skipping path since it's not a valid cairo path: ${relativePathWithoutExt}`); + } else if (fileFullPath.includes('site-packages/nile/base_project')) { + connection.console.log(`Skipping nile base project: ${relativePathWithoutExt}`); } else { connection.console.log(`Adding package path for cairo file: ${relativePathWithoutExt}`); result.push(convertPathToImport(relativePathWithoutExt)); @@ -1002,7 +1003,7 @@ async function getAllCairoFilesStartingWith(uri: string, prefix: string) : Promi function isPartOfAnotherSearchPath(filePath: string, searchPath: string, packageSearchPaths: string[]) { for (let otherSearchPath of packageSearchPaths) { - if (otherSearchPath !== searchPath && filePath.startsWith(otherSearchPath)) { + if (otherSearchPath !== searchPath && otherSearchPath.startsWith(searchPath) && filePath.startsWith(otherSearchPath)) { return true; } }