microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.38k stars 28.62k forks source link

vscode.openWith does not respect 'pinned' option in 'columnAndOptions' parameter #212238

Open jonathanyeung opened 4 months ago

jonathanyeung commented 4 months ago

Type: Bug

Take the following code from an extension:

await vscode.commands.executeCommand(
  "vscode.openWith",
  uri,
  "my-custom-editor",
  {
    pinned: false
  }
);

Actual behavior: The pinned flag is not respected, and the tab always opens in 'pinned' mode. Expected behavior: the tab is opened in non-pinned mode (with the italicized file name in the editor bar that will close upon navigation to a different file).

I believe this is caused by this line of code: https://github.com/microsoft/vscode/blob/28a290225378c83f76ab1d875f3b7391e1ca8e3e/src/vs/workbench/browser/parts/editor/editorCommands.ts#L633

The 'pinned' parameter is hardcoded to true - this can be set to the value coming from ITextEditorOptions, unless there was some reason that this needed to be hardcoded to true.

Note - this also repro's with the default editor, not just custom editors like in my example.

Thank you!

VS Code version: Code 1.89.0 (Universal) (b58957e67ee1e712cebf466b995adf4c5307b2bd, 2024-05-01T02:10:10.196Z) OS version: Darwin arm64 23.4.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 (8 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|5, 4, 3| |Memory (System)|16.00GB (0.08GB free)| |Process Argv|--crash-reporter-id ebd6b185-e8ed-432f-8844-835eaab863ed| |Screen Reader|no| |VM|0%|
Extensions (58) Extension|Author (truncated)|Version ---|---|--- vscode-sql-formatter|adp|1.4.4 project-manager|ale|12.8.0 tsl-problem-matcher|amo|0.6.2 vscode-zipfs|arc|3.0.0 quitcontrol-vscode|art|4.0.0 backlinks-panel|Bin|0.2.2 catppuccin-vsc|Cat|3.14.0 vscode-chrome-extesion-manifest-json-schema|cez|1.0.2 css-theme-completions|con|0.0.5 vscode-eslint|dba|2.4.4 dendron-paste-image|den|1.1.1 nightly|den|0.124.77 gitlens|eam|14.9.1 EditorConfig|Edi|0.16.4 prettier-vscode|esb|10.4.0 copilot|Git|1.187.0 copilot-chat|Git|0.15.0 remotehub|Git|0.62.0 vscode-github-actions|git|0.26.2 vscode-pull-request-github|Git|0.88.0 rest-client|hum|0.25.1 vscode-peacock|joh|4.2.2 mark-sharp|jon|1.2.0 prettify-json|moh|0.0.3 vscode-docker|ms-|1.29.1 csdevkit|ms-|1.5.20 csharp|ms-|2.28.11 vscode-dotnet-runtime|ms-|2.0.5 vscodeintellicode-csharp|ms-|2.1.11 vscode-edge-devtools|ms-|2.1.5 playwright|ms-|1.0.22 debugpy|ms-|2024.6.0 isort|ms-|2023.10.1 python|ms-|2024.6.0 vscode-pylance|ms-|2024.5.1 jupyter|ms-|2024.4.0 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.9 vscode-jupyter-slideshow|ms-|0.1.6 remote-containers|ms-|0.362.0 remote-ssh|ms-|0.110.1 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.88.2 vscode-remote-extensionpack|ms-|0.25.0 azure-repos|ms-|0.38.0 extension-test-runner|ms-|0.0.9 live-server|ms-|0.4.13 remote-explorer|ms-|0.4.3 remote-repositories|ms-|0.40.0 remote-server|ms-|1.5.1 vsliveshare|ms-|1.0.5918 vsliveshare-pack|ms-|0.4.0 angular-console|nrw|18.21.1 run-on-save|puc|1.8.0 timestamp-converter|Sta|0.0.1 rewrap|stk|1.16.3 code-spell-checker|str|3.0.1 (1 theme extensions excluded)
A/B Experiments ``` vsliv368:30146709 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscoreces:30445986 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyonecf:30548226 962ge761:30959799 9b8hh234:30694863 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 chatpanelt:31018789 dsvsc021:30996838 724cj586:31013169 fchga941:31038042 pythonprt:31039817 dwnewjupytercf:31039676 ```
bpasero commented 4 months ago

From https://github.com/microsoft/vscode/commit/dbc2166e56bdfadc2d3161795aa28e704ff5b054

Maybe the option should not be overwritten if provided.