microsoft / microsoft/vscode-custom-data

[Feature request] Multi-valued tab stops with tab stops/variables/values within

Open
#15 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
240
Forks
95
PR merge metrics
No merged PRs in 30d

Description

So I'm trying to create auto completion snippets with custom data by putting snippets tab stops in the "name" and this is working fine until I reach a attribute that can have multiple values. First I should mention that this isn't a normal use case as for the CMS I'm adding customData for makes use of different functionalities for single quotes vs double quotes vs no quotes. So for attributes in order to work around how custom data works, put a valueSet as 'v' and then have the name of the attribute contain the snippet with all possible values. This way if I have attributes that dont have a "name" or attributes with a "name" but must have single quotes or no quotes at all in the value I can do this. What I'm requesting here is how with defining a snippet with multi values eg:

${1|one,two,three|}

You are unable to put another tab stop in those values.
What I would like to do would be

${1|value,${2:'$3'}|}

Here's a real world use case:

{
            "name": "cms:folders",
            "description": "```html \n <cms:folders masterpage='news.php'><cms:show k_folder_title /> <br></cms:folders> \n ```\n=======\n\n\nThe **folders** tag can be used to enumerate the virtual folders that have been defined for a template.\n\n\nPlease see [**Core Concepts - Folders**](../concepts/using-folders.html) for an in-depth discussion of this tag.\n\n\nParameters\n----------\n\n\n\n\n* masterpage\n\n* root\n\n* childof\n\n* hierarchical\n\n* depth\n\n* orderby\n\n* order\n\n* exclude\n\n* extended_info\n\n\n\n### masterpage\n\n\nThis parameter can be used to specify the template the folders of which are to be enumerated. If skipped, the template this tag is being used from is used.\n\n\n### root\n\n\nOnly a sub-section of the folders tree can be enumerated by specifying a folder as this parameter. The folder specified as the root is returned along with all its children.\n\n\n### childof\n\n\nOnly a sub-section of the folders tree can be enumerated by specifying a folder as this parameter. Only the children of the specified folder are returned.\n\n\n### hierarchical\n\n\nBy setting this parameter the **folders** tag can be made to enumerate the folders in their hierarchical order. If skipped, the folders are enumerated in the alphabetical order of their names.\n\n\n### depth\n\n\nThis parameter can be set to specify the maximum level in hierarchy (i.e. depth) that will be reached during enumeration. This can be used, for example, to list only the top folders in the tree by setting the depth to 1. A depth of 0 means unlimited depth.\n\n\n### orderby\n\n\nThis parameter can be set to order the enumerated folders according to the following- *name*, *title*, *id*, *count* or *weight*. If skipped, *name* is used as default.\n\n\n### order\n\n\nCan be set to specify whether the enumerated folders are ordered in the ascending order or in descending order. Valid values are *asc* and *desc*. Default is *asc*.\n\n\n### exclude\n\n\nFolders can be excluded from being enumerated by specifying them with this parameter. If an excluded folder has children, they are excluded too.  \n\nIf multiple folders are to be excluded, separate them with comma.\n\n\n### extended_info\n\n\nIf this parameter is set, additional variables get set to report the changes in hierarchy encountered by the **folders** tag, as it traverses through the folder tree. Please see the **Variables** section below.\n\n\nVariables\n---------\n\n\nThe following variables are set to provide information about each folder that gets enumerated\n\n\n\n\n* k_folder_id\n\n* k_folder_name\n\n* k_folder_title\n\n* k_folder_desc\n\n* k_folder_link\n\n* k_folder_pagecount\n\n* k_folder_totalpagecount\n\n* k_level\n\n\n\nIf the *hierarchical* parameter is set to '1', the following variables also get set to indicate the current position in the hierarchy as this tag enumerates the folders -\n\n\n\n\n* k_level_start\n\n* k_element_start\n\n* k_element_end\n\n* k_level_end\n\n\n\nYou can use these variables to easily create HTML ordered or unordered lists. Please see **Folders** in **Core Concepts**.\n\n\nRelated Tags\n------------\n\n\n\n\n* [folder](folder.html)\n\n* [listfolders](listfolders.html)\n\n* [dropdownfolders](dropdownfolders.html)\n\n* [parentfolders](parentfolders.html)\n\n* [is_ancestor](is_ancestor.html)\n\n* [breadcrumbs](breadcrumbs.html)\n\n* [pages](pages.html)\n\n* [archives](archives.html)\n\n* [templates](templates.html)\n\n* [comments](comments.html)\n\n\n\n'",
            "attributes": [
                {
                    "name": "${masterpage:masterpage}=${1|k_template_name,${2:'$3'}|} ", //this line
                    "description": "Pick either k_template_name or fill in the second tab place, not both. This parameter can be used to specify the template the folders of which are to be enumerated. If skipped, the template this tag is being used from is used.\n\n",
                    "valueSet": "v"
                },
                {
                    "name": "${root:root}=${1|k_template_name, ${2:'$3'}|} ", //this line
                    "description": "Pick either k_template_name or fill in the second tab place, not both. Only a sub-section of the folders tree can be enumerated by specifying a folder as this parameter. The folder specified as the root is returned along with all its children.\n\n",
                    "valueSet": "v"
                },
                {
                    "name": "${childof:childof}=${1|k_template_name,${2:'$3'}|} ", //this line
                    "description": "Pick either k_template_name or fill in the second tab place, not both. Only a sub-section of the folders tree can be enumerated by specifying a folder as this parameter. Only the children of the specified folder are returned.\n\n",
                    "valueSet": "v"
                },
                {
                    "name": "${hierarchical:hierarchical}='${1|0,1|}' ",
                    "description": "By setting this parameter the **folders** tag can be made to enumerate the folders in their hierarchical order. If skipped, the folders are enumerated in the alphabetical order of their names.\n\n",
                    "valueSet":"v"
                },
                {
                    "name": "${depth:depth}='$1",
                    "description": "This parameter can be set to specify the maximum level in hierarchy (i.e. depth) that will be reached during enumeration. This can be used, for example, to list only the top folders in the tree by setting the depth to 1. A depth of 0 means unlimited depth.\n\n",
                    "valueSet": "V"
                },
                {
                    "name": "${orderby:orderby}='${1|name,title,id,weight,count|}' ",
                    "description": "This parameter can be set to order the enumerated folders according to the following- *name*, *title*, *id*, *count* or *weight*. If skipped, *name* is used as default.\n\n",
                    "valueSet": "v"
                },
                {
                    "name": "${order:order}='${1|asc,desc|}' ",
                    "description": "Can be set to specify whether the enumerated folders are ordered in the ascending order or in descending order. Valid values are *asc* and *desc*. Default is *asc*.\n\n",
                    "valueSet": "v"
                },
                {
                    "name": "${exclude:exclude}='${1:folder_name}${2:, another_folder}'",
                    "description": "Folders can be excluded from being enumerated by specifying them with this parameter. If an excluded folder has children, they are excluded too.  \n If multiple folders are to be excluded, separate them with comma.\n\n",
                    "valueSet": "v"
                },
                {
                    "name": "${extended_info:extended_info}='${1|0,1|}'",
                    "description": "If this parameter is set, additional variables get set to report the changes in hierarchy encountered by the **folders** tag, as it traverses through the folder tree. Please see the **Variables** section below.\n\nVariables\n---------\n\nThe following variables are set to provide information about each folder that gets enumerated\n\n\n * k_folder_id\n * k_folder_name\n * k_folder_title\n * k_folder_desc\n * k_folder_link\n * k_folder_pagecount\n * k_folder_totalpagecount\n * k_level\n \nIf the *hierarchical* parameter is set to '1', the following variables also get set to indicate the current position in the hierarchy as this tag enumerates the folders -\n\n\n * k_level_start\n * k_element_start\n * k_element_end\n * k_level_end\n \nYou can use these variables to easily create HTML ordered or unordered lists. Please see **Folders** in **Core Concepts**.\n\nRelated Tags\n------------\n\n\n * [folder](folder.html)\n * [listfolders](listfolders.html)\n * [dropdownfolders](dropdownfolders.html)\n * [parentfolders](parentfolders.html)\n * [is_ancestor](is_ancestor.html)\n * [breadcrumbs](breadcrumbs.html)\n * [pages](pages.html)\n * [archives](archives.html)\n * [templates](templates.html)\n * [comments](comments.html)\n \n",
                    "valueSet": "v"
                }
            ]
        },

The lines to be looking where I'd be using this feature are commented with //this line

Now I'm not sure if this is a customData feature or if its another part of the HTML language server, but since I'm using customData for this I posted this here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the customData format and the HTML language server, since the issue is unsure which component owns nested tab-stop handling. Reproduce the examples marked with //this line and trace how multi-valued attribute snippets are parsed. Done means custom-data values can contain additional tab stops while preserving the requested completion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, json, vscode
Domain
tooling, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.