Skip to content

Conversation

@runchen0919
Copy link
Collaborator

  • Remove syncWorkspaceRoot() function and symlink creation in home directory
  • Use workspaceRoot as the first workspace folder in multi-root mode, ensuring ${workspaceFolder} resolves to the real project path
  • Fix getWorkspaceRoot() to handle workspace files in .vscode directory
  • Add validation for workspace root name extraction
  • Remove unused fs imports and file system watcher for symlinks

- Remove syncWorkspaceRoot() function and symlink creation in home directory
- Use workspaceRoot as the first workspace folder in multi-root mode,
  ensuring ${workspaceFolder} resolves to the real project path
- Fix getWorkspaceRoot() to handle workspace files in .vscode directory
- Add validation for workspace root name extraction
- Remove unused fs imports and file system watcher for symlinks
@runchen0919
Copy link
Collaborator Author

Multi-Root Workspace Design Analysis URL: https://compass-tech.atlassian.net/browse/TECH-16510?focusedCommentId=1096763

@runchen0919 runchen0919 marked this pull request as ready for review February 5, 2026 07:41
registerBuildifierFormatter();

// if this is a multi-root project, create a listener to refresh the symlinked project root directory on file add/remove
if (ProjectViewManager.isMultiRoot()) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this? As my understanding user will never use multi-root mode, case our workspace configuration is force configured to be single-root mode. right?
maybe I missed something, could you explain more?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not mandatory to use single-root mode. When a user opens the plugin through code-workspace, it will load in multi-root mode. Previously, it was always in single-root mode because an incorrect logic for retrieving the project root directory caused multi-root mode loading to fail, after which it started loading in single-root mode.

The logic for synchronizing files in the project root directory was removed here. The original design synchronized files under ~/development/urbancompass to ~/urbancompass, which was what the ProjectViewManager.syncWorkspaceRoot method did. However, this design conflicted with our usage guidelines. Therefore, I removed this logic and instead directly added ~/development/urbancompass to the workspace as the project root directory. Thus, the file monitoring logic can be removed.

if (workspace.workspaceFile) {
return dirname(workspace.workspaceFile.path);
const workspaceFilePath = dirname(workspace.workspaceFile.path);
if (workspaceFilePath.endsWith('.vscode')) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this means? could tell me an example? Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the loaded project is loaded through the code-workspace file, as shown in the image below, the workspaceFile.path is <repoRoot>/.vscode, which is not the desired <repoRoot> directory

Image

Copy link
Owner

@zhirui1994 zhirui1994 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@runchen0919 runchen0919 merged commit 0d97dd3 into zhirui1994:dev Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants