payload: {"action":"created","issue":{"url":"https://api.github.com/repos/atom/snippets/issues/288","repository_url":"https://api.github.com/repos/atom/snippets","labels_url":"https://api.github.com/repos/atom/snippets/issues/288/labels{/name}","comments_url":"https://api.github.com/repos/atom/snippets/issues/288/comments","events_url":"https://api.github.com/repos/atom/snippets/issues/288/events","html_url":"https://github.com/atom/snippets/pull/288","id":407569478,"node_id":"MDExOlB1bGxSZXF1ZXN0MjUxMDE0MDU4","number":288,"title":"[WIP] LSP snippets","user":{"login":"Aerijo","id":22167388,"node_id":"MDQ6VXNlcjIyMTY3Mzg4","avatar_url":"https://avatars2.githubusercontent.com/u/22167388?v=4","gravatar_id":"","url":"https://api.github.com/users/Aerijo","html_url":"https://github.com/Aerijo","followers_url":"https://api.github.com/users/Aerijo/followers","following_url":"https://api.github.com/users/Aerijo/following{/other_user}","gists_url":"https://api.github.com/users/Aerijo/gists{/gist_id}","starred_url":"https://api.github.com/users/Aerijo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aerijo/subscriptions","organizations_url":"https://api.github.com/users/Aerijo/orgs","repos_url":"https://api.github.com/users/Aerijo/repos","events_url":"https://api.github.com/users/Aerijo/events{/privacy}","received_events_url":"https://api.github.com/users/Aerijo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":29,"created_at":"2019-02-07T07:19:04Z","updated_at":"2019-04-16T13:41:02Z","closed_at":null,"author_association":"MEMBER","pull_request":{"url":"https://api.github.com/repos/atom/snippets/pulls/288","html_url":"https://github.com/atom/snippets/pull/288","diff_url":"https://github.com/atom/snippets/pull/288.diff","patch_url":"https://github.com/atom/snippets/pull/288.patch"},"body":"# NOTE: Ready for review\r\n(specs are failing because this changes existing behaviour, and I don't want to touch them again until changes are approved)\r\n______\r\n\r\n### Requirements\r\n\r\n* Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.\r\n* All new code requires tests to ensure against regressions\r\n\r\n### Description of the Change\r\n\r\n<!--\r\n\r\nWe must be able to understand the design of your change from this description. If we can't get a good idea of what the code will be doing from the description here, the pull request may be closed at the maintainers' discretion. Keep in mind that the maintainer reviewing this PR may not be familiar with or have worked with the code here recently, so please walk us through the concepts.\r\n\r\n-->\r\n\r\nRedoes a lot of stuff. Basic idea is to comply with [the VS Code spec](https://code.visualstudio.com/docs/editor/userdefinedsnippets) (based on TextMate spec; also used by Sublime Text) as much as possible, because that's the spec language servers are supposed to use. With this, we'll fully support well formed LSP snippets. The added features are also useful anyway, and following an existing spec means we don't have to define our own (though I believe it's all based off of TextMate anyway).\r\n\r\nPutting this up now for feedback and trying it out while it's still being worked on.\r\n\r\n\r\n#### Added\r\n- [X] Support for variables\r\n- [X] Support for replacement if / else conditionals based on capture group match\r\n- [X] Support for choices (parses the syntax; actual choice popup deferred to later PR)\r\n- [X] Support for LSP transformation syntax\r\n- [X] Service for custom variable resolvers (not in the spec, but I like this idea a lot)\r\n- [X] Implicit end tab stops when one was not already defined (togglable in settings)\r\n- [X] Forced undo breaks at each tabstop\r\n\r\n#### Changed\r\n- [X] Removed implicit `g` flag from transformation regex. If users want it, they can add it explicitly. And now, if they don't want it, they have a choice.\r\n- [X] The parser has been rewritten, but still creates a tree compatible with the existing logic when using existing features. A notable change is that `\\` only escapes the characters `$`, `}`, and `\\` (and a few others depending on context).\r\n- [X] Specs have been updated to add the `g` flag where the implicit one was relied upon.\r\n- [X] Snippet bodies and tab stops are now formed on demand, and are no longer members of the snippet. This is necessary, given the dynamic nature of variables and their transformations. They are now made in the `SnippetExpansion`, which is a temporary representation for the expanded snippet.\r\n- [x] Refactoring the existing `snippet.getTabStops` into something more modular. Currently renamed to `toString`, but it will make the insertion string and tab stops.\r\n- [X] Implicit end tab stops (configurable in Settings)\r\n- [X] End tab stops now break out of the snippet, so you will no longer be able to tab backwards from one (this is in line with their purpose of marking where to put the cursor when the snippet finishes).\r\n- [X] Redid a lot of `editor.transact` calls; these appeared to only make the undo behaviour fail in strange ways.\r\n\r\n#### Open Questions\r\n- [ ] Should `\\` escape everything? It would make it easier to remember what it does, but subtly break VS Code compatibility (which is slightly different in a few areas anyway). It would also simplify the grammar.\r\n\r\n### Alternate Designs\r\n\r\nWould have removed `\\u` and co flags entirely, but they appear to be supported by TextMate too and so are worth keeping.\r\n\r\n### Benefits\r\n\r\n<!-- What benefits will be realized by the code change? -->\r\n99% backwards compatible, and adds much more advanced and dynamic capabilities. With custom variable resolvers, users can do pretty much anything with the provided text editor (and any other relevant params).\r\n\r\n### Possible Drawbacks\r\n\r\nBodies that contained text like `${1|one,two,three|}` will now be interpreted, instead of being a literal. But 1. the fix is to escape the `$` like this `\\\\${1|one,two,three|}` (as the raw CSON value), and 2. no one<sup>*</sup> would be doing that unless they wanted a choice placeholder anyway.\r\n\r\n<sup>*me</sup>\r\n### Applicable Issues\r\n\r\nDepends on #287 \r\n\r\n<!-- Enter any applicable Issues here -->\r\nCloses #285 \r\n\r\nAlso closes #41 I think"},"comment":{"url":"https://api.github.com/repos/atom/snippets/issues/comments/483663870","html_url":"https://github.com/atom/snippets/pull/288#issuecomment-483663870","issue_url":"https://api.github.com/repos/atom/snippets/issues/288","id":483663870,"node_id":"MDEyOklzc3VlQ29tbWVudDQ4MzY2Mzg3MA==","user":{"login":"Aerijo","id":22167388,"node_id":"MDQ6VXNlcjIyMTY3Mzg4","avatar_url":"https://avatars2.githubusercontent.com/u/22167388?v=4","gravatar_id":"","url":"https://api.github.com/users/Aerijo","html_url":"https://github.com/Aerijo","followers_url":"https://api.github.com/users/Aerijo/followers","following_url":"https://api.github.com/users/Aerijo/following{/other_user}","gists_url":"https://api.github.com/users/Aerijo/gists{/gist_id}","starred_url":"https://api.github.com/users/Aerijo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Aerijo/subscriptions","organizations_url":"https://api.github.com/users/Aerijo/orgs","repos_url":"https://api.github.com/users/Aerijo/repos","events_url":"https://api.github.com/users/Aerijo/events{/privacy}","received_events_url":"https://api.github.com/users/Aerijo/received_events","type":"User","site_admin":false},"created_at":"2019-04-16T13:41:02Z","updated_at":"2019-04-16T13:41:02Z","author_association":"MEMBER","body":"@savetheclocktower I'll be rewriting the specs tomorrow. I believe I've fixed all regressions I've come across, and hopefully any other bugs will appear when writing the specs."}}
other: {"actor":{"display_login":"Aerijo"}}