-
Notifications
You must be signed in to change notification settings - Fork 64
added: lsp-haskell-execute-code-action-add-signature #129
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
;;; lsp-haskell.el --- Haskell support for lsp-mode | ||
|
||
;; 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")) | ||
;; Keywords: haskell | ||
;; URL: https://github.com/emacs-lsp/lsp-haskell | ||
|
||
|
@@ -228,6 +228,15 @@ if projectile way fails" | |
(user-error "Couldn't find cabal file, using: %s" dir) | ||
dir)))) | ||
|
||
(defun lsp-haskell-execute-code-action-add-signature () | ||
"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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you should not use gethash because when lsp-use-plists is t the data structures will be plists. You may refer to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant lsp-java-execute-matching-action There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or we want the stuff in emacs-lsp/lsp-mode#2402 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thank. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, lsp-java is using the title because the server is refusing to fix the kinds. |
||
(if (hash-table-p action) | ||
(lsp-execute-code-action action) | ||
(message "I Can't find add signature action for this point")))) | ||
|
||
;; --------------------------------------------------------------------- | ||
;; Starting the server and registration with lsp-mode | ||
|
||
|
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.
👍