Fix Zed Extension breaking when package.json is not present in workspace root#235
Merged
Conversation
|
package.json is not present in workspace root
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close: #217
Cause of the bug
When opening a workspace without
package.jsonin zed,get_ts_plugin_root_pathreturnsErr(_)in the following line.css-modules-kit/crates/zed/src/lib.rs
Line 35 in 5408682
Then,
worktree.root_path()is set as the starting location for searching for ts-plugin in the following line.css-modules-kit/crates/zed/src/lib.rs
Line 110 in 5408682
worktree.root_path()is the root directory of the workspace. However, the ts-plugin is typically not installed in that directory. The Zed Extension for css-modules-kit installs the ts-plugin inextension_work_dir(on macOS, this is~/Library/Application Support/Zed/extensions/work/css-modules-kit).Solution
We change it so that
extension_work_diris used as the starting location for searching for ts-plugin.Changelog
CMK_LOAD_LOCAL_TS_PLUGINfor loading local ts-plugin