Skip to content

Prevent CustomEditor from Opening When a File is Opened from Search or GitLens #244703

@darshan4295

Description

@darshan4295

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.98.2
  • OS Version: MacOS Sequoia Version 15.3.2

Currently, the CustomEditor is launched for all *.js files. As a result, when opening a file from the search panel or GitLens, the CustomEditor is triggered.

To prevent this, we need the getContext API to check whether the file is being opened from the search panel before launching the editor.

Alternatively, if a when clause could be added to the customEditor configuration, it would help resolve the issue. For example:

"customEditors": [
  {
    "viewType": "builder.BasicTextEditor",
    "displayName": "Basic Text Editor",
    "selector": [
      {
        "filenamePattern": "*.js"
      }
    ],
    "priority": "default"
  }
]

If the when clause is supported, I could use the following condition to control when the editor opens:

"when": "sideBarFocus && activeViewlet !== 'workbench.view.search'"

There is already an open issue for this, and I urgently need a fix for my product. If there is any workaround to retrieve the context, that would also be helpful.

I also noticed that a getContext API request has already been raised in the following issue:
#10471

Would appreciate any guidance or possible workarounds. Thanks!


Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions