-
-
Notifications
You must be signed in to change notification settings - Fork 884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Rust-Analyzer] Support SnippetTextEdit #1926
Conversation
@@ -475,6 +475,7 @@ See `-let' for a description of the destructuring mechanism." | |||
(TextDocumentItem (:languageId :text :uri :version) nil) | |||
(TextDocumentSyncOptions nil (:change :openClose :save :willSave :willSaveWaitUntil)) | |||
(TextEdit (:newText :range) nil) | |||
(SnippetTextEdit (:newText :range) (:insertTextFormat)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this part of LSP spec? or is rust specific? if so should this go here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is implemented in vscode experimental features, at least I was unable to find it in rust analyzer client. My guess is that it will make to the spec at some point.
lsp-mode.el
Outdated
(-when-let ((&SnippetTextEdit :range (&RangeToPoint :start) | ||
:insert-text-format? :new-text) edit) | ||
(when (eq insert-text-format? lsp/insert-text-format-snippet) | ||
(yas-expand-snippet (lsp--to-yasnippet-snippet new-text) start (+ start (length new-text))))))))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may need to wrap this one with let (yas-indent-line)
too. To prevent snippet indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, but I didn't test it manually
Fixes #1907