Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/markdownExamples fields for boolean and enum settings UI #119530

Closed
Colengms opened this issue Mar 22, 2021 · 1 comment
Closed

examples/markdownExamples fields for boolean and enum settings UI #119530

Colengms opened this issue Mar 22, 2021 · 1 comment
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) settings-editor VS Code settings editor issues

Comments

@Colengms
Copy link
Contributor

This is a request to add 'examples' fields for values of boolean and enum extension settings. This would allow an example/preview to be visible in the settings UI, illustrating the current effect of the setting.

In the C/C++ Extension, we have some boolean and enum settings for code formatting. We would like to provide code example for each potential value, to display its effect. This is based on similar behavior in VS.

In VS:
image

image

We had planned to create our own UI for editing these settings, using a webView. ( microsoft/vscode-cpptools#5953 ) Though, doing so would introduce a second UI for editing these same settings, which could be confusing for users.

The fields I'm suggesting might look something like:

        "C_Cpp.vcFormat.space.beforeComma": {
          "type": "boolean",
          "default": false,
          "description": "%c_cpp.configuration.vcFormat.space.beforeComma.description%",
          "scope": "resource"
          "markdownExamples": [
            "```cpp\nvoid Function1(int a, int b)\n{\n    Function2(a, b);\n}\n```",
            "```cpp\nvoid Function1(int a , int b)\n{\n    Function2(a , b);\n}\n```",
          ]
        },
        "C_Cpp.vcFormat.indent.multiLineRelativeTo": {
          "type": "string",
          "enum": [
            "outermostParenthesis",
            "innermostParenthesis",
            "statementBegin"
          ],
          "enumDescriptions": [
            "%c_cpp.configuration.vcFormat.indent.multiLineRelativeTo.outermostParenthesis.description%",
            "%c_cpp.configuration.vcFormat.indent.multiLineRelativeTo.innermostParenthesis.description%",
            "%c_cpp.configuration.vcFormat.indent.multiLineRelativeTo.statementBegin.description%"
          ],
          "markdownExamples": [
            "```cpp\n<outermostParenthesis code example>\n```",
            "```cpp\n<innermostParenthesis code example>\n```",
            "```cpp\n<statementBegin code example>\n```"
          ],
          "default": "innermostParenthesis",
          "description": "%c_cpp.configuration.vcFormat.indent.multiLineRelativeTo.description%",
          "scope": "resource"
        },

The examples would be displayed in the settings UI, after the setting, for the selected option. i.e.:

image

image

@roblourens roblourens added feature-request Request for new features or functionality settings-editor VS Code settings editor issues labels Mar 23, 2021
@roblourens roblourens added this to the Backlog milestone Mar 23, 2021
@roblourens
Copy link
Member

This is a good suggestion. I will merge it into #70589 which has similar suggestions. I would like to do this but don't have an ETA for you.

@roblourens roblourens removed this from the Backlog milestone Mar 23, 2021
@roblourens roblourens added *duplicate Issue identified as a duplicate of another issue(s) and removed feature-request Request for new features or functionality labels Mar 23, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) settings-editor VS Code settings editor issues
Projects
None yet
Development

No branches or pull requests

2 participants