pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Respect `files.refactoring.autoSave` for move to file

Open mjbvz opened this issue 1 year ago • 4 comments

Type: Bug

With files.refactoring.autoSave: true (the default), files should be saved automatically after a cross file refactoring is performed

This currently doesn't seem to happen, which causes all changed files to be opened as editor tabs

Extension version: 2023.23.13391009 VS Code version: Code - Insiders 1.85.0-insider (Universal) (af28b32d7e553898b2a91af498b1fb666fdebe0c, 2023-12-06T11:18:22.866Z) OS version: Darwin arm64 23.1.0 Modes:

System Info
Item Value
CPUs Apple M2 Max (12 x 24)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: unavailable_software
Load (avg) 3, 3, 3
Memory (System) 64.00GB (6.08GB free)
Process Argv --crash-reporter-id 0fffb5da-9cd7-46fd-9e7f-a1564e8c5fda
Screen Reader no
VM 0%

mjbvz avatar Dec 06 '23 17:12 mjbvz

I'm unable to repro this. Can you provide repro steps?

Also, it's not clear to me how this would be caused by a language server. We're not involved with saving files as far as I know.

debonte avatar Dec 19 '23 20:12 debonte

There's an isRefactoring option that you should set on workspace edits: https://github.com/microsoft/vscode/blob/d5307c5afa4d00360308af47146311e652e4f5ee/src/vscode-dts/vscode.d.ts#L3888

Simple repo:

def foo():
    pass

def bar():
    pass
  1. Run move symbol to new file on either def

Actual: Unsaved files are opened Expected: File tab for target file is not opened.

mjbvz avatar Dec 19 '23 21:12 mjbvz

It's not currently possible to set isRefactoring to true from LSP. I submitted a PR for that though -- https://github.com/microsoft/vscode-languageserver-node/pull/1390

debonte avatar Dec 21 '23 02:12 debonte

vscode-languageserver-node change has been merged. Waiting on a new release.

debonte avatar Jan 17 '24 18:01 debonte

This issue has been fixed in prerelease version 2024.3.101, which we've just released. You can find the changelog here: CHANGELOG.md

StellaHuang95 avatar Mar 21 '24 23:03 StellaHuang95