added: lsp-haskell-execute-code-action-add-signature#129
added: lsp-haskell-execute-code-action-add-signature#129ncaq wants to merge 3 commits intoemacs-lsp:masterfrom
Conversation
I want it to be a stand-alone function because I often do this in Haskell code actions. I update Package-Requires emacs `24.3` -> `26.1`, because `seq-find` require Emacs 25, lsp-mode of base package require `26.1`, Since lsp-haskell will never work without lsp-mode, there is no point in lsp-haskell supporting old Emacs that lsp-mode does not support.
| "Execute code action of add signature. | ||
| Add the type signature that GHC infers to the function located below the point." | ||
| (interactive) | ||
| (let ((action (seq-find (lambda (e) (string-prefix-p "add signature" (gethash "title" e))) (lsp-code-actions-at-point)))) |
There was a problem hiding this comment.
you should not use gethash because when lsp-use-plists is t the data structures will be plists. You may refer to lsp-execute-code-action-by-kind in lsp-java.
There was a problem hiding this comment.
I meant lsp-java-execute-matching-action
There was a problem hiding this comment.
Or we want the stuff in emacs-lsp/lsp-mode#2402
There was a problem hiding this comment.
HLS should set an identifiable kind for the action for this reason. If it doesn't please open a PR upstream so that it does. See also #112
There was a problem hiding this comment.
thank.
I use lsp:code-action-title.
There was a problem hiding this comment.
Code action titles aren't the same as kinds! Titles are user facing strings that can change at any time, kinds should be more stable.
There was a problem hiding this comment.
In fact, possibly what you want is this: https://github.com/emacs-lsp/lsp-mode/blob/master/lsp-mode.el#L5520
Compare with: https://github.com/haskell/haskell-language-server/pull/1988/files
There was a problem hiding this comment.
Yes, lsp-java is using the title because the server is refusing to fix the kinds.
|
|
||
| ;; Version: 1.0 | ||
| ;; Package-Requires: ((emacs "24.3") (lsp-mode "3.0") (haskell-mode "1.0")) | ||
| ;; Package-Requires: ((emacs "26.1") (lsp-mode "3.0") (haskell-mode "1.0")) |
I followed the code review. > you should not use gethash because when lsp-use-plists is t the data structures will be plists. You may refer to lsp-execute-code-action-by-kind in lsp-java. > > <emacs-lsp#129 (comment)>
[added: lsp-haskell-execute-code-action-add-signature by ncaq · Pull Request #129 · emacs-lsp/lsp-haskell](emacs-lsp/lsp-haskell#129)
|
Seems everything in the thread was addressed. Love providing type signatures for local functions, this would help type programming immensely. |
I want it to be a stand-alone function because I often do this in Haskell code actions.
I update Package-Requires emacs
24.3->26.1,because
seq-findrequire Emacs 25,lsp-mode of base package require
26.1,Since lsp-haskell will never work without lsp-mode,
there is no point in lsp-haskell supporting old Emacs that lsp-mode does not support.