redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.07k stars 433 forks source link

Properties files does not show context menu options from other extension #3717

Closed rH4rtinger closed 2 months ago

rH4rtinger commented 2 months ago

I have another extension, which contributes to VSCode with a command in a context menu in properties files. This element will not be visible, when your extension is active. When I deactivate it, then everything is visible.

Environment
Steps To Reproduce
  1. create a dummy extension with the yo code command. (See VSCode documenation)
  2. add this to the package.json of your extension:
    "contributes": {
    "commands": [
    {
      "command": "foo.helloWorld",
      "title": "Hello World"
    }
    ],
    "menus": {
    "editor/context": [
      {
        "command": "foo.helloWorld",
        "when": "resourceLangId == properties",
        "group": "foo"
      }
    ]
    }
  3. Debug the extension
  4. Open any folder and create a foo.properties file.
  5. Right click in the file to open the context menu.
Current Result

When I open the context menu in my properties-file, I do not see my command. image

Expected Result

When I am disabling your extension, then the "Hello World" command is visible. image

My command should be always visible, even if I have your extension active.

Additional Informations

-

rgrunber commented 2 months ago

I think this has something to do with the fact that the extension takes ownership of .properties files, https://github.com/redhat-developer/vscode-java/blob/7350e2c9b750b5125720fd2aefc85bebf07916c3/package.json#L203-L212 .

You could try : "when": "resourceLangId == properties || resourceLangId == java-properties" to see if that solves the issue. See https://github.com/redhat-developer/vscode-java/pull/2636 for more details on why we have this.

rH4rtinger commented 2 months ago

It does solve the issue, when I set "when": "resourceLangId == properties || resourceLangId == java-properties".

My context menu is now visible.