Skip to content

SnippetString doesn't have builder-method for Choice #43643

Closed

Description

@DanTup

In the snippet docs there's syntax for adding choices for placeholders:

Choice

Placeholders can have choices as values. The syntax is a comma separated enumeration of values, enclosed with the pipe-character, for example ${1|one,two,three|}. When the snippet is inserted and the placeholder selected, choices will prompt the user to pick one of the values.

Currently the SnippetString class has methods for appendPlaceholder, appendVariable, etc. but there isn't an option for choices. We can build these manually, but it'd be better if we could stick to a nice API.

Activity

  1. DanTup commented on Feb 14, 2018

    @DanTup
    ContributorAuthor

    Also seems like the escape method is private, making it more difficult to do this manually without duplicating the implementation.

  2. DanTup commented on Feb 14, 2018

    @DanTup
    ContributorAuthor

    Actually, appendText is escaped so it seems like we can't do this at all without building the whole string ourselves..

  3. jrieken commented on Feb 26, 2018

    @jrieken
    Contributor

    Well, you can do new SnippetString().appendXYZ().value += '${1|my,choice|}'

  4. added
    feature-request
    help wanted
    on Feb 26, 2018
  5. changed the title [-]SnippetString doesn't support choices[/-] [+]SnippetString doesn't have builder-method for Choice[/+] on Feb 26, 2018
  6. DanTup commented on Feb 26, 2018

    @DanTup
    ContributorAuthor

    Johannes Rieken (@jrieken) That seems to have worked, thanks! I did have to copy your escape function and add , to it though!

  7. added
    good first issue
    on Oct 4, 2019
  8. sksaifuddin commented on Oct 30, 2019

    @sksaifuddin

    Hello,is this issue solved ? I am new on this repo and looking for good first issues to solve, this issue looks good for my purpose. Can anyone please guide me about solving this please? Johannes Rieken (@jrieken) Danny Tuppeny (@DanTup)

  9. jrieken commented on Oct 30, 2019

    @jrieken
    Contributor

    This issue would be closed if it's solved. So, "yes" it up for a grab. This is the code pointer entry point:

    export class SnippetString {
    .

  10. added
    verification-needed
    on Dec 2, 2019
  11. added
    verified
    on Dec 4, 2019
  12. added
    on-release-notes
    on Dec 5, 2019
  13. locked and limited conversation to collaborators on Dec 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

apiapi-finalizationfeature-requestgood first issuehelp wantedon-release-notessnippetsverification-neededverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions