vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Adding an import via quick fix scrolls the editor

Open alexdima opened this issue 3 years ago • 1 comments

  • use autofolding of imports "editor.foldingImportsByDefault": true.
  • use a type that is not imported in a TS file
  • use quick fix to add the import
  • the editor scrolls to an incorrect position. I think this is a recent regression, because I've been using both import folding and quick fix for imports since quite a while... maybe starting with the last stable.

https://user-images.githubusercontent.com/5047891/191502148-c0dc8dbf-26b1-4dc8-ab1e-975462212a66.mp4

Version: 1.72.0-insider Commit: 333754f29b719f605904f072b13c054c2231b9bd Date: 2022-09-21T05:40:07.654Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin arm64 21.6.0 Sandboxed: Yes

alexdima avatar Sep 21 '22 12:09 alexdima

Un-assigning myself as I don't think this cause by something the JS/TS extension itself is doing

mjbvz avatar Sep 21 '22 17:09 mjbvz

@mjbvz who owns the quick fix UI now?

alexdima avatar Sep 23 '22 13:09 alexdima

@alexdima I own the UI. However it looks like scrolling here happen when the edit from the quick fix is applied. That's why I unassigned myself

mjbvz avatar Sep 23 '22 18:09 mjbvz

It also unfolds if you do "Organize Imports", so seems like any action related with imports unfolds even though setting is "editor.foldingImportsByDefault": true

svipas avatar Oct 13 '22 17:10 svipas

The root cause appears to be the folding ranges change and end up calling editor.setHiddenAreas. That one does not attempt to maintain the viewport stable in any way.

alexdima avatar Oct 24 '22 13:10 alexdima

@alexdima @mjbvz this issue still exists: https://github.com/microsoft/vscode/issues/168523

svipas avatar Dec 08 '22 22:12 svipas