microsoft / vscode

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

Inconsistent behavior of opening custom editor via ctrl+p #213684

Open deser opened 6 months ago

deser commented 6 months ago

Type: Bug

I have my own extension which is adding custom editor view type for specific file extension. I need to have both built in (default) code editor and custom editor operable. Custom editor has priority "option":

"customEditors": [
      {
        "viewType": "some",
        "displayName": "some",
        "selector": [
          {
            "filenamePattern": "*.some_ext"
          }
        ],
        "priority": "option"
      }
    ]

The bug I am observing is when trying re-open closed files via ctrl+p. Steps to reproduce:

  1. Open custom editor for file 1.some_ext
  2. Close 1.some_ext
  3. Via ctrl+p re-open 1.some_ext

Actual behavior: Custom editor opened. NOTE, that I haven't changed default editor type in Open with explorer's context menu.

Expected behavior: Default code editor opened

NOTE: When reproducing the same scenario but, at step 3 intead of using ctrl+p, opening file via explorer it works as expected (opens code editor).

I tried setting workbench.editorAssociations and it did not help with the scenario:

"workbench.editorAssociations": {
    "*.some_ext": "default"
}

VS Code version: Code 1.89.1 (Universal) (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:14:24.611Z) OS version: Darwin arm64 22.6.0 Modes: Remote OS version: Linux x64 Remote OS version: Linux x64

Extensions (6) Extension|Author (truncated)|Version ---|---|--- coder-remote|cod|0.1.37 remote-ssh|ms-|0.110.1 remote-ssh-edit|ms-|0.86.0 remote-explorer|ms-|0.4.3 nix-env-selector|arr|1.0.11 vscode-jest-runner|fir|0.4.73
deser commented 5 months ago

Any updates, @mjbvz?