vscode-codeql icon indicating copy to clipboard operation
vscode-codeql copied to clipboard

Limitations of Source Archive file systems

Open jcreedcmu opened this issue 5 years ago • 3 comments

To Reproduce Import a database with a zipped archive. Open some file on disk outside the source archive. Select various source files in the source archive. Do VS Code command palette "Go Back"

Expected behavior The previously viewed file is shown.

Actual behavior The most recently viewed file outside the source archive is shown.

Additional context Users have reported that this bug doesn't consistently reproduce, and sometimes Go Back and Go Forward is broken even for normal files. A workaround is making the source archive file a non-preview editor, for example by double clicking on it in the file explorer.

Note that this is just one manifestation of the bug. For more context see https://github.com/github/vscode-codeql/issues/500#issuecomment-712301680 below.

jcreedcmu avatar Jul 15 '20 16:07 jcreedcmu

Here's how I can reliably reproduce:

  1. Close all editors except for editor A
  2. Open an archive file B in a preview editor
  3. Open a different archive file C in a preview editor
  4. run the Go Back command

Expected: navigates to location in B.

Actual: navigates to A.

Note that if B is converted to non-preview, then navigation happens as expected.

aeisenberg avatar Jul 17 '20 21:07 aeisenberg

My thinking is that this is a vscode bug. I can't see any code path that history navigation takes through our code. I would think it's in archive-filesystem-provider.ts, but no breakpoints are reached when Go Back is invoked.

aeisenberg avatar Jul 17 '20 21:07 aeisenberg

Based on some prompting by @p0, I did a deeper dive into this issue. There are currently three limitations that we know of regarding vscode FileSystemProviders.

  1. Code navigation locations are not recorded in history if the file is from a provider and the file was only opened in a preview editor. Navigation locations are removed if an editor for the file is closed https://github.com/microsoft/vscode/issues/108935
  2. Find in files command does not find text in files from providers. https://github.com/microsoft/vscode/issues/59921
  3. Open file command does not include files from providers. https://github.com/microsoft/vscode/issues/73524

As a further example, you can see the same limitations when using the sample MemFS file system provider.

To mitigate #1, we could always open archive files in non-preview mode when navigating from a results view. This would mitigate the problem, not fix it since if the editor is ever closed, we lose navigation history for it.

aeisenberg avatar Oct 19 '20 17:10 aeisenberg