diff --git a/client/scripts/bundle.js b/client/scripts/bundle.js index 64eb9d99..510f9235 100755 --- a/client/scripts/bundle.js +++ b/client/scripts/bundle.js @@ -111,7 +111,7 @@ async function main() { fs.copyFileSync(path.join(".", "LICENSE"), path.join(tmpDir, "LICENSE")); fs.copyFileSync( - path.join("..", "docs", "images", "vscode-logo.png"), + path.join(__dirname, "..", "..", "docs", "images", "vscode-logo.png"), path.join(imagesDir, "vscode-logo.png") ); @@ -182,39 +182,49 @@ async function main() { process.exit(1); } + console.log("> Fetching external server dependencies...") + const serverPackageFile = path.join(__dirname, "..", "..", "server", "package.json"); + const serverPackageJson = JSON.parse(fs.readFileSync(serverPackageFile, "utf8")); + const serverDeps = serverPackageJson?.dependencies; + if (!serverDeps) { + console.error("Error: Could not find server dependencies"); + process.exit(1); + } + const solidityAnalyzerVersion = serverDeps["@nomicfoundation/solidity-analyzer"]; + const slangVersion = serverDeps["@nomicfoundation/slang"]; + fs.writeFileSync( path.join(serverDir, "package.json"), JSON.stringify({ name: "tmp", version: "0.0.1", dependencies: { - "@nomicfoundation/solidity-analyzer": "0.1.1", - "@nomicfoundation/solidity-analyzer-darwin-arm64": "0.1.1", - "@nomicfoundation/solidity-analyzer-win32-arm64-msvc": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-arm64-musl": "0.1.1", - "@nomicfoundation/solidity-analyzer-win32-ia32-msvc": "0.1.1", - "@nomicfoundation/solidity-analyzer-darwin-x64": "0.1.1", - "@nomicfoundation/solidity-analyzer-win32-x64-msvc": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-x64-gnu": "0.1.1", - "@nomicfoundation/solidity-analyzer-linux-x64-musl": "0.1.1", - "@nomicfoundation/solidity-analyzer-freebsd-x64": "0.1.1", - - "@nomicfoundation/slang": "0.10.1", - "@nomicfoundation/slang-darwin-arm64": "0.10.1", - "@nomicfoundation/slang-win32-arm64-msvc": "0.10.1", - "@nomicfoundation/slang-linux-arm64-gnu": "0.10.1", - "@nomicfoundation/slang-linux-arm64-musl": "0.10.1", - "@nomicfoundation/slang-win32-ia32-msvc": "0.10.1", - "@nomicfoundation/slang-darwin-x64": "0.10.1", - "@nomicfoundation/slang-win32-x64-msvc": "0.10.1", - "@nomicfoundation/slang-linux-x64-gnu": "0.10.1", - "@nomicfoundation/slang-linux-x64-musl": "0.10.1", + "@nomicfoundation/solidity-analyzer": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-darwin-arm64": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-win32-arm64-msvc": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-linux-arm64-musl": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-win32-ia32-msvc": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-darwin-x64": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-win32-x64-msvc": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-linux-x64-gnu": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-linux-x64-musl": solidityAnalyzerVersion, + "@nomicfoundation/solidity-analyzer-freebsd-x64": solidityAnalyzerVersion, + + "@nomicfoundation/slang": slangVersion, + "@nomicfoundation/slang-darwin-arm64": slangVersion, + "@nomicfoundation/slang-win32-arm64-msvc": slangVersion, + "@nomicfoundation/slang-linux-arm64-gnu": slangVersion, + "@nomicfoundation/slang-linux-arm64-musl": slangVersion, + "@nomicfoundation/slang-win32-ia32-msvc": slangVersion, + "@nomicfoundation/slang-darwin-x64": slangVersion, + "@nomicfoundation/slang-win32-x64-msvc": slangVersion, + "@nomicfoundation/slang-linux-x64-gnu": slangVersion, + "@nomicfoundation/slang-linux-x64-musl": slangVersion, }, }) ); - console.log("> Fetching external server dependencies...") await new Promise((resolve) => { exec( "npm install --force", diff --git a/package-lock.json b/package-lock.json index 4e3cd0dc..bbf64038 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2667,28 +2667,28 @@ } }, "node_modules/@nomicfoundation/slang": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang/-/slang-0.10.1.tgz", - "integrity": "sha512-qU9eHCExF6Hix4KPXHv1oQN1vWYGeOrHJXZ+uxroCMZ4Tf5P/kSrxVI2SqnVmwpSdxrwJdDQ9cI8Fe6PV7YDCA==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang/-/slang-0.13.1.tgz", + "integrity": "sha512-QbMjVXvLnXY0A/M5BVOMjNT0NrLRSodpYN8YZC7bZBhNdMPp1XQbaJDs8l0QC8jbIS9mAMA1r+YKxZyxftdWjw==", "engines": { "node": ">= 10" }, "optionalDependencies": { - "@nomicfoundation/slang-darwin-arm64": "0.10.1", - "@nomicfoundation/slang-darwin-x64": "0.10.1", - "@nomicfoundation/slang-linux-arm64-gnu": "0.10.1", - "@nomicfoundation/slang-linux-arm64-musl": "0.10.1", - "@nomicfoundation/slang-linux-x64-gnu": "0.10.1", - "@nomicfoundation/slang-linux-x64-musl": "0.10.1", - "@nomicfoundation/slang-win32-arm64-msvc": "0.10.1", - "@nomicfoundation/slang-win32-ia32-msvc": "0.10.1", - "@nomicfoundation/slang-win32-x64-msvc": "0.10.1" + "@nomicfoundation/slang-darwin-arm64": "0.13.1", + "@nomicfoundation/slang-darwin-x64": "0.13.1", + "@nomicfoundation/slang-linux-arm64-gnu": "0.13.1", + "@nomicfoundation/slang-linux-arm64-musl": "0.13.1", + "@nomicfoundation/slang-linux-x64-gnu": "0.13.1", + "@nomicfoundation/slang-linux-x64-musl": "0.13.1", + "@nomicfoundation/slang-win32-arm64-msvc": "0.13.1", + "@nomicfoundation/slang-win32-ia32-msvc": "0.13.1", + "@nomicfoundation/slang-win32-x64-msvc": "0.13.1" } }, "node_modules/@nomicfoundation/slang-darwin-arm64": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-arm64/-/slang-darwin-arm64-0.10.1.tgz", - "integrity": "sha512-lvXEs9qQS5Qm0vUhy5NwTlvkTMH7cbm2//Z80jhaBqIJlQFUW/0A4JqK/9RAji8ZuOtGC2QT9LnOk2VoNQGiwg==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-arm64/-/slang-darwin-arm64-0.13.1.tgz", + "integrity": "sha512-1TBJM9NIVox/eR1WOszoJpJR2KcBcQ7dwWnO5Zt9v/XQnDdIYj3BxootWOuyQQGrGccKYCX0VivTQNMPnxHmAA==", "cpu": [ "arm64" ], @@ -2701,9 +2701,9 @@ } }, "node_modules/@nomicfoundation/slang-darwin-x64": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-x64/-/slang-darwin-x64-0.10.1.tgz", - "integrity": "sha512-YV8OZyA++MZebNc5j62bXvQKKT8x6jg5kR2O332HHLZb/5kYWJ0PQYw61W9/DwnFFhBwVT65AZ+cJdM0LQJxog==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-x64/-/slang-darwin-x64-0.13.1.tgz", + "integrity": "sha512-jOj9703Q71ShKuMR09B0dmmkBRFXfSj8zy1PG1tJcSWqrDfyvlOFQDszhxA0zs4/mYDmyHVhKjzkUoq0tl/GYw==", "cpu": [ "x64" ], @@ -2716,9 +2716,9 @@ } }, "node_modules/@nomicfoundation/slang-linux-arm64-gnu": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-gnu/-/slang-linux-arm64-gnu-0.10.1.tgz", - "integrity": "sha512-6vJmGMa6yvrf5PvO9lxnd5mfFtrP+1eTVhNBjbAazaSFKfpDrjR4b29JyLwREcialj/+L3prvEUjXRchIj1Gqg==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-gnu/-/slang-linux-arm64-gnu-0.13.1.tgz", + "integrity": "sha512-CQVrCAqHAGBstvIhoeTabWXjUsH/XIzisALbU9crC8zZCacKaYwaqQUgLo894HIWPBQKTxMec03UzFwO56QyQQ==", "cpu": [ "arm64" ], @@ -2731,9 +2731,9 @@ } }, "node_modules/@nomicfoundation/slang-linux-arm64-musl": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-musl/-/slang-linux-arm64-musl-0.10.1.tgz", - "integrity": "sha512-cPX5ybj6A46mb9pros8Kwpzv/Lpkp2q+gS+s8Zg62NkogvSqswDZDlBAZ7FUZTzGpMfhZJn75itPgGUCAoImUA==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-musl/-/slang-linux-arm64-musl-0.13.1.tgz", + "integrity": "sha512-ILGuXf1+qtPE2noN5T+T1Pd5i93mDrh42k53/6fUGLJ/THs16fhxD55A+EpbLSgnnQMAnK6P+DlKFf4wGI/jlw==", "cpu": [ "arm64" ], @@ -2746,9 +2746,9 @@ } }, "node_modules/@nomicfoundation/slang-linux-x64-gnu": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-gnu/-/slang-linux-x64-gnu-0.10.1.tgz", - "integrity": "sha512-sZvtSgb5LencgjqfLkFlhrYQgM8QoSy2t0IcCG1JLA8MXWlYRN/F3nDm3zKSmuOwmtFIzvbc7X/wkkGCNsSQ9g==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-gnu/-/slang-linux-x64-gnu-0.13.1.tgz", + "integrity": "sha512-djxpqYNtKQB4sT22G0QbSX5c/QdnU7mUmvX+SDh5EZeA+TqeumODZQhUsF/n9I8F28XL/fmLygCf5aFbAX3Egg==", "cpu": [ "x64" ], @@ -2761,9 +2761,9 @@ } }, "node_modules/@nomicfoundation/slang-linux-x64-musl": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-musl/-/slang-linux-x64-musl-0.10.1.tgz", - "integrity": "sha512-S2WnY4tMCWBPaAQcPoRDZ6M01hKgE1R22n7sqnF7KI2o0Khsm9fnlAZ/2ct4ioe2Je4hyHrNhms8/534P8dQuw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-musl/-/slang-linux-x64-musl-0.13.1.tgz", + "integrity": "sha512-TugHmWIGgeXirbn5PlSACJ9E7/08bp3fiDrnj6ufGBiW6LLJG74Hn6fxwDURa3wtFiLy4lbt+dWZ5/YnuY+QOw==", "cpu": [ "x64" ], @@ -2776,9 +2776,9 @@ } }, "node_modules/@nomicfoundation/slang-win32-arm64-msvc": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-arm64-msvc/-/slang-win32-arm64-msvc-0.10.1.tgz", - "integrity": "sha512-diu8P/UdSdn1p+XKQK5NgZV2RTZWsL2kHLO+n0bZ3Z4lTojL8drDhMXIXzMcwRUuJdXv/NkO97dsBwM+CyhGiw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-arm64-msvc/-/slang-win32-arm64-msvc-0.13.1.tgz", + "integrity": "sha512-EDyO3AaVuR6E/omAzmCgXHrm0XNLvQk2RoW1AKr5VOayR3TITDTCvnubpr17AAWOzRH5dc/90esnFbqa0cHX2g==", "cpu": [ "arm64" ], @@ -2791,9 +2791,9 @@ } }, "node_modules/@nomicfoundation/slang-win32-ia32-msvc": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-ia32-msvc/-/slang-win32-ia32-msvc-0.10.1.tgz", - "integrity": "sha512-oRNDHADhWFq6D2l8UacJ+ExxJO7sYKOMn4IlYGulyp2KGzjnk4fl2vCpYVUVJ+y9pF4W2G1G06nxxddaPk/2mg==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-ia32-msvc/-/slang-win32-ia32-msvc-0.13.1.tgz", + "integrity": "sha512-5ypLao+OGoXcoHS/3LTJSRHHHMSZ5/aLtOOYby3Qe7sG6gdfp2n7OWQYjS1uZ6SA591z1sXbYsKkHi7Aej8nJQ==", "cpu": [ "ia32" ], @@ -2806,9 +2806,9 @@ } }, "node_modules/@nomicfoundation/slang-win32-x64-msvc": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-x64-msvc/-/slang-win32-x64-msvc-0.10.1.tgz", - "integrity": "sha512-1a6ip/OkkJ8rMaMupgmbon0Rc2rgZ4e+rC7rDA3E2VbDjZsCd2bHAOop9bQCO2rUA9pIYkzwueWJkJZGTKs82w==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-x64-msvc/-/slang-win32-x64-msvc-0.13.1.tgz", + "integrity": "sha512-XDQCE81ToyHeRxdznwacXZiH3dMoTtlrFrrHhU/Zdas2p8F1fkLVuzXBKlrB7fMVd7cIDByG3d9iWdDy/SQIwA==", "cpu": [ "x64" ], @@ -12033,7 +12033,7 @@ "version": "0.7.2", "license": "MIT", "dependencies": { - "@nomicfoundation/slang": "^0.10.1", + "@nomicfoundation/slang": "0.13.1", "@nomicfoundation/solidity-analyzer": "0.1.1" }, "bin": { @@ -14810,73 +14810,73 @@ } }, "@nomicfoundation/slang": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang/-/slang-0.10.1.tgz", - "integrity": "sha512-qU9eHCExF6Hix4KPXHv1oQN1vWYGeOrHJXZ+uxroCMZ4Tf5P/kSrxVI2SqnVmwpSdxrwJdDQ9cI8Fe6PV7YDCA==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang/-/slang-0.13.1.tgz", + "integrity": "sha512-QbMjVXvLnXY0A/M5BVOMjNT0NrLRSodpYN8YZC7bZBhNdMPp1XQbaJDs8l0QC8jbIS9mAMA1r+YKxZyxftdWjw==", "requires": { - "@nomicfoundation/slang-darwin-arm64": "0.10.1", - "@nomicfoundation/slang-darwin-x64": "0.10.1", - "@nomicfoundation/slang-linux-arm64-gnu": "0.10.1", - "@nomicfoundation/slang-linux-arm64-musl": "0.10.1", - "@nomicfoundation/slang-linux-x64-gnu": "0.10.1", - "@nomicfoundation/slang-linux-x64-musl": "0.10.1", - "@nomicfoundation/slang-win32-arm64-msvc": "0.10.1", - "@nomicfoundation/slang-win32-ia32-msvc": "0.10.1", - "@nomicfoundation/slang-win32-x64-msvc": "0.10.1" + "@nomicfoundation/slang-darwin-arm64": "0.13.1", + "@nomicfoundation/slang-darwin-x64": "0.13.1", + "@nomicfoundation/slang-linux-arm64-gnu": "0.13.1", + "@nomicfoundation/slang-linux-arm64-musl": "0.13.1", + "@nomicfoundation/slang-linux-x64-gnu": "0.13.1", + "@nomicfoundation/slang-linux-x64-musl": "0.13.1", + "@nomicfoundation/slang-win32-arm64-msvc": "0.13.1", + "@nomicfoundation/slang-win32-ia32-msvc": "0.13.1", + "@nomicfoundation/slang-win32-x64-msvc": "0.13.1" } }, "@nomicfoundation/slang-darwin-arm64": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-arm64/-/slang-darwin-arm64-0.10.1.tgz", - "integrity": "sha512-lvXEs9qQS5Qm0vUhy5NwTlvkTMH7cbm2//Z80jhaBqIJlQFUW/0A4JqK/9RAji8ZuOtGC2QT9LnOk2VoNQGiwg==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-arm64/-/slang-darwin-arm64-0.13.1.tgz", + "integrity": "sha512-1TBJM9NIVox/eR1WOszoJpJR2KcBcQ7dwWnO5Zt9v/XQnDdIYj3BxootWOuyQQGrGccKYCX0VivTQNMPnxHmAA==", "optional": true }, "@nomicfoundation/slang-darwin-x64": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-x64/-/slang-darwin-x64-0.10.1.tgz", - "integrity": "sha512-YV8OZyA++MZebNc5j62bXvQKKT8x6jg5kR2O332HHLZb/5kYWJ0PQYw61W9/DwnFFhBwVT65AZ+cJdM0LQJxog==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-darwin-x64/-/slang-darwin-x64-0.13.1.tgz", + "integrity": "sha512-jOj9703Q71ShKuMR09B0dmmkBRFXfSj8zy1PG1tJcSWqrDfyvlOFQDszhxA0zs4/mYDmyHVhKjzkUoq0tl/GYw==", "optional": true }, "@nomicfoundation/slang-linux-arm64-gnu": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-gnu/-/slang-linux-arm64-gnu-0.10.1.tgz", - "integrity": "sha512-6vJmGMa6yvrf5PvO9lxnd5mfFtrP+1eTVhNBjbAazaSFKfpDrjR4b29JyLwREcialj/+L3prvEUjXRchIj1Gqg==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-gnu/-/slang-linux-arm64-gnu-0.13.1.tgz", + "integrity": "sha512-CQVrCAqHAGBstvIhoeTabWXjUsH/XIzisALbU9crC8zZCacKaYwaqQUgLo894HIWPBQKTxMec03UzFwO56QyQQ==", "optional": true }, "@nomicfoundation/slang-linux-arm64-musl": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-musl/-/slang-linux-arm64-musl-0.10.1.tgz", - "integrity": "sha512-cPX5ybj6A46mb9pros8Kwpzv/Lpkp2q+gS+s8Zg62NkogvSqswDZDlBAZ7FUZTzGpMfhZJn75itPgGUCAoImUA==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-arm64-musl/-/slang-linux-arm64-musl-0.13.1.tgz", + "integrity": "sha512-ILGuXf1+qtPE2noN5T+T1Pd5i93mDrh42k53/6fUGLJ/THs16fhxD55A+EpbLSgnnQMAnK6P+DlKFf4wGI/jlw==", "optional": true }, "@nomicfoundation/slang-linux-x64-gnu": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-gnu/-/slang-linux-x64-gnu-0.10.1.tgz", - "integrity": "sha512-sZvtSgb5LencgjqfLkFlhrYQgM8QoSy2t0IcCG1JLA8MXWlYRN/F3nDm3zKSmuOwmtFIzvbc7X/wkkGCNsSQ9g==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-gnu/-/slang-linux-x64-gnu-0.13.1.tgz", + "integrity": "sha512-djxpqYNtKQB4sT22G0QbSX5c/QdnU7mUmvX+SDh5EZeA+TqeumODZQhUsF/n9I8F28XL/fmLygCf5aFbAX3Egg==", "optional": true }, "@nomicfoundation/slang-linux-x64-musl": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-musl/-/slang-linux-x64-musl-0.10.1.tgz", - "integrity": "sha512-S2WnY4tMCWBPaAQcPoRDZ6M01hKgE1R22n7sqnF7KI2o0Khsm9fnlAZ/2ct4ioe2Je4hyHrNhms8/534P8dQuw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-linux-x64-musl/-/slang-linux-x64-musl-0.13.1.tgz", + "integrity": "sha512-TugHmWIGgeXirbn5PlSACJ9E7/08bp3fiDrnj6ufGBiW6LLJG74Hn6fxwDURa3wtFiLy4lbt+dWZ5/YnuY+QOw==", "optional": true }, "@nomicfoundation/slang-win32-arm64-msvc": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-arm64-msvc/-/slang-win32-arm64-msvc-0.10.1.tgz", - "integrity": "sha512-diu8P/UdSdn1p+XKQK5NgZV2RTZWsL2kHLO+n0bZ3Z4lTojL8drDhMXIXzMcwRUuJdXv/NkO97dsBwM+CyhGiw==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-arm64-msvc/-/slang-win32-arm64-msvc-0.13.1.tgz", + "integrity": "sha512-EDyO3AaVuR6E/omAzmCgXHrm0XNLvQk2RoW1AKr5VOayR3TITDTCvnubpr17AAWOzRH5dc/90esnFbqa0cHX2g==", "optional": true }, "@nomicfoundation/slang-win32-ia32-msvc": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-ia32-msvc/-/slang-win32-ia32-msvc-0.10.1.tgz", - "integrity": "sha512-oRNDHADhWFq6D2l8UacJ+ExxJO7sYKOMn4IlYGulyp2KGzjnk4fl2vCpYVUVJ+y9pF4W2G1G06nxxddaPk/2mg==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-ia32-msvc/-/slang-win32-ia32-msvc-0.13.1.tgz", + "integrity": "sha512-5ypLao+OGoXcoHS/3LTJSRHHHMSZ5/aLtOOYby3Qe7sG6gdfp2n7OWQYjS1uZ6SA591z1sXbYsKkHi7Aej8nJQ==", "optional": true }, "@nomicfoundation/slang-win32-x64-msvc": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-x64-msvc/-/slang-win32-x64-msvc-0.10.1.tgz", - "integrity": "sha512-1a6ip/OkkJ8rMaMupgmbon0Rc2rgZ4e+rC7rDA3E2VbDjZsCd2bHAOop9bQCO2rUA9pIYkzwueWJkJZGTKs82w==", + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/@nomicfoundation/slang-win32-x64-msvc/-/slang-win32-x64-msvc-0.13.1.tgz", + "integrity": "sha512-XDQCE81ToyHeRxdznwacXZiH3dMoTtlrFrrHhU/Zdas2p8F1fkLVuzXBKlrB7fMVd7cIDByG3d9iWdDy/SQIwA==", "optional": true }, "@nomicfoundation/solidity-analyzer": { @@ -14958,7 +14958,7 @@ "version": "file:server", "requires": { "@istanbuljs/nyc-config-typescript": "1.0.2", - "@nomicfoundation/slang": "^0.10.1", + "@nomicfoundation/slang": "0.13.1", "@nomicfoundation/solidity-analyzer": "0.1.1", "@sentry/node": "7.32.1", "@sentry/tracing": "7.32.1", diff --git a/server/package.json b/server/package.json index 905c1467..a633c79e 100644 --- a/server/package.json +++ b/server/package.json @@ -87,7 +87,7 @@ "yaml": "^2.2.1" }, "dependencies": { - "@nomicfoundation/slang": "^0.10.1", + "@nomicfoundation/slang": "0.13.1", "@nomicfoundation/solidity-analyzer": "0.1.1" } } diff --git a/server/src/parser/slangHelpers.ts b/server/src/parser/slangHelpers.ts index 00da758d..c5e7052f 100644 --- a/server/src/parser/slangHelpers.ts +++ b/server/src/parser/slangHelpers.ts @@ -16,7 +16,8 @@ export interface SlangNodeWrapper { type: NodeType; kind: NodeKind; text: string; - pathRuleNodes: SlangNode[]; + name: string; + ancestors: () => SlangNode[]; } export function slangToVSCodeRange( @@ -54,8 +55,11 @@ export function getLanguage(versionPragmas: string[]): Language { ); if (slangVersion === null) { + const latest = supportedVersions[supportedVersions.length - 1]; throw new Error( - `No supported solidity version found. Supported versions: ${supportedVersions}, pragma directives: ${versionPragmas}` + `No Slang-supported version (latest: ${latest}) for Solidity found that satisfies the pragma directives: '${versionPragmas.join( + " " + )}'.` ); } return new Language(slangVersion); diff --git a/server/src/services/documentSymbol/SymbolVisitor.ts b/server/src/services/documentSymbol/SymbolVisitor.ts index 2b8d1dff..2f12b9f1 100644 --- a/server/src/services/documentSymbol/SymbolVisitor.ts +++ b/server/src/services/documentSymbol/SymbolVisitor.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { SymbolKind } from "vscode-languageserver-types"; import _ from "lodash"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { TokenNode } from "@nomicfoundation/slang/cst"; import { TextDocument } from "vscode-languageserver-textdocument"; import { Cursor } from "@nomicfoundation/slang/cursor"; @@ -11,7 +11,8 @@ import { SymbolTreeBuilder } from "./SymbolTreeBuilder"; export abstract class SymbolVisitor { public abstract ruleKind: RuleKind; public abstract symbolKind: SymbolKind; - public abstract nameTokenKind: TokenKind; + /** The token that contains the name of the symbol represented by the rule. */ + public abstract nameToken: readonly [FieldName, TokenKind]; constructor( public document: TextDocument, @@ -27,20 +28,17 @@ export abstract class SymbolVisitor { // Find identifier const childCursor = cursor.spawn(); - do { - const nameToken: TokenNode | null = childCursor.findTokenWithKind([ - this.nameTokenKind, - ]); - - if (nameToken && childCursor.pathRuleNodes.length === 1) { - symbolName = nameToken.text; - selectionRange = slangToVSCodeRange( - this.document, - childCursor.textRange - ); - break; + while (childCursor.goToNextTokenWithKind(this.nameToken[1])) { + if (childCursor.nodeName !== this.nameToken[0]) { + continue; } - } while (childCursor.goToNext()); + + const nameToken = childCursor.node() as TokenNode; + + symbolName = nameToken.text; + selectionRange = slangToVSCodeRange(this.document, childCursor.textRange); + break; + } let lastOpenSymbol; diff --git a/server/src/services/documentSymbol/onDocumentSymbol.ts b/server/src/services/documentSymbol/onDocumentSymbol.ts index 48b77321..33f74aae 100644 --- a/server/src/services/documentSymbol/onDocumentSymbol.ts +++ b/server/src/services/documentSymbol/onDocumentSymbol.ts @@ -5,8 +5,7 @@ import { DocumentSymbolParams } from "vscode-languageserver/node"; import { DocumentSymbol, SymbolInformation } from "vscode-languageserver-types"; import { analyze } from "@nomicfoundation/solidity-analyzer"; import _ from "lodash"; -import { ProductionKind } from "@nomicfoundation/slang/kinds"; -import { Cursor } from "@nomicfoundation/slang/cursor"; +import { RuleKind } from "@nomicfoundation/slang/kinds"; import { RuleNode } from "@nomicfoundation/slang/cst"; import { ServerState } from "../../types"; import { getLanguage } from "../../parser/slangHelpers"; @@ -61,11 +60,10 @@ export function onDocumentSymbol(serverState: ServerState) { span = transaction.startChild({ op: "slang-parsing" }); const parseOutput = language.parse( - ProductionKind.SourceUnit, + RuleKind.SourceUnit, document.getText() ); - const parseTree = parseOutput.parseTree; span.finish(); const builder = new SymbolTreeBuilder(); @@ -94,9 +92,8 @@ export function onDocumentSymbol(serverState: ServerState) { const indexedVisitors = _.keyBy(visitors, "ruleKind"); - const cursor: Cursor = parseTree.cursor; + const cursor = parseOutput.createTreeCursor(); const ruleKinds = visitors.map((v) => v.ruleKind); - let node: RuleNode; // Useful to keep this here for development // const kursor: Cursor = parseTree.cursor.clone(); @@ -109,11 +106,11 @@ export function onDocumentSymbol(serverState: ServerState) { // } while (kursor.goToNext()); span = transaction.startChild({ op: "walk-generate-symbols" }); - while ((node = cursor.findRuleWithKind(ruleKinds)) !== null) { + while (cursor.goToNextRuleWithKinds(ruleKinds)) { + const node = cursor.node() as RuleNode; + const visitor: SymbolVisitor = indexedVisitors[node.kind]; visitor.onRuleNode(cursor); - - cursor.goToNext(); } span.finish(); diff --git a/server/src/services/documentSymbol/visitors/ConstantDefinition.ts b/server/src/services/documentSymbol/visitors/ConstantDefinition.ts index a83013d5..a26c16fc 100644 --- a/server/src/services/documentSymbol/visitors/ConstantDefinition.ts +++ b/server/src/services/documentSymbol/visitors/ConstantDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { RuleKind, TokenKind, FieldName } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class ConstantDefinition extends SymbolVisitor { public ruleKind = RuleKind.ConstantDefinition; public symbolKind = SymbolKind.Constant; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/ConstructorDefinition.ts b/server/src/services/documentSymbol/visitors/ConstructorDefinition.ts index c1faaee9..5586c4ed 100644 --- a/server/src/services/documentSymbol/visitors/ConstructorDefinition.ts +++ b/server/src/services/documentSymbol/visitors/ConstructorDefinition.ts @@ -1,9 +1,12 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { RuleKind, TokenKind, FieldName } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class ConstructorDefinition extends SymbolVisitor { public ruleKind = RuleKind.ConstructorDefinition; public symbolKind = SymbolKind.Constructor; - public nameTokenKind = TokenKind.ConstructorKeyword; + public nameToken = [ + FieldName.ConstructorKeyword, + TokenKind.ConstructorKeyword, + ] as const; } diff --git a/server/src/services/documentSymbol/visitors/ContractDefinition.ts b/server/src/services/documentSymbol/visitors/ContractDefinition.ts index e5f0a9d3..2236cda8 100644 --- a/server/src/services/documentSymbol/visitors/ContractDefinition.ts +++ b/server/src/services/documentSymbol/visitors/ContractDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class ContractDefinition extends SymbolVisitor { public ruleKind = RuleKind.ContractDefinition; public symbolKind = SymbolKind.Class; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/EnumDefinition.ts b/server/src/services/documentSymbol/visitors/EnumDefinition.ts index e27f715f..3bfbe56f 100644 --- a/server/src/services/documentSymbol/visitors/EnumDefinition.ts +++ b/server/src/services/documentSymbol/visitors/EnumDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class EnumDefinition extends SymbolVisitor { public ruleKind = RuleKind.EnumDefinition; public symbolKind = SymbolKind.Enum; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/ErrorDefinition.ts b/server/src/services/documentSymbol/visitors/ErrorDefinition.ts index 7f607faa..caf7382b 100644 --- a/server/src/services/documentSymbol/visitors/ErrorDefinition.ts +++ b/server/src/services/documentSymbol/visitors/ErrorDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { RuleKind, TokenKind, FieldName } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class ErrorDefinition extends SymbolVisitor { public ruleKind = RuleKind.ErrorDefinition; public symbolKind = SymbolKind.Event; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/EventDefinition.ts b/server/src/services/documentSymbol/visitors/EventDefinition.ts index 32bb90eb..7606905b 100644 --- a/server/src/services/documentSymbol/visitors/EventDefinition.ts +++ b/server/src/services/documentSymbol/visitors/EventDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { RuleKind, TokenKind, FieldName } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class EventDefinition extends SymbolVisitor { public ruleKind = RuleKind.EventDefinition; public symbolKind = SymbolKind.Event; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/FallbackFunctionDefinition.ts b/server/src/services/documentSymbol/visitors/FallbackFunctionDefinition.ts index 379b94ce..46dbd6c9 100644 --- a/server/src/services/documentSymbol/visitors/FallbackFunctionDefinition.ts +++ b/server/src/services/documentSymbol/visitors/FallbackFunctionDefinition.ts @@ -1,9 +1,12 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class FallbackFunctionDefinition extends SymbolVisitor { public ruleKind = RuleKind.FallbackFunctionDefinition; public symbolKind = SymbolKind.Function; - public nameTokenKind = TokenKind.FallbackKeyword; + public nameToken = [ + FieldName.FallbackKeyword, + TokenKind.FallbackKeyword, + ] as const; } diff --git a/server/src/services/documentSymbol/visitors/FunctionDefinition.ts b/server/src/services/documentSymbol/visitors/FunctionDefinition.ts index 4f336bec..006ceb89 100644 --- a/server/src/services/documentSymbol/visitors/FunctionDefinition.ts +++ b/server/src/services/documentSymbol/visitors/FunctionDefinition.ts @@ -1,9 +1,11 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class FunctionDefinition extends SymbolVisitor { public ruleKind = RuleKind.FunctionDefinition; public symbolKind = SymbolKind.Function; - public nameTokenKind = TokenKind.Identifier; + // TODO: Support functions named "receive" and "fallback" post 0.6.0 + // (they use TokenKind.{ReceiveKeyword, FallbackKeyword} instead) + public nameToken = [FieldName.Variant, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/InterfaceDefinition.ts b/server/src/services/documentSymbol/visitors/InterfaceDefinition.ts index 7bf9ae13..638de747 100644 --- a/server/src/services/documentSymbol/visitors/InterfaceDefinition.ts +++ b/server/src/services/documentSymbol/visitors/InterfaceDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class InterfaceDefinition extends SymbolVisitor { public ruleKind = RuleKind.InterfaceDefinition; public symbolKind = SymbolKind.Interface; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/LibraryDefinition.ts b/server/src/services/documentSymbol/visitors/LibraryDefinition.ts index 2d54d91d..812110a6 100644 --- a/server/src/services/documentSymbol/visitors/LibraryDefinition.ts +++ b/server/src/services/documentSymbol/visitors/LibraryDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class LibraryDefinition extends SymbolVisitor { public ruleKind = RuleKind.LibraryDefinition; public symbolKind = SymbolKind.Class; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/ModifierDefinition.ts b/server/src/services/documentSymbol/visitors/ModifierDefinition.ts index 0456ab4b..623b21ac 100644 --- a/server/src/services/documentSymbol/visitors/ModifierDefinition.ts +++ b/server/src/services/documentSymbol/visitors/ModifierDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class ModifierDefinition extends SymbolVisitor { public ruleKind = RuleKind.ModifierDefinition; public symbolKind = SymbolKind.Function; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/ReceiveFunctionDefinition.ts b/server/src/services/documentSymbol/visitors/ReceiveFunctionDefinition.ts index 8927c6b0..e0185b31 100644 --- a/server/src/services/documentSymbol/visitors/ReceiveFunctionDefinition.ts +++ b/server/src/services/documentSymbol/visitors/ReceiveFunctionDefinition.ts @@ -1,9 +1,12 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class ReceiveFunctionDefinition extends SymbolVisitor { public ruleKind = RuleKind.ReceiveFunctionDefinition; public symbolKind = SymbolKind.Function; - public nameTokenKind = TokenKind.ReceiveKeyword; + public nameToken = [ + FieldName.ReceiveKeyword, + TokenKind.ReceiveKeyword, + ] as const; } diff --git a/server/src/services/documentSymbol/visitors/StateVariableDeclaration.ts b/server/src/services/documentSymbol/visitors/StateVariableDeclaration.ts index 7f6b17e9..212b8ccd 100644 --- a/server/src/services/documentSymbol/visitors/StateVariableDeclaration.ts +++ b/server/src/services/documentSymbol/visitors/StateVariableDeclaration.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class StateVariableDeclaration extends SymbolVisitor { public ruleKind = RuleKind.StateVariableDefinition; public symbolKind = SymbolKind.Property; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/StructDefinition.ts b/server/src/services/documentSymbol/visitors/StructDefinition.ts index 5f9b69a5..f6a9c59a 100644 --- a/server/src/services/documentSymbol/visitors/StructDefinition.ts +++ b/server/src/services/documentSymbol/visitors/StructDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class StructDefinition extends SymbolVisitor { public ruleKind = RuleKind.StructDefinition; public symbolKind = SymbolKind.Struct; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/StructMember.ts b/server/src/services/documentSymbol/visitors/StructMember.ts index b3f6e734..f2f1e0f6 100644 --- a/server/src/services/documentSymbol/visitors/StructMember.ts +++ b/server/src/services/documentSymbol/visitors/StructMember.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class StructMember extends SymbolVisitor { public ruleKind = RuleKind.StructMember; public symbolKind = SymbolKind.Property; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/UnnamedFunctionDefinition.ts b/server/src/services/documentSymbol/visitors/UnnamedFunctionDefinition.ts index 54bdcfc5..0cbe948a 100644 --- a/server/src/services/documentSymbol/visitors/UnnamedFunctionDefinition.ts +++ b/server/src/services/documentSymbol/visitors/UnnamedFunctionDefinition.ts @@ -1,9 +1,12 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class UnnamedFunctionDefinition extends SymbolVisitor { public ruleKind = RuleKind.UnnamedFunctionDefinition; public symbolKind = SymbolKind.Function; - public nameTokenKind = TokenKind.FunctionKeyword; + public nameToken = [ + FieldName.FunctionKeyword, + TokenKind.FunctionKeyword, + ] as const; } diff --git a/server/src/services/documentSymbol/visitors/UserDefinedValueTypeDefinition.ts b/server/src/services/documentSymbol/visitors/UserDefinedValueTypeDefinition.ts index 7067bd18..fc25e15c 100644 --- a/server/src/services/documentSymbol/visitors/UserDefinedValueTypeDefinition.ts +++ b/server/src/services/documentSymbol/visitors/UserDefinedValueTypeDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class UserDefinedValueTypeDefinition extends SymbolVisitor { public ruleKind = RuleKind.UserDefinedValueTypeDefinition; public symbolKind = SymbolKind.TypeParameter; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/VariableDeclaration.ts b/server/src/services/documentSymbol/visitors/VariableDeclaration.ts index ad8af4b4..12e484d7 100644 --- a/server/src/services/documentSymbol/visitors/VariableDeclaration.ts +++ b/server/src/services/documentSymbol/visitors/VariableDeclaration.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class VariableDeclaration extends SymbolVisitor { - public ruleKind = RuleKind.VariableDeclaration; + public ruleKind = RuleKind.VariableDeclarationStatement; public symbolKind = SymbolKind.Variable; - public nameTokenKind = TokenKind.Identifier; + public nameToken = [FieldName.Name, TokenKind.Identifier] as const; } diff --git a/server/src/services/documentSymbol/visitors/YulFunctionDefinition.ts b/server/src/services/documentSymbol/visitors/YulFunctionDefinition.ts index e1565c83..e5870674 100644 --- a/server/src/services/documentSymbol/visitors/YulFunctionDefinition.ts +++ b/server/src/services/documentSymbol/visitors/YulFunctionDefinition.ts @@ -1,9 +1,9 @@ import { SymbolKind } from "vscode-languageserver-types"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { SymbolVisitor } from "../SymbolVisitor"; export class YulFunctionDefinition extends SymbolVisitor { public ruleKind = RuleKind.YulFunctionDefinition; public symbolKind = SymbolKind.Function; - public nameTokenKind = TokenKind.YulIdentifier; + public nameToken = [FieldName.Name, TokenKind.YulIdentifier] as const; } diff --git a/server/src/services/semanticHighlight/highlighters/ContractDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/ContractDefinitionHighlighter.ts index a0449c91..7e3ed299 100644 --- a/server/src/services/semanticHighlight/highlighters/ContractDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/ContractDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -9,10 +9,11 @@ export class ContractDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.ContractDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/CustomTypeHighlighter.ts b/server/src/services/semanticHighlight/highlighters/CustomTypeHighlighter.ts index 7336ec19..05e87136 100644 --- a/server/src/services/semanticHighlight/highlighters/CustomTypeHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/CustomTypeHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -9,10 +9,12 @@ export class CustomTypeHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + // NOTE: This only supports highlighting the first identifier in the path + nodeWrapper.name === FieldName.Item && ancestors[ancestors.length - 2]?.kind === RuleKind.TypeName ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/EnumDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/EnumDefinitionHighlighter.ts index ff239114..e262acaf 100644 --- a/server/src/services/semanticHighlight/highlighters/EnumDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/EnumDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -8,10 +8,11 @@ export class EnumDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.EnumDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/ErrorDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/ErrorDefinitionHighlighter.ts index 76b46d8c..b105e2dd 100644 --- a/server/src/services/semanticHighlight/highlighters/ErrorDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/ErrorDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -8,10 +8,11 @@ export class ErrorDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.ErrorDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/EventDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/EventDefinitionHighlighter.ts index beeda201..37abc31e 100644 --- a/server/src/services/semanticHighlight/highlighters/EventDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/EventDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -9,10 +9,11 @@ export class EventDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.EventDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/EventEmissionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/EventEmissionHighlighter.ts index 96bc1611..df6f1051 100644 --- a/server/src/services/semanticHighlight/highlighters/EventEmissionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/EventEmissionHighlighter.ts @@ -9,10 +9,11 @@ export class EventEmissionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + // NOTE: This only highlights the first identifier (in path) in the event emission statement ancestors[ancestors.length - 2]?.kind === RuleKind.EmitStatement ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/FunctionCallHighlighter.ts b/server/src/services/semanticHighlight/highlighters/FunctionCallHighlighter.ts index 52b8b7f9..f06cc451 100644 --- a/server/src/services/semanticHighlight/highlighters/FunctionCallHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/FunctionCallHighlighter.ts @@ -9,10 +9,11 @@ export class FunctionCallHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + // NOTE: This only supports the basic case of a function call with positional arguments "(a,b,c)" ancestors[ancestors.length - 2]?.kind === RuleKind.FunctionCallExpression ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.function); diff --git a/server/src/services/semanticHighlight/highlighters/FunctionDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/FunctionDefinitionHighlighter.ts index bce240a5..479cb1c3 100644 --- a/server/src/services/semanticHighlight/highlighters/FunctionDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/FunctionDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -9,11 +9,13 @@ export class FunctionDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && - ancestors[ancestors.length - 1]?.kind === RuleKind.FunctionDefinition + // TODO: Support also 'receive' and 'fallback' functions post 0.6.0 + nodeWrapper.name === FieldName.Variant && + ancestors[ancestors.length - 2]?.kind === RuleKind.FunctionDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.function); } diff --git a/server/src/services/semanticHighlight/highlighters/InterfaceDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/InterfaceDefinitionHighlighter.ts index 3c2e12d8..2c679f69 100644 --- a/server/src/services/semanticHighlight/highlighters/InterfaceDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/InterfaceDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -9,10 +9,11 @@ export class InterfaceDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.InterfaceDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/LibraryDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/LibraryDefinitionHighlighter.ts index 5cc2ec6c..2d05b266 100644 --- a/server/src/services/semanticHighlight/highlighters/LibraryDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/LibraryDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -8,10 +8,11 @@ export class LibraryDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.LibraryDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/StructDefinitionHighlighter.ts b/server/src/services/semanticHighlight/highlighters/StructDefinitionHighlighter.ts index 1a31047a..ba935492 100644 --- a/server/src/services/semanticHighlight/highlighters/StructDefinitionHighlighter.ts +++ b/server/src/services/semanticHighlight/highlighters/StructDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -9,10 +9,11 @@ export class StructDefinitionHighlighter extends HighlightVisitor { public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.StructDefinition ) { this.tokenBuilder.addToken(nodeWrapper, SemanticTokenTypes.type); diff --git a/server/src/services/semanticHighlight/highlighters/UserDefinedValueTypeDefinitionHighlighter copy.ts b/server/src/services/semanticHighlight/highlighters/UserDefinedValueTypeDefinitionHighlighter.ts similarity index 81% rename from server/src/services/semanticHighlight/highlighters/UserDefinedValueTypeDefinitionHighlighter copy.ts rename to server/src/services/semanticHighlight/highlighters/UserDefinedValueTypeDefinitionHighlighter.ts index 96a6f7bf..a56de0c3 100644 --- a/server/src/services/semanticHighlight/highlighters/UserDefinedValueTypeDefinitionHighlighter copy.ts +++ b/server/src/services/semanticHighlight/highlighters/UserDefinedValueTypeDefinitionHighlighter.ts @@ -1,6 +1,6 @@ import { SemanticTokenTypes } from "vscode-languageserver-protocol"; import { NodeType } from "@nomicfoundation/slang/cst"; -import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; +import { FieldName, RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { HighlightVisitor } from "../HighlightVisitor"; import { SlangNodeWrapper } from "../../../parser/slangHelpers"; @@ -8,10 +8,11 @@ export class UserDefinedValueTypeDefinitionHighlighter extends HighlightVisitor public tokenKinds = new Set([TokenKind.Identifier]); public enter(nodeWrapper: SlangNodeWrapper): void { - const ancestors = nodeWrapper.pathRuleNodes; + const ancestors = nodeWrapper.ancestors(); if ( nodeWrapper.type === NodeType.Token && nodeWrapper.kind === TokenKind.Identifier && + nodeWrapper.name === FieldName.Name && ancestors[ancestors.length - 1]?.kind === RuleKind.UserDefinedValueTypeDefinition ) { diff --git a/server/src/services/semanticHighlight/onSemanticTokensFull.ts b/server/src/services/semanticHighlight/onSemanticTokensFull.ts index f997bf2e..c93c136b 100644 --- a/server/src/services/semanticHighlight/onSemanticTokensFull.ts +++ b/server/src/services/semanticHighlight/onSemanticTokensFull.ts @@ -7,8 +7,7 @@ import { } from "vscode-languageserver-protocol"; import _, { Dictionary } from "lodash"; import { analyze } from "@nomicfoundation/solidity-analyzer"; -import { ProductionKind, TokenKind } from "@nomicfoundation/slang/kinds"; -import { Cursor } from "@nomicfoundation/slang/cursor"; +import { RuleKind, TokenKind } from "@nomicfoundation/slang/kinds"; import { TokenNode } from "@nomicfoundation/slang/cst"; import { ServerState } from "../../types"; import { getLanguage } from "../../parser/slangHelpers"; @@ -22,7 +21,7 @@ import { ContractDefinitionHighlighter } from "./highlighters/ContractDefinition import { InterfaceDefinitionHighlighter } from "./highlighters/InterfaceDefinitionHighlighter"; import { StructDefinitionHighlighter } from "./highlighters/StructDefinitionHighlighter"; import { HighlightVisitor } from "./HighlightVisitor"; -import { UserDefinedValueTypeDefinitionHighlighter } from "./highlighters/UserDefinedValueTypeDefinitionHighlighter copy"; +import { UserDefinedValueTypeDefinitionHighlighter } from "./highlighters/UserDefinedValueTypeDefinitionHighlighter"; import { EnumDefinitionHighlighter } from "./highlighters/EnumDefinitionHighlighter"; import { ErrorDefinitionHighlighter } from "./highlighters/ErrorDefinitionHighlighter"; import { LibraryDefinitionHighlighter } from "./highlighters/LibraryDefinitionHighlighter"; @@ -62,11 +61,10 @@ export function onSemanticTokensFull(serverState: ServerState) { span = transaction.startChild({ op: "slang-parsing" }); const parseOutput = language.parse( - ProductionKind.SourceUnit, + RuleKind.SourceUnit, document.getText() ); - const parseTree = parseOutput.parseTree; span.finish(); // Register visitors @@ -102,18 +100,18 @@ export function onSemanticTokensFull(serverState: ServerState) { } } - const cursor: Cursor = parseTree.cursor; - let node: TokenNode; + const cursor = parseOutput.createTreeCursor(); span = transaction.startChild({ op: "walk-highlight-tokens" }); - while ( - (node = cursor.findTokenWithKind(registeredTokenKinds)) !== null - ) { + while (cursor.goToNextTokenWithKinds(registeredTokenKinds)) { + const node = cursor.node() as TokenNode; + const nodeWrapper = { kind: node.kind, - pathRuleNodes: cursor.pathRuleNodes, + ancestors: () => cursor.ancestors(), text: node.text, textRange: cursor.textRange, + name: cursor.nodeName, type: node.type, }; @@ -121,8 +119,6 @@ export function onSemanticTokensFull(serverState: ServerState) { for (const visitor of registeredVisitors) { visitor.enter(nodeWrapper); } - - cursor.goToNext(); } span.finish(); diff --git a/test/protocol/test/textDocument/documentSymbol/documentSymbol.test.ts b/test/protocol/test/textDocument/documentSymbol/documentSymbol.test.ts index 14216fca..e6e108b4 100644 --- a/test/protocol/test/textDocument/documentSymbol/documentSymbol.test.ts +++ b/test/protocol/test/textDocument/documentSymbol/documentSymbol.test.ts @@ -418,8 +418,8 @@ describe('[hardhat] documentSymbol', () => { character: 0, }, end: { - line: 35, - character: 21, + line: 36, + character: 0, }, }, selectionRange: { @@ -644,8 +644,8 @@ describe('[hardhat] documentSymbol', () => { character: 0, }, end: { - line: 62, - character: 39, + line: 63, + character: 0, }, }, selectionRange: { @@ -669,8 +669,8 @@ describe('[hardhat] documentSymbol', () => { character: 0, }, end: { - line: 64, - character: 41, + line: 65, + character: 0, }, }, selectionRange: { @@ -694,8 +694,8 @@ describe('[hardhat] documentSymbol', () => { character: 0, }, end: { - line: 65, - character: 42, + line: 66, + character: 0, }, }, selectionRange: { @@ -719,8 +719,8 @@ describe('[hardhat] documentSymbol', () => { character: 0, }, end: { - line: 77, - character: 35, + line: 78, + character: 0, }, }, selectionRange: {