From ceb1adaaf9b4c464c6ea0242e9ee8aafd3647709 Mon Sep 17 00:00:00 2001 From: Evgeni Chasnovski Date: Fri, 4 Oct 2024 17:53:40 +0300 Subject: [PATCH] Clarify snippet placeholder structure Now grammar implies that placeholder value should be a single `any` node, while in most applications it can be any number of consecutive `any` nodes. For example, as described in earlier "Placeholders" section: `${1:another ${2:placeholder}}`. Adding `+` quantifier to `any` seems to be more precise. This seems to also fix the grammar for initial snippet input (which is implied to be `any`). --- _specifications/lsp/3.18/language/completion.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_specifications/lsp/3.18/language/completion.md b/_specifications/lsp/3.18/language/completion.md index ec8c989f9..bf322a2a1 100644 --- a/_specifications/lsp/3.18/language/completion.md +++ b/_specifications/lsp/3.18/language/completion.md @@ -934,7 +934,7 @@ ${TM_FILENAME/(.*)\..+$/$1/} Below is the grammar for snippets in EBNF ([extended Backus-Naur form, XML variant](https://www.w3.org/TR/xml/#sec-notation)). With `\` (backslash), you can escape `$`, `}` and `\`. Within choice elements, the backslash also escapes comma and pipe characters. Only the characters required to be escaped can be escaped, so `$` should not be escaped within these constructs and neither `$` nor `}` should be escaped inside choice constructs. ``` -any ::= tabstop | placeholder | choice | variable | text +any ::= (tabstop | placeholder | choice | variable | text)+ tabstop ::= '$' int | '${' int '}' placeholder ::= '${' int ':' any '}' choice ::= '${' int '|' choicetext (',' choicetext)* '|}'