Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gjsjohnmurray opened this issue Oct 19, 2020 · 4 comments
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code workbench-history History item issues
Milestone

Comments

@gjsjohnmurray
Copy link
Contributor

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

@jrieken jrieken assigned bpasero and unassigned jrieken Oct 19, 2020
@bpasero bpasero added feature-request Request for new features or functionality workbench-history History item issues labels Oct 19, 2020
@bpasero bpasero removed their assignment Oct 19, 2020
@bpasero bpasero changed the title 'Go Back' not available after 'Go to Definition' from a FileSystemProvider-hosted file that was opened in Preview Mode Allow file system provider schemes to participate in history even after close Oct 19, 2020
@bpasero
Copy link
Member

bpasero commented Oct 19, 2020

Yes, we have limited the support for navigation in history to schemes we know but can think about revisting this.

@gjsjohnmurray
Copy link
Contributor Author

I previously wrote:

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.

Probably #108454

@bpasero
Copy link
Member

bpasero commented Nov 8, 2020

With 36e2868 this situation improved a bit: we now remove the "preview" state of an editor when it is the source of a navigation action such as "Goto definition", as such the functionality of navigating in history will work even for custom file schemes.

@vscodenpa
Copy link

We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding, and happy coding!

@vscodenpa vscodenpa closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality *out-of-scope Posted issue is not in scope of VS Code workbench-history History item issues
Projects
None yet
Development

No branches or pull requests

4 participants