Skip to content

Allow file system provider schemes to participate in history even after close #108935

@gjsjohnmurray

Description

@gjsjohnmurray

Issue Type: Bug

I work on a team developing an extension that implements a FileSystemProvider and a DocumentSymbolProvider.

If the user opens file1 in preview mode (italic tab label), then used F12 when on a symbol defined in file2, this correctly loads file2 in the same tab. But the 'Back' option on the 'Go' menu doesn't get enabled.

I think it is caused by this code executing when file2 replaces file1 in the preview tab:

// Remove this from the stack unless the stack input is a resource
// that can easily be restored even when the input gets disposed
if (stackEditorInput instanceof EditorInput) {
this.onEditorDispose(stackEditorInput, () => this.removeFromNavigationStack(stackEditorInput), this.editorStackListeners);
}

in combination with this logic which didn't turn the 'Go to Definition' history entry into one that points to a ResourceEditorInput because it only does that for a limited range of uri schemes:

private preferResourceEditorInput(input: IEditorInput): IEditorInput | IResourceEditorInput {
const resource = EditorResourceAccessor.getOriginalUri(input);
if (resource && (resource.scheme === Schemas.file || resource.scheme === Schemas.vscodeRemote || resource.scheme === Schemas.userData || resource.scheme === this.pathService.defaultUriScheme)) {
// for now, only prefer well known schemes that we control to prevent
// issues such as https://github.com/microsoft/vscode/issues/85204
return { resource };
}
return input;
}

@bpasero is this your area?

I tried to devise a repro using fsprovider-sample by adding file2.ts to the workspace, exporting a function from it, then referencing it from file.ts. But the 'Initializing JS/TS language features' message never cleared, so I assume JS/TS language support can't handle files provided by the MemFS FileSystemProvider.

VS Code version: Code 1.50.1 (d2e414d, 2020-10-13T15:06:15.712Z)
OS version: Windows_NT x64 10.0.18363

Metadata

Metadata

Assignees

No one assigned

    Labels

    *out-of-scopePosted issue is not in scope of VS Codefeature-requestRequest for new features or functionalityworkbench-historyHistory item issues

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions