Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Completion with snippet with choices #240

Closed
cdietrich opened this issue Nov 5, 2018 · 3 comments
Closed

Completion with snippet with choices #240

cdietrich opened this issue Nov 5, 2018 · 3 comments

Comments

@cdietrich
Copy link
Contributor

In VSCode it works fine to have a completion item like

{
        "label": "New Greeting (Template)",
        "kind": 15,
        "sortText": "00001",
        "insertTextFormat": 2,
        "textEdit": {
          "range": {
            "start": {
              "line": 4,
              "character": 0
            },
            "end": {
              "line": 4,
              "character": 0
            }
          },
          "newText": "Hello ${1|A,B,C|} from ${2|Other,C,B,Xtext,VSCode,ThisFile,you,Demo|}!"
        }
      }

but this does not work with this extension.
(snippet is inserted as plain text)

public static applySnippetToSuggestion(item: CompletionItem, suggestion: ac.SnippetSuggestion): void {

a snippet with simple placeholders works fine

{
        "label": "New Greeting (Template)",
        "kind": 15,
        "sortText": "00001",
        "insertTextFormat": 2,
        "textEdit": {
          "range": {
            "start": {
              "line": 4,
              "character": 0
            },
            "end": {
              "line": 4,
              "character": 0
            }
          },
          "newText": "Hello ${1:foo} from ${2:bar}!"
        }
      }

is there something i need to configure to get this running?

@cdietrich
Copy link
Contributor Author

see https://macromates.com/textmate/manual/snippets too

${«int»|«choice 1»,…,«choice n»|}

@cdietrich
Copy link
Contributor Author

looks like this is atom/snippets#186

@damieng
Copy link
Contributor

damieng commented Nov 5, 2018

Yeah, this package does nothing specific with snippets other than acting as a bridge between language servers and autocomplete so I think that other issue is the place to track it. Closing it this side. If further work needs to be done here once that side is addressed we can re-open this issue or create a new one.

@damieng damieng closed this as completed Nov 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants