Skip to content

Use generic method lsp-initialization-options when :initialization-options is nil #668

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,10 @@ They are added to `markdown-code-lang-modes'")
(cl-defgeneric lsp-execute-command (server command arguments)
"Ask SERVER to execute COMMAND with ARGUMENTS.")

(cl-defgeneric lsp-initialization-options (server)
"JSON object to send under `initializationOptions'"
(:method (_s) nil))

(defun lsp-elt (sequence n)
"Return Nth element of SEQUENCE or nil if N is out of range."
(if (listp sequence) (elt sequence n)
Expand Down Expand Up @@ -5416,9 +5420,11 @@ remote machine and vice versa."
Add workspace folders depending on server being multiroot and
session workspce folder configuration for the server."
(let* ((initialization-options-or-fn (lsp--client-initialization-options client)))
(if (functionp initialization-options-or-fn)
(funcall initialization-options-or-fn)
initialization-options-or-fn)))
(cond
((null initialization-options-or-fn)
(lsp-initialization-options (lsp--client-server-id client)))
((functionp initialization-options-or-fn) (funcall initialization-options-or-fn))
(t initialization-options-or-fn))))

(defun lsp--plist-delete (prop plist)
"Delete by side effect the property PROP from PLIST.
Expand Down