admin管理员组

文章数量:1290179

package.json

    "ICA.config.jiraEnable": {
      "type": "boolean",
      "markdownDescription": "Enable or disable JIRA configuration settings.",
      "description": "Enable JIRA Configuration.",
      "default": false,
      "order": 3
    },
    "ICA.config.jiraBaseUrl": {
      "type": "string",
      "markdownDescription": "JIRA Base URL.",
      "description": "JIRA Base URL.",
      "default": "jsw",
      "order": 4
    },
    "ICA.config.jiraApiVersion": {
      "type": "integer",
      "markdownDescription": "JIRA API Version.",
      "description": "JIRA API Version.",
      "default": 2,
      "order": 5
    },
    "ICA.config.jiraToken": {
      "type": "string",
      "markdownDescription": "JIRA API Token.",
      "description": "JIRA API Token.",
      "order": 6
    }

With respect to jiraEnable property jiraBaseUrl, jiraToken & jiraApiVersion should be disable/enable or appear/disappear

I have used the below code but no use

    "ICA.config.jiraEnable": {
      ...
    },
    "ICA.config.jiraBaseUrl": {
      ...,
      "when": "ICA.config.jiraEnable"
    },
    "ICA.config.jiraApiVersion": {
      ...,
      "when": "ICA.config.jiraEnable"
    },
    "ICA.config.jiraToken": {
      ...,
      "when": "ICA.config.jiraEnable"
    }

package.json

    "ICA.config.jiraEnable": {
      "type": "boolean",
      "markdownDescription": "Enable or disable JIRA configuration settings.",
      "description": "Enable JIRA Configuration.",
      "default": false,
      "order": 3
    },
    "ICA.config.jiraBaseUrl": {
      "type": "string",
      "markdownDescription": "JIRA Base URL.",
      "description": "JIRA Base URL.",
      "default": "jsw.com",
      "order": 4
    },
    "ICA.config.jiraApiVersion": {
      "type": "integer",
      "markdownDescription": "JIRA API Version.",
      "description": "JIRA API Version.",
      "default": 2,
      "order": 5
    },
    "ICA.config.jiraToken": {
      "type": "string",
      "markdownDescription": "JIRA API Token.",
      "description": "JIRA API Token.",
      "order": 6
    }

With respect to jiraEnable property jiraBaseUrl, jiraToken & jiraApiVersion should be disable/enable or appear/disappear

I have used the below code but no use

    "ICA.config.jiraEnable": {
      ...
    },
    "ICA.config.jiraBaseUrl": {
      ...,
      "when": "ICA.config.jiraEnable"
    },
    "ICA.config.jiraApiVersion": {
      ...,
      "when": "ICA.config.jiraEnable"
    },
    "ICA.config.jiraToken": {
      ...,
      "when": "ICA.config.jiraEnable"
    }
Share Improve this question edited Jan 29 at 11:58 Souvik Pal asked Jan 24 at 10:05 Souvik PalSouvik Pal 631 gold badge1 silver badge6 bronze badges 5
  • 1 is when a valid property for configuration settings? If so you need to create a context variable in your code that copies the ICA.config.jiraEnable variable, you can use an isConfigurationChange callback – rioV8 Commented Jan 26 at 7:03
  • @rioV8 can you please provide one sample code how to set the context, Because I have written this code vscode.commands.executeCommand("setContext", "ICA.config.jiraEnable", jiraEnable); inside isConfigurationChange still the settings is visible. Any other alternative we have? – Souvik Pal Commented Jan 28 at 10:27
  • side note: why do you need to name your config settings *.config.* – rioV8 Commented Jan 28 at 14:48
  • I don't think when is supported in package.json settings configurations. I tried a setContext and used it in a when clause and it had no effect. – Mark Commented Jan 29 at 0:41
  • So their is no way to make settings as Conditional View? – Souvik Pal Commented Jan 29 at 5:47
Add a comment  | 

1 Answer 1

Reset to default 1

This kind of constraint is not currently supported in VS Code. So, you won’t be able to enable/disable settings based on other setting value.

Based on the Contribution Points configuration, you will see that neither when nor enablement are supported.

I did a quick search in the VS Code repo (https://github.com/microsoft/vscode/issues?q=is%3Aissue%20state%3Aopen%20when%20label%3Asettings-editor%20), but didn’t find a similar request so, I would suggest you to open a new issue in the VS Code repo, and ask for such improvement in the Settings Editor.

本文标签: