Implement parser and evaluator for TextMate snippets
The Language Server Protocol (LSP) implements TextMate's "snippets" feature. Originally imagined as a kind of Mad Libs for code, with users given a code template and some number of "placeholder" blanks to fill out, which was done by using tab to switch between them, LSP team attempted to standardize this feature across language servers, so that language authors had a well-specified interface to provide "snippets" to any editor implementing the LSP. Today, the LSP specification of TextMate snippets forms the bedrock of the ksonnet prototype specification. Specifically, though users will eventually be able to use Jsonnet to generate prototypes, they are compiled down to the TextMate snippets specification. This commit begins this process by introducing an implementation of the LSP snippets specification, including both a parser and an evaluator. For more details, see the extensive comment in `interface.go`.
Showing
- Makefile 1 addition, 1 deletionMakefile
- prototype/snippet/interface.go 58 additions, 0 deletionsprototype/snippet/interface.go
- prototype/snippet/lexer.go 137 additions, 0 deletionsprototype/snippet/lexer.go
- prototype/snippet/marker.go 168 additions, 0 deletionsprototype/snippet/marker.go
- prototype/snippet/parser.go 171 additions, 0 deletionsprototype/snippet/parser.go
- prototype/snippet/parser_test.go 417 additions, 0 deletionsprototype/snippet/parser_test.go
- prototype/snippet/template.go 111 additions, 0 deletionsprototype/snippet/template.go
- prototype/snippet/util.go 82 additions, 0 deletionsprototype/snippet/util.go
prototype/snippet/interface.go
0 → 100644
prototype/snippet/lexer.go
0 → 100644
prototype/snippet/marker.go
0 → 100644
prototype/snippet/parser.go
0 → 100644
prototype/snippet/parser_test.go
0 → 100644
prototype/snippet/template.go
0 → 100644
prototype/snippet/util.go
0 → 100644
Please register or sign in to comment