atom / snippets

Atom snippets package
MIT License
205 stars 100 forks source link

LSP snippets #288

Closed Aerijo closed 4 years ago

Aerijo commented 5 years ago

NOTE: Ready for review


Requirements

Description of the Change

Redoes a lot of stuff. Basic idea is to comply with the VS Code spec (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).

Putting this up now for feedback and trying it out while it's still being worked on.

Added

Changed

Open Questions

Alternate Designs

Would have removed \u and co flags entirely, but they appear to be supported by TextMate too and so are worth keeping.

Benefits

99% 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).

Possible Drawbacks

Bodies 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* would be doing that unless they wanted a choice placeholder anyway.

*me

Applicable Issues

Closes #287 (this also contains the decaffeination changes)

Closes #285

Also closes #41 I think

Closes https://github.com/atom/apm/issues/213. That conversion uses alternate replacement syntax (?1:=:=) that now has support added here too.

aviatesk commented 4 years ago

@lee-dohm @lkashef bump. I played with this PR for a while and feel that this fairly works well.

Aerijo commented 4 years ago

@aviatesk Progress is happening; we're aiming to split it into smaller, more manageable PRs. The decaffeination of the remaining files is the first step.

Aerijo commented 4 years ago

This PR was too big. I tried splitting it off into smaller PRs, but it was still much easier to just write a new package from the ground up. Many of the changes in this PR have already been added to the new package, and things like cleaner undo/redo are on my radar. Once (if) it matures, I may revisit making changes to this package, but for now I'm focusing all my snippet efforts on the new package.

https://github.com/Aerijo/snippets-plus