question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auto open Diff Editor when Refactor Preview is opened

See original GitHub issue

Hi

I noticed that when we trigger Refactor Preview panel (eg. by using the vscode.workspace.applyEdit with WorkspaceEdits containing needsConfirmation), only the Refactor Preview panel is opened. To open the Diff Editor, users need to click on any of the edits in the panel.

Requirements:

  • Should automatically open the Diff Editor with the first checked edit (not containing needsConfirmation = true).
  • If no edits are checked, first FileElement should open letting the user select which changes to enable/preview.
  • Moving out of the Diff Editor (e.g. clicking on a different file tab) created by the Refactor Preview panel, and reopening the Refactor Preview panel should reopen the Diff Editor. This would make the experience more consistent (Refactor Preview always opening the Diff).

Additonal Details:

  • VS Code Version: 1.70.2
  • OS Version: CromeOS 104.0.5112.83

part of the https://github.com/microsoft/vscode/issues/156886 proposal

tries to fix common problem as https://github.com/microsoft/vscode/issues/158408

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:24
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
marrejcommented, Oct 7, 2022

Hi @daviddossett @jrieken , the main reason would be to cut down the click & improve the discoverability for new users (of Refactor Preview).

It seemed that the bottom panel is not fully understandable to users (what they should do with it/or expect from it) & some defaulted to ignoring the proposed fixes when provided with just the Refactor Preview, rather than following through. This then drives down the users will to interact with the extension & forces extensions to not try to use the Refactor Preview and strips good functionality - such as providing optional fixes, or not 100% confident fixes.

So by providing the detail along the driver, we want to increase the follow through & save users some clicks along the way.

Also, this would also be a novel interaction model, e.g opening a panel (driver) and an editor (detail) at the same time. For instance the search pane doesn’t open the first find match

I don’t think that these 2 usecases are exactly the same (search panel - refactor preview panel). As I understand it, most of the panels provide additional data into the current view. Allowing the users to trigger additional actions, such as opening a file that user might find helpful (via the search panel).

But refactor preview information might not be really helpful in the context of the actual open file. Mainly if the edits are not simple (e.g. rename x to y), but spanning through multiple lines, so the user can’t to easily grasp what the reactor is trying to do.

And since the user already wanted to Preview/apply the fixes it just makes sense to visualise exactly what they can apply.

Does that make sense?

0reactions
daviddossettcommented, Oct 6, 2022

I share the concern about opening two things at once. Is the desire to save the click? What else do you think this solves for @marrej?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why files open over existing tabs in VS Code and how to ...
To do so, open VS Code settings. Search for “enable preview”. You'll see a Workbench › Editor: Enable Preview option that's certainly checked....
Read more >
Code refactoring | IntelliJ IDEA Documentation
To see potential changes (the list of usages where the refactoring will be performed), click Preview in the Refactoring Preview dialog.
Read more >
VSCode and TypeScript - refactoring/renaming without ...
It displays pending changes in a diff editor and allows you to uncheck/check individual changes. Once the rename has been applied (or aborted), ......
Read more >
Refactoring made easy with IntelliCode! - Visual Studio Blog
Refactoring is a preview feature of IntelliCode, so when you get Visual Studio 2019 version 16.3 Preview 3 it will be off by...
Read more >
Visual Studio Code Tips and Tricks
You can open multiple files from Quick Open by pressing the Right arrow key. This will open the currently selected file in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found