Theia: [workspace] misleading `isMultiRootWorkspaceOpened` implementation

Created on 4 Apr 2019  路  2Comments  路  Source: eclipse-theia/theia

The following implementation for the method isMultiRootWorkspaceOpened() is misleading.
https://github.com/theia-ide/theia/blob/a27cbd0bfcc03ccc36044e51c6bd341d7f5eb93a/packages/workspace/src/browser/workspace-service.ts#L267-L269

The method checks whether there is a workspace opened and that the preference is on.
This is a false positive and does not accurately describe if a multi-root workspace is in fact opened.

Additional checks should be made to verify the source of the workspace
(for example being a *.theia-workspace file) or a directory (single root).

@elaihau your thoughts?

bug help wanted workspace

Most helpful comment

you are right. isMultiRootWorkspaceOpened does not return what its name indicates. it should be renamed into something like isMultiRootWorkspaceEnabled.

All 2 comments

you are right. isMultiRootWorkspaceOpened does not return what its name indicates. it should be renamed into something like isMultiRootWorkspaceEnabled.

We can keep though isMultiRootWorkspaceOpened with a workspace file stat check, but should still add a breaking change note in CHANGELOG, since semantics is changed.

Was this page helpful?
0 / 5 - 0 ratings