Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move-ide] Fix startup errors in move-analyzer VSCode extension (#19573)
## Description This PR fixes issues in the `move-analyzer` VSCode extension that were causing startup errors and failing tests. The two big ones are: * The command IDs in `package.json` have been updated from `sui.*` to `move.*` in the `menus` section to match those in the `commands` section, resolving the startup errors where VSCode reported undefined commands. * The JSON syntax in `language-configuration.json` has been corrected by properly formatting the "brackets" array, ensuring the language configuration is correctly parsed by VSCode. Also includes a fix for a small, unrelated problem: * Missing types dependencies for `parse-json` and `ws` have been added, which resolves an error when trying to run the test suite. ## Test plan I also introduced a small tweak in an attempt to fix an unrelated issue with the test suite. With the fixes introduced to the `package.json` file above, `npm test` now successfully kicks off the test suite, compiles the crate, etc. But it fails when it tries to launch Electron in a subprocess. Here's what that looked like on my machine (macOS 14.6.1, m3 chip): ```zsh $ npm test > [email protected] pretest > npm run compile && npm run lint && npm run copy-tests-files > [email protected] compile > tsc -p ./ && cd ../../ && cargo build info: syncing channel updates for '1.81-aarch64-apple-darwin' info: latest update on 2024-09-05, rust version 1.81.0 (eeb90cda1 2024-09-04) info: downloading component 'cargo' Downloaded num-complex v0.4.6 Downloaded num-rational v0.4.2 ... Compiling move-disassembler v0.1.0 (/Users/kz/vcs/sui/external-crates/move/crates/move-disassembler) Compiling move-model v0.1.0 (/Users/kz/vcs/sui/external-crates/move/crates/move-model) Compiling move-docgen v0.1.0 (/Users/kz/vcs/sui/external-crates/move/crates/move-docgen) Compiling move-package v0.1.0 (/Users/kz/vcs/sui/external-crates/move/crates/move-package) Compiling move-analyzer v1.0.0 (/Users/kz/vcs/sui/external-crates/move/crates/move-analyzer) Compiling move-analyzer v1.0.0 (/Users/kz/vcs/sui/external-crates/move/crates/move-analyzer) Finished `dev` profile [unoptimized + debuginfo] target(s) in 42.17s > [email protected] lint > eslint . --ext ts --max-warnings 0 > [email protected] copy-tests-files > copyfiles "tests/**/*.move" "tests/**/*.exp" "tests/**/*.toml" "tests/**/*.code-workspace" out > [email protected] test > node ./out/tests/runTests.js Downloading VS Code 1.64.0 from https://update.code.visualstudio.com/1.64.0/darwin-arm64/stable Downloading VS Code [==============================] 100% Downloaded VS Code into /Users/kz/vcs/sui/external-crates/move/crates/move-analyzer/editors/code/.vscode-test/vscode-darwin-arm64-1.64.0 Downloaded VS Code into /Users/kz/vcs/sui/external-crates/move/crates/move-analyzer/editors/code/.vscode-test/vscode-darwin-arm64-1.64.0 Test error: Error: spawn /Users/kz/vcs/sui/external-crates/move/crates/move-analyzer/editors/code/.vscode-test/vscode-darwin-arm64-1.64.0/Visual Studio Code.app/Contents/MacOS/Electron ENOENT Exit code: -2 Failed to run tests ``` I was able to resolve the `ENOENT` by introducing one other small tweak to the test suite: * In `tests/runTests.ts`, the path to the VSCode executable has been adjusted by erasing the `'Visual Studio Code.app/'` path component from the `vscodeExecutablePath` variable. While this fixes the file not found error, it exposes a new issue where the Electron executable is reported as damaged in a MacOS system alert. That's a bit harder to fix, but hopefully this new error gives a clearer idea why the test suite isn't working. 🙁 --- ## Release notes Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required. For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates. - [ ] Protocol: - [ ] Nodes (Validators and Full nodes): - [ ] Indexer: - [ ] JSON-RPC: - [ ] GraphQL: - [ ] CLI: - [ ] Rust SDK: - [ ] REST API: --------- Co-authored-by: Kevin Zeidler <[email protected]> Co-authored-by: Adam Welc <[email protected]>
- Loading branch information