Skip to content

Commit

Permalink
Cannot create a new file if the preferences widget is opened.
Browse files Browse the repository at this point in the history
Fixes: #7067 , #7253

Initially we were unable to create a new file or folder while the user preferences was open.

The user-preferences has the file scheme set as `user-storage` and we did not fall back to the workspace root URI and instead were getting the URI from 'user_storage:settings.json'.
With this approach, we create files at certain directories and if a directory doesn't have the scheme set to 'file' it will fallback to the workspace root uri.

Signed-off-by: Muhammad Anas Shahid <muhammad.shahid@ericsson.com>
  • Loading branch information
Muhammad Anas Shahid committed Mar 10, 2020
1 parent d0e00c5 commit ab3b9b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/workspace/src/browser/workspace-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ export class WorkspaceRootUriAwareCommandHandler extends UriAwareCommandHandler<
// eslint-disable-next-line @typescript-eslint/no-explicit-any
protected getUri(...args: any[]): URI | undefined {
const uri = super.getUri(...args);
// If the URI is available, return it immediately.
if (uri) {
// Return the `uri` immediately if the resource exists in any of the workspace roots and is of `file` scheme.
if (uri && uri.scheme === 'file' && this.workspaceService.getWorkspaceRootUri(uri)) {
return uri;
}
// Return the first root if available.
Expand Down

0 comments on commit ab3b9b8

Please sign in to comment.