]> git.bundesbrandschatzamt.de Git - emacsconfig.git/commitdiff
added lsp-mode
authorAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 11 Feb 2022 15:06:02 +0000 (16:06 +0100)
committerAndreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
Fri, 11 Feb 2022 15:09:29 +0000 (16:09 +0100)
Signed-off-by: Andreas Gerler <baronNOSPAMbundesbrandschatzamt.de>
94 files changed:
bba.org
elpa/lsp-mode-20220201.852/lsp-actionscript.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-ada.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-angular.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-bash.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-beancount.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-clangd.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-clojure.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-cmake.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-completion.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-crystal.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-csharp.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-css.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-d.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-dhall.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-diagnostics.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-dired.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-dockerfile.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-elixir.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-elm.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-erlang.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-eslint.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-fortran.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-fsharp.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-gdscript.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-go.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-graphql.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-groovy.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-hack.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-haxe.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-headerline.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-html.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-icons.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-ido.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-iedit.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-javascript.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-json.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-kotlin.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-lens.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-lua.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-markdown.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-mode-autoloads.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-mode-pkg.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-mode.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-modeline.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-nginx.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-nim.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-nix.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-ocaml.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-perl.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-php.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-prolog.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-protocol.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-purescript.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-pwsh.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-pyls.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-pylsp.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-r.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-racket.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-remark.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-rf.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-rust.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-semantic-tokens.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-solargraph.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-sorbet.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-sqls.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-steep.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-svelte.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-terraform.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-tex.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-toml.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-v.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-vala.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-verilog.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-vetur.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-vhdl.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-vimscript.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-xml.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-yaml.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp-zig.el [new file with mode: 0644]
elpa/lsp-mode-20220201.852/lsp.el [new file with mode: 0644]
elpa/lsp-mode-readme.txt [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-autoloads.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-doc.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-doc.html [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-flycheck.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-imenu.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-peek.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-pkg.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-sideline.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui-util.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/lsp-ui.el [new file with mode: 0644]
elpa/lsp-ui-20220104.1635/resources/lightbulb.png [new file with mode: 0644]
elpa/lsp-ui-readme.txt [new file with mode: 0644]

diff --git a/bba.org b/bba.org
index c994ef8d2eb1140880f19e3bdc2289367599614e..f6545fb29d8a17ac25e40b2937edb45893447e41 100644 (file)
--- a/bba.org
+++ b/bba.org
@@ -3039,6 +3039,30 @@ Combine abbrev with Ispell:
 * lsp
 [2020-01-16 Thu 11:26]
 
+#+begin_src sh :eval never
+  cpan -i Complier::Lexer
+  cpan -i Perl::LanguageServer
+#+end_src
+
+cpan only has Version 2.0.2.
+thus installed via github.
+
+
+#+begin_src emacs-lisp
+  (require 'lsp-mode)
+  (require 'lsp-ui)
+  (setq lsp-keymap-prefix "s-l")
+  (add-hook 'sh-mode-hook #'lsp)
+  ;; crashes currently in our configuration (add-hook 'cperl-mode-hook #'lsp)
+  (setq lsp-ui-doc-enable t)
+  (setq lsp-ui-doc-header t)
+  (setq lsp-ui-doc-include-signature t)
+  (setq lsp-ui-doc-position 'top)
+  (setq lsp-ui-sideline-enable nil)
+  (setq lsp-ui-sideline-ignore-duplicate t)
+  (setq lsp-ui-sideline-show-code-actions nil)
+#+end_src
+
 #+begin_src emacs-lisp :tangle no
   (lsp-define-stdio-client lsp-sql "sql"
                            (lsp-make-traverser #'(lambda (dir) (directory-files dir nil "sss.sql"))) '("~/.vscode/extensions/ms-mssql.mssql-1.4.0/sqltoolsservice/1.4.0/Ubuntu16/MicrosoftSqlToolsServiceLayer"))
diff --git a/elpa/lsp-mode-20220201.852/lsp-actionscript.el b/elpa/lsp-mode-20220201.852/lsp-actionscript.el
new file mode 100644 (file)
index 0000000..f82e669
--- /dev/null
@@ -0,0 +1,134 @@
+;;; lsp-actionscript.el --- ActionScript Client settings         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021  Jen-Chieh Shen
+
+;; Author: Jen-Chieh Shen <jcs090218NOSPAMgmail.com>
+;; Keywords: actionscript lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP client for ActionScript
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-actionscript nil
+  "LSP support for ActionScript."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/BowlerHatLLC/vscode-as3mxml")
+  :package-version `(lsp-mode . "8.0.0"))
+
+(defcustom lsp-actionscript-java-path "java"
+  "Path of the java executable."
+  :group 'lsp-actionscript
+  :type 'string)
+
+(defcustom lsp-actionscript-sdk-path ""
+  "Path to supported SDK.
+See https://github.com/BowlerHatLLC/vscode-as3mxml/wiki/Choose-an-ActionScript-SDK-for-the-current-workspace-in-Visual-Studio-Code."
+  :type 'string
+  :group 'lsp-actionscript
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-actionscript-version "1.5.0"
+  "Version of ActionScript language server."
+  :type 'string
+  :group 'lsp-actionscript
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-actionscript-extension-name
+  (format "vscode-nextgenas-%s.vsix" lsp-actionscript-version)
+  "File name of the extension file from language server."
+  :type 'string
+  :group 'lsp-actionscript
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-actionscript-server-download-url
+  (format "https://github.com/BowlerHatLLC/vscode-as3mxml/releases/download/v%s/%s"
+          lsp-actionscript-version lsp-actionscript-extension-name)
+  "Automatic download url for lsp-actionscript."
+  :type 'string
+  :group 'lsp-actionscript
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-actionscript-server-store-path
+  (f-join lsp-server-install-dir "as3mxml")
+  "The path to the file in which `lsp-actionscript' will be stored."
+  :type 'file
+  :group 'lsp-actionscript
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-actionscript-option-charset "UTF8"
+  "The charset to use by the ActionScript Language server."
+  :type 'string
+  :group 'lsp-actionscript
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-actionscript--extension-root ()
+  "The path that the downloaded extension will extract to."
+  (f-join lsp-actionscript-server-store-path
+          (format "vscode-nextgenas-%s" lsp-actionscript-version)))
+
+(defun lsp-actionscript--extension-path ()
+  "Return full path of the downloaded extension."
+  (f-join lsp-actionscript-server-store-path lsp-actionscript-extension-name))
+
+(defun lsp-actionscript--extension-dir ()
+  "Return as3mxml extension path."
+  (f-join (lsp-actionscript--extension-root) "extension"))
+
+(defun lsp-actionscript--server-command ()
+  "Startup command for ActionScript language server."
+  (list lsp-actionscript-java-path
+        (format "-Droyalelib=%s" lsp-actionscript-sdk-path)
+        (format "-Dfile.encoding=%s" lsp-actionscript-option-charset)
+        "-cp"
+        (format "%s/bundled-compiler/*;%s/bin/*"
+                (lsp-actionscript--extension-dir) (lsp-actionscript--extension-dir))
+        "com.as3mxml.vscode.Main"))
+
+(defun lsp-actionscript--extension-path-zip ()
+  "Change extension path from .vsix to .zip."
+  (concat (f-no-ext (lsp-actionscript--extension-path)) ".zip"))
+
+(lsp-dependency
+ 'as3mxml
+ '(:system "as3mxml")
+ `(:download :url lsp-actionscript-server-download-url
+             :store-path ,(lsp-actionscript--extension-path-zip)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection
+                   #'lsp-actionscript--server-command
+                   (lambda () (f-exists? (lsp-actionscript--extension-path-zip))))
+  :major-modes '(actionscript-mode)
+  :priority -1
+  :server-id 'as3mxml-ls
+  :download-server-fn (lambda (_client _callback error-callback _update?)
+                        (lsp-package-ensure
+                         'as3mxml
+                         (lambda ()
+                           ;; TODO: Error handling when unzip failed
+                           (lsp-unzip (lsp-actionscript--extension-path-zip)
+                                      (lsp-actionscript--extension-root)))
+                         error-callback))))
+
+(lsp-consistency-check lsp-actionscript)
+
+(provide 'lsp-actionscript)
+;;; lsp-actionscript.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-ada.el b/elpa/lsp-mode-20220201.852/lsp-ada.el
new file mode 100644 (file)
index 0000000..8200041
--- /dev/null
@@ -0,0 +1,106 @@
+;;; lsp-ada.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, ada
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Ada Programming Language
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-ada nil
+  "Settings for Ada Language Server."
+  :group 'tools
+  :tag "Language Server"
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom-lsp lsp-ada-project-file "default.gpr"
+  "Set the project file full path to configure the language server with.
+  The ~ prefix (for the user home directory) is supported.
+  See https://github.com/AdaCore/ada_language_server for a per-project
+  configuration example."
+  :type 'string
+  :group 'lsp-ada
+  :package-version '(lsp-mode . "6.2")
+  :lsp-path "ada.projectFile")
+
+(defcustom-lsp lsp-ada-option-charset "UTF-8"
+  "The charset to use by the Ada Language server. Defaults to 'UTF-8'."
+  :type 'string
+  :group 'lsp-ada
+  :package-version '(lsp-mode . "6.2")
+  :lsp-path "ada.defaultCharset")
+
+(defcustom-lsp lsp-ada-enable-diagnostics t
+  "A boolean to disable diagnostics. Defaults to true."
+  :type 'boolean
+  :group 'lsp-ada
+  :package-version '(lsp-mode . "6.2")
+  :lsp-path "ada.enableDiagnostics")
+
+(defcustom lsp-ada-als-executable "ada_language_server"
+  "Command to start the Ada language server."
+  :group 'lsp-ada
+  :risky t
+  :type 'file)
+
+(defcustom lsp-ada-alira-executable "alr"
+  "The alire executable to run when a project is detected."
+  :type 'string
+  :group 'lsp-ada
+  :package-version '(lsp-mode "8.0.1"))
+
+(defun lsp-ada--environment ()
+  "Add environmental variables if needed."
+  (let ((project-root (lsp-workspace-root)))
+    ;; When there is an alire project, include its environment
+    (when (file-exists-p
+           (concat (file-name-as-directory project-root)
+                   "alire.toml"))
+      (let ((alr-executable (executable-find lsp-ada-alira-executable)))
+        (if alr-executable
+            ;; Transform output variables to environment
+            (let ((env-output (shell-command-to-string (concat alr-executable " printenv --unix"))))
+              (let ((var-strings (split-string env-output "\n")))
+                (mapcar (lambda (string)
+                          (if (string-match (rx "export" space (group (one-or-more ascii)) "=" "\"" (group (one-or-more ascii)) "\"") string)
+                              (let ((var-name (match-string 1 string))
+                                    (var-value (match-string 2 string)))
+                                (cons var-name var-value))))
+                        var-strings)))
+          (lsp--error "Found alire.toml but the executable %s could not be found" alr-executable))))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection lsp-ada-als-executable)
+                  :major-modes '(ada-mode)
+                  :priority -1
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration
+                                       (lsp-configuration-section "ada"))))
+                  :server-id 'ada-ls
+                  :synchronize-sections '("ada")
+                  :environment-fn 'lsp-ada--environment))
+
+(lsp-consistency-check lsp-ada)
+
+(provide 'lsp-ada)
+;;; lsp-ada.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-angular.el b/elpa/lsp-mode-20220201.852/lsp-angular.el
new file mode 100644 (file)
index 0000000..f09aa87
--- /dev/null
@@ -0,0 +1,101 @@
+;;; lsp-angular.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp,
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Angular Web application framework.
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'f)
+
+\f
+;;; Angular
+(defgroup lsp-angular nil
+  "Angular LSP client, provided by the Angular Language Service Server."
+  :group 'lsp-mode
+  :version "8.0.0"
+  :link '(url-link "https://github.com/angular/vscode-ng-language-service"))
+
+(defcustom lsp-clients-angular-language-server-command
+  nil
+  "The command that starts the angular language server."
+  :group 'lsp-angular
+  :type '(choice
+          (string :tag "Single string value")
+          (repeat :tag "List of string values"
+                  string)))
+
+(defcustom lsp-clients-angular-node-get-prefix-command
+  "npm config get --global prefix"
+  "The shell command that returns the path of NodeJS's prefix.
+Has no effects when `lsp-clients-angular-language-server-command' is set."
+  :group 'lsp-angular
+  :type 'string)
+
+(defun lsp-client--angular-start-loading (_workspace params)
+  (lsp--info "Started loading project %s" params))
+
+(defun lsp-client--angular-finished-loading (_workspace params)
+  (lsp--info "Finished loading project %s" params))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection
+  (lsp-stdio-connection
+   (lambda ()
+     (if lsp-clients-angular-language-server-command
+         lsp-clients-angular-language-server-command
+       (let ((node-modules-path
+              (f-join
+               (string-trim
+                (shell-command-to-string lsp-clients-angular-node-get-prefix-command))
+               "lib/node_modules")))
+         ;; The shell command takes a significant time to run,
+         ;; so we "cache" its results after running once
+         (setq lsp-clients-angular-language-server-command
+               (list
+                "node"
+                (f-join node-modules-path "@angular/language-server")
+                "--ngProbeLocations"
+                node-modules-path
+                "--tsProbeLocations"
+                node-modules-path
+                "--stdio"))
+         lsp-clients-angular-language-server-command))))
+  :activation-fn
+  (lambda (&rest _args)
+    (and (string-match-p "\\(\\.html\\|\\.ts\\)\\'" (buffer-file-name))
+         (lsp-workspace-root)
+         (file-exists-p (f-join (lsp-workspace-root) "angular.json"))))
+  :priority -1
+  :notification-handlers
+  (ht ("angular/projectLoadingStart" #'lsp-client--angular-start-loading)
+      ("angular/projectLoadingFinish" #'lsp-client--angular-finished-loading)
+      ("angular/projectLanguageService" #'ignore))
+  :add-on? t
+  :server-id 'angular-ls))
+
+
+(lsp-consistency-check lsp-angular)
+
+(provide 'lsp-angular)
+;;; lsp-angular.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-bash.el b/elpa/lsp-mode-20220201.852/lsp-bash.el
new file mode 100644 (file)
index 0000000..ee8a28e
--- /dev/null
@@ -0,0 +1,90 @@
+;;; lsp-bash.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, bash, shell-script
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Bash Programming Language
+
+;;; Code:
+
+(require 'lsp-mode)
+
+;;; Bash
+(defgroup lsp-bash nil
+  "Settings for the Bash Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/bash-lsp/bash-language-server")
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-bash-explainshell-endpoint nil
+  "The endpoint to use explainshell.com to answer 'onHover' queries.
+See instructions at https://marketplace.visualstudio.com/items?itemName=mads-hartmann.bash-ide-vscode"
+  :type 'string
+  :risky t
+  :group 'lsp-bash
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-bash-highlight-parsing-errors nil
+  "Consider parsing errors in scripts as 'problems'."
+  :type 'boolean
+  :group 'lsp-bash
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-bash-glob-pattern nil
+  "Glob pattern used to find shell script files to parse."
+  :type 'string
+  :group 'lsp-bash
+  :package-version '(lsp-mode . "6.3"))
+
+(defun lsp-bash--bash-ls-server-command ()
+  "Startup command for Bash language server."
+  (list (lsp-package-path 'bash-language-server) "start"))
+
+(lsp-dependency 'bash-language-server
+                '(:system "bash-language-server")
+                '(:npm :package "bash-language-server"
+                       :path "bash-language-server"))
+
+(defvar sh-shell)
+
+(defun lsp-bash-check-sh-shell (&rest _)
+  "Check whether `sh-shell' is sh or bash.
+
+This prevents the Bash server from being turned on in zsh files."
+  (and (eq major-mode 'sh-mode)
+       (memq sh-shell '(sh bash))))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection #'lsp-bash--bash-ls-server-command)
+  :priority -1
+  :activation-fn #'lsp-bash-check-sh-shell
+  :environment-fn (lambda ()
+                    '(("EXPLAINSHELL_ENDPOINT" . lsp-bash-explainshell-endpoint)
+                      ("HIGHLIGHT_PARSING_ERRORS" . lsp-bash-highlight-parsing-errors)
+                      ("GLOB_PATTERN" . lsp-bash-glob-pattern)))
+  :server-id 'bash-ls
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'bash-language-server callback error-callback))))
+
+(lsp-consistency-check lsp-bash)
+
+(provide 'lsp-bash)
+;;; lsp-bash.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-beancount.el b/elpa/lsp-mode-20220201.852/lsp-beancount.el
new file mode 100644 (file)
index 0000000..d2125e8
--- /dev/null
@@ -0,0 +1,71 @@
+;;; lsp-beancount.el --- Beancount Client settings         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, beancount
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP client for Beancount
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-beancount nil
+  "Settings for the Beancount Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/polarmutex/beancount-language-server")
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-beancount-langserver-executable "beancount-langserver"
+  "Command to start Beancount language server."
+  :type 'string
+  :group 'lsp-beancount
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-beancount-python-interpreter nil
+  "Path to Python executable."
+  :type 'string
+  :group 'lsp-beancount
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-beancount-journal-file nil
+  "Pathg to Beancount journal file."
+  :type 'string
+  :group 'lsp-beancount
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection
+  (lsp-stdio-connection
+   (lambda ()
+     (when (null lsp-beancount-python-interpreter)
+       (setq lsp-beancount-python-interpreter (or (executable-find "python3")
+                                                  (executable-find "python"))))
+     `(,lsp-beancount-langserver-executable "--stdio")))
+  :major-modes '(beancount-mode)
+  :initialization-options
+  `((journalFile . ,lsp-beancount-journal-file)
+    (pythonPath . ,lsp-beancount-python-interpreter))
+  :server-id 'beancount-ls))
+
+(lsp-consistency-check lsp-beancount)
+
+(provide 'lsp-beancount)
+;;; lsp-beancount.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-clangd.el b/elpa/lsp-mode-20220201.852/lsp-clangd.el
new file mode 100644 (file)
index 0000000..1a88877
--- /dev/null
@@ -0,0 +1,315 @@
+;;; lsp-clangd.el --- LSP clients for the C Languages Family -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Daniel Martín & emacs-lsp maintainers
+;; URL: https://github.com/emacs-lsp/lsp-mode
+;; Keywords: languages, c, cpp, clang
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP clients for the C Languages Family.
+
+;; ** Clang-tidy Flycheck integration (Clangd) **
+;;
+;; If you invoke `flycheck-display-error-explanation' on a
+;; `clang-tidy' error (if Clangd is configured to show `clang-tidy'
+;; diagnostics), Emacs will open a detailed explanation about the
+;; message by querying the LLVM website. As an embedded web browser is
+;; used to show the documentation, this feature requires that Emacs is
+;; compiled with libxml2 support.
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'cl-lib)
+(require 'rx)
+(require 'seq)
+(require 'dom)
+(eval-when-compile (require 'subr-x))
+
+(require 'dash)
+(require 's)
+
+(defvar flycheck-explain-error-buffer)
+(declare-function flycheck-error-id "ext:flycheck" (err) t)
+(declare-function flycheck-error-group "ext:flycheck" (err) t)
+(declare-function flycheck-error-message "ext:flycheck" (err) t)
+
+(defcustom lsp-clangd-version "13.0.0"
+  "Clangd version to download.
+It has to be set before `lsp-clangd.el' is loaded and it has to
+be available here: https://github.com/clangd/clangd/releases/"
+  :type 'string
+  :group 'lsp-clangd
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clangd-download-url
+  (format (pcase system-type
+            ('darwin "https://github.com/clangd/clangd/releases/download/%s/clangd-mac-%s.zip")
+            ('windows-nt "https://github.com/clangd/clangd/releases/download/%s/clangd-windows-%s.zip")
+            (_ "https://github.com/clangd/clangd/releases/download/%s/clangd-linux-%s.zip"))
+          lsp-clangd-version
+          lsp-clangd-version)
+  "Automatic download url for clangd"
+  :type 'string
+  :group 'lsp-clangd
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clangd-binary-path
+  (f-join lsp-server-install-dir (format "clangd/clangd_%s/bin"
+                                         lsp-clangd-version)
+          (pcase system-type
+            ('windows-nt "clangd.exe")
+            (_ "clangd")))
+  "The path to `clangd' binary."
+  :type 'file
+  :group 'lsp-clangd
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-dependency
+ 'clangd
+ `(:download :url lsp-clangd-download-url
+             :decompress :zip
+             :store-path ,(f-join lsp-server-install-dir "clangd" "clangd.zip")
+             :binary-path lsp-clangd-binary-path
+             :set-executable? t))
+
+(defun lsp-cpp-flycheck-clang-tidy--skip-http-headers ()
+  "Position point just after HTTP headers."
+  (re-search-forward "^$"))
+
+(defun lsp-cpp-flycheck-clang-tidy--narrow-to-http-body ()
+  "Narrow the current buffer to contain the body of an HTTP response."
+  (lsp-cpp-flycheck-clang-tidy--skip-http-headers)
+  (narrow-to-region (point) (point-max)))
+
+(defun lsp-cpp-flycheck-clang-tidy--decode-region-as-utf8 (start end)
+  "Decode a region from START to END in UTF-8."
+  (condition-case nil
+      (decode-coding-region start end 'utf-8)
+    (coding-system-error nil)))
+
+(defun lsp-cpp-flycheck-clang-tidy--remove-crlf ()
+  "Remove carriage return and line feeds from the current buffer."
+  (save-excursion
+    (while (re-search-forward "\r$" nil t)
+      (replace-match "" t t))))
+
+(defun lsp-cpp-flycheck-clang-tidy--extract-relevant-doc-section ()
+  "Extract the parts of the LLVM clang-tidy documentation that are relevant.
+
+This function assumes that the current buffer contains the result
+of browsing 'clang.llvm.org', as returned by `url-retrieve'.
+More concretely, this function returns the main <div> element
+with class 'section', and also removes 'headerlinks'."
+  (goto-char (point-min))
+  (lsp-cpp-flycheck-clang-tidy--narrow-to-http-body)
+  (lsp-cpp-flycheck-clang-tidy--decode-region-as-utf8 (point-min) (point-max))
+  (lsp-cpp-flycheck-clang-tidy--remove-crlf)
+  (let* ((dom (libxml-parse-html-region (point-min) (point-max)))
+         (section (dom-by-class dom "section")))
+    (dolist (headerlink (dom-by-class section "headerlink"))
+      (dom-remove-node section headerlink))
+    section))
+
+(defun lsp-cpp-flycheck-clang-tidy--explain-error (explanation &rest args)
+  "Explain an error in the Flycheck error explanation buffer using EXPLANATION.
+
+EXPLANATION is a function with optional ARGS that, when
+evaluated, inserts the content in the appropriate Flycheck
+buffer."
+  (with-current-buffer flycheck-explain-error-buffer
+    (let ((inhibit-read-only t)
+          (inhibit-modification-hooks t))
+      (erase-buffer)
+      (apply explanation args)
+      (goto-char (point-min)))))
+
+(defun lsp-cpp-flycheck-clang-tidy--show-loading-status ()
+  "Show a loading string while clang-tidy documentation is fetched from llvm.org.
+Recent versions of `flycheck' call `display-message-or-buffer' to
+display error explanations. `display-message-or-buffer' displays
+the documentation string either in the echo area or in a separate
+window, depending on the string's height. This function forces to
+always display it in a separate window by appending the required
+number of newlines."
+  (let* ((num-lines-threshold
+          (round (if resize-mini-windows
+                     (cond ((floatp max-mini-window-height)
+                            (* (frame-height)
+                               max-mini-window-height))
+                           ((integerp max-mini-window-height)
+                            max-mini-window-height)
+                           (t
+                            1))
+                   1)))
+         (extra-new-lines (make-string (1+ num-lines-threshold) ?\n)))
+    (concat "Loading documentation..." extra-new-lines)))
+
+(defun lsp-cpp-flycheck-clang-tidy--show-documentation (error-id)
+  "Show clang-tidy documentation about ERROR-ID.
+
+Information comes from the clang.llvm.org website."
+  (url-retrieve (format
+                 "https://clang.llvm.org/extra/clang-tidy/checks/%s.html" error-id)
+                (lambda (status)
+                  (if-let ((error-status (plist-get status :error)))
+                      (lsp-cpp-flycheck-clang-tidy--explain-error
+                       #'insert
+                       (format
+                        "Error accessing clang-tidy documentation: %s"
+                        (error-message-string error-status)))
+                    (let ((doc-contents
+                           (lsp-cpp-flycheck-clang-tidy--extract-relevant-doc-section)))
+                      (lsp-cpp-flycheck-clang-tidy--explain-error
+                       #'shr-insert-document doc-contents)))))
+  (lsp-cpp-flycheck-clang-tidy--show-loading-status))
+
+;;;###autoload
+(defun lsp-cpp-flycheck-clang-tidy-error-explainer (error)
+  "Explain a clang-tidy ERROR by scraping documentation from llvm.org."
+  (unless (fboundp 'libxml-parse-html-region)
+    (error "This function requires Emacs to be compiled with libxml2"))
+  (if-let ((clang-tidy-error-id (flycheck-error-id error)))
+      (condition-case err
+          (lsp-cpp-flycheck-clang-tidy--show-documentation clang-tidy-error-id)
+        (error
+         (format
+          "Error accessing clang-tidy documentation: %s"
+          (error-message-string err))))
+    (error "The clang-tidy error message does not contain an [error-id]")))
+
+
+;;; lsp-clangd
+(defgroup lsp-clangd nil
+  "LSP support for C-family languages (C, C++, Objective-C, Objective-C++), using clangd."
+  :group 'lsp-mode
+  :link '(url-link "https://clang.llvm.org/extra/clangd"))
+
+(defcustom lsp-clients-clangd-executable nil
+  "The clangd executable to use.
+When `'non-nil' use the name of the clangd executable file
+available in your path to use. Otherwise the system will try to
+find a suitable one. Set this variable before loading lsp."
+  :group 'lsp-clangd
+  :risky t
+  :type '(choice (file :tag "Path")
+                 (const :tag "Auto" nil)))
+
+(defvar lsp-clients--clangd-default-executable nil
+  "Clang default executable full path when found.
+This must be set only once after loading the clang client.")
+
+(defcustom lsp-clients-clangd-args '("--header-insertion-decorators=0")
+  "Extra arguments for the clangd executable."
+  :group 'lsp-clangd
+  :risky t
+  :type '(repeat string))
+
+(defcustom lsp-clients-clangd-library-directories '("/usr")
+  "List of directories which will be considered to be libraries."
+  :risky t
+  :type '(repeat string)
+  :group 'lsp-clangd
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defun lsp-clients--clangd-command ()
+  "Generate the language server startup command."
+  (unless lsp-clients--clangd-default-executable
+    (setq lsp-clients--clangd-default-executable
+          (or (lsp-package-path 'clangd)
+              (-first #'executable-find
+                      (-map (lambda (version)
+                              (concat "clangd" version))
+                            ;; Prefer `clangd` without a version number appended.
+                            (cl-list* "" (-map
+                                          (lambda (vernum) (format "-%d" vernum))
+                                          (number-sequence 14 6 -1)))))
+              (lsp-clients-executable-find "xcodebuild" "-find-executable" "clangd")
+              (lsp-clients-executable-find "xcrun" "--find" "clangd"))))
+
+  `(,(or lsp-clients-clangd-executable lsp-clients--clangd-default-executable "clangd")
+    ,@lsp-clients-clangd-args))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   'lsp-clients--clangd-command)
+                  :activation-fn (lsp-activate-on "c" "cpp" "objective-c")
+                  :priority -1
+                  :server-id 'clangd
+                  :library-folders-fn (lambda (_workspace) lsp-clients-clangd-library-directories)
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure 'clangd callback error-callback))))
+
+(defun lsp-clangd-join-region (beg end)
+  "Apply join-line from BEG to END.
+This function is useful when an indented function prototype needs
+to be shown in a single line."
+  (save-excursion
+    (let ((end (copy-marker end)))
+      (goto-char beg)
+      (while (< (point) end)
+        (join-line 1)))
+    (s-trim (buffer-string))))
+
+(cl-defmethod lsp-clients-extract-signature-on-hover (contents (_server-id (eql clangd)))
+  "Extract a representative line from clangd's CONTENTS, to show in the echo area.
+This function tries to extract the type signature from CONTENTS,
+or the first line if it cannot do so. A single line is always
+returned to avoid that the echo area grows uncomfortably."
+  (with-temp-buffer
+    (-let [value (lsp:markup-content-value contents)]
+      (insert value)
+      (goto-char (point-min))
+      (if (re-search-forward (rx (seq "```cpp\n"
+                                      (opt (group "//"
+                                                  (zero-or-more nonl)
+                                                  "\n"))
+                                      (group
+                                       (one-or-more
+                                        (not (any "`")))
+                                       "\n")
+                                      "```")) nil t nil)
+          (progn (narrow-to-region (match-beginning 2) (match-end 2))
+                 (lsp--render-element (lsp-make-marked-string
+                                       :language "cpp"
+                                       :value (lsp-clangd-join-region (point-min) (point-max)))))
+        (car (s-lines (lsp--render-element contents)))))))
+
+(cl-defmethod lsp-diagnostics-flycheck-error-explainer (e (_server-id (eql clangd)))
+  "Explain a `flycheck-error' E that was generated by the Clangd language server."
+  (cond ((string-equal "clang-tidy" (flycheck-error-group e))
+         (lsp-cpp-flycheck-clang-tidy-error-explainer e))
+        (t (flycheck-error-message e))))
+
+(defun lsp-clangd-find-other-file (&optional new-window)
+  "Switch between the corresponding C/C++ source and header file.
+If NEW-WINDOW (interactively the prefix argument) is non-nil,
+open in a new window.
+
+Only works with clangd."
+  (interactive "P")
+  (let ((other (lsp-send-request (lsp-make-request
+                                  "textDocument/switchSourceHeader"
+                                  (lsp--text-document-identifier)))))
+    (unless (s-present? other)
+      (user-error "Could not find other file"))
+    (funcall (if new-window #'find-file-other-window #'find-file)
+             (lsp--uri-to-path other))))
+
+(lsp-consistency-check lsp-clangd)
+
+(provide 'lsp-clangd)
+;;; lsp-clangd.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-clojure.el b/elpa/lsp-mode-20220201.852/lsp-clojure.el
new file mode 100644 (file)
index 0000000..7f911bb
--- /dev/null
@@ -0,0 +1,418 @@
+;;; lsp-clojure.el --- Clojure Client settings -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Benedek Fazekas
+
+;; Author: Benedek Fazekas <benedek.fazekasNOSPAMgmail.com>
+;; Keywords: languages,tools
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-clojure client
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'lsp-protocol)
+(require 'cl-lib)
+(require 'lsp-semantic-tokens)
+
+(defgroup lsp-clojure nil
+  "LSP support for Clojure."
+  :link '(url-link "https://github.com/snoe/clojure-lsp")
+  :group 'lsp-mode
+  :tag "Lsp Clojure")
+
+(define-obsolete-variable-alias 'lsp-clojure-server-command
+  'lsp-clojure-custom-server-command  "lsp-mode 8.0.0")
+
+(defcustom lsp-clojure-custom-server-command nil
+  "The clojure-lisp server command."
+  :group 'lsp-clojure
+  :risky t
+  :type '(repeat string))
+
+(defcustom lsp-clojure-server-download-url
+  (format "https://github.com/clojure-lsp/clojure-lsp/releases/latest/download/clojure-lsp-native-%s-amd64.zip"
+          (pcase system-type
+            ('gnu/linux "linux")
+            ('darwin "macos")
+            ('windows-nt "windows")))
+  "Automatic download url for lsp-clojure."
+  :type 'string
+  :group 'lsp-clojure
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clojure-server-store-path
+  (f-join lsp-server-install-dir
+          "clojure"
+          (if (eq system-type 'windows-nt)
+              "clojure-lsp.exe"
+            "clojure-lsp"))
+  "The path to the file in which `clojure-lsp' will be stored."
+  :type 'file
+  :group 'lsp-clojure
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clojure-workspace-dir (expand-file-name (locate-user-emacs-file "workspace/"))
+  "LSP clojure workspace directory."
+  :group 'lsp-clojure
+  :risky t
+  :type 'directory)
+
+(defcustom lsp-clojure-workspace-cache-dir (expand-file-name ".cache/" lsp-clojure-workspace-dir)
+  "LSP clojure workspace cache directory."
+  :group 'lsp-clojure
+  :risky t
+  :type 'directory)
+
+(defcustom lsp-clojure-test-tree-position-params nil
+  "The optional test tree position params.
+Defaults to side following treemacs default."
+  :type 'list
+  :group 'lsp-clojure)
+
+;; Internal
+
+(lsp-interface
+ (Clojure:CursorInfoParams (:textDocument :position) nil))
+
+(lsp-dependency
+ 'clojure-lsp
+ `(:download :url lsp-clojure-server-download-url
+   :decompress :zip
+   :store-path lsp-clojure-server-store-path
+   :set-executable? t)
+ '(:system "clojure-lsp"))
+
+;; Refactorings
+
+(defun lsp-clojure--execute-command (command &optional args)
+  "Send an executeCommand request for COMMAND with ARGS."
+  (lsp--cur-workspace-check)
+  (lsp-send-execute-command command (apply #'vector args)))
+
+(defun lsp-clojure--refactoring-call (refactor-name &rest additional-args)
+  "Send an executeCommand request for REFACTOR-NAME with ADDITIONAL-ARGS.
+If there are more arguments expected after the line and column numbers."
+  (lsp--cur-workspace-check)
+  (lsp-clojure--execute-command refactor-name (cl-list* (lsp--buffer-uri)
+                                                        (- (line-number-at-pos) 1) ;; clojure-lsp expects line numbers to start at 0
+                                                        (current-column)
+                                                        additional-args)))
+
+(defun lsp-clojure-add-import-to-namespace (import-name)
+  "Add to IMPORT-NAME to :import form."
+  (interactive "MImport name: ")
+  (lsp-clojure--refactoring-call "add-import-to-namespace" import-name))
+
+(defun lsp-clojure-add-missing-libspec ()
+  "Apply add-missing-libspec refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "add-missing-libspec"))
+
+(defun lsp-clojure-clean-ns ()
+  "Apply clean-ns refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "clean-ns"))
+
+(defun lsp-clojure-cycle-coll ()
+  "Apply cycle-coll refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "cycle-coll"))
+
+(defun lsp-clojure-cycle-privacy ()
+  "Apply cycle-privacy refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "cycle-privacy"))
+
+(defun lsp-clojure-expand-let ()
+  "Apply expand-let refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "expand-let"))
+
+(defun lsp-clojure-extract-function (function-name)
+  "Move form at point into a new function named FUNCTION-NAME."
+  (interactive "MFunction name: ") ;; Name of the function
+  (lsp-clojure--refactoring-call "extract-function" function-name))
+
+(defun lsp-clojure-inline-symbol ()
+  "Apply inline-symbol refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "inline-symbol"))
+
+(defun lsp-clojure-introduce-let (binding-name)
+  "Move form at point into a new let binding as BINDING-NAME."
+  (interactive "MBinding name: ") ;; Name of the let binding
+  (lsp-clojure--refactoring-call "introduce-let" binding-name))
+
+(defun lsp-clojure-move-to-let (binding-name)
+  "Move form at point into nearest existing let binding as BINDING-NAME."
+  (interactive "MBinding name: ") ;; Name of the let binding
+  (lsp-clojure--refactoring-call "move-to-let" binding-name))
+
+(defun lsp-clojure-thread-first ()
+  "Apply thread-first refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "thread-first"))
+
+(defun lsp-clojure-thread-first-all ()
+  "Apply thread-first-all refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "thread-first-all"))
+
+(defun lsp-clojure-thread-last ()
+  "Apply thread-last refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "thread-last"))
+
+(defun lsp-clojure-thread-last-all ()
+  "Apply thread-last-all refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "thread-last-all"))
+
+(defun lsp-clojure-unwind-all ()
+  "Apply unwind-all refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "unwind-all"))
+
+(defun lsp-clojure-unwind-thread ()
+  "Apply unwind-thread refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "unwind-thread"))
+
+(defun lsp-clojure-create-function ()
+  "Apply create-function refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "create-function"))
+
+(defun lsp-clojure-create-test ()
+  "Apply create-test refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "create-test"))
+
+(defun lsp-clojure-sort-map ()
+  "Apply sort-map refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "sort-map"))
+
+(defun lsp-clojure-move-coll-entry-up ()
+  "Apply move coll entry up refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "move-coll-entry-up"))
+
+(defun lsp-clojure-move-coll-entry-down ()
+  "Apply move coll entry down refactoring at point."
+  (interactive)
+  (lsp-clojure--refactoring-call "move-coll-entry-down"))
+
+(defun lsp-clojure-server-info ()
+  "Request server info."
+  (interactive)
+  (lsp--cur-workspace-check)
+  (lsp-notify "clojure/serverInfo/log" nil))
+
+(defun lsp-clojure-server-info-raw ()
+  "Request server info raw data."
+  (interactive)
+  (lsp--cur-workspace-check)
+  (message "%s" (lsp--json-serialize (lsp-request "clojure/serverInfo/raw" nil))))
+
+(defun lsp-clojure-cursor-info ()
+  "Request cursor info at point."
+  (interactive)
+  (lsp--cur-workspace-check)
+  (lsp-notify "clojure/cursorInfo/log"
+              (lsp-make-clojure-cursor-info-params
+               :textDocument (lsp-make-text-document-identifier :uri (lsp--buffer-uri))
+               :position (lsp-make-position :line (- (line-number-at-pos) 1)
+                                            :character (current-column)))))
+
+(defun lsp-clojure-resolve-macro-as ()
+  "Ask to user how the unresolved macro should be resolved."
+  (interactive)
+  (lsp--cur-workspace-check)
+  (lsp-clojure--execute-command "resolve-macro-as"
+                                (list (lsp--buffer-uri)
+                                      (- (line-number-at-pos) 1) ;; clojure-lsp expects line numbers to start at 0
+                                      (current-column))))
+
+(defun lsp-clojure--ensure-dir (path)
+  "Ensure that directory PATH exists."
+  (unless (file-directory-p path)
+    (make-directory path t)))
+
+(defun lsp-clojure--get-metadata-location (file-location)
+  "Given a FILE-LOCATION return the file containing the metadata for the file."
+  (format "%s.%s.metadata"
+          (file-name-directory file-location)
+          (file-name-base file-location)))
+
+(defun lsp-clojure--file-in-jar (uri)
+  "Check URI for a valid jar and include it in workspace."
+  (string-match "^\\(jar\\|zip\\):\\(file:.+\\)!/\\(.+\\)" uri)
+  (let* ((ns-path (match-string 3 uri))
+         (ns (s-replace "/" "." ns-path))
+         (file-location (concat lsp-clojure-workspace-cache-dir ns)))
+    (unless (file-readable-p file-location)
+      (lsp-clojure--ensure-dir (file-name-directory file-location))
+      (with-lsp-workspace (lsp-find-workspace 'clojure-lsp nil)
+        (let ((content (lsp-send-request (lsp-make-request "clojure/dependencyContents" (list :uri uri)))))
+          (with-temp-file file-location
+            (insert content))
+          (with-temp-file (lsp-clojure--get-metadata-location file-location)
+            (insert uri)))))
+    file-location))
+
+(defun lsp-clojure--server-executable-path ()
+  "Return the clojure-lsp server command."
+  (or (executable-find "clojure-lsp")
+      (lsp-package-path 'clojure-lsp)))
+
+(lsp-defun lsp-clojure--show-references ((&Command :arguments? args))
+  "Show references for command with ARGS.
+ARGS is a vector which the first element is the uri, the second the line
+and the third the column."
+  (lsp-show-xrefs
+   (lsp--locations-to-xref-items
+    (lsp-request "textDocument/references"
+                 (lsp--make-reference-params
+                  (lsp--text-document-position-params
+                   (list :uri (seq-elt args 0))
+                   (list :line (1- (seq-elt args 1))
+                         :character (1- (seq-elt args 2)))))))
+   t
+   t))
+
+(defvar-local lsp-clojure--test-tree-data nil)
+(defconst lsp-clojure--test-tree-buffer-name "*Clojure Test Tree*")
+
+(defvar treemacs-position)
+(defvar treemacs-width)
+(declare-function lsp-treemacs-render "ext:lsp-treemacs" (tree title expand-depth &optional buffer-name))
+(declare-function lsp-treemacs--open-file-in-mru "ext:lsp-treemacs" (file))
+
+(defun lsp-clojure--test-tree-ret-action (uri range)
+  "Build the ret action for an item in the test tree view.
+URI is the source of the item.
+RANGE is the range of positions to where this item should point."
+  (interactive)
+  (lsp-treemacs--open-file-in-mru (lsp--uri-to-path uri))
+  (goto-char (lsp--position-to-point (lsp:range-start range)))
+  (run-hooks 'xref-after-jump-hook))
+
+(lsp-defun lsp-clojure--test-tree-data->tree (uri (&clojure-lsp:TestTreeNode :name :range :kind :children?))
+  "Builds a test tree.
+URI is the source of the test tree.
+NODE is the node with all test children data."
+  (-let* ((icon (cl-case kind
+                  (1 'namespace)
+                  (2 'method)
+                  (3 'field)))
+          (base-tree (list :key name
+                           :label name
+                           :icon icon
+                           :ret-action (lambda (&rest _) (lsp-clojure--test-tree-ret-action uri range))
+                           :uri uri)))
+    (if (seq-empty-p children?)
+        base-tree
+      base-tree
+      (plist-put base-tree :children (seq-map (-partial #'lsp-clojure--test-tree-data->tree uri) children?)))))
+
+(lsp-defun lsp-clojure--render-test-tree ((&clojure-lsp:TestTreeParams :uri :tree))
+  "Render a test tree view for current test tree buffer data."
+  (save-excursion
+    (lsp-treemacs-render
+     (list (lsp-clojure--test-tree-data->tree uri tree))
+     "Clojure Test Tree"
+     t
+     lsp-clojure--test-tree-buffer-name)))
+
+(defun lsp-clojure--show-test-tree (ignore-focus?)
+  "Show a test tree for current buffer.
+Focus on it if IGNORE-FOCUS? is nil."
+  (if lsp-clojure--test-tree-data
+      (-let* ((tree-buffer (lsp-clojure--render-test-tree lsp-clojure--test-tree-data))
+              (position-params (or lsp-clojure-test-tree-position-params
+                                   `((side . ,treemacs-position)
+                                     (slot . 2)
+                                     (window-width . ,treemacs-width))))
+              (window (display-buffer-in-side-window tree-buffer position-params)))
+        (unless ignore-focus?
+          (select-window window)
+          (set-window-dedicated-p window t)))
+    (unless ignore-focus?
+      (lsp-log "No Clojure test tree data found."))))
+
+(lsp-defun lsp-clojure--handle-test-tree (_workspace (notification &as &clojure-lsp:TestTreeParams :uri))
+  "Test tree notification handler for workspace WORKSPACE.
+NOTIFICATION is the test tree notification data received from server.
+It updates the test tree view data."
+  (when (require 'lsp-treemacs nil t)
+    (when-let (buffer (find-buffer-visiting (lsp--uri-to-path uri)))
+      (with-current-buffer buffer
+        (setq lsp-clojure--test-tree-data notification)
+        (when (get-buffer-window lsp-clojure--test-tree-buffer-name)
+          (lsp-clojure--show-test-tree t))))))
+
+;;;###autoload
+(defun lsp-clojure-show-test-tree (ignore-focus?)
+  "Show a test tree and focus on it if IGNORE-FOCUS? is nil."
+  (interactive "P")
+  (if (require 'lsp-treemacs nil t)
+      (lsp-clojure--show-test-tree ignore-focus?)
+    (error "The package lsp-treemacs is not installed")))
+
+(lsp-register-client
+ (make-lsp-client
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'clojure-lsp callback error-callback))
+  :semantic-tokens-faces-overrides '(:types (("macro" . font-lock-keyword-face)
+                                             ("keyword" . clojure-keyword-face)
+                                             ("event" . default)))
+  :new-connection (lsp-stdio-connection
+                   (lambda ()
+                     (or lsp-clojure-custom-server-command
+                         `(,(lsp-clojure--server-executable-path))))
+                   (lambda ()
+                     (or lsp-clojure-custom-server-command
+                         (lsp-clojure--server-executable-path))))
+  :major-modes '(clojure-mode clojurec-mode clojurescript-mode)
+  :library-folders-fn (lambda (_workspace) (list lsp-clojure-workspace-cache-dir))
+  :uri-handlers (lsp-ht ("jar" #'lsp-clojure--file-in-jar))
+  :action-handlers (lsp-ht ("code-lens-references" #'lsp-clojure--show-references))
+  :notification-handlers (lsp-ht ("clojure/textDocument/testTree" #'lsp-clojure--handle-test-tree))
+  :initialization-options '(:dependency-scheme "jar"
+                            :show-docs-arity-on-same-line? t)
+  :custom-capabilities `((experimental . ((testTree . ,(and (require 'lsp-treemacs nil t) t)))))
+  :server-id 'clojure-lsp))
+
+(lsp-consistency-check lsp-clojure)
+
+;; Cider integration
+
+(defun lsp-clojure-semantic-tokens-refresh (&rest _)
+  "Force refresh semantic tokens."
+  (when (and lsp-semantic-tokens-enable
+             (lsp-find-workspace 'clojure-lsp (buffer-file-name)))
+    (lsp-semantic-tokens--enable)))
+
+(with-eval-after-load 'cider
+  (when lsp-semantic-tokens-enable
+    ;; refresh tokens as cider flush font-faces after disconnected
+    (add-hook 'cider-mode-hook #'lsp-clojure-semantic-tokens-refresh)))
+
+(provide 'lsp-clojure)
+;;; lsp-clojure.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-cmake.el b/elpa/lsp-mode-20220201.852/lsp-cmake.el
new file mode 100644 (file)
index 0000000..beffa5d
--- /dev/null
@@ -0,0 +1,43 @@
+;;; lsp-cmake.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, cmake
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the CMake build tool.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-cmake nil
+  "LSP support for CMake, using cmake-language-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/regen100/cmake-language-server"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection "cmake-language-server")
+                  :major-modes '(cmake-mode)
+                  :priority -1
+                  :server-id 'cmakels))
+
+(lsp-consistency-check lsp-cmake)
+
+(provide 'lsp-cmake)
+;;; lsp-cmake.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-completion.el b/elpa/lsp-mode-20220201.852/lsp-completion.el
new file mode 100644 (file)
index 0000000..2f47dd8
--- /dev/null
@@ -0,0 +1,809 @@
+;;; lsp-completion.el --- LSP completion -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;;  LSP completion
+;;
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-completion nil
+  "LSP support for completion"
+  :prefix "lsp-completion-"
+  :group 'lsp-mode
+  :tag "LSP Completion")
+
+;;;###autoload
+(define-obsolete-variable-alias 'lsp-prefer-capf
+  'lsp-completion-provider  "lsp-mode 7.0.1")
+
+(defcustom lsp-completion-provider :capf
+  "The completion backend provider."
+  :type '(choice
+          (const :tag "Use company-capf" :capf)
+          (const :tag "None" :none))
+  :group 'lsp-completion
+  :package-version '(lsp-mode . "7.0.1"))
+
+;;;###autoload
+(define-obsolete-variable-alias 'lsp-enable-completion-at-point
+  'lsp-completion-enable "lsp-mode 7.0.1")
+
+(defcustom lsp-completion-enable t
+  "Enable `completion-at-point' integration."
+  :type 'boolean
+  :group 'lsp-completion)
+
+(defcustom lsp-completion-enable-additional-text-edit t
+  "Whether or not to apply additional text edit when performing completion.
+
+If set to non-nil, `lsp-mode' will apply additional text edits
+from the server.  Otherwise, the additional text edits are
+ignored."
+  :type 'boolean
+  :group 'lsp-completion
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-completion-show-kind t
+  "Whether or not to show kind of completion candidates."
+  :type 'boolean
+  :group 'lsp-completion
+  :package-version '(lsp-mode . "7.0.1"))
+
+(defcustom lsp-completion-show-detail t
+  "Whether or not to show detail of completion candidates."
+  :type 'boolean
+  :group 'lsp-completion)
+
+(defcustom lsp-completion-no-cache nil
+  "Whether or not caching the returned completions from server."
+  :type 'boolean
+  :group 'lsp-completion
+  :package-version '(lsp-mode . "7.0.1"))
+
+(defcustom lsp-completion-filter-on-incomplete t
+  "Whether or not filter incomplete results."
+  :type 'boolean
+  :group 'lsp-completion
+  :package-version '(lsp-mode . "7.0.1"))
+
+(defcustom lsp-completion-sort-initial-results t
+  "Whether or not filter initial results from server."
+  :type 'boolean
+  :group 'lsp-completion
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-completion-use-last-result t
+  "Temporarily use last server result when interrupted by keyboard.
+This will help minimize popup flickering issue in `company-mode'."
+  :type 'boolean
+  :group 'lsp-completion
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defconst lsp-completion--item-kind
+  [nil
+   "Text"
+   "Method"
+   "Function"
+   "Constructor"
+   "Field"
+   "Variable"
+   "Class"
+   "Interface"
+   "Module"
+   "Property"
+   "Unit"
+   "Value"
+   "Enum"
+   "Keyword"
+   "Snippet"
+   "Color"
+   "File"
+   "Reference"
+   "Folder"
+   "EnumMember"
+   "Constant"
+   "Struct"
+   "Event"
+   "Operator"
+   "TypeParameter"])
+
+(defvar yas-indent-line)
+(defvar company-backends)
+(defvar company-abort-on-unique-match)
+
+(defvar lsp-completion--no-reordering nil
+  "Dont do client-side reordering completion items when set.")
+
+(declare-function company-mode "ext:company")
+(declare-function yas-expand-snippet "ext:yasnippet")
+
+(defun lsp-doc-buffer (&optional string)
+  (with-current-buffer (get-buffer-create "*lsp-documentation*")
+    (erase-buffer)
+    (fundamental-mode)
+    (when string
+      (save-excursion
+        (insert string)
+        (visual-line-mode)))
+    (current-buffer)))
+
+(defun lsp-falsy? (val)
+  "Non-nil if VAL is falsy."
+  ;; https://developer.mozilla.org/en-US/docs/Glossary/Falsy
+  (or (not val) (equal val "") (equal val 0)))
+
+(cl-defun lsp-completion--make-item (item &key markers prefix)
+  "Make completion item from lsp ITEM and with MARKERS and PREFIX."
+  (-let (((&CompletionItem :label
+                           :sort-text?
+                           :_emacsStartPoint start-point)
+          item))
+    (propertize label
+                'lsp-completion-item item
+                'lsp-sort-text sort-text?
+                'lsp-completion-start-point start-point
+                'lsp-completion-markers markers
+                'lsp-completion-prefix prefix)))
+
+(defun lsp-completion--annotate (item)
+  "Annotate ITEM detail."
+  (-let (((&CompletionItem :detail? :kind?) (plist-get (text-properties-at 0 item)
+                                                       'lsp-completion-item)))
+    (concat (when (and lsp-completion-show-detail detail?)
+              (concat " " (s-replace "\r" "" detail?)))
+            (when lsp-completion-show-kind
+              (when-let ((kind-name (and kind? (aref lsp-completion--item-kind kind?))))
+                (format " (%s)" kind-name))))))
+
+(defun lsp-completion--looking-back-trigger-characterp (trigger-characters)
+  "Return trigger character if text before point match any of the TRIGGER-CHARACTERS."
+  (unless (= (point) (point-at-bol))
+    (seq-some
+     (lambda (trigger-char)
+       (and (equal (buffer-substring-no-properties (- (point) (length trigger-char)) (point))
+                   trigger-char)
+            trigger-char))
+     trigger-characters)))
+
+(defvar lsp-completion--cache nil
+  "Cached candidates for completion at point function.
+In the form of plist (prefix-pos items :lsp-items :prefix ...).
+When the completion is incomplete, `items' contains value of :incomplete.")
+
+(defvar lsp-completion--last-result nil
+  "Last completion result.")
+
+(defun lsp-completion--clear-cache (&optional keep-last-result)
+  "Clear completion caches.
+KEEP-LAST-RESULT if specified."
+  (-some-> lsp-completion--cache
+    (cddr)
+    (plist-get :markers)
+    (cl-second)
+    (set-marker nil))
+  (setq lsp-completion--cache nil)
+  (unless keep-last-result (setq lsp-completion--last-result nil)))
+
+(defcustom lsp-completion-default-behaviour :replace
+  "Default behaviour of `InsertReplaceEdit'."
+  :type '(choice
+          (const :insert :tag "Default completion inserts")
+          (const :replace :tag "Default completion replaces"))
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-defun lsp-completion--guess-prefix ((item &as &CompletionItem :text-edit?))
+  "Guess ITEM's prefix start point according to following heuristics:
+- If `textEdit' exists, use insertion range start as prefix start point.
+- Else, find the point before current point is longest prefix match of
+`insertText' or `label'. And:
+  - The character before prefix is not word constitute
+Return `nil' when fails to guess prefix."
+  (cond
+   ((lsp-insert-replace-edit? text-edit?)
+    (lsp--position-to-point (lsp:range-start (lsp:insert-replace-edit-insert text-edit?))))
+   (text-edit?
+    (lsp--position-to-point (lsp:range-start (lsp:text-edit-range text-edit?))))
+   (t
+    (-let* (((&CompletionItem :label :insert-text?) item)
+            (text (or (unless (lsp-falsy? insert-text?) insert-text?) label))
+            (point (point))
+            (start (max 1 (- point (length text))))
+            (char-before (char-before start))
+            start-point)
+      (while (and (< start point) (not start-point))
+        (unless (or (and char-before (equal (char-syntax char-before) ?w))
+                    (not (string-prefix-p (buffer-substring-no-properties start point)
+                                          text)))
+          (setq start-point start))
+        (cl-incf start)
+        (setq char-before (char-before start)))
+      start-point))))
+
+(defun lsp-completion--to-internal (items)
+  "Convert ITEMS into internal form."
+  (--> items
+    (-map (-lambda ((item &as &CompletionItem
+                          :label
+                          :filter-text?
+                          :_emacsStartPoint start-point
+                          :score?))
+            `( :label ,(or (unless (lsp-falsy? filter-text?) filter-text?) label)
+               :item ,item
+               :start-point ,start-point
+               :score ,score?))
+          it)))
+
+(cl-defun lsp-completion--filter-candidates (items &key
+                                                   lsp-items
+                                                   markers
+                                                   prefix
+                                                   &allow-other-keys)
+  "List all possible completions in cached ITEMS with their prefixes.
+We can pass LSP-ITEMS, which will be used when there's no cache.
+The MARKERS and PREFIX value will be attached to each candidate."
+  (lsp--while-no-input
+    (->>
+     (if items
+         (-->
+             (let (queries fuz-queries)
+               (-keep (-lambda ((cand &as &plist :label :start-point :score))
+                        (let* ((query (or (plist-get queries start-point)
+                                          (let ((s (buffer-substring-no-properties
+                                                    start-point (point))))
+                                            (setq queries (plist-put queries start-point s))
+                                            s)))
+                               (fuz-query (or (plist-get fuz-queries start-point)
+                                              (let ((s (lsp-completion--regex-fuz query)))
+                                                (setq fuz-queries
+                                                      (plist-put fuz-queries start-point s))
+                                                s)))
+                               (label-len (length label)))
+                          (when (string-match fuz-query label)
+                            (put-text-property 0 label-len 'match-data (match-data) label)
+                            (plist-put cand
+                                       :sort-score
+                                       (* (or (lsp-completion--fuz-score query label) 1e-05)
+                                          (or score 0.001)))
+                            cand)))
+                      items))
+           (if lsp-completion--no-reordering
+               it
+             (sort it (lambda (o1 o2)
+                        (> (plist-get o1 :sort-score)
+                           (plist-get o2 :sort-score)))))
+           ;; TODO: pass additional function to sort the candidates
+           (-map (-rpartial #'plist-get :item) it))
+       lsp-items)
+     (-map (lambda (item) (lsp-completion--make-item item
+                                                     :markers markers
+                                                     :prefix prefix))))))
+
+(defconst lsp-completion--kind->symbol
+  '((1 . text)
+    (2 . method)
+    (3 . function)
+    (4 . constructor)
+    (5 . field)
+    (6 . variable)
+    (7 . class)
+    (8 . interface)
+    (9 . module)
+    (10 . property)
+    (11 . unit)
+    (12 . value)
+    (13 . enum)
+    (14 . keyword)
+    (15 . snippet)
+    (16 . color)
+    (17 . file)
+    (18 . reference)
+    (19 . folder)
+    (20 . enum-member)
+    (21 . constant)
+    (22 . struct)
+    (23 . event)
+    (24 . operator)
+    (25 . type-parameter)))
+
+(defun lsp-completion--candidate-kind (item)
+  "Return ITEM's kind."
+  (alist-get (lsp:completion-item-kind? (get-text-property 0 'lsp-completion-item item))
+             lsp-completion--kind->symbol))
+
+(defun lsp-completion--candidate-deprecated (item)
+  "Return if ITEM is deprecated."
+  (let ((completion-item (get-text-property 0 'lsp-completion-item item)))
+    (or (lsp:completion-item-deprecated? completion-item)
+        (seq-position (lsp:completion-item-tags? completion-item)
+                      lsp/completion-item-tag-deprecated))))
+
+(defun lsp-completion--company-match (candidate)
+  "Return highlight of typed prefix inside CANDIDATE."
+  (let* ((prefix (downcase
+                  (buffer-substring-no-properties
+                   (plist-get (text-properties-at 0 candidate) 'lsp-completion-start-point)
+                   (point))))
+         (prefix-len (length prefix))
+         (prefix-pos 0)
+         (label (downcase candidate))
+         (label-len (length label))
+         (label-pos 0)
+         matches start)
+    (while (and (not matches)
+                (< prefix-pos prefix-len))
+      (while (and (< prefix-pos prefix-len)
+                  (< label-pos label-len))
+        (if (equal (aref prefix prefix-pos) (aref label label-pos))
+            (progn
+              (unless start (setq start label-pos))
+              (cl-incf prefix-pos))
+          (when start
+            (setq matches (nconc matches `((,start . ,label-pos))))
+            (setq start nil)))
+        (cl-incf label-pos))
+      (when start (setq matches (nconc matches `((,start . ,label-pos)))))
+      ;; Search again when the whole prefix is not matched
+      (when (< prefix-pos prefix-len)
+        (setq matches nil))
+      ;; Start search from next offset of prefix to find a match with label
+      (unless matches
+        (cl-incf prefix-pos)
+        (setq label-pos 0)))
+    matches))
+
+(defun lsp-completion--get-documentation (item)
+  "Get doc comment for completion ITEM."
+  (unless (get-text-property 0 'lsp-completion-resolved item)
+    (let ((resolved-item
+           (-some->> item
+             (get-text-property 0 'lsp-completion-item)
+             (lsp-completion--resolve)))
+          (len (length item)))
+      (put-text-property 0 len 'lsp-completion-item resolved-item item)
+      (put-text-property 0 len 'lsp-completion-resolved t item)))
+  (-some->> item
+    (get-text-property 0 'lsp-completion-item)
+    (lsp:completion-item-documentation?)
+    (lsp--render-element)))
+
+(defun lsp-completion--get-context (trigger-characters)
+  "Get completion context with provided TRIGGER-CHARACTERS."
+  (let* ((triggered-by-char non-essential)
+         (trigger-char (when triggered-by-char
+                         (lsp-completion--looking-back-trigger-characterp
+                          trigger-characters)))
+         (trigger-kind (cond
+                        (trigger-char
+                         lsp/completion-trigger-kind-trigger-character)
+                        ((equal (cl-second lsp-completion--cache) :incomplete)
+                         lsp/completion-trigger-kind-trigger-for-incomplete-completions)
+                        (t lsp/completion-trigger-kind-invoked))))
+    (apply #'lsp-make-completion-context
+           (nconc
+            `(:trigger-kind ,trigger-kind)
+            (when trigger-char
+              `(:trigger-character? ,trigger-char))))))
+
+(defun lsp-completion--sort-completions (completions)
+  "Sort COMPLETIONS."
+  (sort
+   completions
+   (-lambda ((&CompletionItem :sort-text? sort-text-left :label label-left)
+             (&CompletionItem :sort-text? sort-text-right :label label-right))
+     (if (equal sort-text-left sort-text-right)
+         (string-lessp label-left label-right)
+       (string-lessp sort-text-left sort-text-right)))))
+
+;;;###autoload
+(defun lsp-completion-at-point ()
+  "Get lsp completions."
+  (when (or (--some (lsp--client-completion-in-comments? (lsp--workspace-client it))
+                    (lsp-workspaces))
+            (not (nth 4 (syntax-ppss))))
+    (let* ((trigger-chars (->> (lsp--server-capabilities)
+                               (lsp:server-capabilities-completion-provider?)
+                               (lsp:completion-options-trigger-characters?)))
+           (bounds-start (or (-some--> (cl-first (bounds-of-thing-at-point 'symbol))
+                               (save-excursion
+                                 (ignore-errors
+                                   (goto-char (+ it 1))
+                                   (while (lsp-completion--looking-back-trigger-characterp
+                                           trigger-chars)
+                                     (cl-incf it)
+                                     (forward-char))
+                                   it)))
+                             (point)))
+           result done?
+           (candidates
+            (lambda ()
+              (lsp--catch 'input
+                  (let ((lsp--throw-on-input lsp-completion-use-last-result)
+                        (same-session? (and lsp-completion--cache
+                                            ;; Special case for empty prefix and empty result
+                                            (or (cl-second lsp-completion--cache)
+                                                (not (string-empty-p
+                                                      (plist-get (cddr lsp-completion--cache) :prefix))))
+                                            (equal (cl-first lsp-completion--cache) bounds-start)
+                                            (s-prefix?
+                                             (plist-get (cddr lsp-completion--cache) :prefix)
+                                             (buffer-substring-no-properties bounds-start (point))))))
+                    (cond
+                     ((or done? result) result)
+                     ((and (not lsp-completion-no-cache)
+                           same-session?
+                           (listp (cl-second lsp-completion--cache)))
+                      (setf result (apply #'lsp-completion--filter-candidates
+                                          (cdr lsp-completion--cache))))
+                     (t
+                      (-let* ((resp (lsp-request-while-no-input
+                                     "textDocument/completion"
+                                     (plist-put (lsp--text-document-position-params)
+                                                :context (lsp-completion--get-context trigger-chars))))
+                              (completed (and resp
+                                              (not (and (lsp-completion-list? resp)
+                                                        (lsp:completion-list-is-incomplete resp)))))
+                              (items (lsp--while-no-input
+                                       (--> (cond
+                                             ((lsp-completion-list? resp)
+                                              (lsp:completion-list-items resp))
+                                             (t resp))
+                                         (if (or completed
+                                                 (seq-some #'lsp:completion-item-sort-text? it))
+                                             (lsp-completion--sort-completions it)
+                                           it)
+                                         (-map (lambda (item)
+                                                 (lsp-put item
+                                                          :_emacsStartPoint
+                                                          (or (lsp-completion--guess-prefix item)
+                                                              bounds-start)))
+                                               it))))
+                              (markers (list bounds-start (copy-marker (point) t)))
+                              (prefix (buffer-substring-no-properties bounds-start (point)))
+                              (lsp-completion--no-reordering (not lsp-completion-sort-initial-results)))
+                        (lsp-completion--clear-cache same-session?)
+                        (setf done? completed
+                              lsp-completion--cache (list bounds-start
+                                                          (cond
+                                                           ((and done? (not (seq-empty-p items)))
+                                                            (lsp-completion--to-internal items))
+                                                           ((not done?) :incomplete))
+                                                          :lsp-items nil
+                                                          :markers markers
+                                                          :prefix prefix)
+                              result (lsp-completion--filter-candidates
+                                      (cond (done?
+                                             (cl-second lsp-completion--cache))
+                                            (lsp-completion-filter-on-incomplete
+                                             (lsp-completion--to-internal items)))
+                                      :lsp-items items
+                                      :markers markers
+                                      :prefix prefix))))))
+                (:interrupted lsp-completion--last-result)
+                (`,res (setq lsp-completion--last-result res))))))
+      (list
+       bounds-start
+       (point)
+       (lambda (probe pred action)
+         (cond
+          ;; metadata
+          ((equal action 'metadata)
+           `(metadata (category . lsp-capf)
+                      (display-sort-function . identity)
+                      (cycle-sort-function . identity)))
+          ;; boundaries
+          ((equal (car-safe action) 'boundaries) nil)
+          ;; try-completion
+          ((null action)
+           (when-let ((cands (funcall candidates)))
+             (if (cl-rest cands) probe (cl-first cands))))
+          ;; test-completion: not return exact match so that the selection will
+          ;; always be shown
+          ((equal action 'lambda) nil)
+          ;; retrieve candidates
+          ((equal action t)
+           (all-completions probe (funcall candidates) pred))))
+       :annotation-function #'lsp-completion--annotate
+       :company-kind #'lsp-completion--candidate-kind
+       :company-deprecated #'lsp-completion--candidate-deprecated
+       :company-require-match 'never
+       :company-prefix-length
+       (save-excursion
+         (goto-char bounds-start)
+         (and (lsp-completion--looking-back-trigger-characterp trigger-chars) t))
+       :company-match #'lsp-completion--company-match
+       :company-doc-buffer (-compose #'lsp-doc-buffer
+                                     #'lsp-completion--get-documentation)
+       :exit-function
+       (-rpartial #'lsp-completion--exit-fn candidates)))))
+
+(defun lsp-completion--exit-fn (candidate _status &optional candidates)
+  "Exit function of `completion-at-point'.
+CANDIDATE is the selected completion item.
+Others: CANDIDATES"
+  (unwind-protect
+      (-let* ((candidate (if (plist-member (text-properties-at 0 candidate)
+                                           'lsp-completion-item)
+                             candidate
+                           (cl-find candidate (funcall candidates) :test #'equal)))
+              ((&plist 'lsp-completion-item item
+                       'lsp-completion-start-point start-point
+                       'lsp-completion-markers markers
+                       'lsp-completion-prefix prefix)
+               (text-properties-at 0 candidate))
+              ((&CompletionItem? :label :insert-text? :text-edit? :insert-text-format?
+                                 :additional-text-edits? :insert-text-mode? :command?)
+               item))
+        (cond
+         (text-edit?
+          (apply #'delete-region markers)
+          (insert prefix)
+          (pcase text-edit?
+            ((TextEdit) (lsp--apply-text-edit text-edit?))
+            ((InsertReplaceEdit :insert :replace :new-text)
+             (lsp--apply-text-edit
+              (lsp-make-text-edit
+               :new-text new-text
+               :range (if (or (and current-prefix-arg (eq lsp-completion-default-behaviour :replace))
+                              (and (not current-prefix-arg) (eq lsp-completion-default-behaviour :insert)))
+                          insert
+                        replace))))))
+         ((or (unless (lsp-falsy? insert-text?) insert-text?) label)
+          (apply #'delete-region markers)
+          (insert prefix)
+          (delete-region start-point (point))
+          (insert (or (unless (lsp-falsy? insert-text?) insert-text?) label))))
+
+        (lsp--indent-lines start-point (point) insert-text-mode?)
+        (when (equal insert-text-format? lsp/insert-text-format-snippet)
+          (lsp--expand-snippet (buffer-substring start-point (point))
+                               start-point
+                               (point)))
+
+        (when lsp-completion-enable-additional-text-edit
+          (if (or (get-text-property 0 'lsp-completion-resolved candidate)
+                  (not (seq-empty-p additional-text-edits?)))
+              (lsp--apply-text-edits additional-text-edits? 'completion)
+            (-let [(callback cleanup-fn) (lsp--create-apply-text-edits-handlers)]
+              (lsp-completion--resolve-async
+               item
+               (-compose callback #'lsp:completion-item-additional-text-edits?)
+               cleanup-fn))))
+
+        (if (or (get-text-property 0 'lsp-completion-resolved candidate)
+                command?)
+            (when command? (lsp--execute-command command?))
+          (lsp-completion--resolve-async
+           item
+           (-lambda ((&CompletionItem? :command?))
+             (when command? (lsp--execute-command command?)))))
+
+        (when (and (or
+                    (equal lsp-signature-auto-activate t)
+                    (memq :after-completion lsp-signature-auto-activate)
+                    (and (memq :on-trigger-char lsp-signature-auto-activate)
+                         (-when-let ((&SignatureHelpOptions? :trigger-characters?)
+                                     (lsp--capability :signatureHelpProvider))
+                           (lsp-completion--looking-back-trigger-characterp
+                            trigger-characters?))))
+                   (lsp-feature? "textDocument/signatureHelp"))
+          (lsp-signature-activate))
+
+        (setq-local lsp-inhibit-lsp-hooks nil))
+    (lsp-completion--clear-cache)))
+
+(defun lsp-completion--regex-fuz (str)
+  "Build a regex sequence from STR.  Insert .* between each char."
+  (apply #'concat
+         (cl-mapcar
+          #'concat
+          (cons "" (cdr (seq-map (lambda (c) (format "[^%c]*" c)) str)))
+          (seq-map (lambda (c)
+                     (format "\\(%s\\)" (regexp-quote (char-to-string c))))
+                   str))))
+
+(defun lsp-completion--fuz-score (query str)
+  "Calculate fuzzy score for STR with query QUERY.
+The return is nil or in range of (0, inf)."
+  (-when-let* ((md (cddr (or (get-text-property 0 'match-data str)
+                             (let ((re (lsp-completion--regex-fuz query)))
+                               (when (string-match re str)
+                                 (match-data))))))
+               (start (pop md))
+               (len (length str))
+               ;; To understand how this works, consider these bad ascii(tm)
+               ;; diagrams showing how the pattern "foo" flex-matches
+               ;; "fabrobazo", "fbarbazoo" and "barfoobaz":
+
+               ;;      f abr o baz o
+               ;;      + --- + --- +
+
+               ;;      f barbaz oo
+               ;;      + ------ ++
+
+               ;;      bar foo baz
+               ;;      --- +++ ---
+
+               ;; "+" indicates parts where the pattern matched.  A "hole" in
+               ;; the middle of the string is indicated by "-".  Note that there
+               ;; are no "holes" near the edges of the string.  The completion
+               ;; score is a number bound by ]0..1]: the higher the better and
+               ;; only a perfect match (pattern equals string) will have score
+               ;; 1.  The formula takes the form of a quotient.  For the
+               ;; numerator, we use the number of +, i.e. the length of the
+               ;; pattern.  For the denominator, it first computes
+               ;;
+               ;;     hole_i_contrib = 1 + (Li-1)^1.05 for first hole
+               ;;     hole_i_contrib = 1 + (Li-1)^0.25 for hole i of length Li
+               ;;
+               ;; The final value for the denominator is then given by:
+               ;;
+               ;;    (SUM_across_i(hole_i_contrib) + 1)
+               ;;
+               (score-numerator 0)
+               (score-denominator 0)
+               (last-b -1)
+               (q-ind 0)
+               (update-score
+                (lambda (a b)
+                  "Update score variables given match range (A B)."
+                  (setq score-numerator (+ score-numerator (- b a)))
+                  (unless (= a len)
+                    ;; case mis-match will be pushed to near next rank
+                    (unless (equal (aref query q-ind) (aref str a))
+                      (cl-incf a 0.9))
+                    (setq score-denominator
+                          (+ score-denominator
+                             (if (= a last-b) 0
+                               (+ 1 (* (if (< 0 (- a last-b 1)) 1 -1)
+                                       (expt (abs (- a last-b 1))
+                                             ;; Give a higher score for match near start
+                                             (if (eq last-b -1) 0.75 0.25))))))))
+                  (setq last-b b))))
+    (while md
+      (funcall update-score start (cl-first md))
+      ;; Due to the way completion regex is constructed, `(eq end (+ start 1))`
+      (cl-incf q-ind)
+      (pop md)
+      (setq start (pop md)))
+    (unless (zerop len)
+      (/ score-numerator (1+ score-denominator) 1.0))))
+
+(defun lsp-completion--fix-resolve-data (item)
+  ;; patch `CompletionItem' for rust-analyzer otherwise resolve will fail
+  ;; see #2675
+  (let ((data (lsp:completion-item-data? item)))
+    (when (lsp-member? data :import_for_trait_assoc_item)
+      (unless (lsp-get data :import_for_trait_assoc_item)
+        (lsp-put data :import_for_trait_assoc_item :json-false)))))
+
+(defun lsp-completion--resolve (item)
+  "Resolve completion ITEM."
+  (cl-assert item nil "Completion item must not be nil")
+  (lsp-completion--fix-resolve-data item)
+  (or (ignore-errors
+        (when (lsp-feature? "completionItem/resolve")
+          (lsp-request "completionItem/resolve" item)))
+      item))
+
+(defun lsp-completion--resolve-async (item callback &optional cleanup-fn)
+  "Resolve completion ITEM asynchronously with CALLBACK.
+The CLEANUP-FN will be called to cleanup."
+  (cl-assert item nil "Completion item must not be nil")
+  (lsp-completion--fix-resolve-data item)
+  (ignore-errors
+    (if (lsp-feature? "completionItem/resolve")
+        (lsp-request-async "completionItem/resolve" item
+                           (lambda (result)
+                             (funcall callback result)
+                             (when cleanup-fn (funcall cleanup-fn)))
+                           :error-handler (lambda (err)
+                                            (when cleanup-fn (funcall cleanup-fn))
+                                            (error (lsp:json-error-message err)))
+                           :cancel-handler cleanup-fn
+                           :mode 'alive)
+      (funcall callback item)
+      (when cleanup-fn (funcall cleanup-fn)))))
+
+
+;;;###autoload
+(defun lsp-completion--enable ()
+  "Enable LSP completion support."
+  (when (and lsp-completion-enable
+             (lsp-feature? "textDocument/completion"))
+    (lsp-completion-mode 1)))
+
+(defun lsp-completion--disable ()
+  "Disable LSP completion support."
+  (lsp-completion-mode -1))
+
+(defun lsp-completion-passthrough-all-completions (_string table pred _point)
+  "Like `completion-basic-all-completions' but have prefix ignored."
+  (completion-basic-all-completions "" table pred 0))
+
+;;;###autoload
+(define-minor-mode lsp-completion-mode
+  "Toggle LSP completion support."
+  :group 'lsp-completion
+  :global nil
+  :lighter ""
+  (let ((completion-started-fn (lambda (&rest _)
+                                 (setq-local lsp-inhibit-lsp-hooks t)))
+        (after-completion-fn (lambda (result)
+                               (when (stringp result)
+                                 (lsp-completion--clear-cache))
+                               (setq-local lsp-inhibit-lsp-hooks nil))))
+    (cond
+     (lsp-completion-mode
+      (setq-local completion-at-point-functions nil)
+      (add-hook 'completion-at-point-functions #'lsp-completion-at-point nil t)
+      (make-local-variable 'completion-category-defaults)
+      (setf (alist-get 'lsp-capf completion-category-defaults) '((styles . (lsp-passthrough))))
+      (make-local-variable 'completion-styles-alist)
+      (setf (alist-get 'lsp-passthrough completion-styles-alist)
+            '(completion-basic-try-completion
+              lsp-completion-passthrough-all-completions
+              "Passthrough completion."))
+
+      (cond
+       ((equal lsp-completion-provider :none))
+       ((and (not (equal lsp-completion-provider :none))
+             (fboundp 'company-mode))
+        (setq-local company-abort-on-unique-match nil)
+        (company-mode 1)
+        (setq-local company-backends (cl-adjoin 'company-capf company-backends :test #'equal)))
+       (t
+        (lsp--warn "Unable to autoconfigure company-mode.")))
+
+      (when (bound-and-true-p company-mode)
+        (add-hook 'company-completion-started-hook
+                  completion-started-fn
+                  nil
+                  t)
+        (add-hook 'company-after-completion-hook
+                  after-completion-fn
+                  nil
+                  t))
+      (add-hook 'lsp-unconfigure-hook #'lsp-completion--disable nil t))
+     (t
+      (remove-hook 'completion-at-point-functions #'lsp-completion-at-point t)
+      (setq-local completion-category-defaults
+                  (cl-remove 'lsp-capf completion-category-defaults :key #'cl-first))
+      (setq-local completion-styles-alist
+                  (cl-remove 'lsp-passthrough completion-styles-alist :key #'cl-first))
+      (remove-hook 'lsp-unconfigure-hook #'lsp-completion--disable t)
+      (when (featurep 'company)
+        (remove-hook 'company-completion-started-hook
+                     completion-started-fn
+                     t)
+        (remove-hook 'company-after-completion-hook
+                     after-completion-fn
+                     t))))))
+
+;;;###autoload
+(add-hook 'lsp-configure-hook (lambda ()
+                                (when (and lsp-auto-configure
+                                           lsp-completion-enable)
+                                  (lsp-completion--enable))))
+
+(lsp-consistency-check lsp-completion)
+
+(provide 'lsp-completion)
+;;; lsp-completion.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-crystal.el b/elpa/lsp-mode-20220201.852/lsp-crystal.el
new file mode 100644 (file)
index 0000000..f0aca59
--- /dev/null
@@ -0,0 +1,48 @@
+;;; lsp-crystal.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, crystal
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Crystal Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-scry nil
+  "LSP support for Crystal via scry."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/crystal-lang-tools/scry"))
+
+(defcustom lsp-clients-crystal-executable '("scry" "--stdio")
+  "Command to start the scry language server."
+  :group 'lsp-scry
+  :risky t
+  :type 'file)
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-crystal-executable)
+                  :major-modes '(crystal-mode)
+                  :server-id 'scry))
+
+(lsp-consistency-check lsp-crystal)
+
+(provide 'lsp-crystal)
+;;; lsp-crystal.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-csharp.el b/elpa/lsp-mode-20220201.852/lsp-csharp.el
new file mode 100644 (file)
index 0000000..4658fd4
--- /dev/null
@@ -0,0 +1,443 @@
+;;; lsp-csharp.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Jostein Kjønigsen, Saulius Menkevicius
+
+;; Author: Saulius Menkevicius <saulius.menkeviciusNOSPAMfastmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-csharp client
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'gnutls)
+(require 'f)
+
+(defgroup lsp-csharp nil
+  "LSP support for C#, using the Omnisharp Language Server.
+Version 1.34.3 minimum is required."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/OmniSharp/omnisharp-roslyn"))
+
+(defgroup lsp-csharp-omnisharp nil
+  "LSP support for C#, using the Omnisharp Language Server.
+Version 1.34.3 minimum is required."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/OmniSharp/omnisharp-roslyn")
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-csharp-server-install-dir
+  (f-join lsp-server-install-dir "omnisharp-roslyn/")
+  "Installation directory for OmniSharp Roslyn server."
+  :group 'lsp-csharp-omnisharp
+  :type 'directory)
+
+(defcustom lsp-csharp-server-path
+  nil
+  "The path to the OmniSharp Roslyn language-server binary.
+Set this if you have the binary installed or have it built yourself."
+  :group 'lsp-csharp-omnisharp
+  :type '(string :tag "Single string value or nil"))
+
+(defcustom lsp-csharp-test-run-buffer-name
+  "*lsp-csharp test run*"
+  "The name of buffer used for outputing lsp-csharp test run results."
+  :group 'lsp-csharp-omnisharp
+  :type 'string)
+
+(defcustom lsp-csharp-solution-file
+  nil
+  "Solution to load when starting the server.
+Usually this is to be set in your .dir-locals.el on the project root directory."
+  :group 'lsp-csharp-omnisharp
+  :type 'string)
+
+(defcustom lsp-csharp-omnisharp-roslyn-download-url
+  (concat "https://github.com/omnisharp/omnisharp-roslyn/releases/latest/download/"
+          (cond ((eq system-type 'windows-nt)
+                 ; On Windows we're trying to avoid a crash starting 64bit .NET PE binaries in
+                 ; Emacs by using x86 version of omnisharp-roslyn on older (<= 26.4) versions
+                 ; of Emacs. See https://lists.nongnu.org/archive/html/bug-gnu-emacs/2017-06/msg00893.html"
+                 (if (and (string-match "^x86_64-.*" system-configuration)
+                          (version<= "26.4" emacs-version))
+                     "omnisharp-win-x64.zip"
+                   "omnisharp-win-x86.zip"))
+
+                ((eq system-type 'darwin)
+                 "omnisharp-osx.zip")
+
+                ((and (eq system-type 'gnu/linux)
+                      (or (eq (string-match "^x86_64" system-configuration) 0)
+                          (eq (string-match "^i[3-6]86" system-configuration) 0)))
+                 "omnisharp-linux-x64.zip")
+
+                (t "omnisharp-mono.zip")))
+  "Automatic download url for omnisharp-roslyn."
+  :group 'lsp-csharp-omnisharp
+  :type 'string)
+
+(defcustom lsp-csharp-omnisharp-roslyn-store-path
+  (f-join lsp-csharp-server-install-dir "latest" "omnisharp-roslyn.zip")
+  "The path where omnisharp-roslyn .zip archive will be stored."
+  :group 'lsp-csharp-omnisharp
+  :type 'file)
+
+(defcustom lsp-csharp-omnisharp-roslyn-server-dir
+  (f-join lsp-csharp-server-install-dir "latest" "omnisharp-roslyn")
+  "The path where omnisharp-roslyn .zip archive will be extracted."
+  :group 'lsp-csharp-omnisharp
+  :type 'file)
+
+(lsp-dependency
+ 'omnisharp-roslyn
+ `(:download :url lsp-csharp-omnisharp-roslyn-download-url
+             :store-path lsp-csharp-omnisharp-roslyn-store-path))
+
+(defun lsp-csharp--download-server (_client callback error-callback _update?)
+  "Download zip package for omnisharp-roslyn and install it.
+Will invoke CALLBACK on success, ERROR-CALLBACK on error."
+  (lsp-package-ensure
+   'omnisharp-roslyn
+   (lambda ()
+     (lsp-unzip lsp-csharp-omnisharp-roslyn-store-path
+                lsp-csharp-omnisharp-roslyn-server-dir)
+     (unless (eq system-type 'windows-nt)
+       (let ((run-script (f-join lsp-csharp-omnisharp-roslyn-server-dir "run")))
+         (when (not (f-exists-p run-script))
+           ; create the `run' script when missing (e.g. when server binaries are extracted from omnisharp-mono.zip)
+           ; NOTE: we do not check for presence or version of mono in the system
+           (with-temp-file run-script
+             (insert "#!/bin/bash\n")
+             (insert "BASEDIR=$(dirname \"$0\")\n")
+             (insert "exec mono $BASEDIR/OmniSharp.exe $@\n")))
+         (set-file-modes run-script #o755)))
+     (funcall callback))
+   error-callback))
+
+(defun lsp-csharp--language-server-path ()
+  "Resolve path to use to start the server."
+  (if lsp-csharp-server-path
+      lsp-csharp-server-path
+    (let ((server-dir lsp-csharp-omnisharp-roslyn-server-dir))
+      (when (f-exists? server-dir)
+        (f-join server-dir (cond ((eq system-type 'windows-nt) "OmniSharp.exe")
+                                 (t "run")))))))
+
+(lsp-defun lsp-csharp-open-project-file ()
+  "Open corresponding project file  (.csproj) for the current file."
+  (interactive)
+  (-let* ((project-info-req (lsp-make-omnisharp-project-information-request :file-name (buffer-file-name)))
+          (project-info (lsp-request "o#/project" project-info-req))
+          ((&omnisharp:ProjectInformation :ms-build-project) project-info)
+          ((&omnisharp:MsBuildProject :path) ms-build-project))
+    (find-file path)))
+
+(defun lsp-csharp--get-buffer-code-elements ()
+  "Retrieve code structure by calling into the /v2/codestructure endpoint.
+Returns :elements from omnisharp:CodeStructureResponse."
+  (-let* ((code-structure (lsp-request "o#/v2/codestructure"
+                                       (lsp-make-omnisharp-code-structure-request :file-name (buffer-file-name))))
+          ((&omnisharp:CodeStructureResponse :elements) code-structure))
+    elements))
+
+(defun lsp-csharp--inspect-code-elements-recursively (fn elements)
+  "Invoke FN for every omnisharp:CodeElement found recursively in ELEMENTS."
+  (seq-each
+   (lambda (el)
+     (funcall fn el)
+     (-let (((&omnisharp:CodeElement :children) el))
+       (lsp-csharp--inspect-code-elements-recursively fn children)))
+   elements))
+
+(defun lsp-csharp--collect-code-elements-recursively (predicate elements)
+  "Flatten the omnisharp:CodeElement tree in ELEMENTS matching PREDICATE."
+  (let ((results nil))
+    (lsp-csharp--inspect-code-elements-recursively (lambda (el)
+                                                     (when (funcall predicate el)
+                                                       (setq results (cons el results))))
+                                                   elements)
+    results))
+
+(lsp-defun lsp-csharp--l-c-within-range (l c (&omnisharp:Range :start :end))
+  "Determine if L (line) and C (column) are within RANGE."
+  (-let* (((&omnisharp:Point :line start-l :column start-c) start)
+          ((&omnisharp:Point :line end-l :column end-c) end))
+    (or (and (= l start-l) (>= c start-c) (or (> end-l start-l) (<= c end-c)))
+        (and (> l start-l) (< l end-l))
+        (and (= l end-l) (<= c end-c)))))
+
+(defun lsp-csharp--code-element-stack-on-l-c (l c elements)
+  "Return omnisharp:CodeElement stack at L (line) and C (column) in ELEMENTS tree."
+  (when-let ((matching-element (seq-find (lambda (el)
+                                           (-when-let* (((&omnisharp:CodeElement :ranges) el)
+                                                        ((&omnisharp:RangeList :full?) ranges))
+                                             (lsp-csharp--l-c-within-range l c full?)))
+                                         elements)))
+    (-let (((&omnisharp:CodeElement :children) matching-element))
+      (cons matching-element (lsp-csharp--code-element-stack-on-l-c l c children)))))
+
+(defun lsp-csharp--code-element-stack-at-point ()
+  "Return omnisharp:CodeElement stack at point as a list."
+  (let ((pos-line (plist-get (lsp--cur-position) :line))
+        (pos-col (plist-get (lsp--cur-position) :character)))
+    (lsp-csharp--code-element-stack-on-l-c pos-line
+                                           pos-col
+                                           (lsp-csharp--get-buffer-code-elements))))
+
+(lsp-defun lsp-csharp--code-element-test-method-p (element)
+  "Return test method name and test framework for a given ELEMENT."
+  (when element
+    (-when-let* (((&omnisharp:CodeElement :properties) element)
+                 ((&omnisharp:CodeElementProperties :test-method-name? :test-framework?) properties))
+      (list test-method-name? test-framework?))))
+
+(defun lsp-csharp--reset-test-buffer (present-buffer)
+  "Create new or reuse an existing test result output buffer.
+PRESENT-BUFFER will make the buffer be presented to the user."
+  (with-current-buffer (get-buffer-create lsp-csharp-test-run-buffer-name)
+    (compilation-mode)
+    (read-only-mode)
+    (let ((inhibit-read-only t))
+      (erase-buffer)))
+
+  (when present-buffer
+      (display-buffer lsp-csharp-test-run-buffer-name)))
+
+(defun lsp-csharp--start-tests (test-method-framework test-method-names)
+  "Run test(s) identified by TEST-METHOD-NAMES using TEST-METHOD-FRAMEWORK."
+  (if (and test-method-framework test-method-names)
+      (let ((request-message (lsp-make-omnisharp-run-tests-in-class-request
+                              :file-name (buffer-file-name)
+                              :test-frameworkname test-method-framework
+                              :method-names (vconcat test-method-names))))
+        (lsp-csharp--reset-test-buffer t)
+        (lsp-session-set-metadata "last-test-method-framework" test-method-framework)
+        (lsp-session-set-metadata "last-test-method-names" test-method-names)
+        (lsp-request-async "o#/v2/runtestsinclass"
+                           request-message
+                           (-lambda ((&omnisharp:RunTestResponse))
+                             (message "lsp-csharp: Test run has started"))))
+    (message "lsp-csharp: No test methods to run")))
+
+(defun lsp-csharp--test-message (message)
+  "Emit a MESSAGE to lsp-csharp test run buffer."
+  (when-let ((existing-buffer (get-buffer lsp-csharp-test-run-buffer-name))
+             (inhibit-read-only t))
+    (with-current-buffer existing-buffer
+      (save-excursion
+        (goto-char (point-max))
+        (insert message "\n")))))
+
+(defun lsp-csharp-run-test-at-point ()
+  "Start test run at current point (if any)."
+  (interactive)
+  (let* ((stack (lsp-csharp--code-element-stack-at-point))
+         (element-on-point (car (last stack)))
+         (test-method (lsp-csharp--code-element-test-method-p element-on-point))
+         (test-method-name (car test-method))
+         (test-method-framework (car (cdr test-method))))
+    (lsp-csharp--start-tests test-method-framework (list test-method-name))))
+
+(defun lsp-csharp-run-all-tests-in-buffer ()
+  "Run all test methods in the current buffer."
+  (interactive)
+  (let* ((elements (lsp-csharp--get-buffer-code-elements))
+         (test-methods (lsp-csharp--collect-code-elements-recursively 'lsp-csharp--code-element-test-method-p elements))
+         (test-method-framework (car (cdr (lsp-csharp--code-element-test-method-p (car test-methods)))))
+         (test-method-names (mapcar (lambda (method)
+                                      (car (lsp-csharp--code-element-test-method-p method)))
+                                    test-methods)))
+    (lsp-csharp--start-tests test-method-framework test-method-names)))
+
+(defun lsp-csharp-run-test-in-buffer ()
+  "Run selected test in current buffer."
+  (interactive)
+  (when-let* ((elements (lsp-csharp--get-buffer-code-elements))
+              (test-methods (lsp-csharp--collect-code-elements-recursively 'lsp-csharp--code-element-test-method-p elements))
+              (test-method-framework (car (cdr (lsp-csharp--code-element-test-method-p (car test-methods)))))
+              (test-method-names (mapcar (lambda (method)
+                                           (car (lsp-csharp--code-element-test-method-p method)))
+                                         test-methods))
+              (selected-test-method-name (lsp--completing-read "Select test:" test-method-names 'identity)))
+    (lsp-csharp--start-tests test-method-framework (list selected-test-method-name))))
+
+(defun lsp-csharp-run-last-tests ()
+  "Re-run test(s) that were run last time."
+  (interactive)
+  (if-let ((last-test-method-framework (lsp-session-get-metadata "last-test-method-framework"))
+           (last-test-method-names (lsp-session-get-metadata "last-test-method-names")))
+      (lsp-csharp--start-tests last-test-method-framework last-test-method-names)
+    (message "lsp-csharp: No test method(s) found to be ran previously on this workspace")))
+
+(lsp-defun lsp-csharp--handle-os-error (_workspace (&omnisharp:ErrorMessage :file-name :text))
+  "Handle the 'o#/error' (interop) notification by displaying a message with lsp-warn."
+  (lsp-warn "%s: %s" file-name text))
+
+(lsp-defun lsp-csharp--handle-os-testmessage (_workspace (&omnisharp:TestMessageEvent :message))
+  "Handle the 'o#/testmessage and display test message on lsp-csharp
+test output buffer."
+  (lsp-csharp--test-message message))
+
+(lsp-defun lsp-csharp--handle-os-testcompleted (_workspace (&omnisharp:DotNetTestResult
+                                                            :method-name
+                                                            :outcome
+                                                            :error-message
+                                                            :error-stack-trace
+                                                            :standard-output
+                                                            :standard-error))
+  "Handle the 'o#/testcompleted' message from the server.
+
+Will display the results of the test on the lsp-csharp test output buffer."
+  (let ((passed (string-equal "passed" outcome)))
+    (lsp-csharp--test-message
+     (format "[%s] %s "
+             (propertize (upcase outcome) 'font-lock-face (if passed 'success 'error))
+             method-name))
+
+    (unless passed
+      (lsp-csharp--test-message error-message)
+
+      (when error-stack-trace
+        (lsp-csharp--test-message error-stack-trace))
+
+      (unless (seq-empty-p standard-output)
+        (lsp-csharp--test-message "STANDARD OUTPUT:")
+        (seq-doseq (stdout-line standard-output)
+          (lsp-csharp--test-message stdout-line)))
+
+      (unless (seq-empty-p standard-error)
+        (lsp-csharp--test-message "STANDARD ERROR:")
+        (seq-doseq (stderr-line standard-error)
+          (lsp-csharp--test-message stderr-line))))))
+
+(lsp-defun lsp-csharp--action-client-find-references ((&Command :arguments?))
+  "Read first argument from ACTION as Location and display xrefs for that location
+using the `textDocument/references' request."
+  (-if-let* (((&Location :uri :range) (lsp-seq-first arguments?))
+             ((&Range :start range-start) range)
+             (find-refs-params (append (lsp--text-document-position-params (list :uri uri) range-start)
+                                       (list :context (list :includeDeclaration json-false))))
+             (locations-found (lsp-request "textDocument/references" find-refs-params)))
+      (lsp-show-xrefs (lsp--locations-to-xref-items locations-found) nil t)
+    (message "No references found")))
+
+(lsp-register-client
+ (make-lsp-client :new-connection
+                  (lsp-stdio-connection
+                   #'(lambda ()
+                       (append
+                        (list (lsp-csharp--language-server-path) "-lsp")
+                        (when lsp-csharp-solution-file
+                          (list "-s" (expand-file-name lsp-csharp-solution-file)))))
+                   #'(lambda ()
+                       (when-let ((binary (lsp-csharp--language-server-path)))
+                         (f-exists? binary))))
+                  :major-modes '(csharp-mode csharp-tree-sitter-mode)
+                  :server-id 'omnisharp
+                  :priority -1
+                  :action-handlers (ht ("omnisharp/client/findReferences" 'lsp-csharp--action-client-find-references))
+                  :notification-handlers (ht ("o#/projectadded" 'ignore)
+                                             ("o#/projectchanged" 'ignore)
+                                             ("o#/projectremoved" 'ignore)
+                                             ("o#/packagerestorestarted" 'ignore)
+                                             ("o#/msbuildprojectdiagnostics" 'ignore)
+                                             ("o#/packagerestorefinished" 'ignore)
+                                             ("o#/unresolveddependencies" 'ignore)
+                                             ("o#/error" 'lsp-csharp--handle-os-error)
+                                             ("o#/testmessage" 'lsp-csharp--handle-os-testmessage)
+                                             ("o#/testcompleted" 'lsp-csharp--handle-os-testcompleted)
+                                             ("o#/projectconfiguration" 'ignore)
+                                             ("o#/projectdiagnosticstatus" 'ignore))
+                  :download-server-fn #'lsp-csharp--download-server))
+
+;;
+;; Alternative "csharp-ls" language server support
+;; see https://github.com/razzmatazz/csharp-language-server
+;;
+(lsp-defun lsp-csharp--cls-metadata-uri-handler (uri)
+  "Handle `csharp:/(metadata)' uri from csharp-ls server.
+
+'csharp/metadata' request is issued to retrieve metadata from the server.
+A cache file is created on project root dir that stores this metadata and filename
+is returned so lsp-mode can display this file."
+
+  (-when-let* ((metadata-req (lsp-make-csharp-ls-c-sharp-metadata
+                              :text-document (lsp-make-text-document-identifier :uri uri)))
+               (metadata (lsp-request "csharp/metadata" metadata-req))
+               ((&csharp-ls:CSharpMetadataResponse :project-name
+                                                   :assembly-name
+                                                   :symbol-name
+                                                   :source) metadata)
+               (filename (f-join ".cache"
+                                 "lsp-csharp"
+                                 "metadata"
+                                 "projects" project-name
+                                 "assemblies" assembly-name
+                                 (concat symbol-name ".cs")))
+               (file-location (expand-file-name filename (lsp-workspace-root)))
+               (metadata-file-location (concat file-location ".metadata-uri"))
+               (path (f-dirname file-location)))
+
+    (unless (file-exists-p file-location)
+      (unless (file-directory-p path)
+        (make-directory path t))
+
+      (with-temp-file metadata-file-location
+        (insert uri))
+
+      (with-temp-file file-location
+        (insert source)))
+
+    file-location))
+
+(defun lsp-csharp--cls-before-file-open (_workspace)
+  "Set `lsp-buffer-uri' variable after C# file is open from *.metadata-uri file."
+
+  (let ((metadata-file-name (concat buffer-file-name ".metadata-uri")))
+    (setq-local lsp-buffer-uri
+                (when (file-exists-p metadata-file-name)
+                  (with-temp-buffer (insert-file-contents metadata-file-name)
+                                    (buffer-string))))))
+
+(defun lsp-csharp--cls-download-server (_client callback error-callback update?)
+  "Install/update csharp-ls language server using `dotnet tool'.
+
+Will invoke CALLBACK or ERROR-CALLBACK based on result. Will update if UPDATE? is t"
+  (lsp-async-start-process
+   callback
+   error-callback
+   "dotnet" "tool" (if update? "update" "install") "-g" "csharp-ls"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection
+                  (lsp-stdio-connection
+                   #'(lambda ()
+                       (append (list "csharp-ls")
+                               (when lsp-csharp-solution-file
+                                 (list "-s" lsp-csharp-solution-file)))))
+                  :priority -2
+                  :server-id 'csharp-ls
+                  :major-modes '(csharp-mode csharp-tree-sitter-mode)
+                  :before-file-open-fn #'lsp-csharp--cls-before-file-open
+                  :uri-handlers (ht ("csharp" #'lsp-csharp--cls-metadata-uri-handler))
+                  :download-server-fn #'lsp-csharp--cls-download-server))
+
+(lsp-consistency-check lsp-csharp)
+
+(provide 'lsp-csharp)
+;;; lsp-csharp.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-css.el b/elpa/lsp-mode-20220201.852/lsp-css.el
new file mode 100644 (file)
index 0000000..ca5d957
--- /dev/null
@@ -0,0 +1,254 @@
+;;; lsp-css.el --- CSS language server configuration   -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'lsp-protocol)
+(require 'lsp-mode)
+
+(defgroup lsp-css nil
+  "LSP support for CSS."
+  :group 'lsp-mode
+  :link '(url-link
+          "https://github.com/vscode-langservers/vscode-css-languageserver-bin"))
+
+(defcustom lsp-css-experimental-custom-data nil
+  "A list of JSON file paths that define custom CSS data that
+loads custom properties, at directives, pseudo classes /
+elements."
+  :type '(repeat string))
+
+(defcustom lsp-css-completion-trigger-property-value-completion t
+  "By default, VS Code triggers property value completion after
+selecting a CSS property. Use this setting to disable this
+behavior."
+  :type 'boolean)
+
+(defcustom lsp-css-validate t
+  "Enables or disables all validations."
+  :type 'boolean)
+
+(defcustom lsp-css-lint-compatible-vendor-prefixes "ignore"
+  "When using a vendor-specific prefix make sure to also include
+all other vendor-specific properties."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-vendor-prefix "warning"
+  "When using a vendor-specific prefix, also include the standard
+property."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-duplicate-properties "ignore"
+  "Do not use duplicate style definitions."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-empty-rules "warning"
+  "Do not use empty rulesets."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-import-statement "ignore"
+  "Import statements do not load in parallel."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-box-model "ignore"
+  nil
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-universal-selector "ignore"
+  nil
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-zero-units "ignore"
+  "No unit for zero needed."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-font-face-properties "warning"
+  nil
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-hex-color-length "error"
+  "Hex colors must consist of three or six hex numbers."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-arguments-in-color-function "error"
+  "Invalid number of parameters."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-unknown-properties "warning"
+  "Unknown property."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-valid-properties nil
+  "A list of properties that are not validated against the
+`unknownProperties` rule."
+  :type '(repeat string))
+
+(defcustom lsp-css-lint-ie-hack "ignore"
+  "IE hacks are only necessary when supporting IE7 and older."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-unknown-vendor-specific-properties "ignore"
+  "Unknown vendor specific property."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-property-ignored-due-to-display "warning"
+  nil
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-important "ignore"
+  nil
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-float "ignore"
+  nil
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-id-selector "ignore"
+  "Selectors should not contain IDs because these rules are too
+tightly coupled with the HTML."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-lint-unknown-at-rules "warning"
+  "Unknown at-rule."
+  :type '(choice
+          (const "ignore")
+          (const "warning")
+          (const "error")))
+
+(defcustom lsp-css-trace-server "off"
+  "Traces the communication between VS Code and the CSS language
+server."
+  :type '(choice
+          (const "off")
+          (const "messages")
+          (const "verbose")))
+
+(lsp-register-custom-settings
+ '(("css.trace.server" lsp-css-trace-server)
+   ("css.lint.unknownAtRules" lsp-css-lint-unknown-at-rules)
+   ("css.lint.idSelector" lsp-css-lint-id-selector)
+   ("css.lint.float" lsp-css-lint-float)
+   ("css.lint.important" lsp-css-lint-important)
+   ("css.lint.propertyIgnoredDueToDisplay" lsp-css-lint-property-ignored-due-to-display)
+   ("css.lint.unknownVendorSpecificProperties" lsp-css-lint-unknown-vendor-specific-properties)
+   ("css.lint.ieHack" lsp-css-lint-ie-hack)
+   ("css.lint.validProperties" lsp-css-lint-valid-properties)
+   ("css.lint.unknownProperties" lsp-css-lint-unknown-properties)
+   ("css.lint.argumentsInColorFunction" lsp-css-lint-arguments-in-color-function)
+   ("css.lint.hexColorLength" lsp-css-lint-hex-color-length)
+   ("css.lint.fontFaceProperties" lsp-css-lint-font-face-properties)
+   ("css.lint.zeroUnits" lsp-css-lint-zero-units)
+   ("css.lint.universalSelector" lsp-css-lint-universal-selector)
+   ("css.lint.boxModel" lsp-css-lint-box-model)
+   ("css.lint.importStatement" lsp-css-lint-import-statement)
+   ("css.lint.emptyRules" lsp-css-lint-empty-rules)
+   ("css.lint.duplicateProperties" lsp-css-lint-duplicate-properties)
+   ("css.lint.vendorPrefix" lsp-css-lint-vendor-prefix)
+   ("css.lint.compatibleVendorPrefixes" lsp-css-lint-compatible-vendor-prefixes)
+   ("css.validate" lsp-css-validate t)
+   ("css.completion.triggerPropertyValueCompletion" lsp-css-completion-trigger-property-value-completion t)
+   ("css.experimental.customData" lsp-css-experimental-custom-data)))
+
+(defun lsp-css--server-command ()
+  "Generate startup command for CSS language server."
+  (list (lsp-package-path 'css-languageserver) "--stdio"))
+
+;;; CSS
+(lsp-defun lsp-css--apply-code-action ((&Command :arguments?))
+  "Apply ACTION as workspace edit command."
+  (lsp--apply-text-edits (cl-caddr arguments?) 'code-action))
+
+(lsp-dependency 'css-languageserver
+                '(:system "css-languageserver")
+                '(:npm :package "vscode-css-languageserver-bin"
+                       :path "css-languageserver"))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection #'lsp-css--server-command)
+  :activation-fn (lsp-activate-on "css" "scss" "sass" "less")
+  :priority -1
+  :action-handlers (lsp-ht ("_css.applyCodeAction" #'lsp-css--apply-code-action))
+  :server-id 'css-ls
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'css-languageserver callback error-callback))))
+
+(lsp-consistency-check lsp-css)
+
+(provide 'lsp-css)
+;;; lsp-css.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-d.el b/elpa/lsp-mode-20220201.852/lsp-d.el
new file mode 100644 (file)
index 0000000..f9c7b13
--- /dev/null
@@ -0,0 +1,37 @@
+;;; lsp-d.el --- lsp-mode dlang integration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 lsp-mode maintainers
+
+;; Author: lsp-mode maintainers
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;  client for serve-d
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection "serve-d")
+                  :major-modes '(d-mode)
+                  :server-id 'serve-d))
+
+(lsp-consistency-check lsp-d)
+
+(provide 'lsp-d)
+;;; lsp-d.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-dhall.el b/elpa/lsp-mode-20220201.852/lsp-dhall.el
new file mode 100644 (file)
index 0000000..7b10597
--- /dev/null
@@ -0,0 +1,43 @@
+;;; lsp-dhall.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, dhall
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Dhall Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-dhall nil
+  "LSP support for Dhall, using dhall-lsp-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/dhall-lang/dhall-haskell"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection "dhall-lsp-server")
+                  :major-modes '(dhall-mode)
+                  :priority -1
+                  :server-id 'dhallls))
+
+(lsp-consistency-check lsp-dhall)
+
+(provide 'lsp-dhall)
+;;; lsp-dhall.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-diagnostics.el b/elpa/lsp-mode-20220201.852/lsp-diagnostics.el
new file mode 100644 (file)
index 0000000..f82ef56
--- /dev/null
@@ -0,0 +1,370 @@
+;;; lsp-diagnostics.el --- LSP diagnostics integration -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;;  LSP diagnostics integration
+;;
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-diagnostics nil
+  "LSP support for diagnostics"
+  :prefix "lsp-disagnostics-"
+  :group 'lsp-mode
+  :tag "LSP Diagnostics")
+
+;;;###autoload
+(define-obsolete-variable-alias 'lsp-diagnostic-package
+  'lsp-diagnostics-provider  "lsp-mode 7.0.1")
+
+(defcustom lsp-diagnostics-provider :auto
+  "The checker backend provider."
+  :type
+  '(choice
+    (const :tag "Pick flycheck if present and fallback to flymake" :auto)
+    (const :tag "Pick flycheck" :flycheck)
+    (const :tag "Pick flymake" :flymake)
+    (const :tag "Use neither flymake nor lsp" :none)
+    (const :tag "Prefer flymake" t)
+    (const :tag "Prefer flycheck" nil))
+  :group 'lsp-diagnostics
+  :package-version '(lsp-mode . "6.3"))
+
+;;;###autoload
+(define-obsolete-variable-alias 'lsp-flycheck-default-level
+  'lsp-diagnostics-flycheck-default-level  "lsp-mode 7.0.1")
+
+(defcustom lsp-diagnostics-flycheck-default-level 'error
+  "Error level to use when the server does not report back a diagnostic level."
+  :type '(choice
+          (const error)
+          (const warning)
+          (const info))
+  :group 'lsp-diagnostics)
+
+(defcustom lsp-diagnostics-attributes
+  `((unnecessary :foreground "gray")
+    (deprecated  :strike-through t))
+  "The Attributes used on the diagnostics.
+List containing (tag attributes) where tag is the LSP diagnostic tag and
+attributes is a `plist' containing face attributes which will be applied
+on top the flycheck face for that error level."
+  :type '(repeat list)
+  :group 'lsp-diagnostics)
+
+(defcustom lsp-diagnostics-disabled-modes nil
+  "A list of major models for which `lsp-diagnostics-mode' should be disabled."
+  :type '(repeat symbol)
+  :group 'lsp-diagnostics
+  :package-version '(lsp-mode . "8.0.0"))
+
+;; Flycheck integration
+
+(declare-function flycheck-mode "ext:flycheck")
+(declare-function flycheck-define-generic-checker
+                  "ext:flycheck" (symbol docstring &rest properties))
+(declare-function flycheck-error-new "ext:flycheck" t t)
+(declare-function flycheck-error-message "ext:flycheck" (err) t)
+(declare-function flycheck-define-error-level "ext:flycheck" (level &rest properties))
+(declare-function flycheck-buffer "ext:flycheck")
+(declare-function flycheck-valid-checker-p "ext:flycheck")
+(declare-function flycheck-stop "ext:flycheck")
+
+(defvar flycheck-mode)
+(defvar flycheck-check-syntax-automatically)
+(defvar flycheck-checker)
+(defvar flycheck-checkers)
+
+
+(defvar-local lsp-diagnostics--flycheck-enabled nil
+  "True when lsp diagnostics flycheck integration has been enabled in this buffer.")
+
+(defvar-local lsp-diagnostics--flycheck-checker nil
+  "The value of flycheck-checker before lsp diagnostics was activated.")
+
+(defun lsp-diagnostics--flycheck-level (flycheck-level tags)
+  "Generate flycheck level from the original FLYCHECK-LEVEL (e.
+g. `error', `warning') and list of LSP TAGS."
+  (let ((name (format "lsp-flycheck-%s-%s"
+                      flycheck-level
+                      (mapconcat #'symbol-name tags "-"))))
+    (or (intern-soft name)
+        (let* ((face (--doto (intern (format "lsp-%s-face" name))
+                       (copy-face (-> flycheck-level
+                                      (get 'flycheck-overlay-category)
+                                      (get 'face))
+                                  it)
+                       (mapc (lambda (tag)
+                               (apply #'set-face-attribute it nil
+                                      (cl-rest (assoc tag lsp-diagnostics-attributes))))
+                             tags)))
+               (category (--doto (intern (format "lsp-%s-category" name))
+                           (setf (get it 'face) face
+                                 (get it 'priority) 100)))
+               (new-level (intern name))
+               (bitmap (or (get flycheck-level 'flycheck-fringe-bitmaps)
+                           (get flycheck-level 'flycheck-fringe-bitmap-double-arrow))))
+          (flycheck-define-error-level new-level
+            :severity (get flycheck-level 'flycheck-error-severity)
+            :compilation-level (get flycheck-level 'flycheck-compilation-level)
+            :overlay-category category
+            :fringe-bitmap bitmap
+            :fringe-face (get flycheck-level 'flycheck-fringe-face)
+            :error-list-face face)
+          new-level))))
+
+(defun lsp-diagnostics--flycheck-calculate-level (severity tags)
+  "Calculate flycheck level by SEVERITY and TAGS."
+  (let ((level (pcase severity
+                 (1 'error)
+                 (2 'warning)
+                 (3 'info)
+                 (4 'info)
+                 (_ lsp-flycheck-default-level)))
+        ;; materialize only first tag.
+        (tags (seq-map (lambda (tag)
+                         (cond
+                          ((= tag lsp/diagnostic-tag-unnecessary) 'unnecessary)
+                          ((= tag lsp/diagnostic-tag-deprecated) 'deprecated)))
+                       tags)))
+    (if tags
+        (lsp-diagnostics--flycheck-level level tags)
+      level)))
+
+(defun lsp-diagnostics--flycheck-start (checker callback)
+  "Start an LSP syntax check with CHECKER.
+
+CALLBACK is the status callback passed by Flycheck."
+
+  (remove-hook 'lsp-on-idle-hook #'lsp-diagnostics--flycheck-buffer t)
+
+  (->> (lsp--get-buffer-diagnostics)
+       (-map (-lambda ((&Diagnostic :message :severity? :tags? :code? :source?
+                                    :range (&Range :start (&Position :line      start-line
+                                                                     :character start-character)
+                                                   :end   (&Position :line      end-line
+                                                                     :character end-character))))
+               (flycheck-error-new
+                :buffer (current-buffer)
+                :checker checker
+                :filename buffer-file-name
+                :message message
+                :level (lsp-diagnostics--flycheck-calculate-level severity? tags?)
+                :id code?
+                :group source?
+                :line (lsp-translate-line (1+ start-line))
+                :column (1+ (lsp-translate-column start-character))
+                :end-line (lsp-translate-line (1+ end-line))
+                :end-column (1+ (lsp-translate-column end-character)))))
+       (funcall callback 'finished)))
+
+(defun lsp-diagnostics--flycheck-buffer ()
+  "Trigger flyckeck on buffer."
+  (remove-hook 'lsp-on-idle-hook #'lsp-diagnostics--flycheck-buffer t)
+  (when (bound-and-true-p flycheck-mode)
+    (flycheck-buffer)))
+
+(defun lsp-diagnostics--flycheck-report ()
+  "Report flycheck.
+This callback is invoked when new diagnostics are received
+from the language server."
+  (when (and (or (memq 'idle-change flycheck-check-syntax-automatically)
+                 (and (memq 'save flycheck-check-syntax-automatically)
+                      (not (buffer-modified-p))))
+             lsp--cur-workspace)
+    ;; make sure diagnostics are published even if the diagnostics
+    ;; have been received after idle-change has been triggered
+    (->> lsp--cur-workspace
+         (lsp--workspace-buffers)
+         (mapc (lambda (buffer)
+                 (when (and (lsp-buffer-live-p buffer)
+                            (or
+                             (not (bufferp buffer))
+                             (and (get-buffer-window buffer)
+                                  (not (-contains? (buffer-local-value 'lsp-on-idle-hook buffer)
+                                                   'lsp-diagnostics--flycheck-buffer)))))
+                   (lsp-with-current-buffer buffer
+                     (add-hook 'lsp-on-idle-hook #'lsp-diagnostics--flycheck-buffer nil t)
+                     (lsp--idle-reschedule (current-buffer)))))))))
+
+(cl-defgeneric lsp-diagnostics-flycheck-error-explainer (e _server-id)
+  "Explain a `flycheck-error' E in a generic way depending on the SERVER-ID."
+  (flycheck-error-message e))
+
+(defvar lsp-diagnostics-mode) ;; properly defined by define-minor-mode below
+
+;;;###autoload
+(defun lsp-diagnostics-lsp-checker-if-needed ()
+  (unless (flycheck-valid-checker-p 'lsp)
+    (flycheck-define-generic-checker 'lsp
+      "A syntax checker using the Language Server Protocol (LSP)
+provided by lsp-mode.
+See https://github.com/emacs-lsp/lsp-mode."
+      :start #'lsp-diagnostics--flycheck-start
+      :modes '(lsp-placeholder-mode) ;; placeholder
+      :predicate (lambda () lsp-diagnostics-mode)
+      :error-explainer (lambda (e)
+                         (lsp-diagnostics-flycheck-error-explainer
+                          e (lsp--workspace-server-id (car-safe (lsp-workspaces))))))))
+
+(defun lsp-diagnostics-flycheck-enable (&rest _)
+  "Enable flycheck integration for the current buffer."
+  (require 'flycheck)
+  (lsp-diagnostics-lsp-checker-if-needed)
+  (and (not lsp-diagnostics--flycheck-enabled)
+       (not (eq flycheck-checker 'lsp))
+       (setq lsp-diagnostics--flycheck-checker flycheck-checker))
+  (setq-local lsp-diagnostics--flycheck-enabled t)
+  (flycheck-mode 1)
+  (flycheck-stop)
+  (setq-local flycheck-checker 'lsp)
+  (lsp-flycheck-add-mode major-mode)
+  (add-to-list 'flycheck-checkers 'lsp)
+  (add-hook 'lsp-diagnostics-updated-hook #'lsp-diagnostics--flycheck-report nil t)
+  (add-hook 'lsp-managed-mode-hook #'lsp-diagnostics--flycheck-report nil t))
+
+(defun lsp-diagnostics-flycheck-disable ()
+  "Disable flycheck integration for the current buffer is it was enabled."
+  (when lsp-diagnostics--flycheck-enabled
+    (flycheck-stop)
+    (when (eq flycheck-checker 'lsp)
+      (setq-local flycheck-checker lsp-diagnostics--flycheck-checker))
+    (setq lsp-diagnostics--flycheck-checker nil)
+    (setq-local lsp-diagnostics--flycheck-enabled nil)
+    (when flycheck-mode
+      (flycheck-mode 1))))
+\f
+;; Flymake integration
+
+(declare-function flymake-mode "ext:flymake")
+(declare-function flymake-make-diagnostic "ext:flymake")
+(declare-function flymake-diag-region "ext:flymake")
+
+(defvar flymake-diagnostic-functions)
+(defvar flymake-mode)
+(defvar-local lsp-diagnostics--flymake-report-fn nil)
+
+(defun lsp-diagnostics--flymake-setup ()
+  "Setup flymake."
+  (setq lsp-diagnostics--flymake-report-fn nil)
+  (add-hook 'flymake-diagnostic-functions 'lsp-diagnostics--flymake-backend nil t)
+  (add-hook 'lsp-diagnostics-updated-hook 'lsp-diagnostics--flymake-after-diagnostics nil t)
+  (flymake-mode 1))
+
+(defun lsp-diagnostics--flymake-after-diagnostics ()
+  "Handler for `lsp-diagnostics-updated-hook'."
+  (cond
+   ((and lsp-diagnostics--flymake-report-fn flymake-mode)
+    (lsp-diagnostics--flymake-update-diagnostics))
+   ((not flymake-mode)
+    (setq lsp-diagnostics--flymake-report-fn nil))))
+
+(defun lsp-diagnostics--flymake-backend (report-fn &rest _args)
+  "Flymake backend using REPORT-FN."
+  (let ((first-run (null lsp-diagnostics--flymake-report-fn)))
+    (setq lsp-diagnostics--flymake-report-fn report-fn)
+    (when first-run
+      (lsp-diagnostics--flymake-update-diagnostics))))
+
+(defun lsp-diagnostics--flymake-update-diagnostics ()
+  "Report new diagnostics to flymake."
+  (funcall lsp-diagnostics--flymake-report-fn
+           (-some->> (lsp-diagnostics t)
+             (gethash (lsp--fix-path-casing buffer-file-name))
+             (--map (-let* (((&Diagnostic :message :severity?
+                                          :range (range &as &Range
+                                                        :start (&Position :line start-line :character)
+                                                        :end (&Position :line end-line))) it)
+                            ((start . end) (lsp--range-to-region range)))
+                      (when (= start end)
+                        (if-let ((region (flymake-diag-region (current-buffer)
+                                                              (1+ start-line)
+                                                              character)))
+                            (setq start (car region)
+                                  end (cdr region))
+                          (lsp-save-restriction-and-excursion
+                            (goto-char (point-min))
+                            (setq start (point-at-bol (1+ start-line))
+                                  end (point-at-eol (1+ end-line))))))
+                      (flymake-make-diagnostic (current-buffer)
+                                               start
+                                               end
+                                               (cl-case severity?
+                                                 (1 :error)
+                                                 (2 :warning)
+                                                 (t :note))
+                                               message))))
+           ;; This :region keyword forces flymake to delete old diagnostics in
+           ;; case the buffer hasn't changed since the last call to the report
+           ;; function. See https://github.com/joaotavora/eglot/issues/159
+           :region (cons (point-min) (point-max))))
+
+\f
+
+;;;###autoload
+(defun lsp-diagnostics--enable ()
+  "Enable LSP checker support."
+  (when (and (member lsp-diagnostics-provider '(:auto :none :flycheck :flymake t nil))
+             (not (member major-mode lsp-diagnostics-disabled-modes)))
+    (lsp-diagnostics-mode 1)))
+
+(defun lsp-diagnostics--disable ()
+  "Disable LSP checker support."
+  (lsp-diagnostics-mode -1))
+
+;;;###autoload
+(define-minor-mode lsp-diagnostics-mode
+  "Toggle LSP diagnostics integration."
+  :group 'lsp-diagnostics
+  :global nil
+  :lighter ""
+  (cond
+   (lsp-diagnostics-mode
+    (cond
+     ((and (or
+            (and (eq lsp-diagnostics-provider :auto)
+                 (functionp 'flycheck-mode))
+            (and (eq lsp-diagnostics-provider :flycheck)
+                 (or (functionp 'flycheck-mode)
+                     (user-error "The lsp-diagnostics-provider is set to :flycheck but flycheck is not installed?")))
+            ;; legacy
+            (null lsp-diagnostics-provider))
+           (require 'flycheck nil t))
+      (lsp-diagnostics-flycheck-enable))
+     ((or (eq lsp-diagnostics-provider :auto)
+          (eq lsp-diagnostics-provider :flymake)
+          (eq lsp-diagnostics-provider t))
+      (require 'flymake)
+      (lsp-diagnostics--flymake-setup))
+     ((not (eq lsp-diagnostics-provider :none))
+      (lsp--warn "Unable to autoconfigure flycheck/flymake. The diagnostics won't be rendered.")))
+
+    (add-hook 'lsp-unconfigure-hook #'lsp-diagnostics--disable nil t))
+   (t (lsp-diagnostics-flycheck-disable)
+      (remove-hook 'lsp-unconfigure-hook #'lsp-diagnostics--disable t))))
+
+;;;###autoload
+(add-hook 'lsp-configure-hook (lambda ()
+                                (when lsp-auto-configure
+                                  (lsp-diagnostics--enable))))
+
+(lsp-consistency-check lsp-diagnostics)
+
+(provide 'lsp-diagnostics)
+;;; lsp-diagnostics.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-dired.el b/elpa/lsp-mode-20220201.852/lsp-dired.el
new file mode 100644 (file)
index 0000000..8b84af7
--- /dev/null
@@ -0,0 +1,178 @@
+;;; lsp-dired.el --- `lsp-mode' diagnostics integrated into `dired' -*- lexical-binding: t -*-
+
+;; Copyright (C) 2021
+
+;; Author: Alexander Miller <alexandermNOSPAMweb.de>
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;; `lsp-mode' diagnostics integrated into `dired'
+
+;;; Code:
+
+(require 'dired)
+(require 'pcase)
+(require 'lsp-mode)
+
+(defgroup lsp-dired nil
+  "LSP support for dired"
+  :prefix "lsp-dired-"
+  :group 'lsp-mode
+  :tag "LSP Dired")
+
+(defvar lsp-dired--ranger-adjust nil)
+(with-eval-after-load 'ranger (setf lsp-dired--ranger-adjust t))
+
+(defvar-local lsp-dired-displayed nil
+  "Flags whether icons have been added.")
+
+(defvar-local lsp-dired--covered-subdirs nil
+  "List of subdirs icons were already added for.")
+
+(defun lsp-dired--display ()
+  "Display the icons of files in a dired buffer."
+  (when (and (display-graphic-p)
+             (not lsp-dired-displayed)
+             dired-subdir-alist)
+    (setq-local lsp-dired-displayed t)
+    (pcase-dolist (`(,path . ,pos) dired-subdir-alist)
+      (lsp-dired--insert-for-subdir path pos))))
+
+(defun lsp-dired--insert-for-subdir (path pos)
+  "Display icons for subdir PATH at given POS."
+  (let ((buf (current-buffer)))
+    ;; run the function after current to make sure that we are creating the
+    ;; overlays after `treemacs-icons-dired' has run.
+    (run-with-idle-timer
+     0.0 nil
+     (lambda ()
+       (unless (and (member path lsp-dired--covered-subdirs)
+                    (not (buffer-live-p buf)))
+         (with-current-buffer buf
+           (add-to-list 'lsp-dired--covered-subdirs path)
+           (let (buffer-read-only)
+             (save-excursion
+               (goto-char pos)
+               (forward-line (if lsp-dired--ranger-adjust 1 2))
+               (cl-block :file
+                 (while (not (eobp))
+                   (if (dired-move-to-filename nil)
+                       (let* ((file (dired-get-filename nil t))
+                              (bol (progn
+                                     (point-at-bol)
+                                     (search-forward-regexp "^[[:space:]]*" (line-end-position) t)
+                                     (point)))
+                              (face (lsp-dired--face-for-path file)))
+                         (when face
+                           (-doto (make-overlay bol (point-at-eol))
+                             (overlay-put 'evaporate t)
+                             (overlay-put 'face face))))
+                     (cl-return-from :file nil))
+                   (forward-line 1)))))))))))
+
+(defface lsp-dired-path-face '((t :inherit font-lock-string-face))
+  "Face used for breadcrumb paths on headerline."
+  :group 'lsp-dired)
+
+(defface lsp-dired-path-error-face
+  '((t :underline (:style wave :color "Red1")))
+  "Face used for breadcrumb paths on headerline when there is an error under that path"
+  :group 'lsp-dired)
+
+(defface lsp-dired-path-warning-face
+  '((t :underline (:style wave :color "Yellow")))
+  "Face used for breadcrumb paths on headerline when there is an warning under that path"
+  :group 'lsp-dired)
+
+(defface lsp-dired-path-info-face
+  '((t :underline (:style wave :color "Green")))
+  "Face used for breadcrumb paths on headerline when there is an info under that path"
+  :group 'lsp-dired)
+
+(defface lsp-dired-path-hint-face
+  '((t :underline (:style wave :color "Green")))
+  "Face used for breadcrumb paths on headerline when there is an hint under that path"
+  :group 'lsp-dired)
+
+(defun lsp-dired--face-for-path (dir)
+  "Calculate the face for DIR."
+  (when-let ((diags (lsp-diagnostics-stats-for (directory-file-name dir))))
+    (cl-labels ((check-severity
+                 (severity)
+                 (not (zerop (aref diags severity)))))
+      (cond
+       ((check-severity lsp/diagnostic-severity-error)
+        'lsp-dired-path-error-face)
+       ((check-severity lsp/diagnostic-severity-warning)
+        'lsp-dired-path-warning-face)
+       ((check-severity lsp/diagnostic-severity-information)
+        'lsp-dired-path-info-face)
+       ((check-severity lsp/diagnostic-severity-hint)
+        'lsp-dired-path-hint-face)))))
+
+(defun lsp-dired--insert-subdir-advice (&rest args)
+  "Advice to dired & dired+ insert-subdir commands.
+Will add icons for the subdir in the `car' of ARGS."
+  (let* ((path (car args))
+         (pos (cdr (assoc path dired-subdir-alist))))
+    (when pos
+      (lsp-dired--insert-for-subdir path pos))))
+
+(defun lsp-dired--kill-subdir-advice (&rest _args)
+  "Advice to dired kill-subdir commands.
+Will remove the killed subdir from `lsp-dired--covered-subdirs'."
+  (setf lsp-dired--covered-subdirs (delete (dired-current-directory)
+                                           lsp-dired--covered-subdirs)))
+
+(defun lsp-dired--reset (&rest _args)
+  "Reset metadata on revert."
+  (setq-local lsp-dired--covered-subdirs nil)
+  (setq-local lsp-dired-displayed nil))
+
+;;;###autoload
+(define-minor-mode lsp-dired-mode
+  "Display `lsp-mode' icons for each file in a dired buffer."
+  :require    'lsp-dired
+  :init-value nil
+  :global     t
+  :group      'lsp-dired
+  (cond
+   (lsp-dired-mode
+    (add-hook 'dired-after-readin-hook #'lsp-dired--display)
+    (advice-add 'dired-kill-subdir :before #'lsp-dired--kill-subdir-advice)
+    (advice-add 'dired-insert-subdir :after #'lsp-dired--insert-subdir-advice)
+    (advice-add 'diredp-insert-subdirs :after #'lsp-dired--insert-subdir-advice)
+    (advice-add 'dired-revert :before #'lsp-dired--reset)
+    (dolist (buffer (buffer-list))
+      (with-current-buffer buffer
+        (when (derived-mode-p 'dired-mode)
+          (lsp-dired--display)))))
+   (t
+    (advice-remove 'dired-kill-subdir #'lsp-dired--kill-subdir-advice)
+    (advice-remove 'dired-insert-subdir #'lsp-dired--insert-subdir-advice)
+    (advice-remove 'diredp-insert-subdirs #'lsp-dired--insert-subdir-advice)
+    (advice-remove 'dired-revert #'lsp-dired--reset)
+    (remove-hook 'dired-after-readin-hook #'lsp-dired--display)
+    (dolist (buffer (buffer-list))
+      (with-current-buffer buffer
+        (when (derived-mode-p 'dired-mode)
+          (dired-revert)))))))
+
+
+(lsp-consistency-check lsp-dired)(provide 'lsp-dired)
+
+
+;;; lsp-dired.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-dockerfile.el b/elpa/lsp-mode-20220201.852/lsp-dockerfile.el
new file mode 100644 (file)
index 0000000..1d0075d
--- /dev/null
@@ -0,0 +1,66 @@
+;;; lsp-dockerfile.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, dockerfile
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for Dockerfile documents.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+\f
+;;; Dockerfile
+
+(defgroup lsp-dockerfile nil
+  "Dockerfile LSP client, provided by the Dockerfile Language Server."
+  :group 'lsp-mode
+  :version "8.0.0"
+  :link '(url-link "https://github.com/rcjsuen/dockerfile-language-server-nodejs"))
+
+(defcustom lsp-dockerfile-language-server-command
+  '("docker-langserver" "--stdio")
+  "The command that starts the docker language server."
+  :group 'lsp-dockerfile
+  :type '(repeat :tag "List of string values" string))
+
+(lsp-dependency 'docker-langserver
+                '(:system "docker-langserver")
+                '(:npm :package "dockerfile-language-server-nodejs"
+                       :path "docker-langserver"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     `(,(or (executable-find
+                                             (cl-first lsp-dockerfile-language-server-command))
+                                            (lsp-package-path 'docker-langserver))
+                                       ,@(cl-rest lsp-dockerfile-language-server-command))))
+                  :major-modes '(dockerfile-mode)
+                  :priority -1
+                  :server-id 'dockerfile-ls
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure 'docker-langserver
+                                                            callback error-callback))))
+
+(lsp-consistency-check lsp-dockerfile)
+
+(provide 'lsp-dockerfile)
+;;; lsp-dockerfile.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-elixir.el b/elpa/lsp-mode-20220201.852/lsp-elixir.el
new file mode 100644 (file)
index 0000000..0de8928
--- /dev/null
@@ -0,0 +1,190 @@
+;;; lsp-elixir.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, elixir
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Elixir Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'ht)
+
+(defcustom lsp-elixir-dialyzer-enabled t
+  "Run ElixirLS's rapid Dialyzer when code is saved."
+  :type 'boolean
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-dialyzer-warn-opts '()
+  "Dialyzer options to enable or disable warnings.
+
+See Dialyzer's documentation for options. Note that the \"race_conditions\"
+option is unsupported"
+  :type '(repeat string)
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-dialyzer-format "dialyxir_long"
+  "Formatter to use for Dialyzer warnings."
+  :type 'string
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-mix-env "test"
+  "Mix environment to use for compilation."
+  :type 'string
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-mix-target nil
+  "Mix target to use for compilation (requires Elixir >= 1.8)."
+  :type 'string
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-project-dir nil
+  "Subdirectory containing Mix project if not in the project root.
+
+If value is `\"\"` then defaults to the workspace rootUri."
+  :type 'string
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-fetch-deps t
+  "Automatically fetch project dependencies when compiling."
+  :type 'boolean
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-suggest-specs t
+  "Suggest @spec annotations inline using Dialyzer's inferred success typings.
+This requires Dialyzer."
+  :type 'boolean
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-signature-after-complete t
+  "Show signature help after confirming autocomplete."
+  :type 'boolean
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defgroup lsp-elixir nil
+  "LSP support for Elixir, using elixir-ls."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/elixir-lsp/elixir-ls"))
+
+(define-obsolete-variable-alias 'lsp-clients-elixir-server-executable 'lsp-elixir-server-command "2021-04-05")
+
+(defcustom lsp-elixir-server-command
+  (if (equal system-type 'windows-nt)
+      '("language_server.bat")
+    '("language_server.sh"))
+  "Command to start elixir-ls.
+
+Leave as default to let `executable-find' search for it."
+  :group 'lsp-elixir
+  :type '(repeat string)
+  :package-version '(lsp-mode . "8.0.0"))
+
+
+(defconst lsp-elixir-ls-server-dir
+  (f-join lsp-server-install-dir "elixir-ls")
+  "Elixir-ls local server Directory.")
+
+(defcustom lsp-elixir-local-server-command
+  (f-join lsp-elixir-ls-server-dir
+          (cl-first lsp-elixir-server-command))
+  "Command to start local elixir-ls binary."
+  :group 'lsp-elixir
+  :type '(repeat string)
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-elixir-enable-test-lenses t
+  "Suggest Tests."
+  :type 'boolean
+  :group 'lsp-elixir
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-elixir--build-test-command (argument)
+  "Builds the test command from the ARGUMENT."
+  (let ((test-name (lsp-get argument :testName))
+        (module (lsp-get argument :module))
+        (describe (lsp-get argument :describe)))
+    (cond (module (concat "\"" "module:" module "\""))
+          ((not test-name) (concat "\"" "describe:" describe "\""))
+          (describe (concat "\"" "test:test " describe " " test-name "\"" ))
+          (t (concat "\"" "test:test " test-name "\"" )))))
+
+(lsp-defun lsp-elixir--run-test ((&Command :arguments?))
+  "Runs tests."
+  (let* ((argument (lsp-seq-first arguments?))
+         (file-path (lsp-get argument :filePath))
+         (test-command (lsp-elixir--build-test-command argument)))
+    (compile
+     (concat "cd " (lsp-workspace-root file-path) " && "
+             "mix test --exclude test --include " test-command " " file-path
+             " --no-color"))
+    file-path))
+
+(lsp-dependency 'elixir-ls
+                '(:system "elixir-ls"))
+
+(lsp-register-custom-settings
+ '(("elixirLS.dialyzerEnabled" lsp-elixir-dialyzer-enabled t)
+   ("elixirLS.dialyzerWarnOpts" lsp-elixir-dialyzer-warn-opts)
+   ("elixirLS.dialyzerFormat" lsp-elixir-dialyzer-format)
+   ("elixirLS.mixEnv" lsp-elixir-mix-env)
+   ("elixirLS.mixTarget" lsp-elixir-mix-target)
+   ("elixirLS.projectDir" lsp-elixir-project-dir)
+   ("elixirLS.fetchDeps" lsp-elixir-fetch-deps t)
+   ("elixirLS.suggestSpecs" lsp-elixir-suggest-specs t)
+   ("elixirLS.signatureAfterComplete" lsp-elixir-signature-after-complete t)
+   ("elixirLS.enableTestLenses" lsp-elixir-enable-test-lenses t)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     `(,(or (when (f-exists? lsp-elixir-local-server-command)
+                                              lsp-elixir-local-server-command)
+                                            (or (executable-find
+                                                 (cl-first lsp-elixir-server-command))
+                                                (lsp-package-path 'elixir-ls))
+                                            "language_server.bat")
+                                       ,@(cl-rest lsp-elixir-server-command))))
+                  :major-modes '(elixir-mode)
+                  :priority -1
+                  :server-id 'elixir-ls
+                  :action-handlers (ht ("elixir.lens.test.run" 'lsp-elixir--run-test))
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration
+                                       (lsp-configuration-section "elixirLS")))
+                                    (puthash
+                                     "textDocumentSync"
+                                     (ht ("save" t)
+                                         ("change" 2))
+                                     (lsp--workspace-server-capabilities workspace)))))
+
+(lsp-consistency-check lsp-elixir)
+
+(provide 'lsp-elixir)
+;;; lsp-elixir.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-elm.el b/elpa/lsp-mode-20220201.852/lsp-elm.el
new file mode 100644 (file)
index 0000000..55f9f27
--- /dev/null
@@ -0,0 +1,137 @@
+;;; lsp-elm.el --- Elm Client settings             -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Daniel V
+
+;; Author: Daniel V
+;; Keywords: elm lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-elm client
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-elm nil
+  "LSP support for the Elm programming language, using the server from https://github.com/elm-tooling/elm-language-server"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/elm-tooling/elm-language-server"))
+
+(defcustom lsp-elm-elm-language-server-path nil
+  "Path for elm-language-server.
+Can be installed globally with: npm i -g @elm-tooling/elm-language-server,
+or manually by cloning the repo and following the installing instructions."
+  :group 'lsp-elm
+  :risky t
+  :type 'file)
+
+(defcustom lsp-elm-trace-server
+  nil
+  "Enable/disable trace logging of client and server communication."
+  :type 'boolean
+  :group 'lsp-elm)
+
+(defcustom lsp-elm-elm-path
+  ""
+  "The path to your elm executable.
+
+Should be empty by default, in that case it will assume the name and try
+to first get it from a local npm installation or a global one.  If you
+set it manually it will not try to load from the npm folder."
+  :type 'file
+  :group 'lsp-elm)
+
+(defcustom lsp-elm-elm-format-path
+  ""
+  "The path to your elm-format executable.
+
+Should be empty by default, in that case it will assume the name and try
+to first get it from a local npm installation or a global one.  If you
+set it manually it will not try to load from the npm folder."
+  :type 'file
+  :group 'lsp-elm)
+
+(defcustom lsp-elm-elm-test-path
+  ""
+  "The path to your elm-test executable.
+
+Should be empty by default, in that case it will assume the name and try
+to first get it from a local npm installation or a global one.  If you
+set it manually it will not try to load from the npm folder."
+  :type 'file
+  :group 'lsp-elm)
+
+(defcustom lsp-elm-disable-elmls-diagnostics
+  nil
+  "Enable/Disable linting diagnostics from the language server."
+  :type 'boolean
+  :group 'lsp-elm)
+
+(defcustom lsp-elm-only-update-diagnostics-on-save
+  nil
+  "Only update compiler diagnostics on save, not on document change."
+  :type 'boolean
+  :group 'lsp-elm)
+
+(defcustom lsp-elm-skip-install-package-confirmation
+  nil
+  "Skip confirmation for the Install Package code action."
+  :type 'boolean
+  :group 'lsp-elm)
+
+(defcustom lsp-elm-server-args
+  '("--stdio")
+  "Arguments to pass to the server."
+  :type '(repeat string)
+  :group 'lsp-elm)
+
+(defun lsp-elm--elm-language-server-command ()
+  "Generate LSP startup command for the Elm Language Server."
+  (cons
+   (or lsp-elm-elm-language-server-path
+       (lsp-package-path 'elm-language-server))
+   lsp-elm-server-args))
+
+(defun lsp-clients-elm--make-init-options ()
+  "Init options for elm-language-server."
+  `(:elmPath ,lsp-elm-elm-path
+    :elmFormatPath ,lsp-elm-elm-format-path
+    :elmTestPath ,lsp-elm-elm-test-path
+    :disableElmLSDiagnostics ,(lsp-json-bool lsp-elm-disable-elmls-diagnostics)
+    :onlyUpdateDiagnosticsOnSave ,(lsp-json-bool lsp-elm-only-update-diagnostics-on-save)
+    :skipInstallPackageConfirmation ,(lsp-json-bool lsp-elm-skip-install-package-confirmation)
+    :trace.server ,(lsp-json-bool lsp-elm-trace-server)))
+
+(lsp-dependency 'elm-language-server
+                '(:system "elm-language-server")
+                '(:npm :package "@elm-tooling/elm-language-server"
+                       :path "elm-language-server"))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection #'lsp-elm--elm-language-server-command)
+  :major-modes '(elm-mode)
+  :priority -1
+  :initialization-options #'lsp-clients-elm--make-init-options
+  :server-id 'elm-ls
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'elm-language-server callback error-callback))))
+
+(lsp-consistency-check lsp-elm)
+
+(provide 'lsp-elm)
+;;; lsp-elm.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-erlang.el b/elpa/lsp-mode-20220201.852/lsp-erlang.el
new file mode 100644 (file)
index 0000000..2deae83
--- /dev/null
@@ -0,0 +1,67 @@
+;;; lsp-erlang.el --- Erlang Client settings         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Roberto Aloi
+
+;; Author: Roberto Aloi
+;; Keywords: erlang lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-erlang client
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-erlang nil
+  "LSP support for the Erlang programming language, using erlang-ls"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/erlang-ls/erlang_ls"))
+
+(defcustom lsp-erlang-server-path
+  "erlang_ls"
+  "Path to the Erlang Language Server binary."
+  :group 'lsp-erlang
+  :risky t
+  :type 'file)
+
+(defcustom lsp-erlang-server-connection-type
+  'stdio
+  "Type of connection to use with the Erlang Language Server: tcp or stdio"
+  :group 'lsp-erlang
+  :risky t
+  :type 'symbol)
+
+(defun lsp-erlang-server-start-fun (port)
+  `(,lsp-erlang-server-path
+    "--transport" "tcp"
+    "--port" ,(number-to-string port)))
+
+(defun lsp-erlang-server-connection ()
+  (if (eq lsp-erlang-server-connection-type 'tcp)
+      (lsp-tcp-connection 'lsp-erlang-server-start-fun)
+    (lsp-stdio-connection `(,lsp-erlang-server-path "--transport" "stdio"))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-erlang-server-connection)
+                  :major-modes '(erlang-mode)
+                  :priority -1
+                  :server-id 'erlang-ls))
+
+(lsp-consistency-check lsp-erlang)
+
+(provide 'lsp-erlang)
+;;; lsp-erlang.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-eslint.el b/elpa/lsp-mode-20220201.852/lsp-eslint.el
new file mode 100644 (file)
index 0000000..74df3dd
--- /dev/null
@@ -0,0 +1,408 @@
+;;; lsp-eslint.el --- lsp-mode eslint integration    -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'lsp-protocol)
+(require 'lsp-mode)
+
+(defconst lsp-eslint/status-ok 1)
+(defconst lsp-eslint/status-warn 2)
+(defconst lsp-eslint/status-error 3)
+
+(defgroup lsp-eslint nil
+  "ESlint language server group."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/Microsoft/vscode-eslint"))
+
+(defcustom lsp-eslint-unzipped-path (f-join lsp-server-install-dir "eslint/unzipped")
+  "The path to the file in which `eslint' will be stored."
+  :type 'file
+  :group 'lsp-eslint
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-download-url "https://github.com/emacs-lsp/lsp-server-binaries/blob/master/dbaeumer.vscode-eslint-2.2.2.vsix?raw=true"
+  "Eslint language server download url."
+  :type 'string
+  :group 'lsp-eslint
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-eslint-server-command `("node"
+                                       "~/server/out/eslintServer.js"
+                                       "--stdio")
+  "Command to start eslint server."
+  :risky t
+  :type '(repeat string)
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-enable t
+  "Controls whether eslint is enabled for JavaScript files or not."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-package-manager "npm"
+  "The package manager you use to install node modules."
+  :type '(choice (const :tag "npm" "npm")
+                 (const :tag "yarn" "yarn")
+                 (const :tag "pnpm" "pnpm")
+                 (string :tag "other"))
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-format t
+  "Whether to perform format."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-node-path nil
+  "A path added to NODE_PATH when resolving the eslint module."
+  :type '(repeat string)
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-node "node"
+  "Path to nodejs."
+  :type 'file
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-options nil
+  "The eslint options object to provide args normally passed to
+  eslint when executed from a command line (see
+  http://eslint.org/docs/developer-guide/nodejs-api#cliengine)."
+  :type 'alist)
+
+(defcustom lsp-eslint-trace-server "off"
+  "Traces the communication between VSCode and the eslint linter service."
+  :type 'string)
+
+(defcustom lsp-eslint-run "onType"
+  "Run the linter on save (onSave) or on type (onType)"
+  :type '(choice (const :tag "onSave" "onSave")
+                 (const :tag "onType" "onType"))
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-auto-fix-on-save nil
+  "Turns auto fix on save on or off."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-fix-all-problem-type "all"
+  "Determines which problems are fixed when running the
+source.fixAll code action."
+  :type '(choice
+          (const "all")
+          (const "problems")
+          string)
+  :package-version '(lsp-mode . "7.0.1"))
+
+(defcustom lsp-eslint-quiet nil
+  "Turns on quiet mode, which ignores warnings."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-working-directories []
+  ""
+  :type 'lsp-string-vector
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-validate '("svelte")
+  "An array of language ids which should always be validated by eslint."
+  :type '(repeat string)
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-provide-lint-task nil
+  "Controls whether a task for linting the whole workspace will be available."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-lint-task-enable nil
+  "Controls whether a task for linting the whole workspace will be available."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-lint-task-options "."
+  "Command line options applied when running the task for linting the whole
+workspace (see https://eslint.org/docs/user-guide/command-line-interface)."
+  :type 'string
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-runtime nil
+  "The location of the node binary to run ESLint under."
+  :type '(repeat string)
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-code-action-disable-rule-comment t
+  "Controls whether code actions to add a rule-disabling comment should be shown."
+  :type 'bool
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-code-action-disable-rule-comment-location "separateLine"
+  "Controls where the disable rule code action places comments.
+
+Accepts the following values:
+- \"separateLine\": Add the comment above the line to be disabled (default).
+- \"sameLine\": Add the comment on the same line that will be disabled."
+  :type '(choice
+          (const "separateLine")
+          (const "sameLine"))
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-code-action-show-documentation t
+  "Controls whether code actions to show documentation for an eslint rule should
+be shown."
+  :type 'bool
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-warn-on-ignored-files nil
+  "Controls whether a warning should be emitted when a file is ignored."
+  :type 'bool
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-rules-customizations []
+  "Controls severity overrides for eslint rules.
+
+The value is a vector of alists, with each alist containing the following keys:
+- rule - The rule to match. Can match wildcards with *, or be prefixed with !
+  to negate the match.
+- severity - The severity to report this rule as. Can be one of the following:
+  - \"off\": Disable the rule.
+  - \"info\": Report as informational.
+  - \"warn\": Report as a warning.
+  - \"error\": Report as an error.
+  - \"upgrade\": Increase by 1 severity level (eg. warning -> error).
+  - \"downgrade\": Decrease by 1 severity level (eg. warning -> info).
+  - \"default\": Report as the same severity specified in the eslint config."
+  :type '(lsp-repeatable-vector
+          (alist :options ((rule string)
+                           (severity (choice
+                                      (const "off")
+                                      (const "info")
+                                      (const "warn")
+                                      (const "error")
+                                      (const "upgrade")
+                                      (const "downgrade")
+                                      (const "default"))))))
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-experimental-incremental-sync t
+  "Controls whether the new incremental text document synchronization should
+be used."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-eslint-save-library-choices t
+  "Controls whether to remember choices made to permit or deny ESLint libraries
+from running."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-eslint-library-choices-file (expand-file-name (locate-user-emacs-file ".lsp-eslint-choices"))
+  "The file where choices to permit or deny ESLint libraries from running is
+stored."
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp--find-eslint ()
+  (or
+   (when-let ((workspace-folder (lsp-find-session-folder (lsp-session) default-directory)))
+     (let ((eslint-local-path (f-join workspace-folder "node_modules" ".bin"
+                                      (if (eq system-type 'windows-nt) "eslint.cmd" "eslint"))))
+       (when (f-exists? eslint-local-path)
+         eslint-local-path)))
+   "eslint"))
+
+(defun lsp-eslint-create-default-configuration ()
+  "Create default eslint configuration."
+  (interactive)
+  (unless (lsp-session-folders (lsp-session))
+    (user-error "There are no workspace folders"))
+  (pcase (->> (lsp-session)
+              lsp-session-folders
+              (-filter (lambda (dir)
+                         (-none?
+                          (lambda (file) (f-exists? (f-join dir file)))
+                          '(".eslintrc.js" ".eslintrc.yaml" ".eslintrc.yml" ".eslintrc" ".eslintrc.json")))))
+    (`nil (user-error "All workspace folders contain eslint configuration"))
+    (folders (let ((default-directory (completing-read "Select project folder: " folders nil t)))
+               (async-shell-command (format "%s --init" (lsp--find-eslint)))))))
+
+(lsp-defun lsp-eslint-status-handler (workspace (&eslint:StatusParams :state))
+  (setf (lsp--workspace-status-string workspace)
+        (propertize "ESLint"
+                    'face (cond
+                           ((eq state lsp-eslint/status-error) 'error)
+                           ((eq state lsp-eslint/status-warn) 'warn)
+                           (t 'success)))))
+
+(lsp-defun lsp-eslint--configuration (_workspace (&ConfigurationParams :items))
+  (->> items
+       (seq-map (-lambda ((&ConfigurationItem :scope-uri?))
+                  (-when-let* ((file (lsp--uri-to-path scope-uri?))
+                               (buffer (find-buffer-visiting file))
+                               (workspace-folder (lsp-find-session-folder (lsp-session) file)))
+                    (with-current-buffer buffer
+                      (list :validate (if (member (lsp-buffer-language) lsp-eslint-validate) "on" "probe")
+                            :packageManager lsp-eslint-package-manager
+                            :codeAction (list
+                                         :disableRuleComment (list
+                                                              :enable (lsp-json-bool lsp-eslint-code-action-disable-rule-comment)
+                                                              :location lsp-eslint-code-action-disable-rule-comment-location)
+                                         :showDocumentation (list
+                                                             :enable (lsp-json-bool lsp-eslint-code-action-show-documentation)))
+                            :codeActionOnSave (list :enable (lsp-json-bool lsp-eslint-auto-fix-on-save)
+                                                    :mode lsp-eslint-fix-all-problem-type)
+                            :format (lsp-json-bool lsp-eslint-format)
+                            :quiet (lsp-json-bool lsp-eslint-quiet)
+                            :onIgnoredFiles (if lsp-eslint-warn-on-ignored-files "warn" "off")
+                            :options (or lsp-eslint-options (ht))
+                            :rulesCustomizations lsp-eslint-rules-customizations
+                            :run lsp-eslint-run
+                            :nodePath lsp-eslint-node-path
+                            :workspaceFolder (list :uri (lsp--path-to-uri workspace-folder)
+                                                   :name (f-filename workspace-folder)))))))
+       (apply #'vector)))
+
+(lsp-defun lsp-eslint--open-doc (_workspace (&eslint:OpenESLintDocParams :url))
+  "Open documentation."
+  (browse-url url))
+
+(defun lsp-eslint-apply-all-fixes ()
+  "Apply all autofixes in the current buffer."
+  (interactive)
+  (lsp-send-execute-command "eslint.applyAllFixes" (vector (lsp--versioned-text-document-identifier))))
+
+;; XXX: replace with `lsp-make-interactive-code-action' macro
+;; (lsp-make-interactive-code-action eslint-fix-all "source.fixAll.eslint")
+
+(defun lsp-eslint-fix-all ()
+  "Perform the source.fixAll.eslint code action, if available."
+  (interactive)
+  (condition-case nil
+      (lsp-execute-code-action-by-kind "source.fixAll.eslint")
+    (lsp-no-code-actions
+     (when (called-interactively-p 'any)
+       (lsp--info "source.fixAll.eslint action not available")))))
+
+(defun lsp-eslint-server-command ()
+  (if (lsp-eslint-server-exists? lsp-eslint-server-command)
+      lsp-eslint-server-command
+    `(,lsp-eslint-node ,(f-join lsp-eslint-unzipped-path
+                                "extension/server/out/eslintServer.js")
+                       "--stdio")))
+
+(defun lsp-eslint-server-exists? (eslint-server-command)
+  (let* ((command-name (f-base (f-filename (cl-first eslint-server-command))))
+         (first-argument (cl-second eslint-server-command))
+         (first-argument-exist (and first-argument (file-exists-p first-argument))))
+    (if (equal command-name lsp-eslint-node)
+        first-argument-exist
+      (executable-find (cl-first eslint-server-command)))))
+
+(defvar lsp-eslint--stored-libraries (ht)
+  "Hash table defining if a given path to an ESLint library is allowed to run.
+If the value for a key is 4, it will be allowed. If it is 1, it will not. If a
+value does not exist for the key, or the value is nil, the user will be prompted
+to allow or deny it.")
+
+(when (and (file-exists-p lsp-eslint-library-choices-file)
+           lsp-eslint-save-library-choices)
+  (setq lsp-eslint--stored-libraries (lsp--read-from-file lsp-eslint-library-choices-file)))
+
+(lsp-defun lsp-eslint--confirm-local (_workspace (&eslint:ConfirmExecutionParams :library-path) callback)
+  (if-let ((option-alist '(("Always" 4 . t)
+                           ("Yes" 4 . nil)
+                           ("No" 1 . nil)
+                           ("Never" 1 . t)))
+           (remembered-answer (gethash library-path lsp-eslint--stored-libraries)))
+      (funcall callback remembered-answer)
+    (lsp-ask-question
+     (format
+      "Allow lsp-mode to execute %s? Note: The latest versions of the ESLint language server no longer create this prompt."
+      library-path)
+     (mapcar 'car option-alist)
+     (lambda (response)
+       (let ((option (cdr (assoc response option-alist))))
+         (when (cdr option)
+           (puthash library-path (car option) lsp-eslint--stored-libraries)
+           (when lsp-eslint-save-library-choices
+             (lsp--persist lsp-eslint-library-choices-file lsp-eslint--stored-libraries)))
+         (funcall callback (car option)))))))
+
+(defun lsp-eslint--probe-failed (_workspace _message)
+  "Called when the server detects a misconfiguration in ESLint."
+  (lsp--error "ESLint is not configured correctly. Please ensure your eslintrc is set up for the languages you are using."))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection
+  (lsp-stdio-connection
+   (lambda () (lsp-eslint-server-command))
+   (lambda () (lsp-eslint-server-exists? (lsp-eslint-server-command))))
+  :activation-fn (lambda (filename &optional _)
+                   (when lsp-eslint-enable
+                     (or (string-match-p (rx (one-or-more anything) "."
+                                             (or "ts" "js" "jsx" "tsx" "html" "vue" "svelte")eos)
+                                         filename)
+                         (and (derived-mode-p 'js-mode 'js2-mode 'typescript-mode 'html-mode 'svelte-mode)
+                           (not (string-match-p "\\.json\\'" filename))))))
+  :priority -1
+  :completion-in-comments? t
+  :add-on? t
+  :multi-root t
+  :notification-handlers (ht ("eslint/status" #'lsp-eslint-status-handler))
+  :request-handlers (ht ("workspace/configuration" #'lsp-eslint--configuration)
+                        ("eslint/openDoc" #'lsp-eslint--open-doc)
+                        ("eslint/probeFailed" #'lsp-eslint--probe-failed))
+  :async-request-handlers (ht ("eslint/confirmESLintExecution" #'lsp-eslint--confirm-local))
+  :server-id 'eslint
+  :initialized-fn (lambda (workspace)
+                    (with-lsp-workspace workspace
+                      (lsp--server-register-capability
+                       (lsp-make-registration
+                        :id "random-id"
+                        :method "workspace/didChangeWatchedFiles"
+                        :register-options? (lsp-make-did-change-watched-files-registration-options
+                                            :watchers
+                                            `[,(lsp-make-file-system-watcher
+                                                :glob-pattern "**/.eslintr{c.js,c.yaml,c.yml,c,c.json}")
+                                              ,(lsp-make-file-system-watcher
+                                                :glob-pattern "**/.eslintignore")
+                                              ,(lsp-make-file-system-watcher
+                                                :glob-pattern "**/package.json")])))))
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (let ((tmp-zip (make-temp-file "ext" nil ".zip")))
+                          (delete-file tmp-zip)
+                          (lsp-download-install
+                           (lambda (&rest _)
+                             (condition-case err
+                                 (progn
+                                   (lsp-unzip tmp-zip lsp-eslint-unzipped-path)
+                                   (funcall callback))
+                               (error (funcall error-callback err))))
+                           error-callback
+                           :url lsp-eslint-download-url
+                           :store-path tmp-zip)))))
+
+(lsp-consistency-check lsp-eslint)
+
+(provide 'lsp-eslint)
+;;; lsp-eslint.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-fortran.el b/elpa/lsp-mode-20220201.852/lsp-fortran.el
new file mode 100644 (file)
index 0000000..c9ffb7a
--- /dev/null
@@ -0,0 +1,61 @@
+;;; lsp-fortran.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, fortran
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Fortran Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-fortran nil
+  "LSP support for Fortran, using the Fortran Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/hansec/fortran-language-server"))
+
+(defcustom lsp-clients-fortls-executable "fortls"
+  "The fortls executable to use.
+Leave as just the executable name to use the default behavior of
+finding the executable with `exec-path'."
+  :group 'lsp-fortran
+  :risky t
+  :type 'file)
+
+(defcustom lsp-clients-fortls-args '()
+  "Extra arguments for the fortls executable"
+  :group 'lsp-fortran
+  :risky t
+  :type '(repeat string))
+
+(defun lsp-clients--fortls-command ()
+  "Generate the language server startup command."
+  `(,lsp-clients-fortls-executable,@lsp-clients-fortls-args))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection 'lsp-clients--fortls-command)
+                  :major-modes '(f90-mode fortran-mode)
+                  :priority -1
+                  :server-id 'fortls))
+
+(lsp-consistency-check lsp-fortran)
+
+(provide 'lsp-fortran)
+;;; lsp-fortran.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-fsharp.el b/elpa/lsp-mode-20220201.852/lsp-fsharp.el
new file mode 100644 (file)
index 0000000..2668b48
--- /dev/null
@@ -0,0 +1,331 @@
+;;; lsp-fsharp.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Reed Mullanix
+
+;; Author: Reed Mullanix <reedmullanixNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-fsharp client
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-fsharp nil
+  "LSP support for the F# Programming Language, using the FsharpAutoComplete server."
+  :link '(url-link "https://github.com/fsharp/FsAutoComplete")
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-fsharp-server-runtime 'net-core
+  "The .NET runtime to use."
+  :group 'lsp-fsharp
+  :type '(choice (const :tag "Use .Net Core" net-core)
+                 (const :tag "Use Mono" mono)
+                 (const :tag "Use .Net Framework" net-framework))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-fsharp-server-install-dir (f-join lsp-server-install-dir "fsautocomplete/")
+  "Install directory for fsautocomplete server.
+The slash is expected at the end."
+  :group 'lsp-fsharp
+  :risky t
+  :type 'directory
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-fsharp-server-args nil
+  "Extra arguments for the F# language server."
+  :type '(repeat string)
+  :group 'lsp-fsharp
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-fsharp-keywords-autocomplete t
+  "Provides keywords in autocomplete list."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-external-autocomplete nil
+  "Provides autocompletion for symbols from not opened namespaces/modules;
+inserts open on accept."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-linter t
+  "Enables FSharpLint integration, provides additional warnings and code
+action fixes."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-union-case-stub-generation t
+  "Enables a code action to generate pattern matching cases."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-union-case-stub-generation-body "failwith \"Not Implemented\""
+  "Defines dummy body used by pattern matching generator."
+  :group 'lsp-fsharp
+  :type 'string
+  :risky t
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-record-stub-generation t
+  "Enables code action to generate record stub."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-record-stub-generation-body "failwith \"Not Implemented\""
+  "Defines dummy body used by record stub generator."
+  :group 'lsp-fsharp
+  :type 'string
+  :risky t
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-interface-stub-generation t
+  "Enables code action to generate an interface stub."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-interface-stub-generation-object-identifier "this"
+  "Defines object identifier used by interface stub generator,
+e.g. `this' or `self'."
+  :group 'lsp-fsharp
+  :type 'string
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-interface-stub-generation-method-body "failwith \"Not Implemented\""
+  "Defines dummy body used by interface stub generator."
+  :group 'lsp-fsharp
+  :type 'string
+  :risky t
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-unused-opens-analyzer t
+  "Enables unused open detection."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-unused-declarations-analyzer t
+  "Enables unused symbol detection."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-simplify-name-analyzer nil
+  "Enables simplify name analyzer and remove redundant qualifier quick fix."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-resolve-namespaces t
+  "Enables resolve namespace quick fix; adds `open' if symbol is from not yet
+opened module/namespace."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-enable-reference-code-lens t
+  "Enables reference count code lenses.
+It is recommended to disable if `--backgorund-service-enabled' is not used."
+  :group 'lsp-fsharp
+  :type 'bool
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-fsharp-auto-workspace-init nil
+  "Enable automatic workspace initialization.
+Do note that this can cause unexpected or challenging behaviors, as solutions
+with test projects are not autoloaded by FSharpAutoComplete."
+  :group 'lsp-fsharp
+  :type 'bool
+  :risky t)
+
+(defun lsp-fsharp--fsac-runtime-cmd ()
+  "Get the command required to run fsautocomplete based off of the
+current runtime."
+  (pcase lsp-fsharp-server-runtime
+    ('net-core "dotnet")
+    ('mono "mono")
+    ('net-framework nil)))
+
+(defun lsp-fsharp--fsac-cmd ()
+  "The location of fsautocomplete executable."
+  (let ((file-ext (if (eq lsp-fsharp-server-runtime 'net-core)
+                      ".dll"
+                    ".exe")))
+    (expand-file-name (concat "fsautocomplete" file-ext) lsp-fsharp-server-install-dir)))
+
+(defun lsp-fsharp--version-list-latest (lst)
+  "Return latest version from LST (if any)."
+  (->> lst
+       (-map (lambda (x) (car (s-split " " x))))
+       (-filter (lambda (x) (> (length x) 0)))
+       (-sort (lambda (a b) (not (version<= (substring a 1)
+                                            (substring b 1)))))
+       cl-first))
+
+(defun lsp-fsharp--fetch-json (url)
+  "Retrieve and parse JSON from URL."
+  (with-temp-buffer
+    (url-insert-file-contents url)
+    (let ((json-false :false))
+      (json-read))))
+
+(defun lsp-fsharp--latest-version-from-github ()
+  "Return latest version of the server available from github."
+   (lsp-fsharp--version-list-latest
+    (seq-map (lambda (elt) (s-trim (cdr (assq 'name elt))))
+             (lsp-fsharp--fetch-json "https://api.github.com/repos/fsharp/FsAutoComplete/releases"))))
+
+(defun lsp-fsharp--server-download-url (version)
+  "Return url for .zip file to download for given VERSION, depending on `lsp-fsharp-server-runtime'."
+  (concat "https://github.com/fsharp/FsAutoComplete/releases/download"
+          "/" version
+          "/" (if (eq lsp-fsharp-server-runtime 'net-core)
+                  "fsautocomplete.netcore.zip"
+                "fsautocomplete.zip")))
+
+(defun lsp-fsharp--change-permissions (install-dir-full)
+  (unless (eq system-type 'windows-nt) ; Windows does not have chmod
+      (lsp--info "Altering permissions")
+      (dolist (file (directory-files-recursively install-dir-full ""))
+       (if (file-directory-p file)
+           (chmod file #o755)
+         (chmod file #o644)))
+      (lsp--info "Finished altering permissions")))
+
+(defun lsp-fsharp--fsac-install (_client callback _error-callback _update?)
+  "Download the latest version of fsautocomplete and extract it to `lsp-fsharp-server-install-dir'."
+  (let* ((temp-file (make-temp-file "fsautocomplete" nil ".zip"))
+         (install-dir-full (expand-file-name lsp-fsharp-server-install-dir))
+         (unzip-script (cond ((executable-find "unzip") (format "mkdir -p %s && unzip -qq %s -d %s" install-dir-full temp-file install-dir-full))
+                             ((executable-find "powershell") (format "powershell -noprofile -noninteractive -nologo -ex bypass Expand-Archive -path '%s' -dest '%s'" temp-file install-dir-full))
+                             (t (user-error (format "Unable to unzip server - file %s cannot be extracted, please extract it manually" temp-file)))))
+         (latest-version (lsp-fsharp--latest-version-from-github))
+         (server-download-url (lsp-fsharp--server-download-url latest-version)))
+    (url-copy-file server-download-url temp-file t)
+    (shell-command unzip-script)
+    (lsp-fsharp--change-permissions install-dir-full)
+    (shell-command (format "%s %s --version" (lsp-fsharp--fsac-runtime-cmd) (lsp-fsharp--fsac-cmd)))
+    (funcall callback)))
+
+(defun lsp-fsharp-update-fsac ()
+  "Update fsautocomplete to the latest version."
+  (interactive)
+  (-let [install-dir (f-expand lsp-fsharp-server-install-dir)]
+    (f-delete install-dir t)
+    (lsp-fsharp--fsac-install nil #'ignore #'lsp--error t)))
+
+(defun lsp-fsharp--make-launch-cmd ()
+  "Build the command required to launch fsautocomplete."
+  (append (list (lsp-fsharp--fsac-runtime-cmd) (lsp-fsharp--fsac-cmd) "--background-service-enabled")
+          lsp-fsharp-server-args))
+
+(defun lsp-fsharp--project-list ()
+  "Get the list of files we need to send to fsharp/workspaceLoad."
+  (let* ((response (lsp-request "fsharp/workspacePeek"
+                                `(:directory ,(lsp-workspace-root)
+                                             :deep 10
+                                             :excludedDirs ["paket-files" ".git" "packages" "node_modules"])))
+         (data (lsp--read-json (lsp-get response :content)))
+         (found (-> data (lsp-get :Data) (lsp-get :Found)))
+         (directory (seq-find (lambda (d) (equal "directory" (lsp-get d :Type))) found)))
+    (-> directory (lsp-get :Data) (lsp-get :Fsprojs))))
+
+;;;###autoload
+(defun lsp-fsharp--workspace-load (projects)
+  "Load all of the provided PROJECTS."
+  (lsp-request-async "fsharp/workspaceLoad"
+                     `(:textDocuments ,(vconcat [] (mapcar (lambda (p) `(:uri ,p)) projects)))
+                     (lambda (_)
+                       (lsp--info "Workspace Loaded!"))))
+
+(defvar lsp-fsharp--default-init-options  (list)
+  "Default init options to be passed to FSharpAutoComplete,
+  updated conditionally by `lsp-fsharp--make-init-options'.")
+
+(defun lsp-fsharp--make-init-options ()
+  "Init options for F#."
+  (-let [opts lsp-fsharp--default-init-options]
+    (if lsp-fsharp-auto-workspace-init
+        (push '(:AutomaticWorkspaceInit . t) opts)
+      opts)))
+
+(lsp-register-custom-settings
+ `(("FSharp.KeywordsAutocomplete" lsp-fsharp-keywords-autocomplete t)
+   ("FSharp.ExternalAutocomplete" lsp-fsharp-external-autocomplete t)
+   ("FSharp.Linter" lsp-fsharp-linter t)
+   ("FSharp.UnionCaseStubGeneration" lsp-fsharp-union-case-stub-generation t)
+   ("FSharp.UnionCaseStubGenerationBody" lsp-fsharp-union-case-stub-generation-body)
+   ("FSharp.RecordStubGeneration" lsp-fsharp-record-stub-generation t)
+   ("FSharp.RecordStubGenerationBody" lsp-fsharp-record-stub-generation-body)
+   ("FSharp.InterfaceStubGeneration" lsp-fsharp-interface-stub-generation t)
+   ("FSharp.InterfaceStubGenerationObjectIdentifier" lsp-fsharp-interface-stub-generation-object-identifier)
+   ("FSharp.InterfaceStubGenerationMethodBody" lsp-fsharp-interface-stub-generation-method-body)
+   ("FSharp.UnusedOpensAnalyzer" lsp-fsharp-unused-opens-analyzer t)
+   ("FSharp.UnusedDeclarationsAnalyzer" lsp-fsharp-unused-declarations-analyzer t)
+   ("FSharp.SimplifyNameAnalyzer" lsp-fsharp-simplify-name-analyzer t)
+   ("FSharp.ResolveNamespaces" lsp-fsharp-resolve-namespaces t)
+   ("FSharp.EnableReferenceCodeLens" lsp-fsharp-enable-reference-code-lens t)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   #'lsp-fsharp--make-launch-cmd
+                                   (lambda () (f-exists? (lsp-fsharp--fsac-cmd))))
+                  :major-modes '(fsharp-mode)
+                  :notification-handlers (ht ("fsharp/notifyCancel" #'ignore)
+                                             ("fsharp/notifyWorkspace" #'ignore)
+                                             ("fsharp/fileParsed" #'ignore)
+                                             ("fsharp/notifyWorkspacePeek" #'ignore))
+                  :initialization-options 'lsp-fsharp--make-init-options
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      ;; Something needs to be calling lsp--set-configuration
+                                      (progn
+                                        (lsp--set-configuration
+                                         (lsp-configuration-section "fsharp"))
+                                        (lsp-fsharp--workspace-load
+                                         (lsp-fsharp--project-list)))))
+                  :after-open-fn ;; workaround https://github.com/fsharp/FsAutoComplete/issues/833
+                  (lambda ()
+                    (setq-local lsp-default-create-error-handler-fn
+                                (lambda (method)
+                                  (lambda (error)
+                                    (when
+                                        (not
+                                         (seq-find (lambda (s)
+                                                     (string= s (lsp-get error :message)))
+                                                   '("Index was outside the bounds of the array."
+                                                     "No symbol information found"
+                                                     "No ident at this location")))
+                                      (lsp--warn
+                                       "%s"
+                                       (or (lsp--error-string error)
+                                           (format "%s Request has failed" method))))))))
+                  :server-id 'fsac
+                  :download-server-fn #'lsp-fsharp--fsac-install))
+
+(lsp-consistency-check lsp-fsharp)
+
+(provide 'lsp-fsharp)
+;;; lsp-fsharp.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-gdscript.el b/elpa/lsp-mode-20220201.852/lsp-gdscript.el
new file mode 100644 (file)
index 0000000..4a52ec8
--- /dev/null
@@ -0,0 +1,61 @@
+;;; lsp-gdscript.el --- LSP mode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Oliver Frank
+
+;; Author: Oliver Frank <oliverfrank321NOSPAMgmail.com>
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-gdscript client
+
+;;; Code:
+(require 'lsp-mode)
+
+(defgroup lsp-gdscript nil
+  "LSP support for GDScript, using godot's language server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/godotengine/godot")
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-gdscript-port 6008
+  "Port to connect server to"
+  :type 'integer
+  :group 'lsp-gdscript)
+
+(defun lsp-gdscript-tcp-connect-to-port ()
+  (list
+   :connect (lambda (filter sentinel name _environment-fn)
+              (let* ((host "localhost")
+                     (port lsp-gdscript-port)
+                     (tcp-proc (lsp--open-network-stream host port (concat name "::tcp"))))
+
+                (set-process-query-on-exit-flag tcp-proc nil)
+                (set-process-filter tcp-proc filter)
+                (set-process-sentinel tcp-proc sentinel)
+                (cons tcp-proc tcp-proc)))
+   :test? (lambda () t)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-gdscript-tcp-connect-to-port)
+                  :major-modes '(gdscript-mode)
+                  :server-id 'gdscript))
+
+
+(lsp-consistency-check lsp-gdscript)(provide 'lsp-gdscript)
+
+
+;;; lsp-gdscript.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-go.el b/elpa/lsp-mode-20220201.852/lsp-go.el
new file mode 100644 (file)
index 0000000..874b576
--- /dev/null
@@ -0,0 +1,337 @@
+;;; lsp-go.el --- Go Client settings             -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Muir Manders
+
+;; Author: Muir Manders <muirNOSPAMmnd.rs>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-go client
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'lsp-completion)
+
+(defgroup lsp-go nil
+  "LSP support for the Go Programming Language, using the gopls language server."
+  :link '(url-link "https://github.com/golang/tools/blob/master/gopls/README.md")
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.3.2"))
+
+(define-obsolete-variable-alias
+  'lsp-gopls-server-path
+  'lsp-go-gopls-server-path
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-gopls-server-path "gopls"
+  "Path to gopls server binary."
+  :type 'string
+  :group 'lsp-go)
+
+(define-obsolete-variable-alias
+  'lsp-gopls-server-args
+  'lsp-go-gopls-server-args
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-gopls-server-args nil
+  "Extra CLI arguments for gopls."
+  :type '(repeat string)
+  :group 'lsp-go)
+
+(define-obsolete-variable-alias
+  'lsp-gopls-use-placeholders
+  'lsp-go-use-placeholders
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-use-placeholders t
+  "Cause gopls to provide placeholder parameter snippets when
+completing function calls."
+  :type 'boolean
+  :group 'lsp-go)
+
+(define-obsolete-variable-alias
+  'lsp-gopls-build-flags
+  'lsp-go-build-flags
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-build-flags []
+  "A vector of flags passed on to the build system when invoked,
+  applied to queries like `go list'."
+  :type 'lsp-string-vector
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "6.2"))
+
+(define-obsolete-variable-alias
+  'lsp-gopls-env
+  'lsp-go-env
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-env nil
+  "`gopls' has the unusual ability to set environment variables,
+  intended to affect the behavior of commands invoked by `gopls'
+  on the user's behalf. This variable takes a hash table of env
+  var names to desired values."
+  :type '(alist :key-type (symbol :tag "env var name") :value-type (string :tag "value"))
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "6.2"))
+
+(defcustom lsp-go-directory-filters []
+  "A vector of directory filters."
+  :link '(url-link "https://github.com/golang/tools/blob/67e49ef2d0f326051e22a4a55bdf9344ae1a8ed8/gopls/doc/settings.md#directoryfilters-string")
+  :group 'lsp-go
+  :type 'lsp-string-vector
+  :package-version '(lsp-mode "8.0.0"))
+
+(define-obsolete-variable-alias
+  'lsp-gopls-hover-kind
+  'lsp-go-hover-kind
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-hover-kind "SynopsisDocumentation"
+  "`gopls' allows the end user to select the desired amount of
+  documentation returned during e.g. hover and thing-at-point
+  operations."
+  :type '(choice (const "SynopsisDocumentation")
+                 (const "NoDocumentation")
+                 (const "FullDocumentation")
+                 (const "SingleLine")
+                 (const "Structured"))
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "6.2"))
+
+(define-obsolete-variable-alias
+  'lsp-gopls-available-codelens
+  'lsp-go-available-codelenses
+  "lsp-mode 7.0.1")
+
+(define-obsolete-variable-alias
+  'lsp-go-available-codelens
+  'lsp-go-available-codelenses
+  "lsp-mode 7.0.1")
+
+(defvar lsp-go-available-codelenses
+  '(
+    (gc_details . "Toggle the calculation of gc annotations")
+    (generate . "Run `go generate` for a directory")
+    (regenerate_cgo . "Regenerate cgo definitions")
+    (test . "Run `go test` for a specific set of test or benchmark functions (lgeacy)")
+    (tidy . "Run `go mod tidy` for a module")
+    (upgrade_dependency . "Upgrade a dependency")
+    (vendor . "Runs `go mod vendor' for a module"))
+  "Available codelenses that can be further enabled or disabled
+  through `lsp-go-codelenses'.")
+
+(defun lsp-go--defcustom-available-as-alist-type (alist)
+  "Returns a list suitable for the `:type' field in a `defcustom' used to populate an alist.
+
+The input ALIST has the form `((\"name\" . \"documentation sentence\") [...])'
+
+The returned type provides a tri-state that either:
+  - does not include the element in the alist
+  - sets element to false (actually, :json-false)
+  - sets element to true (actually, t)
+"
+  (let ((list '()))
+       (dolist (v alist)
+         (push `(cons
+                         :tag ,(cdr v)
+                         (const :format "" ,(car v))
+                         (choice (const :tag "Enable" t) (const :tag "Disable" :json-false)))
+                       list))
+       (push 'set list)
+       list))
+
+(define-obsolete-variable-alias
+  'lsp-gopls-codelens
+  'lsp-go-codelenses
+  "lsp-mode 7.0.1")
+
+(define-obsolete-variable-alias
+  'lsp-go-codelens
+  'lsp-go-codelenses
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-codelenses '((gc_details . :json-false)
+                              (generate . t)
+                              (regenerate_cgo . t)
+                              (tidy . t)
+                              (upgrade_dependency . t)
+                              (test . t)
+                              (vendor . t))
+  "Select what codelenses should be enabled or not.
+
+The codelenses can be found at https://github.com/golang/tools/blob/3fa0e8f87c1aae0a9adc2a63af1a1945d16d9359/internal/lsp/source/options.go#L106-L112."
+  :type (lsp-go--defcustom-available-as-alist-type lsp-go-available-codelenses)
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "7.0"))
+
+(define-obsolete-variable-alias
+  'lsp-clients-go-library-directories
+  'lsp-go-library-directories
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-library-directories '("/usr")
+  "List of directories which will be considered to be libraries."
+  :group 'lsp-go
+  :risky t
+  :type '(repeat string))
+
+(define-obsolete-variable-alias
+  'lsp-clients-go-library-directories-include-go-modules
+  'lsp-go-library-directories-include-go-modules
+  "lsp-mode 7.0.1")
+
+(defcustom lsp-go-library-directories-include-go-modules t
+  "Whether or not $GOPATH/pkg/mod should be included as a library directory."
+  :type 'boolean
+  :group 'lsp-go)
+
+(defun lsp-go--library-default-directories (_workspace)
+  "Calculate go library directories.
+
+If `lsp-go-library-directories-include-go-modules' is non-nil
+and the environment variable GOPATH is set this function will return
+$GOPATH/pkg/mod along with the value of
+`lsp-go-library-directories'."
+  (let ((library-dirs lsp-go-library-directories))
+    (when (and lsp-go-library-directories-include-go-modules
+               (or (and (not (file-remote-p default-directory)) (executable-find "go"))
+                   (and (version<= "27.0" emacs-version) (with-no-warnings (executable-find "go" (file-remote-p default-directory))))))
+      (with-temp-buffer
+        (when (zerop (process-file "go" nil t nil "env" "GOPATH"))
+          (setq library-dirs
+                (append
+                 library-dirs
+                 (list
+                  (concat
+                   (string-trim-right (buffer-substring (point-min) (point-max)))
+                   "/pkg/mod")))))))
+    (if (file-remote-p default-directory)
+        (mapcar (lambda (path) (concat (file-remote-p default-directory) path)) library-dirs)
+      library-dirs)))
+
+(defcustom lsp-go-link-target "pkg.go.dev"
+  "Which website to use for displaying Go documentation."
+  :type '(choice (const "pkg.go.dev")
+                (string :tag "A custom website"))
+  :group 'lsp-go
+  :package-version '(lsp-mode "7.0.1"))
+
+(defcustom lsp-go-links-in-hover t
+  "If non-nil, hover documentation includes links."
+  :type 'boolean
+  :group 'lsp-go
+  :package-version '(lsp-mode "8.0.0"))
+
+(defcustom lsp-go-use-gofumpt nil
+  "If non-nil, use gofumpt formatting."
+  :type 'boolean
+  :group 'lsp-go
+  :package-version '(lsp-mode "8.0.0"))
+
+(defcustom lsp-go-goimports-local ""
+  "Equivalent of the goimports -local flag, which puts imports beginning with
+ this string after third-party packages.  It should be the prefix of the import
+ path whose imports should be grouped separately."
+  :type 'string
+  :group 'lsp-go
+  :package-version '(lsp-mode "8.0.0"))
+
+(defcustom lsp-go-analyses nil
+  "Specify analyses that the user would like to enable or disable. A map of the
+  names of analysis passes that should be enabled/disabled. A full list of
+  analyzers that gopls uses can be found at
+  https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md"
+  :type '(alist :key-type (string :tag "analyzer name") :value-type (boolean :tag "value"))
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "8.0.0"))
+
+(defcustom lsp-go-import-shortcut "Both"
+  "Specifies whether import statements should link to documentation or go to 
+  definitions."
+  :type '(choice (const "Both")
+                 (const "Link")
+                 (const "Definition"))
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "8.0.0"))
+
+(defcustom lsp-go-symbol-matcher "Fuzzy"
+  "Sets the algorithm that is used when finding workspace symbols."
+  :type '(choice (const "Fuzzy")
+                 (const "CaseInsensitive")
+                 (const "CaseSensitive"))
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "8.0.0"))
+
+(defcustom lsp-go-symbol-style "Dynamic"
+  "Controls how symbols are qualified in symbol responses.
+
+  'Dynamic' uses whichever qualifier results in the highest scoring match for
+  the given symbol query. Here a 'qualifier' is any '/' or '.' delimited suffix
+  of the fully qualified symbol. i.e. 'to/pkg.Foo.Field' or just 'Foo.Field'.
+
+  'Full' is fully qualified symbols, i.e. 'path/to/pkg.Foo.Field'.
+
+  'Package' is package qualified symbols i.e. 'pkg.Foo.Field'."
+  :type '(choice (const "Dynamic")
+                 (const "Full")
+                 (const "Package"))
+  :group 'lsp-go
+  :risky t
+  :package-version '(lsp-mode "8.0.0"))
+
+(lsp-register-custom-settings
+ '(("gopls.usePlaceholders" lsp-go-use-placeholders t)
+   ("gopls.hoverKind" lsp-go-hover-kind)
+   ("gopls.buildFlags" lsp-go-build-flags)
+   ("gopls.env" lsp-go-env)
+   ("gopls.linkTarget" lsp-go-link-target)
+   ("gopls.codelenses" lsp-go-codelenses)
+   ("gopls.linksInHover" lsp-go-links-in-hover t)
+   ("gopls.gofumpt" lsp-go-use-gofumpt t)
+   ("gopls.local" lsp-go-goimports-local)
+   ("gopls.directoryFilters" lsp-go-directory-filters)
+   ("gopls.analyses" lsp-go-analyses)
+   ("gopls.importShortcut" lsp-go-import-shortcut)
+   ("gopls.symbolMatcher" lsp-go-symbol-matcher)
+   ("gopls.symbolStyle" lsp-go-symbol-style)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda () (cons lsp-go-gopls-server-path lsp-go-gopls-server-args)))
+                  :major-modes '(go-mode go-dot-mod-mode)
+                  :language-id "go"
+                  :priority 0
+                  :server-id 'gopls
+                  :completion-in-comments? t
+                  :library-folders-fn #'lsp-go--library-default-directories
+                  :after-open-fn (lambda ()
+                                   ;; https://github.com/golang/tools/commit/b2d8b0336
+                                   (setq-local lsp-completion-filter-on-incomplete nil))))
+
+(lsp-consistency-check lsp-go)
+
+(provide 'lsp-go)
+;;; lsp-go.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-graphql.el b/elpa/lsp-mode-20220201.852/lsp-graphql.el
new file mode 100644 (file)
index 0000000..3b1bfba
--- /dev/null
@@ -0,0 +1,73 @@
+;;; lsp-graphql.el --- lsp client for graphql        -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021  Binbin Ye
+
+;; Author: Binbin Ye
+;; Keywords: lsp, graphql
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Support for running graphql lsp.  Support multiple server running at the same time when editing tsx/jsx.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(lsp-dependency 'graphql-language-service-cli
+                '(:npm :package "graphql-language-service-cli"
+                       :path "graphql-lsp"))
+
+
+(defgroup lsp-graphql nil
+  "LSP support for the GraphQL, using the graphql-language-service-cli as language server."
+  :link '(url-link "https://github.com/graphql/graphiql/tree/main/packages/graphql-language-service-cli#readme")
+  :group 'lsp-mode)
+
+(defcustom lsp-clients-graphql-server-args '("server" "--method=stream")
+  "CLI arguments for graphql language server."
+  :type '(repeat string)
+  :risky t
+  :group 'lsp-graphql)
+
+(defun lsp-graphql-activate-p (filename &optional _)
+  "Check if the GraphQL language server should be enabled based on FILENAME."
+  (or (string-match-p (rx (one-or-more anything) "."
+                        (or "ts" "js" "jsx" "tsx" "vue" "graphql" "gql")eos)
+        filename)
+    (and (derived-mode-p 'js-mode 'js2-mode 'typescript-mode)
+      (not (derived-mode-p 'json-mode)))))
+
+(lsp-register-client
+  (make-lsp-client :new-connection (lsp-stdio-connection (lambda()
+                                                           (cons (lsp-package-path 'graphql-language-service-cli)
+                                                                 lsp-clients-graphql-server-args)))
+                   :major-modes '(graphql-mode)
+                   :language-id "graphql"
+                   :server-id 'graphql-lsp
+                   :priority -3
+                   :add-on? t
+                   :multi-root t
+                   :activation-fn 'lsp-graphql-activate-p
+                   :download-server-fn (lambda (_client callback error-callback _update?)
+                                         (lsp-package-ensure
+                                          'graphql-language-service-cli
+                                          callback
+                                          error-callback))))
+
+(lsp-consistency-check lsp-graphql)
+
+(provide 'lsp-graphql)
+;;; lsp-graphql.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-groovy.el b/elpa/lsp-mode-20220201.852/lsp-groovy.el
new file mode 100644 (file)
index 0000000..c1fcaaf
--- /dev/null
@@ -0,0 +1,66 @@
+;;; lsp-groovy.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, groovy
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Groovy Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'f)
+
+(defgroup lsp-groovy nil
+  "LSP support for Groovy, using groovy-language-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/prominic/groovy-language-server"))
+
+(defcustom lsp-groovy-server-file (f-join lsp-server-install-dir "groovy-language-server-all.jar")
+  "JAR file path for groovy-language-server-all.jar."
+  :group 'lsp-groovy
+  :risky t
+  :type 'file)
+
+(defun lsp-groovy--lsp-command ()
+  "Generate LSP startup command."
+  `("java" "-jar" ,(expand-file-name lsp-groovy-server-file)))
+
+(defcustom lsp-groovy-classpath ["/usr/local/opt/groovy/libexec/lib"]
+  "List of paths to Groovy JARs."
+  :group 'lsp-groovy
+  :risky t
+  :type 'lsp-string-vector)
+
+(lsp-register-custom-settings
+ '(("groovy.classpath" lsp-groovy-classpath)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection 'lsp-groovy--lsp-command)
+                  :major-modes '(groovy-mode)
+                  :priority -1
+                  :server-id 'groovy-ls
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration (lsp-configuration-section "groovy"))))))
+
+(lsp-consistency-check lsp-groovy)
+
+(provide 'lsp-groovy)
+;;; lsp-groovy.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-hack.el b/elpa/lsp-mode-20220201.852/lsp-hack.el
new file mode 100644 (file)
index 0000000..161659a
--- /dev/null
@@ -0,0 +1,54 @@
+;;; lsp-xxx.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, hack
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Hack Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-hack nil
+  "LSP support for Hack, using HHVM."
+  :group 'lsp-mode
+  :link '(url-link "https://docs.hhvm.com/hhvm"))
+
+(defcustom lsp-clients-hack-command '("hh_client" "lsp" "--from" "emacs")
+  "Command to start hh_client."
+  :group 'lsp-hack
+  :risky t
+  :type '(repeat string))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-clients-hack-command))
+                  :major-modes '(hack-mode)
+                  :priority -1
+                  :server-id 'hack
+                  ;; ignore some unsupported messages from Nuclide
+                  :notification-handlers (lsp-ht ("telemetry/event" 'ignore)
+                                                 ("$/cancelRequest" 'ignore))
+                  :request-handlers (lsp-ht ("window/showStatus" 'ignore))))
+
+
+(lsp-consistency-check lsp-hack)
+
+(provide 'lsp-hack)
+;;; lsp-hack.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-haxe.el b/elpa/lsp-mode-20220201.852/lsp-haxe.el
new file mode 100644 (file)
index 0000000..62707be
--- /dev/null
@@ -0,0 +1,226 @@
+;;; lsp-haxe.el --- Haxe Client settings             -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Yannik Böttcher
+
+;; Author: Yannik Böttcher <yannikboettcherNOSPAMoutlook.de>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-haxe client
+
+;;; Code:
+
+
+;; adapted from lsp-clangd configuration
+(require 'lsp-protocol)
+(require 'lsp-mode)
+
+(defgroup lsp-haxe nil
+  "LSP support for Haxe using the language server provided by vshaxe"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/vshaxe/vshaxe"))
+
+
+;; Haxe ls is executed via node
+(defcustom lsp-clients--haxe-executable "node"
+  "Haxe ls is executed via node."
+  :group 'lsp-haxe
+  :risky t
+  :type 'file)
+
+;; The server.js is being passed to node as an argument
+(defcustom lsp-clients--haxe-server-path (expand-file-name "~/.haxe-language-server/bin/server.js")
+  "The path to the server.js file."
+  :group 'lsp-haxe
+  :risky t
+  :type 'file)
+
+;; Build the actual Haxe ls command.
+(defun lsp-clients--haxe-command ()
+  "Haxe ls startup command."
+  `(,lsp-clients--haxe-executable ,lsp-clients--haxe-server-path))
+
+;; https://github.com/yyoncho/lsp-mode/commit/72186e1adc089d772c87ed8f287eb3333b66bfa7
+;; This is to force the client to send a didChangeConfiguration Message. Without this, the server won't start, https://github.com/vshaxe/vshaxe/issues/328#issuecomment-471809093
+(defcustom lsp-clients--haxe-settings (list :haxe.executable "haxe")
+  "Lsp clients configuration settings."
+  :group 'lsp-haxe
+  :risky t
+  :type '(repeat string))
+
+;; The build spec for the project.
+(defcustom lsp-haxe-hxml "build.hxml"
+  "The compile file for the haxe project."
+  :type 'file
+  :group 'lsp-haxe
+  :package-version '(lsp-mode . "7.0"))
+
+;; https://github.com/emacs-lsp/lsp-mode/blob/150a933694349df960dc8fd7a15e04f5727e6433/lsp-rust.el#L251
+(lsp-defun lsp-clients--haxe-processStart (_workspace (&haxe:ProcessStartNotification :title))
+  "Handle processStart notification.  Just logs PARAMS."
+  (lsp-log title))
+
+(defcustom lsp-haxe-executable "haxe"
+  nil
+  :type 'file
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-configurations nil
+  nil
+  :type '(repeat string)
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-display-configurations nil
+  nil
+  :type '(repeat string)
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-display-server nil
+  nil
+  :type 'string
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-display-port "auto"
+  nil
+  :type 'number
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-enable-compilation-server t
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-task-presentation
+  '((echo . t)
+    (reveal . "always")
+    (focus . :json-false)
+    (panel . "shared")
+    (showReuseMessage . t)
+    (clear . :json-false))
+  nil
+  :type 'plist
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-enable-code-lens t
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-enable-diagnostics t
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-enable-server-view nil
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-enable-methods-view nil
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-enable-signature-help-documentation t
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-diagnostics-path-filter "${workspaceRoot}"
+  nil
+  :type 'string
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-build-completion-cache t
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-enable-completion-cache-warning t
+  nil
+  :type 'boolean
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-code-generation nil
+  nil
+  :type 'string
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-exclude ["zpp_nape"]
+  nil
+  :type '(repeat string)
+  :group 'lsp-haxe)
+
+(defcustom lsp-haxe-postfix-completion nil
+  nil
+  :type 'string
+  :group 'lsp-haxe)
+
+(lsp-register-custom-settings
+ '(("haxe.hxml" lsp-haxe-hxml)
+   ("haxe.postfixCompletion" lsp-haxe-postfix-completion)
+   ("haxe.exclude" lsp-haxe-exclude)
+   ("haxe.codeGeneration" lsp-haxe-code-generation)
+   ("haxe.enableCompletionCacheWarning" lsp-haxe-enable-completion-cache-warning t)
+   ("haxe.buildCompletionCache" lsp-haxe-build-completion-cache t)
+   ("haxe.diagnosticsPathFilter" lsp-haxe-diagnostics-path-filter)
+   ("haxe.enableSignatureHelpDocumentation" lsp-haxe-enable-signature-help-documentation t)
+   ("haxe.enableMethodsView" lsp-haxe-enable-methods-view t)
+   ("haxe.enableServerView" lsp-haxe-enable-server-view t)
+   ("haxe.enableDiagnostics" lsp-haxe-enable-diagnostics t)
+   ("haxe.enableCodeLens" lsp-haxe-enable-code-lens t)
+   ("haxe.taskPresentation" lsp-haxe-task-presentation)
+   ("haxe.enableCompilationServer" lsp-haxe-enable-compilation-server t)
+   ("haxe.displayPort" lsp-haxe-display-port)
+   ("haxe.displayServer" lsp-haxe-display-server)
+   ("haxe.displayConfigurations" lsp-haxe-display-configurations)
+   ("haxe.configurations" lsp-haxe-configurations)
+   ("haxe.executable" lsp-haxe-executable)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection #'lsp-clients--haxe-command)
+  :major-modes '(haxe-mode)  ; force didChangeConfiguration message
+  :initialized-fn
+  (lambda (workspace)
+    (with-lsp-workspace workspace
+      (lsp--set-configuration (lsp-configuration-section "haxe"))))
+  :priority -1
+  :server-id 'haxe
+  :initialization-options
+  (lambda ()
+    `(:sendMethodResults t
+      :haxelibConfig (:executable "haxelib")
+      :displayServerConfig
+      ( :print (:reusing :json-false :completion :json-false)
+               :arguments []
+               :env nil
+               :path "haxe")
+      :displayArguments [,lsp-haxe-hxml]))
+  :notification-handlers
+  (lsp-ht ("haxe/progressStart" 'lsp-clients--haxe-processStart)
+          ("haxe/progressStop" 'ignore)
+          ("haxe/didDetectOldPreview" 'ignore)
+          ("haxe/didChangeDisplayPort" 'ignore)
+          ("haxe/didRunHaxeMethod" 'ignore)
+          ("haxe/didChangeRequestQueue" 'ignore)
+          ("haxe/cacheBuildFailed" 'ignore))))
+
+(lsp-consistency-check lsp-haxe)
+
+(provide 'lsp-haxe)
+;;; lsp-haxe.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-headerline.el b/elpa/lsp-mode-20220201.852/lsp-headerline.el
new file mode 100644 (file)
index 0000000..50063cf
--- /dev/null
@@ -0,0 +1,473 @@
+;;; lsp-headerline.el --- LSP headerline features -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;;  LSP headerline features
+;;
+;;; Code:
+
+(require 'lsp-icons)
+(require 'lsp-mode)
+
+(defgroup lsp-headerline nil
+  "LSP support for headerline"
+  :prefix "lsp-headerline-"
+  :group 'lsp-mode
+  :tag "LSP Headerline")
+
+(defcustom lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols)
+  "Segments used in breadcrumb text on headerline."
+  :type '(repeat
+          (choice (const :tag "Include the project name." project)
+                  (const :tag "Include the open file name." file)
+                  (const :tag "Include the directories up to project." path-up-to-project)
+                  (const :tag "Include document symbols if server supports it." symbols)))
+  :group 'lsp-headerline)
+
+(defcustom lsp-headerline-breadcrumb-enable-symbol-numbers nil
+  "Whether to label symbols with numbers on the breadcrumb."
+  :type 'boolean
+  :group 'lsp-headerline)
+
+(defcustom lsp-headerline-breadcrumb-enable-diagnostics t
+  "If non-nil, apply different face on the breadcrumb based on the errors."
+  :type 'boolean
+  :group 'lsp-headerline
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defface lsp-headerline-breadcrumb-separator-face '((t :inherit shadow :height 0.8))
+  "Face used for breadcrumb separator on headerline."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-path-face '((t :inherit font-lock-string-face))
+  "Face used for breadcrumb paths on headerline."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-path-error-face
+  '((t :underline (:style wave :color "Red1")
+       :inherit lsp-headerline-breadcrumb-path-face))
+  "Face used for breadcrumb paths on headerline when there is an error under that path"
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-path-warning-face
+  '((t :underline (:style wave :color "Yellow")
+       :inherit lsp-headerline-breadcrumb-path-face))
+  "Face used for breadcrumb paths on headerline when there is an warning under that path"
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-path-info-face
+  '((t :underline (:style wave :color "Green")
+       :inherit lsp-headerline-breadcrumb-path-face))
+  "Face used for breadcrumb paths on headerline when there is an info under that path"
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-path-hint-face
+  '((t :underline (:style wave :color "Green")
+       :inherit lsp-headerline-breadcrumb-path-face))
+  "Face used for breadcrumb paths on headerline when there is an hint under that path"
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-project-prefix-face
+  '((t :inherit font-lock-string-face :weight bold))
+  "Face used for breadcrumb prefix on headerline.
+Only if `lsp-headerline-breadcrumb-prefix` is `project-name-only`."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-unknown-project-prefix-face
+  '((t :inherit shadow :weight bold))
+  "Face used for breadcrumb prefix on headerline.
+Only if `lsp-headerline-breadcrumb-prefix` is `project-name-only`."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-symbols-face
+  '((t :inherit font-lock-doc-face :weight bold))
+  "Face used for breadcrumb symbols text on headerline."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-symbols-error-face
+  '((t :inherit lsp-headerline-breadcrumb-symbols-face
+       :underline (:style wave :color "Red1")))
+  "Face used for breadcrumb symbols text on headerline when there
+is an error in symbols range."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-symbols-warning-face
+  '((t :inherit lsp-headerline-breadcrumb-symbols-face
+       :underline (:style wave :color "Yellow")))
+  "Face used for breadcrumb symbols text on headerline when there
+is an warning in symbols range."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-symbols-info-face
+  '((t :inherit lsp-headerline-breadcrumb-symbols-face
+       :underline (:style wave :color "Green")))
+  "Face used for breadcrumb symbols text on headerline when there
+is an info in symbols range."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-symbols-hint-face
+  '((t :inherit lsp-headerline-breadcrumb-symbols-face
+       :underline (:style wave :color "Green")))
+  "Face used for breadcrumb symbols text on headerline when there
+is an hints in symbols range."
+  :group 'lsp-headerline)
+
+(defface lsp-headerline-breadcrumb-deprecated-face
+  '((t :inherit lsp-headerline-breadcrumb-symbols-face
+       :strike-through t))
+  "Face used on breadcrumb deprecated text on modeline."
+  :group 'lsp-headerline)
+
+(defvar-local lsp-headerline--string nil
+  "Holds the current breadcrumb string on headerline.")
+
+(defvar lsp-headerline-arrow nil
+  "Holds the current breadcrumb string on headerline.")
+
+(defvar-local lsp-headerline--path-up-to-project-segments nil
+  "Holds the current breadcrumb path-up-to-project segments for
+caching purposes.")
+
+(defun lsp-headerline--arrow-icon ()
+  "Build the arrow icon for headerline breadcrumb."
+  (or
+   lsp-headerline-arrow
+   (setq lsp-headerline-arrow (lsp-icons-all-the-icons-material-icon
+                               "chevron_right"
+                               'lsp-headerline-breadcrumb-separator-face
+                               ">"
+                               'headerline-breadcrumb))))
+
+(lsp-defun lsp-headerline--symbol-icon ((&DocumentSymbol :kind))
+  "Build the SYMBOL icon for headerline breadcrumb."
+  (concat (lsp-icons-get-by-symbol-kind kind 'headerline-breadcrumb)
+          " "))
+
+(lsp-defun lsp-headerline--go-to-symbol ((&DocumentSymbol
+                                          :selection-range (&RangeToPoint :start selection-start)
+                                          :range (&RangeToPoint :start narrowing-start
+                                                                :end narrowing-end)))
+  "Go to breadcrumb symbol.
+If the buffer is narrowed and the target symbol lies before the
+minimum reachable point in the narrowed buffer, then widen and
+narrow to the outer symbol."
+  (when (buffer-narrowed-p)
+    (narrow-to-region
+     (min (point-min) narrowing-start)
+     (max (point-max) narrowing-end)))
+  (goto-char selection-start))
+
+(lsp-defun lsp-headerline--narrow-to-symbol ((&DocumentSymbol :range (&RangeToPoint :start :end)))
+  "Narrow to breadcrumb symbol range."
+  (narrow-to-region start end))
+
+(defun lsp-headerline--with-action (local-map help-echo-string display-string)
+  "Assign LOCAL-MAP and HELP-ECHO-STRING to the region around the DISPLAY-STRING."
+  (propertize display-string
+              'mouse-face 'header-line-highlight
+              'help-echo help-echo-string
+              'local-map local-map))
+
+(defmacro lsp-headerline--make-mouse-handler (&rest body)
+  "Making mouse event handler.
+Switch to current mouse interacting window before doing BODY."
+  (declare (debug t) (indent 0))
+  `(lambda (event)
+     (interactive "e")
+     (select-window (posn-window (elt event 1)))
+     ,@body))
+
+(defun lsp-headerline--directory-with-action (full-path directory-display-string)
+  "Build action for FULL-PATH and DIRECTORY-DISPLAY-STRING."
+  (lsp-headerline--with-action (let ((map (make-sparse-keymap)))
+                                 (define-key map [header-line mouse-1]
+                                   (lsp-headerline--make-mouse-handler
+                                     (dired full-path)))
+                                 (define-key map [header-line mouse-2]
+                                   (lsp-headerline--make-mouse-handler
+                                     (dired-other-window full-path)))
+                                 map)
+                               (format "mouse-1: browse '%s' with Dired\nmouse-2: browse '%s' with Dired in other window"
+                                       directory-display-string
+                                       directory-display-string)
+                               (propertize directory-display-string
+                                           'lsp-full-path full-path)))
+
+(declare-function evil-set-jump "ext:evil-jumps")
+
+(lsp-defun lsp-headerline--symbol-with-action ((symbol &as &DocumentSymbol :name) symbol-display-string)
+  "Build action for SYMBOL and SYMBOL-STRING."
+  (lsp-headerline--with-action (let ((map (make-sparse-keymap)))
+                                 (define-key map [header-line mouse-1]
+                                   (lsp-headerline--make-mouse-handler
+                                     (when (bound-and-true-p evil-mode)
+                                       (evil-set-jump))
+                                     (lsp-headerline--go-to-symbol symbol)))
+                                 (define-key map [header-line mouse-2]
+                                   (lsp-headerline--make-mouse-handler
+                                     (-let (((&DocumentSymbol :range (&RangeToPoint :start :end)) symbol))
+                                       (if (and (eq (point-min) start) (eq (point-max) end))
+                                           (widen)
+                                         (lsp-headerline--narrow-to-symbol symbol)))))
+                                 map)
+                               (format "mouse-1: go to '%s' symbol\nmouse-2: %s"
+                                       name
+                                       (-let (((&DocumentSymbol :range (&RangeToPoint :start :end)) symbol))
+                                         (if (and (eq (point-min) start) (eq (point-max) end))
+                                             "widen"
+                                           (format "narrow to '%s' range" name))))
+                               symbol-display-string))
+
+(defun lsp-headerline--path-up-to-project-root (root-path path)
+  "Find recursively the folders until the project ROOT-PATH.
+PATH is the current folder to be checked."
+  (let ((current-path path)
+        headerline-path-components)
+    (while (not (lsp-f-same? root-path current-path))
+      (push (lsp-headerline--directory-with-action current-path
+                                                   (f-filename current-path))
+            headerline-path-components)
+      (setq current-path (lsp-f-parent current-path)))
+    headerline-path-components))
+
+(defun lsp-headerline--build-project-string ()
+  "Build the project-segment string for the breadcrumb."
+  (-if-let (root (lsp-workspace-root))
+      (propertize (lsp-headerline--directory-with-action
+                   root
+                   (f-filename root))
+                  'font-lock-face
+                  'lsp-headerline-breadcrumb-project-prefix-face)
+    (propertize "<unknown>"
+                'font-lock-face
+                'lsp-headerline-breadcrumb-unknown-project-prefix-face)))
+
+(defun lsp-headerline--build-file-string ()
+  "Build the file-segment string for the breadcrumb."
+  (let* ((file-path (or (buffer-file-name) ""))
+         (filename (f-filename file-path)))
+    (if-let ((file-ext (f-ext file-path)))
+        (concat (lsp-icons-get-by-file-ext file-ext 'headerline-breadcrumb)
+                " "
+                (propertize filename
+                            'font-lock-face
+                            (lsp-headerline--face-for-path file-path)))
+      filename)))
+
+
+(defun lsp-headerline--face-for-path (dir)
+  "Calculate the face for DIR."
+  (if-let ((diags (lsp-diagnostics-stats-for (directory-file-name dir))))
+      (cl-labels ((check-severity
+                   (severity)
+                   (not (zerop (aref diags severity)))))
+        (cond
+         ((not lsp-headerline-breadcrumb-enable-diagnostics)
+          'lsp-headerline-breadcrumb-path-face)
+         ((check-severity lsp/diagnostic-severity-error)
+          'lsp-headerline-breadcrumb-path-error-face)
+         ((check-severity lsp/diagnostic-severity-warning)
+          'lsp-headerline-breadcrumb-path-warning-face)
+         ((check-severity lsp/diagnostic-severity-information)
+          'lsp-headerline-breadcrumb-path-info-face)
+         ((check-severity lsp/diagnostic-severity-hint)
+          'lsp-headerline-breadcrumb-path-hint-face)
+         (t 'lsp-headerline-breadcrumb-path-face)))
+    'lsp-headerline-breadcrumb-path-face))
+
+(defun lsp-headerline--severity-level-for-range (range)
+  "Get the severiy level for RANGE."
+  (let ((range-severity 10))
+    (mapc (-lambda ((&Diagnostic :range (&Range :start) :severity?))
+            (when (lsp-point-in-range? start range)
+              (setq range-severity (min range-severity severity?))))
+          (lsp--get-buffer-diagnostics))
+    range-severity))
+
+(defun lsp-headerline--build-path-up-to-project-string ()
+  "Build the path-up-to-project segment for the breadcrumb."
+  (if-let ((root (lsp-workspace-root)))
+      (let ((segments (or
+                       lsp-headerline--path-up-to-project-segments
+                       (setq lsp-headerline--path-up-to-project-segments
+                             (lsp-headerline--path-up-to-project-root
+                              root
+                              (lsp-f-parent (buffer-file-name)))))))
+        (mapconcat (lambda (next-dir)
+                     (propertize next-dir
+                                 'font-lock-face
+                                 (lsp-headerline--face-for-path
+                                  (get-text-property
+                                   0 'lsp-full-path next-dir))))
+                   segments
+                   (concat " " (lsp-headerline--arrow-icon) " ")))
+    ""))
+
+(lsp-defun lsp-headerline--face-for-symbol ((&DocumentSymbol :deprecated?
+                                                             :range))
+  "Get the face for SYMBOL."
+  (let ((range-severity (lsp-headerline--severity-level-for-range range)))
+    (cond
+     (deprecated? 'lsp-headerline-breadcrumb-deprecated-face)
+     ((not lsp-headerline-breadcrumb-enable-diagnostics)
+      'lsp-headerline-breadcrumb-symbols-face)
+     ((= range-severity lsp/diagnostic-severity-error)
+      'lsp-headerline-breadcrumb-symbols-error-face)
+     ((= range-severity lsp/diagnostic-severity-warning)
+      'lsp-headerline-breadcrumb-symbols-warning-face)
+     ((= range-severity lsp/diagnostic-severity-information)
+      'lsp-headerline-breadcrumb-symbols-info-face)
+     ((= range-severity lsp/diagnostic-severity-hint)
+      'lsp-headerline-breadcrumb-symbols-hint-face)
+     (t 'lsp-headerline-breadcrumb-symbols-face))))
+
+(defun lsp-headerline--build-symbol-string ()
+  "Build the symbol segment for the breadcrumb."
+  (if (lsp-feature? "textDocument/documentSymbol")
+      (-if-let* ((lsp--document-symbols-request-async t)
+                 (symbols (lsp--get-document-symbols))
+                 (symbols-hierarchy (lsp--symbols->document-symbols-hierarchy symbols))
+                 (enumerated-symbols-hierarchy
+                  (-map-indexed (lambda (index elt)
+                                  (cons elt (1+ index)))
+                                symbols-hierarchy)))
+          (mapconcat
+           (-lambda (((symbol &as &DocumentSymbol :name)
+                      . index))
+             (let* ((symbol2-name
+                     (propertize name
+                                 'font-lock-face
+                                 (lsp-headerline--face-for-symbol symbol)))
+                    (symbol2-icon (lsp-headerline--symbol-icon symbol))
+                    (full-symbol-2
+                     (concat
+                      (if lsp-headerline-breadcrumb-enable-symbol-numbers
+                          (concat
+                           (propertize (number-to-string index)
+                                       'face
+                                       'lsp-headerline-breadcrumb-symbols-face)
+                           " ")
+                        "")
+                      (if symbol2-icon
+                          (concat symbol2-icon symbol2-name)
+                        symbol2-name))))
+               (lsp-headerline--symbol-with-action symbol full-symbol-2)))
+           enumerated-symbols-hierarchy
+           (concat " " (lsp-headerline--arrow-icon) " "))
+        "")
+    ""))
+
+(defun lsp-headerline--build-string ()
+  "Build the header-line string."
+  (string-trim-right
+   (mapconcat
+    (lambda (segment)
+      (let ((segment-string
+             (pcase segment
+               ('project (lsp-headerline--build-project-string))
+               ('file (lsp-headerline--build-file-string))
+               ('path-up-to-project (lsp-headerline--build-path-up-to-project-string))
+               ('symbols (lsp-headerline--build-symbol-string))
+               (_ (lsp-log "'%s' is not a valid entry for `lsp-headerline-breadcrumb-segments'"
+                           (symbol-name segment))
+                  ""))))
+        (if (eq segment-string "")
+            ""
+          (concat (lsp-headerline--arrow-icon)
+                  " "
+                  segment-string
+                  " "))))
+    lsp-headerline-breadcrumb-segments
+    "")))
+
+(defun lsp-headerline--check-breadcrumb (&rest _)
+  "Request for document symbols to build the breadcrumb."
+  (setq lsp-headerline--string (lsp-headerline--build-string))
+  (force-mode-line-update))
+
+(defun lsp-headerline--enable-breadcrumb ()
+  "Enable headerline breadcrumb mode."
+  (when (and lsp-headerline-breadcrumb-enable
+             (lsp-feature? "textDocument/documentSymbol"))
+    (lsp-headerline-breadcrumb-mode 1)))
+
+(defun lsp-headerline--disable-breadcrumb ()
+  "Disable headerline breadcrumb mode."
+  (lsp-headerline-breadcrumb-mode -1))
+
+;;;###autoload
+(define-minor-mode lsp-headerline-breadcrumb-mode
+  "Toggle breadcrumb on headerline."
+  :group 'lsp-headerline
+  :global nil
+  (cond
+   (lsp-headerline-breadcrumb-mode
+    (add-to-list 'header-line-format '(t (:eval lsp-headerline--string)))
+
+    (add-hook 'xref-after-jump-hook #'lsp-headerline--check-breadcrumb nil t)
+
+    (add-hook 'lsp-on-idle-hook #'lsp-headerline--check-breadcrumb nil t)
+    (add-hook 'lsp-configure-hook #'lsp-headerline--enable-breadcrumb nil t)
+    (add-hook 'lsp-unconfigure-hook #'lsp-headerline--disable-breadcrumb nil t))
+   (t
+    (remove-hook 'lsp-on-idle-hook #'lsp-headerline--check-breadcrumb t)
+    (remove-hook 'lsp-configure-hook #'lsp-headerline--enable-breadcrumb t)
+    (remove-hook 'lsp-unconfigure-hook #'lsp-headerline--disable-breadcrumb t)
+
+    (remove-hook 'xref-after-jump-hook #'lsp-headerline--check-breadcrumb t)
+
+    (setq lsp-headerline--path-up-to-project-segments nil)
+    (setq header-line-format (remove '(t (:eval lsp-headerline--string)) header-line-format)))))
+
+;;;###autoload
+(defun lsp-breadcrumb-go-to-symbol (symbol-position)
+  "Go to the symbol on breadcrumb at SYMBOL-POSITION."
+  (interactive "P")
+  (if (numberp symbol-position)
+      (if (lsp-feature? "textDocument/documentSymbol")
+          (-if-let* ((lsp--document-symbols-request-async t)
+                     (symbols (lsp--get-document-symbols))
+                     (symbols-hierarchy (lsp--symbols->document-symbols-hierarchy symbols)))
+              (lsp-headerline--go-to-symbol (nth (1- symbol-position) symbols-hierarchy))
+            (lsp--info "Symbol not found for position %s" symbol-position))
+        (lsp--info "Server does not support breadcrumb."))
+    (lsp--info "Call this function with a number representing the symbol position on breadcrumb")))
+
+(declare-function evil-set-command-property "ext:evil-common")
+
+(with-eval-after-load 'evil
+  (evil-set-command-property 'lsp-breadcrumb-go-to-symbol :jump t))
+
+;;;###autoload
+(defun lsp-breadcrumb-narrow-to-symbol (symbol-position)
+  "Narrow to the symbol range on breadcrumb at SYMBOL-POSITION."
+  (interactive "P")
+  (if (numberp symbol-position)
+      (if (lsp-feature? "textDocument/documentSymbol")
+          (-if-let* ((lsp--document-symbols-request-async t)
+                     (symbols (lsp--get-document-symbols))
+                     (symbols-hierarchy (lsp--symbols->document-symbols-hierarchy symbols)))
+              (lsp-headerline--narrow-to-symbol (nth (1- symbol-position) symbols-hierarchy))
+            (lsp--info "Symbol not found for position %s" symbol-position))
+        (lsp--info "Server does not support breadcrumb."))
+    (lsp--info "Call this function with a number representing the symbol position on breadcrumb")))
+
+(lsp-consistency-check lsp-headerline)
+
+(provide 'lsp-headerline)
+;;; lsp-headerline.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-html.el b/elpa/lsp-mode-20220201.852/lsp-html.el
new file mode 100644 (file)
index 0000000..0b44e16
--- /dev/null
@@ -0,0 +1,198 @@
+;;; lsp-html.el --- vscode-html-languageserver configuration  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Vibhav Pant
+
+;; Author: Vibhav Pant <vibhavpNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-html nil
+  "LSP support for HTML, using vscode-html-languageserver."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/vscode-langservers/vscode-html-languageserver")
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-experimental-custom-data nil
+  "A list of JSON file paths that define custom tags, properties and other HTML
+syntax constructs. Only workspace folder setting will be read."
+  :type '(choice (const nil) string)
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-enable t
+  "Enable/disable default HTML formatter."
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-wrap-line-length 120
+  "Maximum amount of characters per line (0 = disable)."
+  :type 'number
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-unformatted "wbr"
+  nil
+  :type '(choice (const nil) string)
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-content-unformatted "pre,code,textarea"
+  nil
+  :group 'lsp-html
+  :type '(choice (const nil) string)
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-indent-inner-html nil
+  nil
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-preserve-new-lines t
+  "Controls whether existing line breaks before elements should be preserved.
+Only works before elements, not inside tags or for text."
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-max-preserve-new-lines nil
+  nil
+  :type '(choice (const nil) integer)
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-indent-handlebars nil nil
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-end-with-newline nil
+  "End with a newline."
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-extra-liners "head, body, /html"
+  nil
+  :type '(choice (const nil) string)
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-format-wrap-attributes "auto"
+  "Wrap attributes."
+  :type '(choice
+          (const "auto")
+          (const "force")
+          (const "force-aligned")
+          (const "force-expand-multiline")
+          (const "aligned-multiple")
+          (const "preserve")
+          (const "preserve-aligned"))
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-suggest-html5 t
+  "Controls whether the built-in HTML language support suggests HTML5 tags,
+properties and values."
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-validate-scripts t
+  "Controls whether the built-in HTML language support validates embedded
+scripts."
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-validate-styles t
+  "Controls whether the built-in HTML language support validates embedded
+styles."
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-auto-closing-tags t
+  "Enable/disable autoclosing of HTML tags."
+  :type 'boolean
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-html-trace-server "off"
+  "Traces the communication between VS Code and the HTML language server."
+  :type '(choice
+          (const "off")
+          (const "messages")
+          (const "verbose"))
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.1"))
+
+(lsp-register-custom-settings
+ '(("html.trace.server" lsp-html-trace-server)
+   ("html.autoClosingTags" lsp-html-auto-closing-tags t)
+   ("html.validate.styles" lsp-html-validate-styles t)
+   ("html.validate.scripts" lsp-html-validate-scripts t)
+   ("html.suggest.html5" lsp-html-suggest-html5 t)
+   ("html.format.wrapAttributes" lsp-html-format-wrap-attributes)
+   ("html.format.extraLiners" lsp-html-format-extra-liners)
+   ("html.format.endWithNewline" lsp-html-format-end-with-newline t)
+   ("html.format.indentHandlebars" lsp-html-format-indent-handlebars t)
+   ("html.format.maxPreserveNewLines" lsp-html-format-max-preserve-new-lines)
+   ("html.format.preserveNewLines" lsp-html-format-preserve-new-lines t)
+   ("html.format.indentInnerHtml" lsp-html-format-indent-inner-html t)
+   ("html.format.contentUnformatted" lsp-html-format-content-unformatted)
+   ("html.format.unformatted" lsp-html-format-unformatted)
+   ("html.format.wrapLineLength" lsp-html-format-wrap-line-length)
+   ("html.format.enable" lsp-html-format-enable t)
+   ("html.experimental.customData" lsp-html-experimental-custom-data)))
+
+(defcustom lsp-html-server-command-args '("--stdio")
+  "Command to start html-languageserver."
+  :type '(repeat string)
+  :group 'lsp-html
+  :package-version '(lsp-mode . "6.3"))
+
+(lsp-dependency 'html-language-server
+                '(:system "html-languageserver")
+                '(:npm :package "vscode-html-languageserver-bin"
+                       :path "html-languageserver"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     (cons (lsp-package-path 'html-language-server)
+                                           lsp-html-server-command-args)))
+                  :activation-fn (lsp-activate-on "html")
+                  :priority -4
+                  :completion-in-comments? t
+                  :server-id 'html-ls
+                  :initialized-fn (lambda (w)
+                                    (with-lsp-workspace w
+                                      (lsp--set-configuration
+                                       (lsp-configuration-section "html"))))
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure
+                                         'html-language-server callback
+                                         error-callback))))
+
+(lsp-consistency-check lsp-html)
+
+(provide 'lsp-html)
+;;; lsp-html.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-icons.el b/elpa/lsp-mode-20220201.852/lsp-icons.el
new file mode 100644 (file)
index 0000000..7bd8bc6
--- /dev/null
@@ -0,0 +1,96 @@
+;;; lsp-icons.el --- LSP icons management -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;;  LSP icons management
+;;
+;;; Code:
+(require 'lsp-mode)
+
+(defgroup lsp-icons nil
+  "LSP icons"
+  :group 'lsp-mode
+  :tag "LSP Icons")
+
+(defcustom lsp-headerline-breadcrumb-icons-enable t
+  "If non-nil, icons support is enabled for headerline-breadcrumb."
+  :type 'boolean
+  :group 'lsp-icons)
+
+(declare-function all-the-icons-material "ext:all-the-icons" t t)
+(declare-function lsp-treemacs-symbol-icon "ext:lsp-treemacs" (kind))
+(declare-function lsp-treemacs-get-icon "ext:lsp-treemacs" (icon-name))
+
+(defun lsp-icons--enabled-for-feature (feature)
+  "Check if icons support is enabled for FEATURE."
+  (cond
+   ((eq feature 'headerline-breadcrumb) lsp-headerline-breadcrumb-icons-enable)
+   (t t)))
+
+(defun lsp-icons--fix-image-background (image)
+  "Fix IMAGE background if it is a file otherwise return as an icon."
+  (if image
+      (let ((display-image (get-text-property 0 'display image)))
+        (if (and (listp display-image)
+                 (plist-member (cl-copy-list (cl-rest display-image)) :type))
+            (propertize " " 'display
+                        (cl-list* 'image
+                                  (plist-put
+                                   (cl-copy-list
+                                    (cl-rest display-image))
+                                   :background (face-attribute 'header-line :background nil t))))
+          (if (stringp display-image)
+              (replace-regexp-in-string "\s\\|\t" "" display-image)
+            (replace-regexp-in-string "\s\\|\t" "" image))))
+    ""))
+
+(defun lsp-icons-get-by-file-ext (file-ext &optional feature)
+  "Get an icon by file FILE-EXT.
+FEATURE is the feature that will use the icon which we should check
+if its enabled."
+  (when (and file-ext
+             (lsp-icons--enabled-for-feature feature)
+             (functionp 'lsp-treemacs-get-icon))
+    (lsp-icons--fix-image-background
+     (lsp-treemacs-get-icon file-ext))))
+
+(defun lsp-icons-get-by-symbol-kind (kind &optional feature)
+  "Get an icon by symbol KIND.
+FEATURE is the feature that will use the icon which we should check
+if its enabled."
+  (when (and kind
+             (lsp-icons--enabled-for-feature feature)
+             (functionp 'lsp-treemacs-symbol-icon))
+    (lsp-icons--fix-image-background
+     (lsp-treemacs-symbol-icon kind))))
+
+(defun lsp-icons-all-the-icons-material-icon (icon-name face fallback &optional feature)
+  "Get a material icon from all-the-icons by ICON-NAME using FACE.
+Fallback to FALLBACK string if not found or not available.
+FEATURE is the feature that will use the icon which we should check
+if its enabled."
+  (if (and (functionp 'all-the-icons-material)
+           (lsp-icons--enabled-for-feature feature))
+      (all-the-icons-material icon-name
+                              :face face)
+    (propertize fallback 'face face)))
+
+(lsp-consistency-check lsp-icons)
+
+(provide 'lsp-icons)
+;;; lsp-icons.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-ido.el b/elpa/lsp-mode-20220201.852/lsp-ido.el
new file mode 100644 (file)
index 0000000..ac34dd7
--- /dev/null
@@ -0,0 +1,142 @@
+;;; lsp-ido.el --- `ido' integration -*- lexical-binding: t -*-
+;;
+;; Copyright (C) 2021 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This module provides an interactive ido interface to the workspace symbol
+;; functionality offered by lsp-mode.
+
+;;; Code:
+
+(require 'ido)
+(require 'lsp-protocol)
+(require 'lsp-mode)
+
+(defgroup lsp-ido nil
+  "LSP support for ido-based symbol completion"
+  :group 'lsp-mode
+  :tag "LSP ido")
+
+(defcustom lsp-ido-symbol-kind-to-string
+  ["    "          ; Unknown - 0
+   "File"          ; File - 1
+   "Modu"          ; Module - 2
+   "Nmsp"          ; Namespace - 3
+   "Pack"          ; Package - 4
+   "Clss"          ; Class - 5
+   "Meth"          ; Method - 6
+   "Prop"          ; Property - 7
+   "Fld "          ; Field - 8
+   "Cons"          ; Constructor - 9
+   "Enum"          ; Enum - 10
+   "Intf"          ; Interface - 11
+   "Func"          ; Function - 12
+   "Var "          ; Variable - 13
+   "Cnst"          ; Constant - 14
+   "Str "          ; String - 15
+   "Num "          ; Number - 16
+   "Bool "         ; Boolean - 17
+   "Arr "          ; Array - 18
+   "Obj "          ; Object - 19
+   "Key "          ; Key - 20
+   "Null"          ; Null - 21
+   "EmMm"          ; EnumMember - 22
+   "Srct"          ; Struct - 23
+   "Evnt"          ; Event - 24
+   "Op  "          ; Operator - 25
+   "TPar"]          ; TypeParameter - 26
+  "A vector of 26 itens representing the SymbolKind."
+  :group 'lsp-ido
+  :type 'vector)
+
+(defcustom lsp-ido-show-symbol-filename
+  t
+  "Whether to show the project-relative path to a symbol's point of definition."
+  :group 'lsp-ido
+  :type 'boolean)
+
+(defcustom lsp-ido-show-symbol-kind
+  t
+  "Whether to show the symbol's kind when showing lsp symbols."
+  :group 'lsp-ido
+  :type 'boolean)
+
+(eval-when-compile
+  (lsp-interface
+   (lsp-ido:FormattedSymbolInformation
+    (:kind :name :location :textualRepresentation)
+    (:containerName :deprecated))))
+
+(lsp-defun lsp-ido--transform-candidate
+  ((symbol-information &as &SymbolInformation :kind :location (&Location :uri))
+   lsp-ido--results project-root)
+  (let* ((sanitized-kind (if (< kind (length lsp-ido-symbol-kind-to-string)) kind 0))
+         (type (elt lsp-ido-symbol-kind-to-string sanitized-kind))
+         (typestr (if lsp-ido-show-symbol-kind
+                      (format "[%s] " type)
+                    ""))
+         (pathstr (if lsp-ido-show-symbol-filename
+                      (propertize (format " . %s" (file-relative-name (lsp--uri-to-path uri) project-root))
+                                  'face 'font-lock-comment-face)
+                    ""))
+         (textual-representation
+          (lsp-render-symbol-information symbol-information "."))
+         (entry (concat typestr textual-representation pathstr)))
+    (puthash entry symbol-information lsp-ido--results)))
+
+(lsp-defun lsp-ido--jump-selected-candidate
+  ((&SymbolInformation
+    :location (&Location :uri :range (&Range :start (&Position :line :character)))))
+  "Jump to selected candidate."
+  (find-file (lsp--uri-to-path uri))
+  (goto-char (point-min))
+  (forward-line line)
+  (forward-char character))
+
+(defun lsp-ido--workspace-symbol (workspaces query)
+  "Search against WORKSPACES based on QUERY."
+  (let* ((lsp-ido--results (make-hash-table :test 'equal))
+         (workspace-root (lsp-workspace-root))
+         (raw-choices
+          (with-lsp-workspaces workspaces
+            (lsp-request
+             "workspace/symbol"
+             (lsp-make-workspace-symbol-params :query query)))))
+    (mapc (lambda (it)
+            (lsp-ido--transform-candidate it lsp-ido--results workspace-root))
+          raw-choices)
+    lsp-ido--results))
+
+;;;###autoload
+(defun lsp-ido-workspace-symbol (arg)
+  "`ido' for lsp workspace/symbol.
+When called with prefix ARG the default selection will be symbol at point."
+  (interactive "P")
+  (let* ((query (if arg "" (read-string "Workspace symbol: ")))
+         (hash-table-candidates (lsp-ido--workspace-symbol (lsp-workspaces) query))
+         (choice (ido-completing-read
+                  "Workspace symbol: "
+                  (hash-table-keys hash-table-candidates)
+                  nil
+                  nil
+                  (when arg (thing-at-point 'symbol)))))
+    (lsp-ido--jump-selected-candidate (gethash choice hash-table-candidates))))
+
+(lsp-consistency-check lsp-ido)
+
+(provide 'lsp-ido)
+;;; lsp-ido.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-iedit.el b/elpa/lsp-mode-20220201.852/lsp-iedit.el
new file mode 100644 (file)
index 0000000..55ae0a9
--- /dev/null
@@ -0,0 +1,149 @@
+;;; lsp-iedit.el --- `iedit' integration -*- lexical-binding: t -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This module provides features that allow starting `iedit' on various
+;; different lsp-based, semantic units (like documentHighlights, and
+;; linkedEditingRanges in the future).
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'dash)
+
+(declare-function iedit-make-occurrence-overlay "iedit-lib" (begin end))
+(declare-function iedit-start-buffering "iedit-lib" ())
+(declare-function iedit-lib-start "iedit-lib" (mode-exit-func))
+(declare-function iedit-done "iedit" ())
+(declare-function evil-multiedit-mode "evil-multiedit" (mode))
+(declare-function evil-iedit-state "evil-iedit-state" ())
+
+(defvar iedit-mode)
+(defvar iedit-auto-buffering)
+(defvar iedit-occurrences-overlays)
+(defvar iedit-occurrence-keymap)
+(defvar iedit-mode-occurrence-keymap)
+(defvar evil-multiedit--dont-recall)
+
+(defun lsp-iedit--on-ranges (ranges)
+  "Start an `iedit' operation using RANGES.
+RANGES shall be a list of lsp-`&Range's. They can be acquired
+from various lsp protocol requests, e.g.
+`textDocument/documentHighlight', ...."
+  (require 'iedit)
+  (unless (seq-empty-p ranges)
+    (mapc (-lambda ((&RangeToPoint :start :end))
+            (push (iedit-make-occurrence-overlay start end)
+                  iedit-occurrences-overlays))
+          ranges)
+    ;; See `iedit-start'; TODO: upstream this
+    (setq iedit-occurrence-keymap iedit-mode-occurrence-keymap)
+    (setq iedit-mode t)
+    (when iedit-auto-buffering
+      (iedit-start-buffering))
+    (iedit-lib-start 'iedit-done)
+    (run-hooks 'iedit-mode-hook)
+    (add-hook 'before-revert-hook 'iedit-done nil t)
+    (add-hook 'kbd-macro-termination-hook 'iedit-done nil t)
+    (add-hook 'change-major-mode-hook 'iedit-done nil t)
+    (add-hook 'iedit-aborting-hook 'iedit-done nil t)
+    (message "%d occurrences of \"%s\""
+             (seq-length ranges)
+             (lsp--range-text (lsp-seq-first ranges)))))
+\f
+;; iedit
+
+;;;###autoload
+(defun lsp-iedit-highlights ()
+  "Start an `iedit' operation on the documentHighlights at point.
+This can be used as a primitive `lsp-rename' replacement if the
+language server doesn't support renaming.
+
+See also `lsp-enable-symbol-highlighting'."
+  (interactive)
+  (let ((highlights (lsp-request "textDocument/documentHighlight"
+                                 (lsp--text-document-position-params)))
+        (-compare-fn (-lambda ((&Location :range (&Range :start l-start :end l-end))
+                               (&Location :range (&Range :start r-start :end r-end)))
+                       (and (lsp--position-equal l-start r-start)
+                            (lsp--position-equal l-end   r-end)))))
+    (lsp-iedit--on-ranges (mapcar #'lsp:document-highlight-range (-distinct highlights)))))
+
+;;;###autoload
+(defun lsp-iedit-linked-ranges ()
+  "Start an `iedit' for `textDocument/linkedEditingRange'"
+  (interactive)
+  (unless (lsp-feature? "textDocument/linkedEditingRange")
+    (user-error "`textDocument/linkedEditingRange' is not supported by current server"))
+
+  (-> (lsp-request "textDocument/linkedEditingRange" (lsp--text-document-position-params))
+      (lsp:linked-editing-ranges-ranges)
+      (or (user-error "No editing ranges found"))
+      (lsp-iedit--on-ranges)))
+
+\f
+;; evil-multi-edit
+
+;;;###autoload
+(defun lsp-evil-multiedit-highlights ()
+  "Start an `evil-multiedit' operation on the documentHighlights at point.
+This can be used as a primitive `lsp-rename' replacement if the
+language server doesn't support renaming.
+
+See also `lsp-enable-symbol-highlighting'."
+  (interactive)
+  (require 'evil-multiedit)
+  (when (fboundp 'ahs-clear) (ahs-clear))
+  (setq evil-multiedit--dont-recall t)
+  (lsp-iedit-highlights)
+  (evil-multiedit-mode +1))
+
+;;;###autoload
+(defun lsp-evil-multiedit-linked-ranges ()
+  "Start an `evil-multiedit' for `textDocument/linkedEditingRange'"
+  (interactive)
+  (require 'evil-multiedit)
+  (when (fboundp 'ahs-clear) (ahs-clear))
+  (setq evil-multiedit--dont-recall t)
+  (lsp-iedit-linked-ranges)
+  (evil-multiedit-mode +1))
+\f
+;; evil-evil-state
+
+;;;###autoload
+(defun lsp-evil-state-highlights ()
+  "Start `iedit-mode'. for `textDocument/documentHighlight'"
+  (interactive "P")
+  (if (fboundp 'ahs-clear) (ahs-clear))
+  (lsp-iedit-highlights)
+  (evil-iedit-state))
+
+;;;###autoload
+(defun lsp-evil-state-linked-ranges ()
+  "Start `iedit-mode'. for `textDocument/linkedEditingRange'"
+  (interactive "P")
+  (if (fboundp 'ahs-clear) (ahs-clear))
+  (lsp-iedit-linked-ranges)
+  (evil-iedit-state))
+
+\f
+
+(lsp-consistency-check lsp-iedit)
+
+(provide 'lsp-iedit)
+;;; lsp-iedit.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-javascript.el b/elpa/lsp-mode-20220201.852/lsp-javascript.el
new file mode 100644 (file)
index 0000000..c4f913b
--- /dev/null
@@ -0,0 +1,371 @@
+;;; lsp-javascript.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp,
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the JavaScript and TypeScript Programming Languages.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(lsp-dependency 'javascript-typescript-langserver
+                '(:system "javascript-typescript-stdio")
+                '(:npm :package "javascript-typescript-langserver"
+                       :path "javascript-typescript-stdio"))
+
+(defgroup lsp-typescript-javascript nil
+  "Support for TypeScript/JavaScript, using Sourcegraph's JavaScript/TypeScript language server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/sourcegraph/javascript-typescript-langserver"))
+
+(defcustom lsp-clients-typescript-javascript-server-args '()
+  "Extra arguments for the typescript-language-server language server."
+  :group 'lsp-typescript-javascript
+  :risky t
+  :type '(repeat string))
+
+(defun lsp-typescript-javascript-tsx-jsx-activate-p (filename &optional _)
+  "Check if the javascript-typescript language server should be enabled based on FILENAME."
+  (or (string-match-p "\\.mjs\\|\\.[jt]sx?\\'" filename)
+      (and (derived-mode-p 'js-mode 'typescript-mode)
+           (not (derived-mode-p 'json-mode)))))
+
+;; Unmaintained sourcegraph server
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda ()
+                                                          (cons (lsp-package-path 'javascript-typescript-langserver)
+                                                                lsp-clients-typescript-javascript-server-args)))
+                  :activation-fn 'lsp-typescript-javascript-tsx-jsx-activate-p
+                  :priority -3
+                  :completion-in-comments? t
+                  :server-id 'jsts-ls
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure
+                                         'javascript-typescript-langserver
+                                         callback
+                                         error-callback))
+                  :initialized-fn (lambda (_workspace)
+                                    (warn (concat "The javascript-typescript-langserver (jsts-ls) is unmaintained; "
+                                                  "it is recommended to use ts-ls or deno-ls instead.")))))
+
+(defgroup lsp-typescript nil
+  "LSP support for TypeScript, using Theia/Typefox's TypeScript Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/theia-ide/typescript-language-server"))
+
+(defcustom lsp-clients-typescript-tls-path "typescript-language-server"
+  "Path to the typescript-language-server binary."
+  :group 'lsp-typescript
+  :risky t
+  :type 'string)
+
+(defcustom lsp-clients-typescript-server-args '("--stdio")
+  "Extra arguments for the typescript-language-server language server."
+  :group 'lsp-typescript
+  :risky t
+  :type '(repeat string))
+
+(defcustom lsp-clients-typescript-log-verbosity "info"
+  "The server log verbosity."
+  :group 'lsp-typescript
+  :type 'string)
+
+(defcustom lsp-clients-typescript-init-opts nil
+  "Configuration options provided to tsserver.
+See the UserPreferences interface at https://github.com/microsoft/TypeScript/blob/main/lib/protocol.d.ts for the list of options available in the latest version of TypeScript."
+  :group 'lsp-typescript
+  :type 'plist)
+
+(defcustom lsp-clients-typescript-plugins (vector)
+  "The list of plugins to load.
+It should be a vector of plist with keys `:location' and `:name'
+where `:name' is the name of the package and `:location' is the
+directory containing the package. Example:
+\(vector
+   \(list :name \"@vsintellicode/typescript-intellicode-plugin\"
+         :location \"<path>.vscode/extensions/visualstudioexptteam.
+                            vscodeintellicode-1.1.9/\"))"
+  :group 'lsp-typescript
+  :type  '(restricted-sexp :tag "Vector"
+                           :match-alternatives
+                           (lambda (xs)
+                             (and (vectorp xs) (seq-every-p
+                                                (-lambda ((&plist :name :location))
+                                                  (and name location))
+                                                xs)))))
+
+(lsp-dependency 'typescript-language-server
+                '(:system lsp-clients-typescript-tls-path)
+                '(:npm :package "typescript-language-server"
+                       :path "typescript-language-server"))
+
+(lsp-dependency 'typescript
+                '(:system "tsserver")
+                '(:npm :package "typescript"
+                       :path "tsserver"))
+
+(defun lsp-javascript--rename (_workspace args)
+  (let ((path (lsp--uri-to-path (lsp-get (lsp-get args :textDocument) :uri))))
+    (if (f-exists? path)
+        (with-current-buffer (find-file path)
+          (goto-char (lsp--position-to-point
+                      (lsp-get args :position))))
+      (error "There is no file %s" path)))
+  (call-interactively #'lsp-rename)
+  nil)
+
+(defun lsp-javascript-rename-file ()
+  "Rename current file and all it's references in other files."
+  (interactive)
+  (let* ((name (buffer-name))
+         (old (buffer-file-name))
+         (basename (file-name-nondirectory old)))
+    (unless (and old (file-exists-p old))
+      (error "Buffer '%s' is not visiting a file." name))
+    (let ((new (read-file-name "New name: " (file-name-directory old) basename nil basename)))
+      (when (get-file-buffer new)
+        (error "A buffer named '%s' already exists." new))
+      (when (file-exists-p new)
+        (error "A file named '%s' already exists." new))
+      (lsp--send-execute-command
+       "_typescript.applyRenameFile"
+       (vector (list :sourceUri (lsp--buffer-uri)
+                     :targetUri (lsp--path-to-uri new))))
+      (mkdir (file-name-directory new) t)
+      (rename-file old new)
+      (rename-buffer new)
+      (set-visited-file-name new)
+      (set-buffer-modified-p nil)
+      (lsp-disconnect)
+      (setq-local lsp-buffer-uri nil)
+      (lsp)
+      (lsp--info "Renamed '%s' to '%s'." name (file-name-nondirectory new)))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda ()
+                                                          `(,(lsp-package-path 'typescript-language-server)
+                                                            "--tsserver-path"
+                                                            ,(lsp-package-path 'typescript)
+                                                            ,@lsp-clients-typescript-server-args)))
+                  :activation-fn 'lsp-typescript-javascript-tsx-jsx-activate-p
+                  :priority -2
+                  :completion-in-comments? t
+                  :initialization-options (lambda ()
+                                            (list :plugins lsp-clients-typescript-plugins
+                                                  :logVerbosity lsp-clients-typescript-log-verbosity
+                                                  :tsServerPath (lsp-package-path 'typescript)
+                                                  :preferences lsp-clients-typescript-init-opts))
+                  :ignore-messages '("readFile .*? requested by TypeScript but content not available")
+                  :server-id 'ts-ls
+                  :request-handlers (ht ("_typescript.rename" #'lsp-javascript--rename))
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure
+                                         'typescript
+                                         (-partial #'lsp-package-ensure
+                                                   'typescript-language-server
+                                                   callback
+                                                   error-callback)
+                                         error-callback))))
+
+
+(defgroup lsp-flow nil
+  "LSP support for the Flow Javascript type checker."
+  :group 'lsp-mode
+  :link '(url-link "https://flow.org"))
+
+(defcustom lsp-clients-flow-server "flow"
+  "The Flow executable to use.
+Leave as just the executable name to use the default behavior of
+finding the executable with variable `exec-path'."
+  :group 'lsp-flow
+  :risky t
+  :type 'file)
+
+(defcustom lsp-clients-flow-server-args '("lsp")
+  "Extra arguments for starting the Flow language server."
+  :group 'lsp-flow
+  :risky t
+  :type '(repeat string))
+
+(defun lsp-clients-flow-tag-file-present-p (file-name)
+  "Check if the '// @flow' or `/* @flow */' tag is present in
+the contents of FILE-NAME."
+  (if-let ((buffer (find-buffer-visiting file-name)))
+      (with-current-buffer buffer
+        (lsp-clients-flow-tag-string-present-p))
+    (with-temp-buffer
+      (insert-file-contents file-name)
+      (lsp-clients-flow-tag-string-present-p))))
+
+(defun lsp-clients-flow-tag-string-present-p ()
+  "Helper for `lsp-clients-flow-tag-file-present-p' that works
+with the file contents."
+  (save-excursion
+    (goto-char (point-min))
+    (let (stop found)
+      (while (not stop)
+        (unless (re-search-forward "[^\n[:space:]]" nil t)
+          (setq stop t))
+        (if (= (point) (point-min)) (setq stop t) (backward-char))
+        (cond ((or (looking-at "//+[ ]*@flow")
+                   (looking-at "/\\**[ ]*@flow")
+                   (looking-at "[ ]*\\*[ ]*@flow"))
+               (setq found t) (setq stop t))
+              ((or (looking-at "//") (looking-at "*"))
+               (forward-line))
+              ((looking-at "/\\*")
+               (save-excursion
+                 (unless (re-search-forward "*/" nil t) (setq stop t)))
+               (forward-line))
+              (t (setq stop t))))
+      found)))
+
+(defun lsp-clients-flow-project-p (file-name)
+  "Check if FILE-NAME is part of a Flow project, that is, if
+there is a .flowconfig file in the folder hierarchy."
+  (locate-dominating-file file-name ".flowconfig"))
+
+(defun lsp-clients-flow-activate-p (file-name _mode)
+  "Check if the Flow language server should be enabled for a
+particular FILE-NAME and MODE."
+  (and (derived-mode-p 'js-mode 'web-mode 'js2-mode 'flow-js2-mode 'rjsx-mode)
+       (not (derived-mode-p 'json-mode))
+       (or (lsp-clients-flow-project-p file-name)
+           (lsp-clients-flow-tag-file-present-p file-name))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection
+                  (lsp-stdio-connection (lambda ()
+                                          (cons lsp-clients-flow-server
+                                                lsp-clients-flow-server-args)))
+                  :priority -1
+                  :activation-fn 'lsp-clients-flow-activate-p
+                  :server-id 'flow-ls))
+
+(defgroup lsp-deno nil
+  "LSP support for the Deno language server."
+  :group 'lsp-mode
+  :link '(url-link "https://deno.land/"))
+
+(defcustom lsp-clients-deno-server "deno"
+  "The Deno executable to use.
+Leave as just the executable name to use the default behavior of
+finding the executable with variable `exec-path'."
+  :group 'lsp-deno
+  :risky t
+  :type 'file
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-server-args '("lsp")
+  "Extra arguments for starting the Deno language server."
+  :group 'lsp-deno
+  :risky t
+  :type '(repeat string)
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-enable-lint t
+  "Controls if linting information will be provided by the Deno Language Server."
+  :group 'lsp-deno
+  :risky t
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-enable-code-lens-references t
+  "Enables or disables the display of code lens information."
+  :group 'lsp-deno
+  :risky t
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-enable-code-lens-references-all-functions t
+  "Enables or disables the display of code lens information for all functions.
+Setting this variable to `non-nil' implicitly enables
+`lsp-clients-deno-enable-code-lens-references'."
+  :group 'lsp-deno
+  :risky t
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-enable-code-lens-implementations t
+  "Enables or disables the display of code lens information for implementations."
+  :group 'lsp-deno
+  :risky t
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-config nil
+  "The file path to a tsconfig.json file.
+The path can be either be relative to the workspace, or an
+absolute path.
+
+Examples: `./tsconfig.json',
+`/path/to/tsconfig.json', `C:\\path\\to\\tsconfig.json'"
+  :group 'lsp-deno
+  :risky t
+  :type 'file
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-import-map nil
+  "The file path to an import map.
+Import maps provide a way to relocate modules based on their
+specifiers.  The path can either be relative to the workspace, or
+an absolute path.
+
+Examples: `./import-map.json',
+`/path/to/import-map.json', `C:\\path\\to\\import-map.json'."
+  :group 'lsp-deno
+  :risky t
+  :type 'file
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-deno-enable-unstable nil
+  "Controls if code will be type checked with Deno's unstable APIs."
+  :group 'lsp-deno
+  :risky t
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-clients-deno--make-init-options ()
+  "Initialization options for the Deno language server."
+  `(:enable t
+    :config ,lsp-clients-deno-config
+    :importMap ,lsp-clients-deno-import-map
+    :lint ,(lsp-json-bool lsp-clients-deno-enable-lint)
+    :unstable ,(lsp-json-bool lsp-clients-deno-enable-unstable)
+    :codeLens (:implementations ,(lsp-json-bool lsp-clients-deno-enable-code-lens-implementations)
+               :references ,(lsp-json-bool (or lsp-clients-deno-enable-code-lens-references
+                                               lsp-clients-deno-enable-code-lens-references-all-functions))
+               :referencesAllFunctions ,(lsp-json-bool lsp-clients-deno-enable-code-lens-references-all-functions))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection
+                  (lsp-stdio-connection (lambda ()
+                                          (cons lsp-clients-deno-server
+                                                lsp-clients-deno-server-args)))
+                  :initialization-options #'lsp-clients-deno--make-init-options
+                  :priority -5
+                  :activation-fn #'lsp-typescript-javascript-tsx-jsx-activate-p
+                  :server-id 'deno-ls))
+
+(lsp-consistency-check lsp-javascript)
+
+(provide 'lsp-javascript)
+;;; lsp-javascript.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-json.el b/elpa/lsp-mode-20220201.852/lsp-json.el
new file mode 100644 (file)
index 0000000..127d5e4
--- /dev/null
@@ -0,0 +1,131 @@
+;;; lsp-json.el ---  vscode-json-languageserver integration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Kien Nguyen
+
+;; Author: kien.n.quang at gmail.com
+;; Keywords: lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'ht)
+(require 'url)
+(require 'url-util)
+
+(defgroup lsp-json nil
+  "LSP support for JSON, using vscode-json-languageserver."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/vscode-langservers/vscode-json-languageserver")
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-json-schemas nil
+  "Associate schemas to JSON files in the current project"
+  :type '(repeat alist)
+  :group 'lsp-json
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-http-proxy nil
+  "The URL of the proxy server to use when fetching schema."
+  :type 'string
+  :group 'lsp-json
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-http-proxyStrictSSL t
+  "The URL of the proxy server to use when fetching schema."
+  :type 'boolean
+  :group 'lsp-json
+  :package-version '(lsp-mode . "6.3"))
+
+(lsp-register-custom-settings
+ '(("json.schemas" lsp-json-schemas)
+   ("http.proxy" lsp-http-proxy)
+   ("http.proxyStrictSSL" lsp-http-proxyStrictSSL)))
+
+(defvar lsp-json--extra-init-params
+  `(:provideFormatter t
+    :handledSchemaProtocols ["file" "http" "https"]))
+
+(defvar lsp-json--schema-associations
+  `(:/*.css-data.json ["https://raw.githubusercontent.com/Microsoft/vscode-css-languageservice/master/docs/customData.schema.json"]
+    :/package.json ["http://json.schemastore.org/package"]
+    :/*.html-data.json ["https://raw.githubusercontent.com/Microsoft/vscode-html-languageservice/master/docs/customData.schema.json"]
+    :/*.schema.json ["http://json-schema.org/draft-07/schema#"]
+    :/bower.json ["http://json.schemastore.org/bower"]
+    :/composer.json ["http://json.schemastore.org/composer"]
+    :/tsconfig.json ["http://json.schemastore.org/tsconfig"]
+    :/tsconfig.*.json ["http://json.schemastore.org/tsconfig"]
+    :/typings.json ["http://json.schemastore.org/typings"]
+    :/.bowerrc ["http://json.schemastore.org/bowerrc"]
+    :/.babelrc ["http://json.schemastore.org/babelrc"]
+    :/.babelrc.json ["http://json.schemastore.org/babelrc"]
+    :/babel.config.json ["http://json.schemastore.org/babelrc"]
+    :/jsconfig.json ["http://json.schemastore.org/jsconfig"]
+    :/jsconfig.*.json ["http://json.schemastore.org/jsconfig"]
+    :/project.json ["http://json.schemastore.org/project"]
+    :/omnisharp.json ["http://json.schemastore.org/omnisharp"]
+    :/.eslintrc.json ["http://json.schemastore.org/eslintrc"]
+    :/.eslintrc ["http://json.schemastore.org/eslintrc"])
+  "Default json schemas.")
+
+(defun lsp-json--get-content (_workspace uri callback)
+  "Get content from URI."
+  (ignore-errors
+    (url-retrieve uri
+                  (lambda (_status callback)
+                    (goto-char (point-min))
+                    (re-search-forward "\n\n" nil 'noerror)
+                    (funcall
+                     callback
+                     (decode-coding-string (buffer-substring (point) (point-max))
+                                           'utf-8-unix)))
+                  (list callback))))
+
+(lsp-dependency 'vscode-json-languageserver
+                '(:system "vscode-json-languageserver")
+                '(:npm :package "vscode-json-languageserver"
+                       :path "vscode-json-languageserver"))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection
+  (lsp-stdio-connection
+   (lambda () (list (lsp-package-path 'vscode-json-languageserver) "--stdio")))
+  :activation-fn (lsp-activate-on "json" "jsonc")
+  :server-id 'json-ls
+  :priority 0
+  :multi-root t
+  :completion-in-comments? t
+  :initialization-options lsp-json--extra-init-params
+  :async-request-handlers (ht ("vscode/content" #'lsp-json--get-content))
+  :initialized-fn
+  (lambda (w)
+    (with-lsp-workspace w
+      (lsp--set-configuration
+       (ht-merge (lsp-configuration-section "json")
+                 (lsp-configuration-section "http")))
+      (lsp-notify "json/schemaAssociations" lsp-json--schema-associations)))
+  :download-server-fn
+  (lambda (_client callback error-callback _update?)
+    (lsp-package-ensure 'vscode-json-languageserver callback error-callback))))
+
+(lsp-consistency-check lsp-json)
+
+(provide 'lsp-json)
+;;; lsp-json.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-kotlin.el b/elpa/lsp-mode-20220201.852/lsp-kotlin.el
new file mode 100644 (file)
index 0000000..2cbb166
--- /dev/null
@@ -0,0 +1,149 @@
+;;; lsp-kotlin.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, kotlin
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Kotlin Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-kotlin nil
+  "LSP support for Kotlin, using KotlinLanguageServer."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/fwcd/KotlinLanguageServer"))
+
+(define-obsolete-variable-alias
+  'lsp-kotlin-language-server-path
+  'lsp-clients-kotlin-server-executable
+  "lsp-mode 6.4")
+
+(defcustom lsp-clients-kotlin-server-executable
+  (if (eq system-type 'windows-nt)
+      "kotlin-language-server.bat"
+    "kotlin-language-server")
+  "The kotlin-language-server executable to use.
+Leave as just the executable name to use the default behavior of finding the
+executable with `exec-path'."
+  :type 'string
+  :group 'lsp-kotlin)
+
+(defcustom lsp-kotlin-trace-server "off"
+  "Traces the communication between VSCode and the Kotlin language server."
+  :type '(choice (:tag "off" "messages" "verbose"))
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-kotlin-compiler-jvm-target "1.8"
+  "Specifies the JVM target, e.g. \"1.6\" or \"1.8\"."
+  :type 'string
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-kotlin-linting-debounce-time 250
+  "[DEBUG] Specifies the debounce time limit.
+Lower to increase responsiveness at the cost of possible stability issues."
+  :type 'number
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-kotlin-completion-snippets-enabled t
+  "Specifies whether code completion should provide snippets (true) or
+plain-text items (false)."
+  :type 'boolean
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-kotlin-debug-adapter-enabled t
+  "[Recommended] Specifies whether the debug adapter should be used.
+When enabled a debugger for Kotlin will be available."
+  :type 'boolean)
+
+(defcustom lsp-kotlin-debug-adapter-path ""
+  "Optionally a custom path to the debug adapter executable."
+  :type 'string
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-kotlin-external-sources-use-kls-scheme t
+  "[Recommended] Specifies whether URIs inside JARs should be represented
+using the 'kls'-scheme."
+  :type 'boolean
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-kotlin-external-sources-auto-convert-to-kotlin t
+  "Specifies whether decompiled/external classes should be auto-converted
+to Kotlin."
+  :type 'boolean
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-kotlin-server-download-url
+  "https://github.com/fwcd/kotlin-language-server/releases/latest/download/server.zip"
+  "The URL for the language server download."
+  :type 'string
+  :group 'lsp-kotlin
+  :package-version '(lsp-mode . "8.0.1"))
+
+(lsp-register-custom-settings
+ '(("kotlin.externalSources.autoConvertToKotlin" lsp-kotlin-external-sources-auto-convert-to-kotlin t)
+   ("kotlin.externalSources.useKlsScheme" lsp-kotlin-external-sources-use-kls-scheme t)
+   ("kotlin.debugAdapter.path" lsp-kotlin-debug-adapter-path)
+   ("kotlin.debugAdapter.enabled" lsp-kotlin-debug-adapter-enabled t)
+   ("kotlin.completion.snippets.enabled" lsp-kotlin-completion-snippets-enabled t)
+   ("kotlin.linting.debounceTime" lsp-kotlin-linting-debounce-time)
+   ("kotlin.compiler.jvm.target" lsp-kotlin-compiler-jvm-target)
+   ("kotlin.trace.server" lsp-kotlin-trace-server)
+   ("kotlin.languageServer.path" lsp-clients-kotlin-server-executable)))
+
+(defvar lsp-kotlin--language-server-path
+  (f-join lsp-server-install-dir
+          "kotlin" "server" "bin" (if (eq system-type 'windows-nt)
+                                      "kotlin-language-server.bat"
+                                    "kotlin-language-server"))
+  "The path to store the language server at if necessary.")
+
+(lsp-dependency
+ 'kotlin-language-server
+ `(:system ,lsp-clients-kotlin-server-executable)
+ `(:download :url lsp-kotlin-server-download-url
+             :decompress :zip
+             :store-path ,(f-join lsp-server-install-dir "kotlin" "kotlin-language-server")
+             :binary-path lsp-kotlin--language-server-path
+             :set-executable? t))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection lsp-clients-kotlin-server-executable)
+  :major-modes '(kotlin-mode)
+  :priority -1
+  :server-id 'kotlin-ls
+  :initialized-fn (lambda (workspace)
+                    (with-lsp-workspace workspace
+                      (lsp--set-configuration (lsp-configuration-section "kotlin"))))
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'kotlin-language-server callback error-callback))))
+
+(lsp-consistency-check lsp-kotlin)
+
+(provide 'lsp-kotlin)
+;;; lsp-kotlin.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-lens.el b/elpa/lsp-mode-20220201.852/lsp-lens.el
new file mode 100644 (file)
index 0000000..5cecff4
--- /dev/null
@@ -0,0 +1,448 @@
+;;; lsp-lens.el --- LSP lens -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;;  LSP lens
+;;
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-lens nil
+  "LSP support for lens"
+  :prefix "lsp-lens-"
+  :group 'lsp-mode
+  :tag "LSP Lens")
+
+(defcustom lsp-lens-debounce-interval 0.001
+  "Debounce interval for loading lenses."
+  :group 'lsp-lens
+  :type 'number)
+
+(defcustom lsp-lens-place-position 'end-of-line
+  "The position to place lens relative to returned lens position."
+  :group 'lsp-lens
+  :type '(choice (const above-line)
+                 (const end-of-line))
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defface lsp-lens-mouse-face
+  '((t :height 0.8 :inherit link))
+  "The face used for code lens overlays."
+  :group 'lsp-lens)
+
+(defface lsp-lens-face
+  '((t :inherit lsp-details-face))
+  "The face used for code lens overlays."
+  :group 'lsp-lens)
+
+(defvar-local lsp-lens--modified? nil)
+
+(defvar-local lsp-lens--overlays nil
+  "Current lenses.")
+
+(defvar-local lsp-lens--page nil
+  "Pair of points which holds the last window location the lenses were loaded.")
+
+(defvar-local lsp-lens--last-count nil
+  "The number of lenses the last time they were rendered.")
+
+(defvar lsp-lens-backends '(lsp-lens--backend)
+  "Backends providing lenses.")
+
+(defvar-local lsp-lens--refresh-timer nil
+  "Refresh timer for the lenses.")
+
+(defvar-local lsp-lens--data nil
+  "Pair of points which holds the last window location the lenses were loaded.")
+
+(defvar-local lsp-lens--backend-cache nil)
+
+(defun lsp-lens--text-width (from to)
+  "Measure the width of the text between FROM and TO.
+Results are meaningful only if FROM and TO are on the same line."
+  ;; `current-column' takes prettification into account
+  (- (save-excursion (goto-char to) (current-column))
+     (save-excursion (goto-char from) (current-column))))
+
+(defun lsp-lens--update (ov)
+  "Redraw quick-peek overlay OV."
+  (let* ((offset (lsp-lens--text-width (save-excursion
+                                         (beginning-of-visual-line)
+                                         (point))
+                                       (save-excursion
+                                         (beginning-of-line-text)
+                                         (point))))
+         (str (if (eq 'end-of-line lsp-lens-place-position)
+                  (overlay-get ov 'lsp--lens-contents)
+                (concat (make-string offset ?\s)
+                        (overlay-get ov 'lsp--lens-contents)))))
+    (save-excursion
+      (goto-char (overlay-start ov))
+      (if (eq 'end-of-line lsp-lens-place-position)
+          (overlay-put ov 'after-string (propertize (concat " " str) 'cursor t))
+        (overlay-put ov 'before-string (concat str "\n")))
+      (overlay-put ov 'lsp-original str))))
+
+(defun lsp-lens--overlay-ensure-at (pos)
+  "Find or create a lens for the line at POS."
+  (-doto (save-excursion
+           (goto-char pos)
+           (if (eq 'end-of-line lsp-lens-place-position)
+               (make-overlay (point-at-eol) -1 nil t t)
+             (make-overlay (point-at-bol) (1+ (point-at-eol)) nil t t)))
+    (overlay-put 'lsp-lens t)
+    (overlay-put 'evaporate t)
+    (overlay-put 'lsp-lens-position pos)))
+
+(defun lsp-lens--show (str pos metadata)
+  "Show STR in an inline window at POS including METADATA."
+  (let ((ov (lsp-lens--overlay-ensure-at pos)))
+    (save-excursion
+      (goto-char pos)
+      (setf (overlay-get ov 'lsp--lens-contents) str)
+      (setf (overlay-get ov 'lsp--metadata) metadata)
+      (lsp-lens--update ov)
+      ov)))
+
+(defun lsp-lens--idle-function (&optional buffer)
+  "Create idle function for buffer BUFFER."
+  (when (and (or (not buffer) (eq (current-buffer) buffer))
+             (not (equal (cons (window-start) (window-end)) lsp-lens--page)))
+    (lsp-lens--schedule-refresh nil)))
+
+(defun lsp-lens--overlay-matches-pos (ov pos)
+  "Check if OV is a lens covering POS."
+  (and (overlay-get ov 'lsp-lens)
+       (overlay-start ov)
+       (<= (overlay-start ov) pos)
+       (< pos (overlay-end ov))))
+
+(defun lsp-lens--after-save ()
+  "Handler for `after-save-hook' for lens mode."
+  (lsp-lens--schedule-refresh t))
+
+(defun lsp-lens--schedule-refresh (&optional buffer-modified?)
+  "Call each of the backend.
+BUFFER-MODIFIED? determines whether the buffer was modified or
+not."
+  (-some-> lsp-lens--refresh-timer cancel-timer)
+
+  (setq lsp-lens--page (cons (window-start) (window-end)))
+  (setq lsp-lens--refresh-timer
+        (run-with-timer lsp-lens-debounce-interval
+                        nil
+                        #'lsp-lens-refresh
+                        (or lsp-lens--modified? buffer-modified?)
+                        (current-buffer))))
+
+(defun lsp-lens--schedule-refresh-modified ()
+  "Schedule a lens refresh due to a buffer-modification.
+See `lsp-lens--schedule-refresh' for details."
+  (lsp-lens--schedule-refresh t))
+
+(defun lsp-lens--keymap (command)
+  "Build the lens keymap for COMMAND."
+  (-doto (make-sparse-keymap)
+    (define-key [mouse-1] (lsp-lens--create-interactive-command command))))
+
+(defun lsp-lens--create-interactive-command (command?)
+  "Create an interactive COMMAND? for the lens.
+COMMAND? shall be an `&Command' (e.g. `&CodeLens' :command?) and
+mustn't be nil."
+  (if (functionp (lsp:command-command command?))
+      (lsp:command-command command?)
+    (lambda ()
+      (interactive)
+      (lsp--execute-command command?))))
+
+(defun lsp-lens--display (lenses)
+  "Show LENSES."
+  ;; rerender only if there are lenses which are not processed or if their count
+  ;; has changed(e. g. delete lens should trigger redisplay).
+  (let ((scroll-preserve-screen-position t))
+    (setq lsp-lens--modified? nil)
+    (when (or (-any? (-lambda ((&CodeLens :_processed processed))
+                       (not processed))
+                     lenses)
+              (eq (length lenses) lsp-lens--last-count)
+              (not lenses))
+      (setq lsp-lens--last-count (length lenses))
+      (mapc #'delete-overlay lsp-lens--overlays)
+      (setq lsp-lens--overlays
+            (->> lenses
+                 (-filter #'lsp:code-lens-command?)
+                 (--map (prog1 it (lsp-put it :_processed t)))
+                 (-group-by (-compose #'lsp:position-line #'lsp:range-start #'lsp:code-lens-range))
+                 (-map
+                  (-lambda ((_ . lenses))
+                    (let* ((sorted (-sort (-on #'< (-compose #'lsp:position-character
+                                                             #'lsp:range-start
+                                                             #'lsp:code-lens-range))
+                                          lenses))
+                           (data (-map
+                                  (-lambda ((lens &as &CodeLens
+                                                  :command? (command &as
+                                                                     &Command :title :_face face)))
+                                    (propertize
+                                     title
+                                     'face (or face 'lsp-lens-face)
+                                     'action (lsp-lens--create-interactive-command command)
+                                     'pointer 'hand
+                                     'mouse-face 'lsp-lens-mouse-face
+                                     'local-map (lsp-lens--keymap command)))
+                                  sorted)))
+                      (lsp-lens--show
+                       (s-join (propertize "|" 'face 'lsp-lens-face) data)
+                       (-> sorted cl-first lsp:code-lens-range lsp:range-start lsp--position-to-point)
+                       data)))))))))
+
+(defun lsp-lens-refresh (buffer-modified? &optional buffer)
+  "Refresh lenses using lenses backend.
+BUFFER-MODIFIED? determines whether the BUFFER is modified or not."
+  (let ((buffer (or buffer (current-buffer))))
+    (when (buffer-live-p buffer)
+      (with-current-buffer buffer
+        (dolist (backend lsp-lens-backends)
+          (funcall backend buffer-modified?
+                   (lambda (lenses version)
+                     (when (buffer-live-p buffer)
+                       (with-current-buffer buffer
+                         (lsp-lens--process backend lenses version))))))))))
+
+(defun lsp-lens--process (backend lenses version)
+  "Process LENSES originated from BACKEND.
+VERSION is the version of the file. The lenses has to be
+refreshed only when all backends have reported for the same
+version."
+  (setq lsp-lens--data (or lsp-lens--data (make-hash-table)))
+  (puthash backend (cons version (append lenses nil)) lsp-lens--data)
+
+  (-let [backend-data (->> lsp-lens--data ht-values (-filter #'cl-rest))]
+    (when (and
+           (= (length lsp-lens-backends) (ht-size lsp-lens--data))
+           (seq-every-p (-lambda ((version))
+                          (or (not version) (eq version lsp--cur-version)))
+                        backend-data))
+      ;; display the data only when the backends have reported data for the
+      ;; current version of the file
+      (lsp-lens--display (apply #'append (-map #'cl-rest backend-data)))))
+  version)
+
+(lsp-defun lsp--lens-backend-not-loaded? ((&CodeLens :range
+                                                     (&Range :start)
+                                                     :command?
+                                                     :_pending pending))
+  "Return t if LENS has to be loaded."
+  (and (< (window-start) (lsp--position-to-point start) (window-end))
+       (not command?)
+       (not pending)))
+
+(lsp-defun lsp--lens-backend-present? ((&CodeLens :range (&Range :start) :command?))
+  "Return t if LENS has to be loaded."
+  (or command?
+      (not (< (window-start) (lsp--position-to-point start) (window-end)))))
+
+(defun lsp-lens--backend-fetch-missing (lenses callback file-version)
+  "Fetch LENSES without command in for the current window.
+
+TICK is the buffer modified tick. If it does not match
+`buffer-modified-tick' at the time of receiving the updates the
+updates must be discarded..
+CALLBACK - the callback for the lenses.
+FILE-VERSION - the version of the file."
+  (seq-each
+   (lambda (it)
+     (with-lsp-workspace (lsp-get it :_workspace)
+       (lsp-put it :_pending t)
+       (lsp-put it :_workspace nil)
+       (lsp-request-async "codeLens/resolve" it
+                          (-lambda ((&CodeLens :command?))
+                            (lsp-put it :_pending nil)
+                            (lsp-put it :command command?)
+                            (when (seq-every-p #'lsp--lens-backend-present? lenses)
+                              (funcall callback lenses file-version)))
+                          :mode 'tick)))
+   (seq-filter #'lsp--lens-backend-not-loaded? lenses)))
+
+(defun lsp-lens--backend (modified? callback)
+  "Lenses backend using `textDocument/codeLens'.
+MODIFIED? - t when buffer is modified since the last invocation.
+CALLBACK - callback for the lenses."
+  (when (lsp--find-workspaces-for "textDocument/codeLens")
+    (if modified?
+        (progn
+          (setq lsp-lens--backend-cache nil)
+          (lsp-request-async "textDocument/codeLens"
+                             `(:textDocument (:uri ,(lsp--buffer-uri)))
+                             (lambda (lenses)
+                               (setq lsp-lens--backend-cache
+                                     (seq-mapcat
+                                      (-lambda ((workspace . workspace-lenses))
+                                        ;; preserve the original workspace so we can later use it to resolve the lens
+                                        (seq-do (-rpartial #'lsp-put :_workspace workspace) workspace-lenses)
+                                        workspace-lenses)
+                                      lenses))
+                               (if (-every? #'lsp:code-lens-command? lsp-lens--backend-cache)
+                                   (funcall callback lsp-lens--backend-cache lsp--cur-version)
+                                 (lsp-lens--backend-fetch-missing lsp-lens--backend-cache callback lsp--cur-version)))
+                             :error-handler #'ignore
+                             :mode 'tick
+                             :no-merge t
+                             :cancel-token (concat (buffer-name (current-buffer)) "-lenses")))
+      (if (-all? #'lsp--lens-backend-present? lsp-lens--backend-cache)
+          (funcall callback lsp-lens--backend-cache lsp--cur-version)
+        (lsp-lens--backend-fetch-missing lsp-lens--backend-cache callback lsp--cur-version)))))
+
+(defun lsp-lens--refresh-buffer ()
+  "Trigger lens refresh on buffer."
+  (remove-hook 'lsp-on-idle-hook #'lsp-lens--refresh-buffer t)
+  (when (bound-and-true-p lsp-lens-mode)
+    (lsp-lens-refresh t)))
+
+(defun lsp--lens-on-refresh (workspace)
+  "Clear lens within all buffers of WORKSPACE, refreshing all workspace buffers."
+  (cl-assert (not (eq nil workspace)))
+  (->> (lsp--workspace-buffers workspace)
+       (mapc (lambda (buffer)
+               (lsp-with-current-buffer buffer
+                 (if (lsp--buffer-visible-p)
+                     (when (bound-and-true-p lsp-lens-mode)
+                       (lsp-lens-refresh t))
+                   (progn
+                     (add-hook 'lsp-on-idle-hook #'lsp-lens--refresh-buffer nil t)
+                     (lsp--idle-reschedule (current-buffer)))))))))
+
+;;;###autoload
+(defun lsp-lens--enable ()
+  "Enable lens mode."
+  (when (and lsp-lens-enable
+             (lsp-feature? "textDocument/codeLens"))
+    (lsp-lens-mode 1)))
+
+(defun lsp-lens--disable ()
+  "Disable lens mode."
+  (lsp-lens-mode -1))
+
+;;;###autoload
+(defun lsp-lens-show ()
+  "Display lenses in the buffer."
+  (interactive)
+  (->> (lsp-request "textDocument/codeLens"
+                    `(:textDocument (:uri
+                                     ,(lsp--path-to-uri buffer-file-name))))
+       (seq-map (-lambda ((lens &as &CodeAction :command?))
+                  (if command?
+                      lens
+                    (lsp-request "codeLens/resolve" lens))))
+       lsp-lens--display))
+
+;;;###autoload
+(defun lsp-lens-hide ()
+  "Delete all lenses."
+  (interactive)
+  (let ((scroll-preserve-screen-position t))
+    (seq-do #'delete-overlay lsp-lens--overlays)
+    (setq lsp-lens--overlays nil)))
+
+;;;###autoload
+(define-minor-mode lsp-lens-mode
+  "Toggle code-lens overlays."
+  :group 'lsp-lens
+  :global nil
+  :init-value nil
+  :lighter " Lens"
+  (cond
+   (lsp-lens-mode
+    (add-hook 'lsp-unconfigure-hook #'lsp-lens--disable nil t)
+    (add-hook 'lsp-configure-hook #'lsp-lens--enable nil t)
+    (add-hook 'lsp-on-idle-hook #'lsp-lens--idle-function nil t)
+    (add-hook 'lsp-on-change-hook #'lsp-lens--schedule-refresh-modified nil t)
+    (add-hook 'after-save-hook #'lsp-lens--after-save nil t)
+    (add-hook 'before-revert-hook #'lsp-lens-hide nil t)
+    (lsp-lens-refresh t))
+   (t
+    (remove-hook 'lsp-on-idle-hook #'lsp-lens--idle-function t)
+    (remove-hook 'lsp-on-change-hook #'lsp-lens--schedule-refresh-modified t)
+    (remove-hook 'after-save-hook #'lsp-lens--after-save t)
+    (remove-hook 'before-revert-hook #'lsp-lens-hide t)
+    (when lsp-lens--refresh-timer
+      (cancel-timer lsp-lens--refresh-timer))
+    (setq lsp-lens--refresh-timer nil)
+    (lsp-lens-hide)
+    (setq lsp-lens--last-count nil)
+    (setq lsp-lens--backend-cache nil)
+    (remove-hook 'lsp-configure-hook #'lsp-lens--enable t)
+    (remove-hook 'lsp-unconfigure-hook #'lsp-lens--disable t))))
+
+\f
+;; avy integration
+
+(declare-function avy-process "ext:avy" (candidates &optional overlay-fn cleanup-fn))
+(declare-function avy--key-to-char "ext:avy" (c))
+(defvar avy-action)
+
+;;;###autoload
+(defun lsp-avy-lens ()
+  "Click lsp lens using `avy' package."
+  (interactive)
+  (unless lsp-lens--overlays
+    (user-error "No lenses in current buffer"))
+  (let* ((avy-action 'identity)
+         (position (if (eq lsp-lens-place-position 'end-of-line)
+                       'after-string
+                     'before-string))
+         (action (cl-third
+                  (avy-process
+                   (-mapcat
+                    (lambda (overlay)
+                      (-map-indexed
+                       (lambda (index lens-token)
+                         (list overlay index
+                               (get-text-property 0 'action lens-token)))
+                       (overlay-get overlay 'lsp--metadata)))
+                    lsp-lens--overlays)
+                   (-lambda (path ((ov index) . _win))
+                     (let* ((path (mapcar #'avy--key-to-char path))
+                            (str (propertize (string (car (last path)))
+                                             'face 'avy-lead-face))
+                            (old-str (overlay-get ov position))
+                            (old-str-tokens (s-split "|" old-str))
+                            (old-token (seq-elt old-str-tokens index))
+                            (tokens `(,@(-take index old-str-tokens)
+                                      ,(-if-let ((_ prefix suffix)
+                                                 (s-match "\\(^[[:space:]]+\\)\\(.*\\)" old-token))
+                                           (concat prefix str suffix)
+                                         (concat str old-token))
+                                      ,@(-drop (1+ index) old-str-tokens)))
+                            (new-str (s-join (propertize "|" 'face 'lsp-lens-face) tokens))
+                            (new-str (if (or (s-ends-with? "\n" new-str)
+                                             (eq lsp-lens-place-position 'end-of-line))
+                                         new-str
+                                       (concat new-str "\n"))))
+                       (overlay-put ov position new-str)))
+                   (lambda ()
+                     (--map (overlay-put it position
+                                         (overlay-get it 'lsp-original))
+                            lsp-lens--overlays))))))
+    (when action (funcall-interactively action))))
+
+(lsp-consistency-check lsp-lens)
+
+(provide 'lsp-lens)
+;;; lsp-lens.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-lua.el b/elpa/lsp-mode-20220201.852/lsp-lua.el
new file mode 100644 (file)
index 0000000..3349a61
--- /dev/null
@@ -0,0 +1,678 @@
+;;; lsp-lua.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 E. Alexander Barbosa
+
+;; Author: E. Alexander Barbosa <elxbarbosaNOSPAMoutlook.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Lua Programming Language
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'f)
+(require 'files)
+
+(defgroup lsp-emmy-lua nil
+  "Lua LSP client, provided by the EmmyLua Language Server."
+  :group 'lsp-mode
+  :version "8.0.0"
+  :link '(url-link "https://github.com/EmmyLua/EmmyLua-LanguageServer"))
+
+(defcustom lsp-clients-emmy-lua-java-path "java"
+  "Java Runtime binary location."
+  :group 'lsp-emmy-lua
+  :version "8.0.0"
+  :risky t
+  :type 'file)
+
+(defcustom lsp-clients-emmy-lua-jar-path (f-join lsp-server-install-dir "EmmyLua-LS-all.jar")
+  "Emmy Lua language server jar file."
+  :group 'lsp-emmy-lua
+  :version "8.0.0"
+  :risky t
+  :type 'file)
+
+(defcustom lsp-clients-emmy-lua-args '("-jar")
+  "Arguments to the Lua Language server."
+  :group 'lsp-emmy-lua
+  :version "8.0.0"
+  :risky t
+  :type  '(repeat string))
+
+(defcustom lsp-clients-emmy-lua-command nil
+  "Final command to call the Lua Language server."
+  :group 'lsp-emmy-lua
+  :version "8.0.0"
+  :risky t
+  :type '(repeat string))
+
+(defun lsp-clients-emmy-lua-test ()
+  "Test the Emmy Lua binaries and files."
+  (and (executable-find lsp-clients-emmy-lua-java-path)
+       (f-exists? lsp-clients-emmy-lua-jar-path)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda () (or lsp-clients-emmy-lua-command
+                                                       `(,lsp-clients-emmy-lua-java-path
+                                                         ,@lsp-clients-emmy-lua-args
+                                                         ,lsp-clients-emmy-lua-jar-path)))
+                                        #'lsp-clients-emmy-lua-test)
+  :major-modes '(lua-mode)
+  :server-id 'emmy-lua
+  :priority -1
+  :notification-handlers (lsp-ht ("emmy/progressReport" #'ignore))))
+
+
+;;; lua-language-server
+(defgroup lsp-lua-language-server nil
+  "Lua LSP client, provided by the Lua Language Server."
+  :group 'lsp-mode
+  :version "8.0.0"
+  :link '(url-link "https://github.com/sumneko/lua-language-server"))
+
+(defcustom lsp-clients-lua-language-server-install-dir (f-join lsp-server-install-dir "lua-language-server/")
+  "Installation directory for Lua Language Server."
+  :group 'lsp-lua-language-server
+  :version "8.0.0"
+  :risky t
+  :type 'directory)
+
+(defcustom lsp-clients-lua-language-server-bin
+  (f-join lsp-clients-lua-language-server-install-dir
+          "extension/server/bin/"
+          (pcase system-type
+            ('gnu/linux "Linux/lua-language-server")
+            ('darwin "macOS/lua-language-server")
+            ('windows-nt "Windows/lua-language-server.exe")
+            (_ "Linux/lua-language-server")))
+  "Location of Lua Language Server."
+  :group 'lsp-lua-language-server
+  :version "8.0.0"
+  :risky t
+  :type 'file)
+
+(defcustom lsp-clients-lua-language-server-main-location
+  (f-join lsp-clients-lua-language-server-install-dir
+          "extension/server/main.lua")
+  "Location of Lua Language Server main.lua."
+  :group 'lsp-lua-language-server
+  :version "8.0.0"
+  :risky t
+  :type 'file)
+
+(defcustom lsp-clients-lua-language-server-args '("-E")
+  "Arguments to run the Lua Language server."
+  :group 'lsp-lua-language-server
+  :version "8.0.0"
+  :risky t
+  :type '(repeat string))
+
+(defcustom lsp-clients-lua-language-server-command nil
+  "Command to start Lua Language server."
+  :group 'lsp-lua-language-server
+  :type '(repeat string))
+
+
+(defun lsp-clients-lua-language-server-test ()
+  "Test Lua language server binaries and files."
+  (and (f-exists? lsp-clients-lua-language-server-main-location)
+       (f-exists? lsp-clients-lua-language-server-bin)))
+
+(defcustom lsp-lua-color-mode "Semantic"
+  "Color mode."
+  :type '(choice (:tag "Grammar" "Semantic"))
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-completion-call-snippet "Disable"
+  "Shows function call snippets."
+  :type '(choice (:tag "Disable" "Both" "Replace"))
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-completion-display-context 6
+  "Previewing the relevant code snippet of the suggestion may help you
+understand the usage of the suggestion.
+
+The number set indicates the number of intercepted lines in the code
+fragment.  If it is set to `0`, this feature can be disabled."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-completion-enable t
+  "Enable completion."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-completion-keyword-snippet "Replace"
+  "Shows keyword syntax snippets."
+  :type '(choice (:tag "Disable" "Both" "Replace"))
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-completion-workspace-word t
+  "Show words within the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-develop-debugger-port 11412
+  "Listen port of debugger."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-develop-debugger-wait nil
+  "Suspend before debugger connects."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-develop-enable nil
+  "Developer mode.  Do not enable, performance will be affected."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-diagnostics-disable nil
+  "Disabled diagnostic (Use code in hover brackets).
+```json
+\"Lua.diagnostics.disable\" : [
+\"unused-local\",
+\"lowercase-global\"
+]
+```"
+  :type 'lsp-string-vector
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-diagnostics-enable t
+  "Enable diagnostics."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-diagnostics-globals nil
+  "Defined global variables.
+```json
+\"Lua.diagnostics.globals\" : [
+\"GLOBAL1\",
+\"GLOBAL2\"
+]
+```"
+  :type 'lsp-string-vector
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-diagnostics-needed-file-status nil
+  "If you want to check only opened files, choice Opened; else choice Any.
+```json
+\"Lua.diagnostics.neededFileStatus\" : {
+\"ambiguity-1\" : \"Any\",
+\"circle-doc-class\" : \"Opened\"
+}
+```"
+  :type 'alist
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-diagnostics-severity nil
+  "Modified diagnostic severity.
+```json
+\"Lua.diagnostics.severity\" : {
+\"redefined-local\" : \"Warning\",
+\"emmy-lua\" : \"Hint\"
+}
+```"
+  :type 'alist
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-diagnostics-workspace-delay 0
+  "Latency (milliseconds) for workspace diagnostics. When you start the
+workspace, or edit any file, the entire workspace will be re-diagnosed in the
+background. Set to negative to disable workspace diagnostics."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-diagnostics-workspace-rate 100
+  "Workspace diagnostics run rate (%). Decreasing this value reduces CPU usage,
+but also reduces the speed of workspace diagnostics. The diagnosis of the file
+you are currently editing is always done at full speed and is not affected by
+this setting."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hint-enable nil
+  "Enable hint."
+  :type 'boolean
+  :package-version '(lsp-mmode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hint-param-name t
+  "Hint parameter name when the parameter called is literal."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hint-param-type t
+  "Show type hints at the parameter of the function."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hint-set-type nil
+  "Hint type at assignment operation."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hover-enable t
+  "Enable hover."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hover-field-infer 3000
+  "When hovering to view a table, type infer will be performed for each field.
+When the accumulated time of type infer reaches the set value (MS), the type
+infer of subsequent fields will be skipped."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hover-preview-fields 100
+  "When hovering to view a table, limits the maximum number of previews for
+fields."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hover-view-number t
+  "Hover to view numeric content (only if literal is not decimal)."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hover-view-string t
+  "Hover to view the contents of a string (only if the literal contains an
+escape character)."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-hover-view-string-max 1000
+  "The maximum length of a hover to view the contents of a string."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-intelli-sense-search-depth 0
+  "Set the search depth for IntelliSense. Increasing this value increases
+accuracy, but decreases performance. Different workspace have different
+tolerance for this setting. Please adjust it to the appropriate value."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-runtime-file-encoding "utf8"
+  "File encoding. The 'ansi' option is only available under the 'Windows'
+platform."
+  :type '(choice (:tag "utf8" "ansi"))
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-runtime-nonstandard-symbol nil
+  "Supports non-standard symbols. Make sure that your runtime environment
+supports these symbols."
+  :type 'lsp-string-vector
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-runtime-path
+  ["?.lua" "?/init.lua" "?/?.lua"]
+  "`package.path`."
+  :type 'lsp-string-vector
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-runtime-plugin nil
+  "(Proposed) Plugin path. Default is `.vscode/lua/plugin.lua`"
+  :type 'file
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-runtime-special nil
+  "The custom global variables are regarded as some special built-in variables,
+and the language server will provide special support.
+```json
+\"Lua.runtime.special\" : {
+\"include\" : \"require\"
+}
+```"
+  :type 'alist
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-runtime-unicode-name nil
+  "Allows Unicode characters in name."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-runtime-version "Lua 5.4"
+  "Lua runtime version."
+  :type '(choice (:tag "Lua 5.1" "Lua 5.2" "Lua 5.3" "Lua 5.4" "LuaJIT"))
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-signature-help-enable t
+  "Enable signature help."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-telemetry-enable nil
+  "Enable telemetry to send your editor information and error logs over the
+network."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-window-progress-bar t
+  "Show progress bar in status bar."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-window-status-bar t
+  "Show extension status in status bar."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-workspace-ignore-dir
+  [".vscode"]
+  "Ignored directories (Use `.gitignore` grammar).
+```json
+\"Lua.workspace.ignoreDir\" : [
+\"temp/*.*\",
+\"!temp/*.lua\"
+]
+```"
+  :type 'lsp-string-vector
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-workspace-ignore-submodules t
+  "Ignore submodules."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-workspace-library nil
+  "Load external library.
+
+This feature can load external Lua files, which can be used for definition,
+automatic completion and other functions.  Note that the language server does
+not monitor changes in external files and needs to restart if the external
+files are modified.  The following example shows loaded files in `C:/lua`
+and `../lib` ,exclude `../lib/temp`.
+
+```json
+\"Lua.workspace.library\": {
+\"C:/lua\": true,
+\"../lib\": [
+\"temp/*\"
+]
+}
+```"
+  :type 'alist
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-workspace-max-preload 1000
+  "Max preloaded files."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-workspace-preload-file-size 100
+  "Skip files larger than this value (KB) when preloading."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-workspace-use-git-ignore t
+  "Ignore files list in `.gitignore` ."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-files-associations nil
+  "Files.associations."
+  :type 'alist
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(defcustom lsp-lua-files-exclude nil
+  "Files.exclude."
+  :type 'alist
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-lua-language-server)
+
+(lsp-register-custom-settings
+ '(("files.associations" lsp-lua-files-associations t)
+   ("files.exclude" lsp-lua-files-exclude t)
+   ("Lua.workspace.useGitIgnore" lsp-lua-workspace-use-git-ignore t)
+   ("Lua.workspace.preloadFileSize" lsp-lua-workspace-preload-file-size)
+   ("Lua.workspace.maxPreload" lsp-lua-workspace-max-preload)
+   ("Lua.workspace.library" lsp-lua-workspace-library)
+   ("Lua.workspace.ignoreSubmodules" lsp-lua-workspace-ignore-submodules t)
+   ("Lua.workspace.ignoreDir" lsp-lua-workspace-ignore-dir)
+   ("Lua.window.statusBar" lsp-lua-window-status-bar t)
+   ("Lua.window.progressBar" lsp-lua-window-progress-bar t)
+   ("Lua.telemetry.enable" lsp-lua-telemetry-enable t)
+   ("Lua.signatureHelp.enable" lsp-lua-signature-help-enable t)
+   ("Lua.runtime.version" lsp-lua-runtime-version)
+   ("Lua.runtime.unicodeName" lsp-lua-runtime-unicode-name nil)
+   ("Lua.runtime.special" lsp-lua-runtime-special)
+   ("Lua.runtime.plugin" lsp-lua-runtime-plugin)
+   ("Lua.runtime.path" lsp-lua-runtime-path)
+   ("Lua.runtime.nonstandardSymbol" lsp-lua-runtime-nonstandard-symbol)
+   ("Lua.runtime.fileEncoding" lsp-lua-runtime-file-encoding)
+   ("Lua.intelliSense.searchDepth" lsp-lua-intelli-sense-search-depth)
+   ("Lua.hover.viewStringMax" lsp-lua-hover-view-string-max)
+   ("Lua.hover.viewString" lsp-lua-hover-view-string t)
+   ("Lua.hover.viewNumber" lsp-lua-hover-view-number t)
+   ("Lua.hover.previewFields" lsp-lua-hover-preview-fields)
+   ("Lua.hover.fieldInfer" lsp-lua-hover-field-infer)
+   ("Lua.hover.enable" lsp-lua-hover-enable t)
+   ("Lua.hint.setType" lsp-lua-hint-set-type nil)
+   ("Lua.hint.paramType" lsp-lua-hint-param-type t)
+   ("Lua.hint.paramName" lsp-lua-hint-param-name t)
+   ("Lua.hint.enable" lsp-lua-hint-enable t)
+   ("Lua.diagnostics.workspaceRate" lsp-lua-diagnostics-workspace-rate)
+   ("Lua.diagnostics.workspaceDelay" lsp-lua-diagnostics-workspace-delay)
+   ("Lua.diagnostics.severity" lsp-lua-diagnostics-severity)
+   ("Lua.diagnostics.neededFileStatus" lsp-lua-diagnostics-needed-file-status)
+   ("Lua.diagnostics.globals" lsp-lua-diagnostics-globals)
+   ("Lua.diagnostics.enable" lsp-lua-diagnostics-enable t)
+   ("Lua.diagnostics.disable" lsp-lua-diagnostics-disable)
+   ("Lua.develop.enable" lsp-lua-develop-enable t)
+   ("Lua.develop.debuggerWait" lsp-lua-develop-debugger-wait t)
+   ("Lua.develop.debuggerPort" lsp-lua-develop-debugger-port)
+   ("Lua.completion.workspaceWord" lsp-lua-completion-workspace-word t)
+   ("Lua.completion.keywordSnippet" lsp-lua-completion-keyword-snippet)
+   ("Lua.completion.enable" lsp-lua-completion-enable t)
+   ("Lua.completion.displayContext" lsp-lua-completion-display-context)
+   ("Lua.completion.callSnippet" lsp-lua-completion-call-snippet)
+   ("Lua.color.mode" lsp-lua-color-mode)))
+
+(defun lsp-lua-language-server-install (client callback error-callback update?)
+  "Download the latest version of lua-language-server and extract it to
+`lsp-lua-language-server-install-dir'."
+  (ignore client update?)
+  (let ((store-path (expand-file-name "vs-lua" lsp-clients-lua-language-server-install-dir)))
+    (lsp-download-install
+     (lambda (&rest _)
+       (set-file-modes lsp-clients-lua-language-server-bin #o0700)
+       (funcall callback))
+     error-callback
+     :url (lsp-vscode-extension-url "sumneko" "lua" "1.17.4")
+     :store-path store-path
+     :decompress :zip)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda () (or lsp-clients-lua-language-server-command
+                                                       `(,lsp-clients-lua-language-server-bin
+                                                         ,@lsp-clients-lua-language-server-args
+                                                         ,lsp-clients-lua-language-server-main-location)))
+                                        #'lsp-clients-lua-language-server-test)
+  :major-modes '(lua-mode)
+  :priority -2
+  :server-id 'lua-language-server
+  :download-server-fn #'lsp-lua-language-server-install))
+
+
+;;; lua-lsp
+(defgroup lsp-lua-lsp nil
+  "Lua LSP client, provided by the Lua-Lsp."
+  :group 'lsp-mode
+  :version "8.0.0"
+  :link '(url-link "https://github.com/Alloyed/lua-lsp"))
+
+(defcustom lsp-clients-luarocks-bin-dir (f-join (getenv "HOME") ".luarocks/bin/")
+  "LuaRocks bin directory."
+  :group 'lsp-lua-lsp
+  :version "8.0.0"
+  :risky t
+  :type 'directory)
+
+(defcustom lsp-clients-lua-lsp-server-install-dir nil
+  "Installation directory for Lua-Lsp Language Server."
+  :group 'lsp-lua-lsp
+  :version "8.0.0"
+  :risky t
+  :type 'file)
+
+(defun lsp-clients-lua-lsp-test ()
+  "Test Lua-lsp language server files."
+  (and (f-exists? lsp-clients-lua-lsp-server-install-dir)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda ()
+                                          (or lsp-clients-lua-lsp-server-install-dir
+                                              (f-join lsp-clients-luarocks-bin-dir "lua-lsp")))
+                                        #'lsp-clients-lua-lsp-test)
+  :major-modes '(lua-mode)
+  :priority -3
+  :server-id 'lsp-lua-lsp))
+
+;;; lua-roblox-language-server
+(defgroup lsp-lua-roblox-language-server nil
+  "Roblox Lua LSP client, provided by the Roblox Lua Language Server."
+  :group 'lsp-mode
+  :version "8.0.0"
+  :link '(url-link "https://github.com/NightrainsRbx/RobloxLsp"))
+
+(defcustom lsp-lua-roblox-language-server-install-dir (f-join lsp-server-install-dir "lua-roblox-language-server/")
+  "Installation directory for Lua Language Server."
+  :group 'lsp-lua-roblox-language-server
+  :version "8.0.0"
+  :risky t
+  :type 'directory)
+
+(defcustom lsp-lua-roblox-language-server-bin
+  (f-join lsp-lua-roblox-language-server-install-dir
+          "extension/server/bin/"
+          (pcase system-type
+            ('gnu/linux "Linux/lua-language-server")
+            ('darwin "macOS/lua-language-server")
+            ('windows-nt "Windows/lua-language-server.exe")
+            (_ "Linux/lua-language-server")))
+  "Location of Roblox Lua Language Server."
+  :group 'lsp-lua-roblox-language-server
+  :version "8.0.0"
+  :risky t
+  :type 'file)
+
+(defcustom lsp-lua-roblox-language-server-main-location
+  (f-join lsp-lua-roblox-language-server-install-dir
+          "extension/server/main.lua")
+  "Location of Roblox Lua Language Server main.lua."
+  :group 'lsp-lua-roblox-language-server
+  :version "8.0.0"
+  :risky t
+  :type 'file)
+
+(defcustom lsp-lua-roblox-server-download-url
+  (lsp-vscode-extension-url "Nightrains" "robloxlsp" "0.15.8")
+  "Download url for Roblox Lua vscode extension."
+  :group 'lsp-lua-roblox-language-server
+  :version "8.0.0"
+  :type 'string)
+
+(defcustom lsp-lua-roblox-server-store-path
+  (expand-file-name "vs-lua-roblox" lsp-lua-roblox-language-server-install-dir)
+  "Server file name for the vscode extension."
+  :group 'lsp-lua-roblox-language-server
+  :version "8.0.0"
+  :type 'string)
+
+(defun lsp-lua-roblox-language-server-test ()
+  "Test Lua language server binaries and files."
+  (and (f-exists? lsp-lua-roblox-language-server-main-location)
+       (f-exists? lsp-lua-roblox-language-server-bin)))
+
+(defun lsp-lua-roblox-language-server-install (_client callback error-callback _update?)
+  "Download the latest version of lua-language-server and extract it to
+`lsp-lua-roblox-language-server-download-url'."
+  (lsp-download-install
+    (lambda (&rest _)
+     (set-file-modes lsp-lua-roblox-language-server-bin #o0700)
+     (funcall callback))
+     error-callback
+     :url lsp-lua-roblox-server-download-url
+     :store-path lsp-lua-roblox-server-store-path
+     :decompress :zip))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda () (or lsp-clients-lua-language-server-command
+                                                       `(,lsp-lua-roblox-language-server-bin
+                                                         ,@lsp-clients-lua-language-server-args
+                                                         ,lsp-lua-roblox-language-server-main-location)))
+                                        #'lsp-lua-roblox-language-server-test)
+  :major-modes '(lua-mode)
+  :priority -4
+  :server-id 'lua-roblox-language-server
+  :download-server-fn #'lsp-lua-roblox-language-server-install))
+
+(lsp-consistency-check lsp-lua)
+
+(provide 'lsp-lua)
+;;; lsp-lua.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-markdown.el b/elpa/lsp-mode-20220201.852/lsp-markdown.el
new file mode 100644 (file)
index 0000000..08f1b20
--- /dev/null
@@ -0,0 +1,103 @@
+;;; lsp-markdown.el --- lsp-mode markdown integration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 lsp-mode maintainers
+
+;; Author: lsp-mode maintainers
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;  LSP client for unified-language-server
+
+;;; Code:
+
+(require 'lsp-mode)
+
+;;; Markdown
+(defgroup lsp-markdown nil
+  "Settings for the markdown language server client."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/unifiedjs/unified-language-server")
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-markdown-server-command "unified-language-server"
+  "The binary (or full path to binary) which executes the server."
+  :type 'string
+  :group 'lsp-markdown
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-markdown-server-command-args '("--parser=remark-parse" "--stdio")
+  "Command-line arguments for the markdown lsp server."
+  :type '(repeat 'string)
+  :group 'lsp-markdown
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-markdown-remark-plugins [["#remark-preset-lint-markdown-style-guide"]]
+  "The JSON configuration object for plugins.
+
+For a complete list of plugins, check:
+ https://github.com/unifiedjs/unified-language-server/blob/main/CONFIGURATION.md#re-using-settings"
+  :type 'lsp-string-vector
+  :group 'lsp-markdown
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-markdown-remark-check-text-with-setting "retext-english"
+  "Configure `checkTextWith' subproperty.
+
+For a complete list of plugins, check:
+ https://github.com/unifiedjs/unified-language-server/blob/main/CONFIGURATION.md#re-using-settings"
+  :type '(choice (
+                  (const "retext-english")
+                  (const "remark-parse")))
+  :group 'lsp-markdown
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-markdown-remark-check-text-with-mutator ["#remark-retext" "#parse-latin"]
+  "Vector of additional mutators.
+
+For a complete list of plugins, check:
+ https://github.com/unifiedjs/unified-language-server/blob/main/CONFIGURATION.md#re-using-settings"
+  :type 'lsp-string-vector
+  :group 'lsp-markdown
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-dependency 'unified-language-server
+                '(:system "unified-language-server")
+                '(:npm :package "unified-language-server"
+                       :path "unified-language-server"))
+
+(lsp-register-custom-settings
+ `(("unified-language-server.remark-parse.plugins" lsp-markdown-remark-plugins)
+   ("unified-language-server.remark-parse.checkTextWith.setting" lsp-markdown-remark-check-text-with-setting)
+   ("unified-language-server.remark-parse.checkTextWith.mutator" lsp-markdown-remark-check-text-with-mutator)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     (cons (or (executable-find lsp-markdown-server-command)
+                                               (lsp-package-path 'unified-language-server))
+                                           lsp-markdown-server-command-args)))
+                  :activation-fn (lsp-activate-on "markdown")
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration (lsp-configuration-section "unified-language-server"))))
+                  :priority -1
+                  :server-id 'unified))
+
+(lsp-consistency-check lsp-markdown)
+
+(provide 'lsp-markdown)
+;;; lsp-markdown.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-mode-autoloads.el b/elpa/lsp-mode-20220201.852/lsp-mode-autoloads.el
new file mode 100644 (file)
index 0000000..4f1e199
--- /dev/null
@@ -0,0 +1,807 @@
+;;; lsp-mode-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+
+(add-to-list 'load-path (directory-file-name
+                         (or (file-name-directory #$) (car load-path))))
+
+\f
+;;;### (autoloads nil "lsp-actionscript" "lsp-actionscript.el" (0
+;;;;;;  0 0 0))
+;;; Generated autoloads from lsp-actionscript.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-actionscript" '("lsp-actionscript-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ada" "lsp-ada.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ada.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ada" '("lsp-ada-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-angular" "lsp-angular.el" (0 0 0 0))
+;;; Generated autoloads from lsp-angular.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-angular" '("lsp-client")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-bash" "lsp-bash.el" (0 0 0 0))
+;;; Generated autoloads from lsp-bash.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-bash" '("lsp-bash-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-beancount" "lsp-beancount.el" (0 0 0 0))
+;;; Generated autoloads from lsp-beancount.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-beancount" '("lsp-beancount-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-clangd" "lsp-clangd.el" (0 0 0 0))
+;;; Generated autoloads from lsp-clangd.el
+
+(autoload 'lsp-cpp-flycheck-clang-tidy-error-explainer "lsp-clangd" "\
+Explain a clang-tidy ERROR by scraping documentation from llvm.org.
+
+\(fn ERROR)" nil nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-clangd" '("lsp-c")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-clojure" "lsp-clojure.el" (0 0 0 0))
+;;; Generated autoloads from lsp-clojure.el
+
+(autoload 'lsp-clojure-show-test-tree "lsp-clojure" "\
+Show a test tree and focus on it if IGNORE-FOCUS? is nil.
+
+\(fn IGNORE-FOCUS\\=\\?)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-clojure" '("lsp-clojure-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-completion" "lsp-completion.el" (0 0 0
+;;;;;;  0))
+;;; Generated autoloads from lsp-completion.el
+
+(define-obsolete-variable-alias 'lsp-prefer-capf 'lsp-completion-provider "lsp-mode 7.0.1")
+
+(define-obsolete-variable-alias 'lsp-enable-completion-at-point 'lsp-completion-enable "lsp-mode 7.0.1")
+
+(autoload 'lsp-completion-at-point "lsp-completion" "\
+Get lsp completions." nil nil)
+
+(autoload 'lsp-completion--enable "lsp-completion" "\
+Enable LSP completion support." nil nil)
+
+(autoload 'lsp-completion-mode "lsp-completion" "\
+Toggle LSP completion support.
+
+If called interactively, enable Lsp-Completion mode if ARG is
+positive, and disable it if ARG is zero or negative.  If called
+from Lisp, also enable the mode if ARG is omitted or nil, and
+toggle it if ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(add-hook 'lsp-configure-hook (lambda nil (when (and lsp-auto-configure lsp-completion-enable) (lsp-completion--enable))))
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-completion" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-crystal" "lsp-crystal.el" (0 0 0 0))
+;;; Generated autoloads from lsp-crystal.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-crystal" '("lsp-clients-crystal-executable")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-csharp" "lsp-csharp.el" (0 0 0 0))
+;;; Generated autoloads from lsp-csharp.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-csharp" '("lsp-csharp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-css" "lsp-css.el" (0 0 0 0))
+;;; Generated autoloads from lsp-css.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-css" '("lsp-css-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-diagnostics" "lsp-diagnostics.el" (0 0
+;;;;;;  0 0))
+;;; Generated autoloads from lsp-diagnostics.el
+
+(define-obsolete-variable-alias 'lsp-diagnostic-package 'lsp-diagnostics-provider "lsp-mode 7.0.1")
+
+(define-obsolete-variable-alias 'lsp-flycheck-default-level 'lsp-diagnostics-flycheck-default-level "lsp-mode 7.0.1")
+
+(autoload 'lsp-diagnostics-lsp-checker-if-needed "lsp-diagnostics" nil nil nil)
+
+(autoload 'lsp-diagnostics--enable "lsp-diagnostics" "\
+Enable LSP checker support." nil nil)
+
+(autoload 'lsp-diagnostics-mode "lsp-diagnostics" "\
+Toggle LSP diagnostics integration.
+
+If called interactively, enable Lsp-Diagnostics mode if ARG is
+positive, and disable it if ARG is zero or negative.  If called
+from Lisp, also enable the mode if ARG is omitted or nil, and
+toggle it if ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(add-hook 'lsp-configure-hook (lambda nil (when lsp-auto-configure (lsp-diagnostics--enable))))
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-diagnostics" '("lsp-diagnostics-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-dired" "lsp-dired.el" (0 0 0 0))
+;;; Generated autoloads from lsp-dired.el
+
+(defvar lsp-dired-mode nil "\
+Non-nil if Lsp-Dired mode is enabled.
+See the `lsp-dired-mode' command
+for a description of this minor mode.
+Setting this variable directly does not take effect;
+either customize it (see the info node `Easy Customization')
+or call the function `lsp-dired-mode'.")
+
+(custom-autoload 'lsp-dired-mode "lsp-dired" nil)
+
+(autoload 'lsp-dired-mode "lsp-dired" "\
+Display `lsp-mode' icons for each file in a dired buffer.
+
+If called interactively, enable Lsp-Dired mode if ARG is
+positive, and disable it if ARG is zero or negative.  If called
+from Lisp, also enable the mode if ARG is omitted or nil, and
+toggle it if ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-dired" '("lsp-dired-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-dockerfile" "lsp-dockerfile.el" (0 0 0
+;;;;;;  0))
+;;; Generated autoloads from lsp-dockerfile.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-dockerfile" '("lsp-dockerfile-language-server-command")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-elixir" "lsp-elixir.el" (0 0 0 0))
+;;; Generated autoloads from lsp-elixir.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-elixir" '("lsp-elixir-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-elm" "lsp-elm.el" (0 0 0 0))
+;;; Generated autoloads from lsp-elm.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-elm" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-erlang" "lsp-erlang.el" (0 0 0 0))
+;;; Generated autoloads from lsp-erlang.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-erlang" '("lsp-erlang-server-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-eslint" "lsp-eslint.el" (0 0 0 0))
+;;; Generated autoloads from lsp-eslint.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-eslint" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-fortran" "lsp-fortran.el" (0 0 0 0))
+;;; Generated autoloads from lsp-fortran.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-fortran" '("lsp-clients-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-fsharp" "lsp-fsharp.el" (0 0 0 0))
+;;; Generated autoloads from lsp-fsharp.el
+
+(autoload 'lsp-fsharp--workspace-load "lsp-fsharp" "\
+Load all of the provided PROJECTS.
+
+\(fn PROJECTS)" nil nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-fsharp" '("lsp-fsharp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-gdscript" "lsp-gdscript.el" (0 0 0 0))
+;;; Generated autoloads from lsp-gdscript.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-gdscript" '("lsp-gdscript-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-go" "lsp-go.el" (0 0 0 0))
+;;; Generated autoloads from lsp-go.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-go" '("lsp-go-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-graphql" "lsp-graphql.el" (0 0 0 0))
+;;; Generated autoloads from lsp-graphql.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-graphql" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-groovy" "lsp-groovy.el" (0 0 0 0))
+;;; Generated autoloads from lsp-groovy.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-groovy" '("lsp-groovy-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-hack" "lsp-hack.el" (0 0 0 0))
+;;; Generated autoloads from lsp-hack.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-hack" '("lsp-clients-hack-command")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-haxe" "lsp-haxe.el" (0 0 0 0))
+;;; Generated autoloads from lsp-haxe.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-haxe" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-headerline" "lsp-headerline.el" (0 0 0
+;;;;;;  0))
+;;; Generated autoloads from lsp-headerline.el
+
+(autoload 'lsp-headerline-breadcrumb-mode "lsp-headerline" "\
+Toggle breadcrumb on headerline.
+
+If called interactively, enable Lsp-Headerline-Breadcrumb mode if
+ARG is positive, and disable it if ARG is zero or negative.  If
+called from Lisp, also enable the mode if ARG is omitted or nil,
+and toggle it if ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'lsp-breadcrumb-go-to-symbol "lsp-headerline" "\
+Go to the symbol on breadcrumb at SYMBOL-POSITION.
+
+\(fn SYMBOL-POSITION)" t nil)
+
+(autoload 'lsp-breadcrumb-narrow-to-symbol "lsp-headerline" "\
+Narrow to the symbol range on breadcrumb at SYMBOL-POSITION.
+
+\(fn SYMBOL-POSITION)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-headerline" '("lsp-headerline-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-html" "lsp-html.el" (0 0 0 0))
+;;; Generated autoloads from lsp-html.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-html" '("lsp-html-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-icons" "lsp-icons.el" (0 0 0 0))
+;;; Generated autoloads from lsp-icons.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-icons" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ido" "lsp-ido.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ido.el
+
+(autoload 'lsp-ido-workspace-symbol "lsp-ido" "\
+`ido' for lsp workspace/symbol.
+When called with prefix ARG the default selection will be symbol at point.
+
+\(fn ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ido" '("lsp-ido-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-iedit" "lsp-iedit.el" (0 0 0 0))
+;;; Generated autoloads from lsp-iedit.el
+
+(autoload 'lsp-iedit-highlights "lsp-iedit" "\
+Start an `iedit' operation on the documentHighlights at point.
+This can be used as a primitive `lsp-rename' replacement if the
+language server doesn't support renaming.
+
+See also `lsp-enable-symbol-highlighting'." t nil)
+
+(autoload 'lsp-iedit-linked-ranges "lsp-iedit" "\
+Start an `iedit' for `textDocument/linkedEditingRange'" t nil)
+
+(autoload 'lsp-evil-multiedit-highlights "lsp-iedit" "\
+Start an `evil-multiedit' operation on the documentHighlights at point.
+This can be used as a primitive `lsp-rename' replacement if the
+language server doesn't support renaming.
+
+See also `lsp-enable-symbol-highlighting'." t nil)
+
+(autoload 'lsp-evil-multiedit-linked-ranges "lsp-iedit" "\
+Start an `evil-multiedit' for `textDocument/linkedEditingRange'" t nil)
+
+(autoload 'lsp-evil-state-highlights "lsp-iedit" "\
+Start `iedit-mode'. for `textDocument/documentHighlight'" t nil)
+
+(autoload 'lsp-evil-state-linked-ranges "lsp-iedit" "\
+Start `iedit-mode'. for `textDocument/linkedEditingRange'" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-iedit" '("lsp-iedit--on-ranges")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-javascript" "lsp-javascript.el" (0 0 0
+;;;;;;  0))
+;;; Generated autoloads from lsp-javascript.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-javascript" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-json" "lsp-json.el" (0 0 0 0))
+;;; Generated autoloads from lsp-json.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-json" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-kotlin" "lsp-kotlin.el" (0 0 0 0))
+;;; Generated autoloads from lsp-kotlin.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-kotlin" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-lens" "lsp-lens.el" (0 0 0 0))
+;;; Generated autoloads from lsp-lens.el
+
+(autoload 'lsp-lens--enable "lsp-lens" "\
+Enable lens mode." nil nil)
+
+(autoload 'lsp-lens-show "lsp-lens" "\
+Display lenses in the buffer." t nil)
+
+(autoload 'lsp-lens-hide "lsp-lens" "\
+Delete all lenses." t nil)
+
+(autoload 'lsp-lens-mode "lsp-lens" "\
+Toggle code-lens overlays.
+
+If called interactively, enable Lsp-Lens mode if ARG is positive,
+and disable it if ARG is zero or negative.  If called from Lisp,
+also enable the mode if ARG is omitted or nil, and toggle it if
+ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'lsp-avy-lens "lsp-lens" "\
+Click lsp lens using `avy' package." t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-lens" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-lua" "lsp-lua.el" (0 0 0 0))
+;;; Generated autoloads from lsp-lua.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-lua" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-markdown" "lsp-markdown.el" (0 0 0 0))
+;;; Generated autoloads from lsp-markdown.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-markdown" '("lsp-markdown-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-mode" "lsp-mode.el" (0 0 0 0))
+;;; Generated autoloads from lsp-mode.el
+(put 'lsp-enable-file-watchers 'safe-local-variable #'booleanp)
+(put 'lsp-file-watch-ignored-directories 'safe-local-variable 'lsp--string-listp)
+(put 'lsp-file-watch-ignored-files 'safe-local-variable 'lsp--string-listp)
+(put 'lsp-file-watch-threshold 'safe-local-variable (lambda (i) (or (numberp i) (not i))))
+
+(autoload 'lsp--string-listp "lsp-mode" "\
+Return t if all elements of SEQUENCE are strings, else nil.
+
+\(fn SEQUENCE)" nil nil)
+
+(autoload 'lsp-load-vscode-workspace "lsp-mode" "\
+Load vscode workspace from FILE
+
+\(fn FILE)" t nil)
+
+(autoload 'lsp-save-vscode-workspace "lsp-mode" "\
+Save vscode workspace to FILE
+
+\(fn FILE)" t nil)
+
+(autoload 'lsp-install-server "lsp-mode" "\
+Interactively install or re-install server.
+When prefix UPDATE? is t force installation even if the server is present.
+
+\(fn UPDATE\\=\\? &optional SERVER-ID)" t nil)
+
+(autoload 'lsp-update-server "lsp-mode" "\
+Interactively update a server.
+
+\(fn &optional SERVER-ID)" t nil)
+
+(autoload 'lsp-ensure-server "lsp-mode" "\
+Ensure server SERVER-ID
+
+\(fn SERVER-ID)" nil nil)
+
+(autoload 'lsp "lsp-mode" "\
+Entry point for the server startup.
+When ARG is t the lsp mode will start new language server even if
+there is language server which can handle current language. When
+ARG is nil current file will be opened in multi folder language
+server if there is such. When `lsp' is called with prefix
+argument ask the user to select which language server to start.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'lsp-deferred "lsp-mode" "\
+Entry point that defers server startup until buffer is visible.
+`lsp-deferred' will wait until the buffer is visible before invoking `lsp'.
+This avoids overloading the server with many files when starting Emacs." nil nil)
+
+(autoload 'lsp-start-plain "lsp-mode" "\
+Start `lsp-mode' using mininal configuration using the latest `melpa' version of the packages.
+
+In case the major-mode that you are using for " t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-mode" '("defcustom-lsp" "lsp-" "make-lsp-client" "when-lsp-workspace" "with-lsp-workspace")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-modeline" "lsp-modeline.el" (0 0 0 0))
+;;; Generated autoloads from lsp-modeline.el
+
+(define-obsolete-variable-alias 'lsp-diagnostics-modeline-scope 'lsp-modeline-diagnostics-scope "lsp-mode 7.0.1")
+
+(autoload 'lsp-modeline-code-actions-mode "lsp-modeline" "\
+Toggle code actions on modeline.
+
+If called interactively, enable Lsp-Modeline-Code-Actions mode if
+ARG is positive, and disable it if ARG is zero or negative.  If
+called from Lisp, also enable the mode if ARG is omitted or nil,
+and toggle it if ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(define-obsolete-function-alias 'lsp-diagnostics-modeline-mode 'lsp-modeline-diagnostics-mode "lsp-mode 7.0.1")
+
+(autoload 'lsp-modeline-diagnostics-mode "lsp-modeline" "\
+Toggle diagnostics modeline.
+
+If called interactively, enable Lsp-Modeline-Diagnostics mode if
+ARG is positive, and disable it if ARG is zero or negative.  If
+called from Lisp, also enable the mode if ARG is omitted or nil,
+and toggle it if ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'lsp-modeline-workspace-status-mode "lsp-modeline" "\
+Toggle workspace status on modeline.
+
+If called interactively, enable Lsp-Modeline-Workspace-Status
+mode if ARG is positive, and disable it if ARG is zero or
+negative.  If called from Lisp, also enable the mode if ARG is
+omitted or nil, and toggle it if ARG is `toggle'; disable the
+mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-modeline" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-nginx" "lsp-nginx.el" (0 0 0 0))
+;;; Generated autoloads from lsp-nginx.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-nginx" '("lsp-nginx-server-command")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-nix" "lsp-nix.el" (0 0 0 0))
+;;; Generated autoloads from lsp-nix.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-nix" '("lsp-nix-server-path")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ocaml" "lsp-ocaml.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ocaml.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ocaml" '("lsp-ocaml-l")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-perl" "lsp-perl.el" (0 0 0 0))
+;;; Generated autoloads from lsp-perl.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-perl" '("lsp-perl-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-php" "lsp-php.el" (0 0 0 0))
+;;; Generated autoloads from lsp-php.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-php" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-prolog" "lsp-prolog.el" (0 0 0 0))
+;;; Generated autoloads from lsp-prolog.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-prolog" '("lsp-prolog-server-command")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-protocol" "lsp-protocol.el" (0 0 0 0))
+;;; Generated autoloads from lsp-protocol.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-protocol" '("dash-expand:&RangeToPoint" "lsp")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-purescript" "lsp-purescript.el" (0 0 0
+;;;;;;  0))
+;;; Generated autoloads from lsp-purescript.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-purescript" '("lsp-purescript-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-pwsh" "lsp-pwsh.el" (0 0 0 0))
+;;; Generated autoloads from lsp-pwsh.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-pwsh" '("lsp-pwsh-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-pyls" "lsp-pyls.el" (0 0 0 0))
+;;; Generated autoloads from lsp-pyls.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-pyls" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-pylsp" "lsp-pylsp.el" (0 0 0 0))
+;;; Generated autoloads from lsp-pylsp.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-pylsp" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-r" "lsp-r.el" (0 0 0 0))
+;;; Generated autoloads from lsp-r.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-r" '("lsp-clients-r-server-command")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-racket" "lsp-racket.el" (0 0 0 0))
+;;; Generated autoloads from lsp-racket.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-racket" '("lsp-racket-lang")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-remark" "lsp-remark.el" (0 0 0 0))
+;;; Generated autoloads from lsp-remark.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-remark" '("lsp-remark-server-command")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-rf" "lsp-rf.el" (0 0 0 0))
+;;; Generated autoloads from lsp-rf.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-rf" '("expand-start-command" "lsp-rf-language-server-" "parse-rf-language-server-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-rust" "lsp-rust.el" (0 0 0 0))
+;;; Generated autoloads from lsp-rust.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-rust" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-semantic-tokens" "lsp-semantic-tokens.el"
+;;;;;;  (0 0 0 0))
+;;; Generated autoloads from lsp-semantic-tokens.el
+
+(autoload 'lsp--semantic-tokens-initialize-buffer "lsp-semantic-tokens" "\
+Initialize the buffer for semantic tokens.
+IS-RANGE-PROVIDER is non-nil when server supports range requests." nil nil)
+
+(autoload 'lsp--semantic-tokens-initialize-workspace "lsp-semantic-tokens" "\
+Initialize semantic tokens for WORKSPACE.
+
+\(fn WORKSPACE)" nil nil)
+
+(autoload 'lsp-semantic-tokens--warn-about-deprecated-setting "lsp-semantic-tokens" "\
+Warn about deprecated semantic highlighting variable." nil nil)
+
+(autoload 'lsp-semantic-tokens--enable "lsp-semantic-tokens" "\
+Enable semantic tokens mode." nil nil)
+
+(autoload 'lsp-semantic-tokens-mode "lsp-semantic-tokens" "\
+Toggle semantic-tokens support.
+
+If called interactively, enable Lsp-Semantic-Tokens mode if ARG
+is positive, and disable it if ARG is zero or negative.  If
+called from Lisp, also enable the mode if ARG is omitted or nil,
+and toggle it if ARG is `toggle'; disable the mode otherwise.
+
+\(fn &optional ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-semantic-tokens" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-solargraph" "lsp-solargraph.el" (0 0 0
+;;;;;;  0))
+;;; Generated autoloads from lsp-solargraph.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-solargraph" '("lsp-solargraph-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-sorbet" "lsp-sorbet.el" (0 0 0 0))
+;;; Generated autoloads from lsp-sorbet.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-sorbet" '("lsp-sorbet-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-sqls" "lsp-sqls.el" (0 0 0 0))
+;;; Generated autoloads from lsp-sqls.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-sqls" '("lsp-sql")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-steep" "lsp-steep.el" (0 0 0 0))
+;;; Generated autoloads from lsp-steep.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-steep" '("lsp-steep-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-svelte" "lsp-svelte.el" (0 0 0 0))
+;;; Generated autoloads from lsp-svelte.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-svelte" '("lsp-svelte-plugin-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-terraform" "lsp-terraform.el" (0 0 0 0))
+;;; Generated autoloads from lsp-terraform.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-terraform" '("lsp-terraform-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-tex" "lsp-tex.el" (0 0 0 0))
+;;; Generated autoloads from lsp-tex.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-tex" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-toml" "lsp-toml.el" (0 0 0 0))
+;;; Generated autoloads from lsp-toml.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-toml" '("lsp-toml-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-v" "lsp-v.el" (0 0 0 0))
+;;; Generated autoloads from lsp-v.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-v" '("lsp-v-vls-executable")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-vala" "lsp-vala.el" (0 0 0 0))
+;;; Generated autoloads from lsp-vala.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-vala" '("lsp-clients-vala-ls-executable")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-verilog" "lsp-verilog.el" (0 0 0 0))
+;;; Generated autoloads from lsp-verilog.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-verilog" '("lsp-clients-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-vetur" "lsp-vetur.el" (0 0 0 0))
+;;; Generated autoloads from lsp-vetur.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-vetur" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-vhdl" "lsp-vhdl.el" (0 0 0 0))
+;;; Generated autoloads from lsp-vhdl.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-vhdl" '("ghdl-ls-bin-name" "hdl-checker-bin-name" "lsp-vhdl-" "vhdl-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-vimscript" "lsp-vimscript.el" (0 0 0 0))
+;;; Generated autoloads from lsp-vimscript.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-vimscript" '("lsp-clients-vim-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-xml" "lsp-xml.el" (0 0 0 0))
+;;; Generated autoloads from lsp-xml.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-xml" '("lsp-xml-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-yaml" "lsp-yaml.el" (0 0 0 0))
+;;; Generated autoloads from lsp-yaml.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-yaml" '("lsp-yaml-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-zig" "lsp-zig.el" (0 0 0 0))
+;;; Generated autoloads from lsp-zig.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-zig" '("lsp-zig-zls-executable")))
+
+;;;***
+\f
+;;;### (autoloads nil nil ("lsp-cmake.el" "lsp-d.el" "lsp-dhall.el"
+;;;;;;  "lsp-mode-pkg.el" "lsp-nim.el" "lsp.el") (0 0 0 0))
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; coding: utf-8
+;; End:
+;;; lsp-mode-autoloads.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-mode-pkg.el b/elpa/lsp-mode-20220201.852/lsp-mode-pkg.el
new file mode 100644 (file)
index 0000000..9d98442
--- /dev/null
@@ -0,0 +1,18 @@
+(define-package "lsp-mode" "20220201.852" "LSP mode"
+  '((emacs "26.1")
+    (dash "2.18.0")
+    (f "0.20.0")
+    (ht "2.3")
+    (spinner "1.7.3")
+    (markdown-mode "2.3")
+    (lv "0"))
+  :commit "fbfaa80095a82f7473cb7e45fe73b32ecc1900ae" :authors
+  '(("Vibhav Pant, Fangrui Song, Ivan Yonchovski"))
+  :maintainer
+  '("Vibhav Pant, Fangrui Song, Ivan Yonchovski")
+  :keywords
+  '("languages")
+  :url "https://github.com/emacs-lsp/lsp-mode")
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
diff --git a/elpa/lsp-mode-20220201.852/lsp-mode.el b/elpa/lsp-mode-20220201.852/lsp-mode.el
new file mode 100644 (file)
index 0000000..146e759
--- /dev/null
@@ -0,0 +1,8890 @@
+;;; lsp-mode.el --- LSP mode                              -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: Vibhav Pant, Fangrui Song, Ivan Yonchovski
+;; Keywords: languages
+;; Package-Requires: ((emacs "26.1") (dash "2.18.0") (f "0.20.0") (ht "2.3") (spinner "1.7.3") (markdown-mode "2.3") (lv "0"))
+;; Version: 8.0.1
+
+;; URL: https://github.com/emacs-lsp/lsp-mode
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Emacs client/library for the Language Server Protocol
+
+;;; Code:
+
+(require 'cl-generic)
+(require 'cl-lib)
+(require 'compile)
+(require 'dash)
+(require 'epg)
+(require 'ewoc)
+(require 'f)
+(require 'filenotify)
+(require 'files)
+(require 'ht)
+(require 'imenu)
+(require 'inline)
+(require 'json)
+(require 'lv)
+(require 'markdown-mode)
+(require 'network-stream)
+(require 'pcase)
+(require 'rx)
+(require 's)
+(require 'seq)
+(require 'spinner)
+(require 'subr-x)
+(require 'tree-widget)
+(require 'url-parse)
+(require 'url-util)
+(require 'widget)
+(require 'xref)
+(require 'minibuffer)
+(require 'yasnippet nil t)
+(require 'lsp-protocol)
+
+(defgroup lsp-mode nil
+  "Language Server Protocol client."
+  :group 'tools
+  :tag "Language Server (lsp-mode)")
+
+(declare-function evil-set-command-property "ext:evil-common")
+(declare-function projectile-project-root "ext:projectile")
+(declare-function yas-expand-snippet "ext:yasnippet")
+(declare-function dap-mode "ext:dap-mode")
+(declare-function dap-auto-configure-mode "ext:dap-mode")
+
+(defvar yas-inhibit-overlay-modification-protection)
+(defvar yas-indent-line)
+(defvar yas-wrap-around-region)
+(defvar yas-also-auto-indent-first-line)
+(defvar dap-auto-configure-mode)
+(defvar dap-ui-menu-items)
+(defvar company-minimum-prefix-length)
+
+(defconst lsp--message-type-face
+  `((1 . ,compilation-error-face)
+    (2 . ,compilation-warning-face)
+    (3 . ,compilation-message-face)
+    (4 . ,compilation-info-face)))
+
+(defconst lsp--errors
+  '((-32700 "Parse Error")
+    (-32600 "Invalid Request")
+    (-32601 "Method not Found")
+    (-32602 "Invalid Parameters")
+    (-32603 "Internal Error")
+    (-32099 "Server Start Error")
+    (-32000 "Server End Error")
+    (-32002 "Server Not Initialized")
+    (-32001 "Unknown Error Code")
+    (-32800 "Request Cancelled"))
+  "Alist of error codes to user friendly strings.")
+
+(defconst lsp--empty-ht (make-hash-table))
+
+(eval-and-compile
+  (defun dash-expand:&lsp-wks (key source)
+    `(,(intern-soft (format "lsp--workspace-%s" (eval key))) ,source))
+
+  (defun dash-expand:&lsp-cln (key source)
+    `(,(intern-soft (format "lsp--client-%s" (eval key))) ,source)))
+
+(define-obsolete-variable-alias 'lsp-print-io 'lsp-log-io "lsp-mode 6.1")
+
+(defcustom lsp-log-io nil
+  "If non-nil, log all messages from the language server to a *lsp-log* buffer."
+  :group 'lsp-mode
+  :type 'boolean)
+
+(defcustom lsp-log-io-allowlist-methods '()
+  "The methods to filter before print to lsp-log-io."
+  :group 'lsp-mode
+  :type '(repeat string)
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-log-max message-log-max
+  "Maximum number of lines to keep in the log buffer.
+If nil, disable message logging.  If t, log messages but don’t truncate
+the buffer when it becomes large."
+  :group 'lsp-mode
+  :type '(choice (const :tag "Disable" nil)
+                 (integer :tag "lines")
+                 (const :tag "Unlimited" t))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-io-messages-max t
+  "Maximum number of messages that can be locked in a `lsp-io' buffer."
+  :group 'lsp-mode
+  :type '(choice (const :tag "Unlimited" t)
+                 (integer :tag "Messages"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-keep-workspace-alive t
+  "If non nil keep workspace alive when the last workspace buffer is closed."
+  :group 'lsp-mode
+  :type 'boolean)
+
+(defcustom lsp-enable-snippet t
+  "Enable/disable snippet completion support."
+  :group 'lsp-completion
+  :type 'boolean)
+
+(defcustom lsp-enable-folding t
+  "Enable/disable code folding support."
+  :group 'lsp-mode
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(define-obsolete-variable-alias 'lsp-enable-semantic-highlighting 'lsp-semantic-tokens-enable "lsp-mode 8.0.0")
+
+(defcustom lsp-semantic-tokens-enable nil
+  "Enable/disable support for semantic tokens.
+As defined by the Language Server Protocol 3.16."
+  :group 'lsp-semantic-tokens
+  :type 'boolean)
+
+(defcustom lsp-folding-range-limit nil
+  "The maximum number of folding ranges to receive from the language server."
+  :group 'lsp-mode
+  :type '(choice (const :tag "No limit." nil)
+                 (integer :tag "Number of lines."))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-folding-line-folding-only nil
+  "If non-nil, only fold complete lines."
+  :group 'lsp-mode
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-client-packages
+  '(ccls lsp-actionscript lsp-ada lsp-angular lsp-bash lsp-beancount lsp-clangd lsp-clojure lsp-cmake
+         lsp-crystal lsp-csharp lsp-css lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm
+         lsp-elixir lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go lsp-graphql
+         lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe lsp-java lsp-javascript lsp-json
+         lsp-kotlin lsp-latex lsp-ltex lsp-lua lsp-markdown lsp-nginx lsp-nim lsp-nix lsp-metals lsp-mssql lsp-ocaml lsp-pascal lsp-perl lsp-php lsp-pwsh
+         lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms lsp-purescript lsp-r lsp-remark lsp-rf lsp-rust lsp-solargraph lsp-sorbet lsp-sourcekit lsp-sonarlint
+         lsp-tailwindcss lsp-tex lsp-terraform lsp-toml lsp-v lsp-vala lsp-verilog lsp-vetur lsp-vhdl lsp-vimscript lsp-xml
+         lsp-yaml lsp-sqls lsp-svelte lsp-steep lsp-zig)
+  "List of the clients to be automatically required."
+  :group 'lsp-mode
+  :type '(repeat symbol))
+
+(defcustom lsp-progress-via-spinner t
+  "If non-nil, display LSP $/progress reports via a spinner in the modeline."
+  :group 'lsp-mode
+  :type 'boolean)
+
+(defvar-local lsp--cur-workspace nil)
+
+(defvar-local lsp--cur-version 0)
+(defvar-local lsp--virtual-buffer-connections nil)
+(defvar-local lsp--virtual-buffer nil)
+(defvar lsp--virtual-buffer-mappings (ht))
+
+(defvar lsp--uri-file-prefix (pcase system-type
+                               (`windows-nt "file:///")
+                               (_ "file://"))
+  "Prefix for a file-uri.")
+
+(defvar-local lsp-buffer-uri nil
+  "If set, return it instead of calculating it using `buffer-file-name'.")
+
+(define-error 'lsp-error "Unknown lsp-mode error")
+(define-error 'lsp-empty-response-error
+  "Empty response from the language server" 'lsp-error)
+(define-error 'lsp-timed-out-error
+  "Timed out while waiting for a response from the language server" 'lsp-error)
+(define-error 'lsp-capability-not-supported
+  "Capability not supported by the language server" 'lsp-error)
+(define-error 'lsp-file-scheme-not-supported
+  "Unsupported file scheme" 'lsp-error)
+(define-error 'lsp-client-already-exists-error
+  "A client with this server-id already exists" 'lsp-error)
+(define-error 'lsp-no-code-actions
+  "No code actions" 'lsp-error)
+
+(defcustom lsp-auto-guess-root nil
+  "Automatically guess the project root using projectile/project.
+Do *not* use this setting unless you are familiar with `lsp-mode'
+internals and you are sure that all of your projects are
+following `projectile'/`project.el' conventions."
+  :group 'lsp-mode
+  :type 'boolean)
+
+(defcustom lsp-restart 'interactive
+  "Defines how server-exited events must be handled."
+  :group 'lsp-mode
+  :type '(choice (const interactive)
+                 (const auto-restart)
+                 (const ignore)))
+
+(defcustom lsp-session-file (expand-file-name (locate-user-emacs-file ".lsp-session-v1"))
+  "File where session information is stored."
+  :group 'lsp-mode
+  :type 'file)
+
+(defcustom lsp-auto-configure t
+  "Auto configure `lsp-mode' main features.
+When set to t `lsp-mode' will auto-configure completion,
+code-actions, breadcrumb, `flycheck', `flymake', `imenu', symbol highlighting,
+lenses, links, and so on.
+
+For finer granularity you may use `lsp-enable-*' properties."
+  :group 'lsp-mode
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-disabled-clients nil
+  "A list of disabled/blacklisted clients.
+Each entry in the list can be either:
+a symbol, the server-id for the LSP client, or
+a cons pair (MAJOR-MODE . CLIENTS), where MAJOR-MODE is the major-mode,
+and CLIENTS is either a client or a list of clients.
+
+This option can also be used as a file- or directory-local variable to
+disable a language server for individual files or directories/projects
+respectively."
+  :group 'lsp-mode
+  :type '(repeat (symbol))
+  :safe 'listp
+  :package-version '(lsp-mode . "6.1"))
+
+(defvar lsp-clients (make-hash-table :test 'eql)
+  "Hash table server-id -> client.
+It contains all of the clients that are currently registered.")
+
+(defvar lsp-enabled-clients nil
+  "List of clients allowed to be used for projects.
+When nil, all registered clients are considered candidates.")
+
+(defvar lsp-last-id 0
+  "Last request id.")
+
+(defcustom lsp-before-initialize-hook nil
+  "List of functions to be called before a Language Server has been initialized
+for a new workspace."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-after-initialize-hook nil
+  "List of functions to be called after a Language Server has been initialized
+for a new workspace."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-before-open-hook nil
+  "List of functions to be called before a new file with LSP support is opened."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-after-open-hook nil
+  "List of functions to be called after a new file with LSP support is opened."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-enable-file-watchers t
+  "If non-nil lsp-mode will watch the files in the workspace if
+the server has requested that."
+  :type 'boolean
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.1"))
+;;;###autoload(put 'lsp-enable-file-watchers 'safe-local-variable #'booleanp)
+
+(define-obsolete-variable-alias 'lsp-file-watch-ignored 'lsp-file-watch-ignored-directories "8.0.0")
+
+(defcustom lsp-file-watch-ignored-directories
+  '(; SCM tools
+    "[/\\\\]\\.git\\'"
+    "[/\\\\]\\.github\\'"
+    "[/\\\\]\\.circleci\\'"
+    "[/\\\\]\\.hg\\'"
+    "[/\\\\]\\.bzr\\'"
+    "[/\\\\]_darcs\\'"
+    "[/\\\\]\\.svn\\'"
+    "[/\\\\]_FOSSIL_\\'"
+    ;; IDE or build tools
+    "[/\\\\]\\.idea\\'"
+    "[/\\\\]\\.ensime_cache\\'"
+    "[/\\\\]\\.eunit\\'"
+    "[/\\\\]node_modules"
+    "[/\\\\]\\.yarn\\'"
+    "[/\\\\]\\.fslckout\\'"
+    "[/\\\\]\\.tox\\'"
+    "[/\\\\]dist\\'"
+    "[/\\\\]dist-newstyle\\'"
+    "[/\\\\]\\.stack-work\\'"
+    "[/\\\\]\\.bloop\\'"
+    "[/\\\\]\\.metals\\'"
+    "[/\\\\]target\\'"
+    "[/\\\\]\\.ccls-cache\\'"
+    "[/\\\\]\\.vscode\\'"
+    "[/\\\\]\\.venv\\'"
+    "[/\\\\]\\.mypy_cache\\'"
+    ;; Autotools output
+    "[/\\\\]\\.deps\\'"
+    "[/\\\\]build-aux\\'"
+    "[/\\\\]autom4te.cache\\'"
+    "[/\\\\]\\.reference\\'"
+    ;; Clojure
+    "[/\\\\]\\.lsp\\'"
+    "[/\\\\]\\.clj-kondo\\'"
+    "[/\\\\]\\.shadow-cljs\\'"
+    "[/\\\\]\\.babel_cache\\'"
+    "[/\\\\]\\.cpcache\\'"
+    "[/\\\\]\\checkouts\\'"
+    ;; Maven
+    "[/\\\\]\\.m2\\'"
+    ;; .Net Core build-output
+    "[/\\\\]bin/Debug\\'"
+    "[/\\\\]obj\\'"
+    ;; OCaml and Dune
+    "[/\\\\]_opam\\'"
+    "[/\\\\]_build\\'"
+    ;; Elixir
+    "[/\\\\]\\.elixir_ls\\'"
+    ;; nix-direnv
+    "[/\\\\]\\.direnv\\'")
+  "List of regexps matching directory paths which won't be monitored when
+creating file watches. Customization of this variable is only honored at
+the global level or at a root of an lsp workspace."
+  :group 'lsp-mode
+  :type '(repeat string)
+  :package-version '(lsp-mode . "8.0.0"))
+
+(define-obsolete-function-alias 'lsp-file-watch-ignored 'lsp-file-watch-ignored-directories "7.0.1")
+
+(defun lsp-file-watch-ignored-directories ()
+  lsp-file-watch-ignored-directories)
+
+;; Allow lsp-file-watch-ignored-directories as a file or directory-local variable
+;;;###autoload(put 'lsp-file-watch-ignored-directories 'safe-local-variable 'lsp--string-listp)
+
+(defcustom lsp-file-watch-ignored-files
+  '(
+    ;; Flycheck tempfiles
+    "[/\\\\]flycheck_[^/\\\\]+\\'"
+    ;; lockfiles
+    "[/\\\\]\\.#[^/\\\\]+\\'"
+    ;; backup files
+    "[/\\\\][^/\\\\]+~\\'" )
+  "List of regexps matching files for which change events will
+not be sent to the server.
+
+This setting has no impact on whether a file-watch is created for
+a directory; it merely prevents notifications pertaining to
+matched files from being sent to the server.  To prevent a
+file-watch from being created for a directory, customize
+`lsp-file-watch-ignored-directories'
+
+Customization of this variable is only honored at the global
+level or at a root of an lsp workspace."
+  :group 'lsp-mode
+  :type '(repeat string)
+  :package-version '(lsp-mode . "8.0.0"))
+
+;; Allow lsp-file-watch-ignored-files as a file or directory-local variable
+;;;###autoload(put 'lsp-file-watch-ignored-files 'safe-local-variable 'lsp--string-listp)
+
+(defcustom lsp-after-uninitialized-functions nil
+  "List of functions to be called after a Language Server has been uninitialized."
+  :type 'hook
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.3"))
+
+(defconst lsp--sync-none 0)
+(defconst lsp--sync-full 1)
+(defconst lsp--sync-incremental 2)
+
+(defcustom lsp-debounce-full-sync-notifications t
+  "If non-nil debounce full sync events.
+This flag affects only servers which do not support incremental updates."
+  :type 'boolean
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-debounce-full-sync-notifications-interval 1.0
+  "Time to wait before sending full sync synchronization after buffer modification."
+  :type 'float
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.1"))
+
+(defvar lsp--stderr-index 0)
+
+(defvar lsp--delayed-requests nil)
+(defvar lsp--delay-timer nil)
+
+(defcustom lsp-document-sync-method nil
+  "How to sync the document with the language server."
+  :type '(choice (const :tag "Documents should not be synced at all." nil)
+                 (const :tag "Documents are synced by always sending the full content of the document." lsp--sync-full)
+                 (const :tag "Documents are synced by always sending incremental changes to the document." lsp--sync-incremental)
+                 (const :tag "Use the method recommended by the language server." nil))
+  :group 'lsp-mode)
+
+(defcustom lsp-auto-execute-action t
+  "Auto-execute single action."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-enable-links t
+  "If non-nil, all references to links in a file will be made clickable, if
+supported by the language server."
+  :type 'boolean
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-enable-imenu t
+  "If non-nil, automatically enable `imenu' integration when server provides
+`textDocument/documentSymbol'."
+  :type 'boolean
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-enable-dap-auto-configure t
+  "If non-nil, enable `dap-auto-configure-mode`."
+  :type 'boolean
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "7.0"))
+
+(defcustom lsp-eldoc-enable-hover t
+  "If non-nil, `eldoc' will display hover info when it is present."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-eldoc-render-all nil
+  "Display all of the info returned by document/onHover.
+If this is set to nil, `eldoc' will show only the symbol information."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(define-obsolete-variable-alias 'lsp-enable-completion-at-point
+  'lsp-completion-enable "lsp-mode 7.0.1")
+
+(defcustom lsp-completion-enable t
+  "Enable `completion-at-point' integration."
+  :type 'boolean
+  :group 'lsp-completion)
+
+(defcustom lsp-enable-symbol-highlighting t
+  "Highlight references of the symbol at point."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-enable-xref t
+  "Enable xref integration."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-enable-indentation t
+  "Indent regions using the file formatting functionality provided by the
+language server."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-enable-on-type-formatting t
+  "Enable `textDocument/onTypeFormatting' integration."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-enable-text-document-color t
+  "Enable `textDocument/documentColor' integration."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-before-save-edits t
+  "If non-nil, `lsp-mode' will apply edits suggested by the language server
+before saving a document."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defcustom lsp-after-apply-edits-hook nil
+  "Hooks to run when text edit is applied.
+It contains the operation source."
+  :type 'hook
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-modeline-code-actions-enable t
+  "Whether to show code actions on modeline."
+  :type 'boolean
+  :group 'lsp-modeline)
+
+(defcustom lsp-modeline-diagnostics-enable t
+  "Whether to show diagnostics on modeline."
+  :type 'boolean
+  :group 'lsp-modeline)
+
+(defcustom lsp-modeline-workspace-status-enable t
+  "Whether to show workspace status on modeline."
+  :type 'boolean
+  :group 'lsp-modeline
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-headerline-breadcrumb-enable t
+  "Whether to enable breadcrumb on headerline."
+  :type 'boolean
+  :group 'lsp-headerline)
+
+(defcustom lsp-configure-hook nil
+  "Hooks to run when `lsp-configure-buffer' is called."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-unconfigure-hook nil
+  "Hooks to run when `lsp-unconfig-buffer' is called."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-after-diagnostics-hook nil
+  "Hooks to run after diagnostics are received.
+Note: it runs only if the receiving buffer is open. Use
+`lsp-diagnostics-updated-hook'if you want to be notified when
+diagnostics have changed."
+  :type 'hook
+  :group 'lsp-mode)
+
+(define-obsolete-variable-alias 'lsp-after-diagnostics-hook
+  'lsp-diagnostics-updated-hook "lsp-mode 6.4")
+
+(defcustom lsp-diagnostics-updated-hook nil
+  "Hooks to run after diagnostics are received."
+  :type 'hook
+  :group 'lsp-mode)
+
+(define-obsolete-variable-alias 'lsp-workspace-folders-changed-hook
+  'lsp-workspace-folders-changed-functions "lsp-mode 6.3")
+
+(defcustom lsp-workspace-folders-changed-functions nil
+  "Hooks to run after the folders has changed.
+The hook will receive two parameters list of added and removed folders."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-eldoc-hook '(lsp-hover)
+  "Hooks to run for eldoc."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-before-apply-edits-hook nil
+  "Hooks to run before applying edits."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defgroup lsp-imenu nil
+  "LSP Imenu."
+  :group 'lsp-mode
+  :tag "LSP Imenu")
+
+(defcustom lsp-imenu-show-container-name t
+  "Display the symbol's container name in an imenu entry."
+  :type 'boolean
+  :group 'lsp-imenu)
+
+(defcustom lsp-imenu-container-name-separator "/"
+  "Separator string to use to separate the container name from the symbol while
+displaying imenu entries."
+  :type 'string
+  :group 'lsp-imenu)
+
+(defcustom lsp-imenu-sort-methods '(kind name)
+  "How to sort the imenu items.
+
+The value is a list of `kind' `name' or `position'.  Priorities
+are determined by the index of the element."
+  :type '(repeat (choice (const name)
+                         (const position)
+                         (const kind)))
+  :group 'lsp-imenu)
+
+(defcustom lsp-imenu-index-symbol-kinds nil
+  "Which symbol kinds to show in imenu."
+  :type '(repeat (choice (const :tag "Miscellaneous" nil)
+                         (const :tag "File" File)
+                         (const :tag "Module" Module)
+                         (const :tag "Namespace" Namespace)
+                         (const :tag "Package" Package)
+                         (const :tag "Class" Class)
+                         (const :tag "Method" Method)
+                         (const :tag "Property" Property)
+                         (const :tag "Field" Field)
+                         (const :tag "Constructor" Constuctor)
+                         (const :tag "Enum" Enum)
+                         (const :tag "Interface" Interface)
+                         (const :tag "Function" Function)
+                         (const :tag "Variable" Variable)
+                         (const :tag "Constant" Constant)
+                         (const :tag "String" String)
+                         (const :tag "Number" Number)
+                         (const :tag "Boolean" Boolean)
+                         (const :tag "Array" Array)
+                         (const :tag "Object" Object)
+                         (const :tag "Key" Key)
+                         (const :tag "Null" Null)
+                         (const :tag "Enum Member" EnumMember)
+                         (const :tag "Struct" Struct)
+                         (const :tag "Event" Event)
+                         (const :tag "Operator" Operator)
+                         (const :tag "Type Parameter" TypeParameter)))
+  :group 'lsp-imenu)
+
+;; vibhavp: Should we use a lower value (5)?
+(defcustom lsp-response-timeout 10
+  "Number of seconds to wait for a response from the language server before
+timing out. Nil if no timeout."
+  :type '(choice
+          (number :tag "Seconds")
+          (const :tag "No timeout" nil))
+  :group 'lsp-mode)
+
+(defcustom lsp-tcp-connection-timeout 2
+  "The timeout for tcp connection in seconds."
+  :type 'number
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.2"))
+
+(defconst lsp--imenu-compare-function-alist
+  (list (cons 'name #'lsp--imenu-compare-name)
+        (cons 'kind #'lsp--imenu-compare-kind)
+        (cons 'position #'lsp--imenu-compare-line-col))
+  "An alist of (METHOD . FUNCTION).
+METHOD is one of the symbols accepted by
+`lsp-imenu-sort-methods'.
+
+FUNCTION takes two hash tables representing DocumentSymbol.  It
+returns a negative number, 0, or a positive number indicating
+whether the first parameter is less than, equal to, or greater
+than the second parameter.")
+
+(defcustom lsp-diagnostic-clean-after-change nil
+  "When non-nil, clean the diagnostics on change.
+
+Note that when that setting is nil, `lsp-mode' will show stale
+diagnostics until server publishes the new set of diagnostics"
+  :type 'boolean
+  :group 'lsp-diagnostics
+  :package-version '(lsp-mode . "7.0.1"))
+
+(defcustom lsp-server-trace nil
+  "Request tracing on the server side.
+The actual trace output at each level depends on the language server in use.
+Changes take effect only when a new session is started."
+  :type '(choice (const :tag "Disabled" "off")
+                 (const :tag "Messages only" "messages")
+                 (const :tag "Verbose" "verbose")
+                 (const :tag "Default (disabled)" nil))
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-auto-touch-files t
+  "If non-nil ensure the files exist before sending
+`textDocument/didOpen' notification."
+  :type 'boolean
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defvar lsp-language-id-configuration '((".*\\.vue$" . "vue")
+                                        (".*\\.tsx$" . "typescriptreact")
+                                        (".*\\.ts$" . "typescript")
+                                        (".*\\.jsx$" . "javascriptreact")
+                                        (".*\\.js$" . "javascript")
+                                        (".*\\.xml$" . "xml")
+                                        (".*\\.hx$" . "haxe")
+                                        (".*\\.lua$" . "lua")
+                                        (".*\\.sql$" . "sql")
+                                        (".*\\.html$" . "html")
+                                        (".*\\.css" . "css")
+                                        (".*/settings.json$" . "jsonc")
+                                        (".*\\.json$" . "json")
+                                        (".*\\.jsonc$" . "jsonc")
+                                        (".*\\.php$" . "php")
+                                        (".*\\.svelte$" . "svelte")
+                                        (".*\\.ebuild$" . "shellscript")
+                                        (ada-mode . "ada")
+                                        (nxml-mode . "xml")
+                                        (sql-mode . "sql")
+                                        (vimrc-mode . "vim")
+                                        (sh-mode . "shellscript")
+                                        (ebuild-mode . "shellscript")
+                                        (scala-mode . "scala")
+                                        (julia-mode . "julia")
+                                        (clojure-mode . "clojure")
+                                        (clojurec-mode . "clojure")
+                                        (clojurescript-mode . "clojurescript")
+                                        (java-mode . "java")
+                                        (jdee-mode . "java")
+                                        (groovy-mode . "groovy")
+                                        (python-mode . "python")
+                                        (cython-mode . "python")
+                                        (lsp--render-markdown . "markdown")
+                                        (rust-mode . "rust")
+                                        (rustic-mode . "rust")
+                                        (kotlin-mode . "kotlin")
+                                        (css-mode . "css")
+                                        (less-mode . "less")
+                                        (less-css-mode . "less")
+                                        (lua-mode . "lua")
+                                        (sass-mode . "sass")
+                                        (ssass-mode . "sass")
+                                        (scss-mode . "scss")
+                                        (xml-mode . "xml")
+                                        (c-mode . "c")
+                                        (c++-mode . "cpp")
+                                        (objc-mode . "objective-c")
+                                        (html-mode . "html")
+                                        (sgml-mode . "html")
+                                        (mhtml-mode . "html")
+                                        (go-dot-mod-mode . "go.mod")
+                                        (go-mode . "go")
+                                        (graphql-mode . "graphql")
+                                        (haskell-mode . "haskell")
+                                        (hack-mode . "hack")
+                                        (php-mode . "php")
+                                        (powershell-mode . "powershell")
+                                        (powershell-mode . "PowerShell")
+                                        (json-mode . "json")
+                                        (jsonc-mode . "jsonc")
+                                        (rjsx-mode . "javascript")
+                                        (js2-mode . "javascript")
+                                        (js-mode . "javascript")
+                                        (typescript-mode . "typescript")
+                                        (fsharp-mode . "fsharp")
+                                        (reason-mode . "reason")
+                                        (caml-mode . "ocaml")
+                                        (tuareg-mode . "ocaml")
+                                        (swift-mode . "swift")
+                                        (elixir-mode . "elixir")
+                                        (conf-javaprop-mode . "spring-boot-properties")
+                                        (yaml-mode . "spring-boot-properties-yaml")
+                                        (ruby-mode . "ruby")
+                                        (enh-ruby-mode . "ruby")
+                                        (fortran-mode . "fortran")
+                                        (f90-mode . "fortran")
+                                        (elm-mode . "elm")
+                                        (dart-mode . "dart")
+                                        (erlang-mode . "erlang")
+                                        (dockerfile-mode . "dockerfile")
+                                        (csharp-mode . "csharp")
+                                        (csharp-tree-sitter-mode . "csharp")
+                                        (plain-tex-mode . "plaintex")
+                                        (latex-mode . "latex")
+                                        (v-mode . "v")
+                                        (vhdl-mode . "vhdl")
+                                        (verilog-mode . "verilog")
+                                        (terraform-mode . "terraform")
+                                        (ess-julia-mode . "julia")
+                                        (ess-r-mode . "r")
+                                        (crystal-mode . "crystal")
+                                        (nim-mode . "nim")
+                                        (dhall-mode . "dhall")
+                                        (cmake-mode . "cmake")
+                                        (purescript-mode . "purescript")
+                                        (gdscript-mode . "gdscript")
+                                        (perl-mode . "perl")
+                                        (cperl-mode . "perl")
+                                        (robot-mode . "robot")
+                                        (racket-mode . "racket")
+                                        (nix-mode . "nix")
+                                        (prolog-mode . "prolog")
+                                        (vala-mode . "vala")
+                                        (actionscript-mode . "actionscript")
+                                        (d-mode . "d")
+                                        (zig-mode . "zig")
+                                        (text-mode . "plaintext")
+                                        (markdown-mode . "markdown")
+                                        (gfm-mode . "markdown")
+                                        (beancount-mode . "beancount")
+                                        (conf-toml-mode . "toml")
+                                        (org-mode . "org")
+                                        (nginx-mode . "nginx"))
+  "Language id configuration.")
+
+(defvar lsp--last-active-workspaces nil
+  "Keep track of last active workspace.
+We want to try the last workspace first when jumping into a library
+directory")
+
+(defvar lsp-method-requirements
+  '(("textDocument/callHierarchy" :capability :callHierarchyProvider)
+    ("textDocument/codeAction" :capability :codeActionProvider)
+    ("codeAction/resolve"
+     :check-command (lambda (workspace)
+                      (with-lsp-workspace workspace
+                        (lsp:code-action-options-resolve-provider?
+                         (or (lsp--capability :codeActionProvider)
+                             (when-let ((maybe-capability (lsp--registered-capability "textDocument/codeAction"))
+                                        (capability-options (lsp--registered-capability-options maybe-capability)))
+                               capability-options))))))
+    ("textDocument/codeLens" :capability :codeLensProvider)
+    ("textDocument/completion" :capability :completionProvider)
+    ("completionItem/resolve"
+     :check-command (lambda (wk)
+                      (with-lsp-workspace wk
+                        (lsp:completion-options-resolve-provider?
+                         (lsp--capability :completionProvider)))))
+    ("textDocument/declaration" :capability :declarationProvider)
+    ("textDocument/definition" :capability :definitionProvider)
+    ("textDocument/documentColor" :capability :colorProvider)
+    ("textDocument/documentLink" :capability :documentLinkProvider)
+    ("textDocument/documentHighlight" :capability :documentHighlightProvider)
+    ("textDocument/documentSymbol" :capability :documentSymbolProvider)
+    ("textDocument/foldingRange" :capability :foldingRangeProvider)
+    ("textDocument/formatting" :capability :documentFormattingProvider)
+    ("textDocument/hover" :capability :hoverProvider)
+    ("textDocument/implementation" :capability :implementationProvider)
+    ("textDocument/linkedEditingRange" :capability :linkedEditingRangeProvider)
+    ("textDocument/onTypeFormatting" :capability :documentOnTypeFormattingProvider)
+    ("textDocument/prepareRename"
+     :check-command (lambda (workspace)
+                      (with-lsp-workspace workspace
+                        (lsp:rename-options-prepare-provider?
+                         (or (lsp--capability :renameProvider)
+                             (when-let ((maybe-capability (lsp--registered-capability "textDocument/rename")))
+                               (lsp--registered-capability-options maybe-capability)))))))
+    ("textDocument/rangeFormatting" :capability :documentRangeFormattingProvider)
+    ("textDocument/references" :capability :referencesProvider)
+    ("textDocument/rename" :capability :renameProvider)
+    ("textDocument/selectionRange" :capability :selectionRangeProvider)
+    ("textDocument/semanticTokens" :capability :semanticTokensProvider)
+    ("textDocument/semanticTokensFull"
+     :check-command (lambda (workspace)
+                      (with-lsp-workspace workspace
+                        (lsp-get (lsp--capability :semanticTokensProvider) :full))))
+    ("textDocument/semanticTokensFull/Delta"
+     :check-command (lambda (workspace)
+                      (with-lsp-workspace workspace
+                        (let ((capFull (lsp-get (lsp--capability :semanticTokensProvider) :full)))
+                          (and (not (booleanp capFull)) (lsp-get capFull :delta))))))
+    ("textDocument/semanticTokensRangeProvider"
+     :check-command (lambda (workspace)
+                      (with-lsp-workspace workspace
+                        (lsp-get (lsp--capability :semanticTokensProvider) :range))))
+    ("textDocument/signatureHelp" :capability :signatureHelpProvider)
+    ("textDocument/typeDefinition" :capability :typeDefinitionProvider)
+    ("workspace/executeCommand" :capability :executeCommandProvider)
+    ("workspace/symbol" :capability :workspaceSymbolProvider))
+
+  "Map methods to requirements.
+It is used by request-sending functions to determine which server
+must be used for handling a particular message.")
+
+(defconst lsp--file-change-type
+  `((created . 1)
+    (changed . 2)
+    (deleted . 3)))
+
+(defconst lsp--watch-kind
+  `((create . 1)
+    (change . 2)
+    (delete . 4)))
+
+(defvar lsp-window-body-width 40
+  "Window body width when rendering doc.")
+
+(defface lsp-face-highlight-textual
+  '((t :inherit highlight))
+  "Face used for textual occurrences of symbols."
+  :group 'lsp-mode)
+
+(defface lsp-face-highlight-read
+  '((t :inherit highlight :underline t))
+  "Face used for highlighting symbols being read."
+  :group 'lsp-mode)
+
+(defface lsp-face-highlight-write
+  '((t :inherit highlight :weight bold))
+  "Face used for highlighting symbols being written to."
+  :group 'lsp-mode)
+
+(define-obsolete-variable-alias 'lsp-lens-auto-enable
+  'lsp-lens-enable "lsp-mode 7.0.1")
+
+(defcustom lsp-lens-enable t
+  "Auto enable lenses if server supports."
+  :group 'lsp-lens
+  :type 'boolean
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-symbol-highlighting-skip-current nil
+  "If non-nil skip current symbol when setting symbol highlights."
+  :group 'lsp-mode
+  :type 'boolean)
+
+(defcustom lsp-file-watch-threshold 1000
+  "Show warning if the files to watch are more than.
+Set to nil to disable the warning."
+  :type 'number
+  :group 'lsp-mode)
+;;;###autoload(put 'lsp-file-watch-threshold 'safe-local-variable (lambda (i) (or (numberp i) (not i))))
+
+(defvar lsp-custom-markup-modes
+  '((rust-mode "no_run" "rust,no_run" "rust,ignore" "rust,should_panic"))
+  "Mode to uses with markdown code blocks.
+They are added to `markdown-code-lang-modes'")
+
+(defcustom lsp-signature-render-documentation t
+  "Display signature documentation in `eldoc'."
+  :type 'boolean
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-signature-auto-activate '(:on-trigger-char :on-server-request)
+  "Auto activate signature conditions."
+  :type '(repeat (choice (const :tag "On trigger chars pressed." :on-trigger-char)
+                         (const :tag "After selected completion." :after-completion)
+                         (const :tag "When the server has sent show signature help." :on-server-request)))
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-signature-doc-lines 20
+  "If number, limit the number of lines to show in the docs."
+  :type 'number
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-signature-function 'lsp-lv-message
+  "The function used for displaying signature info.
+It will be called with one param - the signature info. When
+called with nil the signature info must be cleared."
+  :type 'function
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-keymap-prefix "s-l"
+  "LSP-mode keymap prefix."
+  :group 'lsp-mode
+  :type 'string
+  :package-version '(lsp-mode . "6.3"))
+
+(defvar-local lsp--buffer-workspaces ()
+  "List of the buffer workspaces.")
+
+(defvar lsp--session nil
+  "Contain the `lsp-session' for the current Emacs instance.")
+
+(defvar lsp--tcp-port 10000)
+
+(defvar lsp--client-packages-required nil
+  "If nil, `lsp-client-packages' are yet to be required.")
+
+(defvar lsp--tcp-server-port 0
+  "The server socket which is opened when using `lsp-tcp-server' (a server
+socket is opened in Emacs and the language server connects to it).  The
+default value of 0 ensures that a random high port is used. Set it to a positive
+integer to use a specific port.")
+
+(defvar lsp--tcp-server-wait-seconds 10
+  "Wait this amount of time for the client to connect to our server socket
+when using `lsp-tcp-server'.")
+
+(defvar-local lsp--document-symbols nil
+  "The latest document symbols.")
+
+(defvar-local lsp--document-selection-range-cache nil
+  "The document selection cache.")
+
+(defvar-local lsp--document-symbols-request-async nil
+  "If non-nil, request document symbols asynchronously.")
+
+(defvar-local lsp--document-symbols-tick -1
+  "The value of `buffer-chars-modified-tick' when document
+  symbols were last retrieved.")
+
+(defvar-local lsp--have-document-highlights nil
+  "Set to `t' on symbol highlighting, cleared on
+`lsp--cleanup-highlights-if-needed'. Checking a separately
+defined flag is substantially faster than unconditionally
+calling `remove-overlays'.")
+
+;; Buffer local variable for storing number of lines.
+(defvar lsp--log-lines)
+
+(defvar-local lsp--eldoc-saved-message nil)
+
+(defvar lsp--on-change-timer nil)
+(defvar lsp--on-idle-timer nil)
+
+(defvar-local lsp--signature-last nil)
+(defvar-local lsp--signature-last-index nil)
+(defvar lsp--signature-last-buffer nil)
+
+(defvar-local lsp--virtual-buffer-point-max nil)
+
+(cl-defgeneric lsp-execute-command (server command arguments)
+  "Ask SERVER to execute COMMAND with ARGUMENTS.")
+
+(defun lsp-elt (sequence n)
+  "Return Nth element of SEQUENCE or nil if N is out of range."
+  (cond
+   ((listp sequence) (elt sequence n))
+   ((arrayp sequence)
+    (and (> (length sequence) n) (aref sequence n)))
+   (t (and (> (length sequence) n) (elt sequence n)))))
+
+;; define seq-first and seq-rest for older emacs
+(defun lsp-seq-first (sequence)
+  "Return the first element of SEQUENCE."
+  (lsp-elt sequence 0))
+
+(defun lsp-seq-rest (sequence)
+  "Return a sequence of the elements of SEQUENCE except the first one."
+  (seq-drop sequence 1))
+
+;;;###autoload
+(defun lsp--string-listp (sequence)
+  "Return t if all elements of SEQUENCE are strings, else nil."
+  (not (seq-find (lambda (x) (not (stringp x))) sequence)))
+
+(defun lsp--string-vector-p (candidate)
+  "Returns true if CANDIDATE is a vector data structure and
+every element of it is of type string, else nil."
+  (and
+   (vectorp candidate)
+   (seq-every-p #'stringp candidate)))
+
+(make-obsolete 'lsp--string-vector-p nil "lsp-mode 8.0.0")
+
+(defun lsp--editable-vector-match (widget value)
+  "Function for `lsp-editable-vector' :match."
+  ;; Value must be a list or a vector and all the members must match the type.
+  (and (or (listp value) (vectorp value))
+       (length (cdr (lsp--editable-vector-match-inline widget value)))))
+
+(defun lsp--editable-vector-match-inline (widget value)
+  "Value for `lsp-editable-vector' :match-inline."
+  (let ((type (nth 0 (widget-get widget :args)))
+        (ok t)
+        found)
+    (while (and value ok)
+      (let ((answer (widget-match-inline type value)))
+        (if answer
+            (let ((head (if (vectorp answer) (aref answer 0) (car answer)))
+                  (tail (if (vectorp answer) (seq-drop 1 answer) (cdr answer))))
+              (setq found (append found head)
+                    value tail))
+          (setq ok nil))))
+    (cons found value)))
+
+(defun lsp--editable-vector-value-to-external (_widget internal-value)
+  "Convert the internal list value to a vector."
+  (if (listp internal-value)
+      (apply 'vector internal-value)
+    internal-value))
+
+(defun lsp--editable-vector-value-to-internal (_widget external-value)
+  "Convert the external vector value to a list."
+  (if (vectorp external-value)
+      (append external-value nil)
+    external-value))
+
+(define-widget 'lsp--editable-vector 'editable-list
+  "A subclass of `editable-list' that accepts and returns a
+vector instead of a list."
+  :value-to-external 'lsp--editable-vector-value-to-external
+  :value-to-internal 'lsp--editable-vector-value-to-internal
+  :match 'lsp--editable-vector-match
+  :match-inline 'lsp--editable-vector-match-inline)
+
+(define-widget 'lsp-repeatable-vector 'lsp--editable-vector
+  "A variable length homogeneous vector."
+  :tag "Repeat"
+  :format "%{%t%}:\n%v%i\n")
+
+(define-widget 'lsp-string-vector 'lazy
+  "A vector of zero or more elements, every element of which is a string.
+Appropriate for any language-specific `defcustom' that needs to
+serialize as a JSON array of strings.
+
+Deprecated. Use `lsp-repeatable-vector' instead. "
+  :offset 4
+  :tag "Vector"
+  :type '(lsp-repeatable-vector string))
+
+(make-obsolete 'lsp-string-vector nil "lsp-mode 8.0.0")
+
+(defvar lsp--show-message t
+  "If non-nil, show debug message from `lsp-mode'.")
+
+(defun lsp--message  (format &rest args)
+  "Wrapper for `message'
+
+We `inhibit-message' the message when the cursor is in the
+minibuffer and when emacs version is before emacs 27 due to the
+fact that we often use `lsp--info', `lsp--warn' and `lsp--error'
+in async context and the call to these function is removing the
+minibuffer prompt. The issue with async messages is already fixed
+in emacs 27.
+
+See #2049"
+  (when lsp--show-message
+    (let ((inhibit-message (and (minibufferp)
+                                (version< emacs-version "27.0"))))
+      (apply #'message format args))))
+
+(defun lsp--info (format &rest args)
+  "Display lsp info message with FORMAT with ARGS."
+  (lsp--message "%s :: %s" (propertize "LSP" 'face 'success) (apply #'format format args)))
+
+(defun lsp--warn (format &rest args)
+  "Display lsp warn message with FORMAT with ARGS."
+  (lsp--message "%s :: %s" (propertize "LSP" 'face 'warning) (apply #'format format args)))
+
+(defun lsp--error (format &rest args)
+  "Display lsp error message with FORMAT with ARGS."
+  (lsp--message "%s :: %s" (propertize "LSP" 'face 'error) (apply #'format format args)))
+
+(defun lsp--eldoc-message (&optional msg)
+  "Show MSG in eldoc."
+  (setq lsp--eldoc-saved-message msg)
+  (run-with-idle-timer 0 nil (lambda ()
+                               ;; XXX: new eldoc in Emacs 28
+                               ;; recommends running the hook variable
+                               ;; `eldoc-documentation-functions'
+                               ;; instead of using eldoc-message
+                               (with-no-warnings
+                                 (eldoc-message msg)))))
+
+(defun lsp-log (format &rest args)
+  "Log message to the ’*lsp-log*’ buffer.
+
+FORMAT and ARGS i the same as for `message'."
+  (when lsp-log-max
+    (let ((log-buffer (get-buffer "*lsp-log*"))
+          (inhibit-read-only t))
+      (unless log-buffer
+        (setq log-buffer (get-buffer-create "*lsp-log*"))
+        (with-current-buffer log-buffer
+          (buffer-disable-undo)
+          (view-mode 1)
+          (set (make-local-variable 'lsp--log-lines) 0)))
+      (with-current-buffer log-buffer
+        (save-excursion
+          (let* ((message (apply 'format format args))
+                 ;; Count newlines in message.
+                 (newlines (1+ (cl-loop with start = 0
+                                        for count from 0
+                                        while (string-match "\n" message start)
+                                        do (setq start (match-end 0))
+                                        finally return count))))
+            (goto-char (point-max))
+
+            ;; in case the buffer is not empty insert before last \n to preserve
+            ;; the point position(in case it is in the end)
+            (if (eq (point) (point-min))
+                (progn
+                  (insert "\n")
+                  (backward-char))
+              (backward-char)
+              (insert "\n"))
+            (insert message)
+
+            (setq lsp--log-lines (+ lsp--log-lines newlines))
+
+            (when (and (integerp lsp-log-max) (> lsp--log-lines lsp-log-max))
+              (let ((to-delete (- lsp--log-lines lsp-log-max)))
+                (goto-char (point-min))
+                (forward-line to-delete)
+                (delete-region (point-min) (point))
+                (setq lsp--log-lines lsp-log-max)))))))))
+
+(defalias 'lsp-message 'lsp-log)
+
+(defalias 'lsp-ht 'ht)
+
+(defalias 'lsp-file-local-name 'file-local-name)
+
+(defun lsp-f-canonical (file-name)
+  "Return the canonical FILE-NAME, without a trailing slash."
+  (directory-file-name (expand-file-name file-name)))
+
+(defalias 'lsp-canonical-file-name 'lsp-f-canonical)
+
+(defun lsp-f-same? (path-a path-b)
+  "Return t if PATH-A and PATH-B are references to the same file.
+Symlinks are not followed."
+  (when (and (f-exists? path-a)
+             (f-exists? path-b))
+    (equal
+     (lsp-f-canonical (directory-file-name (f-expand path-a)))
+     (lsp-f-canonical (directory-file-name (f-expand path-b))))))
+
+(defun lsp-f-parent (path)
+  "Return the parent directory to PATH.
+Symlinks are not followed."
+  (let ((parent (file-name-directory
+                 (directory-file-name (f-expand path default-directory)))))
+    (unless (lsp-f-same? path parent)
+      (if (f-relative? path)
+          (f-relative parent)
+        (directory-file-name parent)))))
+
+(defun lsp-f-ancestor-of? (path-a path-b)
+  "Return t if PATH-A is an ancestor of PATH-B.
+Symlinks are not followed."
+  (unless (lsp-f-same? path-a path-b)
+    (s-prefix? (concat (lsp-f-canonical path-a) (f-path-separator))
+               (lsp-f-canonical path-b))))
+
+(defun lsp--merge-results (results method)
+  "Merge RESULTS by filtering the empty hash-tables and merging
+the lists according to METHOD."
+  (pcase (--map (if (vectorp it)
+                    (append it nil) it)
+                (-filter #'identity results))
+    (`() ())
+    ;; only one result - simply return it
+    (`(,fst) fst)
+    ;; multiple results merge it based on strategy
+    (results
+     (pcase method
+       ("textDocument/hover" (pcase (seq-filter
+                                     (-compose #'not #'lsp-empty?)
+                                     results)
+                               (`(,hover) hover)
+                               (hovers (lsp-make-hover
+                                        :contents
+                                        (-mapcat
+                                         (-lambda ((&Hover :contents))
+                                           (if (and (sequencep contents)
+                                                    (not (stringp contents)))
+                                               (append contents ())
+                                             (list contents)))
+                                         hovers)))))
+       ("textDocument/completion"
+        (lsp-make-completion-list
+         :is-incomplete (seq-some
+                         #'lsp:completion-list-is-incomplete
+                         results)
+         :items (cl-mapcan (lambda (it) (append (if (lsp-completion-list? it)
+                                                    (lsp:completion-list-items it)
+                                                  it)
+                                                nil))
+                           results)))
+       ("completionItem/resolve"
+        (let ((item (cl-first results)))
+          (when-let ((details (seq-filter #'identity
+                                          (seq-map #'lsp:completion-item-detail? results))))
+            (lsp:set-completion-item-detail?
+             item
+             (string-join details " ")))
+          (when-let ((docs (seq-filter #'identity
+                                       (seq-map #'lsp:completion-item-documentation? results))))
+            (lsp:set-completion-item-documentation?
+             item
+             (lsp-make-markup-content
+              :kind (or (seq-some (lambda (it)
+                                    (when (equal (lsp:markup-content-kind it)
+                                                 lsp/markup-kind-markdown)
+                                      lsp/markup-kind-markdown))
+                                  docs)
+                        lsp/markup-kind-plain-text)
+              :value (string-join (seq-map (lambda (doc)
+                                             (or (lsp:markup-content-value doc)
+                                                 (and (stringp doc) doc)))
+                                           docs)
+                                  "\n"))))
+          (when-let ((edits (seq-filter #'identity
+                                        (seq-map #'lsp:completion-item-additional-text-edits? results))))
+            (lsp:set-completion-item-additional-text-edits?
+             item
+             (cl-mapcan (lambda (it) (if (seqp it) it (list it))) edits)))
+          item))
+       (_ (cl-mapcan (lambda (it) (if (seqp it) it (list it))) results))))))
+
+(defun lsp--spinner-start ()
+  "Start spinner indication."
+  (condition-case _err (spinner-start 'progress-bar-filled) (error)))
+
+(defun lsp--propertize (str type)
+  "Propertize STR as per TYPE."
+  (propertize str 'face (alist-get type lsp--message-type-face)))
+
+(defun lsp-workspaces ()
+  "Return the lsp workspaces associated with the current project."
+  (if lsp--cur-workspace (list lsp--cur-workspace) lsp--buffer-workspaces))
+
+(defun lsp--completing-read (prompt collection transform-fn &optional predicate
+                                    require-match initial-input
+                                    hist def inherit-input-method)
+  "Wrap `completing-read' to provide transformation function and disable sort.
+
+TRANSFORM-FN will be used to transform each of the items before displaying.
+
+PROMPT COLLECTION PREDICATE REQUIRE-MATCH INITIAL-INPUT HIST DEF
+INHERIT-INPUT-METHOD will be proxied to `completing-read' without changes."
+  (let* ((col (--map (cons (funcall transform-fn it) it) collection))
+         (completion (completing-read prompt
+                                      (lambda (string pred action)
+                                        (if (eq action 'metadata)
+                                            `(metadata (display-sort-function . identity))
+                                          (complete-with-action action col string pred)))
+                                      predicate require-match initial-input hist
+                                      def inherit-input-method)))
+    (cdr (assoc completion col))))
+
+(defmacro lsp-with-current-buffer (buffer-id &rest body)
+  (declare (indent 1) (debug t))
+  `(if-let ((wcb (plist-get ,buffer-id :with-current-buffer)))
+       (with-lsp-workspaces (plist-get ,buffer-id :workspaces)
+         (funcall wcb (lambda () ,@body)))
+     (with-current-buffer ,buffer-id
+       ,@body)))
+
+(defvar lsp--throw-on-input nil
+  "Make `lsp-*-while-no-input' throws `input' on interrupted.")
+
+(defmacro lsp--catch (tag bodyform &rest handlers)
+  "Catch TAG thrown in BODYFORM.
+The return value from TAG will be handled in HANDLERS by `pcase'."
+  (declare (debug (form form &rest (pcase-PAT body))) (indent 2))
+  (let ((re-sym (make-symbol "re")))
+    `(let ((,re-sym (catch ,tag ,bodyform)))
+       (pcase ,re-sym
+         ,@handlers))))
+
+(defmacro lsp--while-no-input (&rest body)
+  "Wrap BODY in `while-no-input' and respecting `non-essential'.
+If `lsp--throw-on-input' is set, will throw if input is pending, else
+return value of `body' or nil if interrupted."
+  (declare (debug t) (indent 0))
+  `(if non-essential
+       (let ((res (while-no-input ,@body)))
+         (cond
+          ((and lsp--throw-on-input (equal res t))
+           (throw 'input :interrupted))
+          ((booleanp res) nil)
+          (t res)))
+     ,@body))
+
+;; A ‘lsp--client’ object describes the client-side behavior of a language
+;; server.  It is used to start individual server processes, each of which is
+;; represented by a ‘lsp--workspace’ object.  Client objects are normally
+;; created using ‘lsp-define-stdio-client’ or ‘lsp-define-tcp-client’.  Each
+;; workspace refers to exactly one client, but there can be multiple workspaces
+;; for a single client.
+(cl-defstruct lsp--client
+  ;; ‘language-id’ is a function that receives a buffer as a single argument
+  ;; and should return the language identifier for that buffer.  See
+  ;; https://microsoft.github.io/language-server-protocol/specification#textdocumentitem
+  ;; for a list of language identifiers.  Also consult the documentation for
+  ;; the language server represented by this client to find out what language
+  ;; identifiers it supports or expects.
+  (language-id nil)
+
+  ;; ‘add-on?’ when set to t the server will be started no matter whether there
+  ;; is another server handling the same mode.
+  (add-on? nil)
+  ;; ‘new-connection’ is a function that should start a language server process
+  ;; and return a cons (COMMAND-PROCESS . COMMUNICATION-PROCESS).
+  ;; COMMAND-PROCESS must be a process object representing the server process
+  ;; just started.  COMMUNICATION-PROCESS must be a process (including pipe and
+  ;; network processes) that ‘lsp-mode’ uses to communicate with the language
+  ;; server using the language server protocol.  COMMAND-PROCESS and
+  ;; COMMUNICATION-PROCESS may be the same process; in that case
+  ;; ‘new-connection’ may also return that process as a single
+  ;; object. ‘new-connection’ is called with two arguments, FILTER and
+  ;; SENTINEL.  FILTER should be used as process filter for
+  ;; COMMUNICATION-PROCESS, and SENTINEL should be used as process sentinel for
+  ;; COMMAND-PROCESS.
+  (new-connection nil)
+
+  ;; ‘ignore-regexps’ is a list of regexps.  When a data packet from the
+  ;; language server matches any of these regexps, it will be ignored.  This is
+  ;; intended for dealing with language servers that output non-protocol data.
+  (ignore-regexps nil)
+
+  ;; ‘ignore-messages’ is a list of regexps.  When a message from the language
+  ;; server matches any of these regexps, it will be ignored.  This is useful
+  ;; for filtering out unwanted messages; such as servers that send nonstandard
+  ;; message types, or extraneous log messages.
+  (ignore-messages nil)
+
+  ;; ‘notification-handlers’ is a hash table mapping notification method names
+  ;; (strings) to functions handling the respective notifications.  Upon
+  ;; receiving a notification, ‘lsp-mode’ will call the associated handler
+  ;; function passing two arguments, the ‘lsp--workspace’ object and the
+  ;; deserialized notification parameters.
+  (notification-handlers (make-hash-table :test 'equal))
+
+  ;; ‘request-handlers’ is a hash table mapping request method names
+  ;; (strings) to functions handling the respective notifications.  Upon
+  ;; receiving a request, ‘lsp-mode’ will call the associated handler function
+  ;; passing two arguments, the ‘lsp--workspace’ object and the deserialized
+  ;; request parameters.
+  (request-handlers (make-hash-table :test 'equal))
+
+  ;; ‘response-handlers’ is a hash table mapping integral JSON-RPC request
+  ;; identifiers for pending asynchronous requests to functions handling the
+  ;; respective responses.  Upon receiving a response from the language server,
+  ;; ‘lsp-mode’ will call the associated response handler function with a
+  ;; single argument, the deserialized response parameters.
+  (response-handlers (make-hash-table :test 'eql))
+
+  ;; ‘prefix-function’ is called for getting the prefix for completion.
+  ;; The function takes no parameter and returns a cons (start . end) representing
+  ;; the start and end bounds of the prefix. If it's not set, the client uses a
+  ;; default prefix function."
+  (prefix-function nil)
+
+  ;; Contains mapping of scheme to the function that is going to be used to load
+  ;; the file.
+  (uri-handlers (make-hash-table :test #'equal))
+
+  ;; ‘action-handlers’ is a hash table mapping action to a handler function. It
+  ;; can be used in `lsp-execute-code-action' to determine whether the action
+  ;; current client is interested in executing the action instead of sending it
+  ;; to the server.
+  (action-handlers (make-hash-table :test 'equal))
+
+  ;; major modes supported by the client.
+  major-modes
+  ;; Function that will be called to decide if this language client
+  ;; should manage a particular buffer. The function will be passed
+  ;; the file name and major mode to inform the decision. Setting
+  ;; `activation-fn' will override `major-modes', if
+  ;; present.
+  activation-fn
+  ;; Break the tie when major-mode is supported by multiple clients.
+  (priority 0)
+  ;; Unique identifier for representing the client object.
+  server-id
+  ;; defines whether the client supports multi root workspaces.
+  multi-root
+  ;; Initialization options or a function that returns initialization options.
+  initialization-options
+  ;; Overrides semantic tokens faces for specific clients
+  semantic-tokens-faces-overrides
+  ;; Provides support for registering LSP Server specific capabilities.
+  custom-capabilities
+  ;; Function which returns the folders that are considered to be not projects but library files.
+  ;; The function accepts one parameter currently active workspace.
+  ;; See: https://github.com/emacs-lsp/lsp-mode/issues/225.
+  library-folders-fn
+  ;; function which will be called when opening file in the workspace to perform
+  ;; client specific initialization. The function accepts one parameter
+  ;; currently active workspace.
+  before-file-open-fn
+  ;; Function which will be called right after a workspace has been initialized.
+  initialized-fn
+  ;; ‘remote?’ indicate whether the client can be used for LSP server over TRAMP.
+  (remote? nil)
+
+  ;; ‘completion-in-comments?’ t if the client supports completion in comments.
+  (completion-in-comments? nil)
+
+  ;; ‘path->uri-fn’ the function to use for path->uri conversion for the client.
+  (path->uri-fn nil)
+
+  ;; ‘uri->path-fn’ the function to use for uri->path conversion for the client.
+  (uri->path-fn nil)
+  ;; Function that returns an environment structure that will be used
+  ;; to set some environment variables when starting the language
+  ;; server process. These environment variables enable some
+  ;; additional features in the language server. The environment
+  ;; structure is an alist of the form (KEY . VALUE), where KEY is a
+  ;; string (regularly in all caps), and VALUE may be a string, a
+  ;; boolean, or a sequence of strings.
+  environment-fn
+
+  ;; ‘after-open-fn’ workspace after open specific hooks.
+  (after-open-fn nil)
+
+  ;; ‘async-request-handlers’ is a hash table mapping request method names
+  ;; (strings) to functions handling the respective requests that may take
+  ;; time to finish.  Upon receiving a request, ‘lsp-mode’ will call the
+  ;; associated handler function passing three arguments, the ‘lsp--workspace’
+  ;; object, the deserialized request parameters and the callback which accept
+  ;; result as its parameter.
+  (async-request-handlers (make-hash-table :test 'equal))
+  download-server-fn
+  download-in-progress?
+  buffers
+  synchronize-sections)
+
+(defun lsp-clients-executable-find (find-command &rest args)
+  "Finds an executable by invoking a search command.
+
+FIND-COMMAND is the executable finder that searches for the
+actual language server executable. ARGS is a list of arguments to
+give to FIND-COMMAND to find the language server.  Returns the
+output of FIND-COMMAND if it exits successfully, nil otherwise.
+
+Typical uses include finding an executable by invoking 'find' in
+a project, finding LLVM commands on macOS with 'xcrun', or
+looking up project-specific language servers for projects written
+in the various dynamic languages, e.g. 'nvm', 'pyenv' and 'rbenv'
+etc."
+  (when-let* ((find-command-path (executable-find find-command))
+              (executable-path
+               (with-temp-buffer
+                 (when (zerop (apply 'call-process find-command-path nil t nil args))
+                   (buffer-substring-no-properties (point-min) (point-max))))))
+    (string-trim executable-path)))
+
+(defvar lsp--already-widened nil)
+
+(defmacro lsp-save-restriction-and-excursion (&rest form)
+  (declare (indent 0) (debug t))
+  `(if lsp--already-widened
+       (save-excursion ,@form)
+     (-let [lsp--already-widened t]
+       (save-restriction
+         (widen)
+         (save-excursion ,@form)))))
+
+;; from http://emacs.stackexchange.com/questions/8082/how-to-get-buffer-position-given-line-number-and-column-number
+(defun lsp--line-character-to-point (line character)
+  "Return the point for character CHARACTER on line LINE."
+  (or (lsp-virtual-buffer-call :line/character->point line character)
+      (let ((inhibit-field-text-motion t))
+        (lsp-save-restriction-and-excursion
+          (goto-char (point-min))
+          (forward-line line)
+          ;; server may send character position beyond the current line and we
+          ;; should fallback to line end.
+          (-let [line-end (line-end-position)]
+            (if (> character (- line-end (point)))
+                line-end
+              (forward-char character)
+              (point)))))))
+
+(lsp-defun lsp--position-to-point ((&Position :line :character))
+  "Convert `Position' object in PARAMS to a point."
+  (lsp--line-character-to-point line character))
+
+(lsp-defun lsp--range-to-region ((&RangeToPoint :start :end))
+  (cons start end))
+
+(lsp-defun lsp--range-text ((&RangeToPoint :start :end))
+  (buffer-substring start end))
+
+(lsp-defun lsp--find-wrapping-range ((&SelectionRange :parent? :range (&RangeToPoint :start :end)))
+  (cond
+   ((and
+     (region-active-p)
+     (<= start (region-beginning) end)
+     (<= start (region-end) end)
+     (or (not (= start (region-beginning)))
+         (not (= end (region-end)))))
+    (cons start end))
+   ((and (<= start (point) end)
+         (not (region-active-p)))
+    (cons start end))
+   (parent? (lsp--find-wrapping-range parent?))))
+
+(defun lsp--get-selection-range ()
+  (or
+   (-when-let ((cache . cache-tick) lsp--document-selection-range-cache)
+     (when (= cache-tick (buffer-modified-tick)) cache))
+   (let ((response (cl-first
+                    (lsp-request
+                     "textDocument/selectionRange"
+                     (list :textDocument (lsp--text-document-identifier)
+                           :positions (vector (lsp--cur-position)))))))
+     (setq lsp--document-selection-range-cache
+           (cons response (buffer-modified-tick)))
+     response)))
+
+(defun lsp-extend-selection ()
+  "Extend selection."
+  (interactive)
+  (unless (lsp--capability :selectionRangeProvider)
+    (signal 'lsp-capability-not-supported (list "selectionRangeProvider")))
+  (-when-let ((start . end) (lsp--find-wrapping-range (lsp--get-selection-range)))
+    (goto-char start)
+    (set-mark (point))
+    (goto-char end)
+    (exchange-point-and-mark)))
+
+(defun lsp-warn (message &rest args)
+  "Display a warning message made from (`format-message' MESSAGE ARGS...).
+This is equivalent to `display-warning', using `lsp-mode' as the type and
+`:warning' as the level."
+  (display-warning 'lsp-mode (apply #'format-message message args)))
+
+(defun lsp--get-uri-handler (scheme)
+  "Get uri handler for SCHEME in the current workspace."
+  (--some (gethash scheme (lsp--client-uri-handlers (lsp--workspace-client it)))
+          (or (lsp-workspaces) (lsp--session-workspaces (lsp-session)))))
+
+(defun lsp--fix-path-casing (path)
+  "On windows, downcases path because the windows file system is
+case-insensitive.
+
+On other systems, returns path without change."
+  (if (eq system-type 'windows-nt) (downcase path) path))
+
+(defun lsp--uri-to-path (uri)
+  "Convert URI to a file path."
+  (if-let ((fn (->> (lsp-workspaces)
+                    (-keep (-compose #'lsp--client-uri->path-fn #'lsp--workspace-client))
+                    (cl-first))))
+      (funcall fn uri)
+    (lsp--uri-to-path-1 uri)))
+
+(defun lsp-remap-path-if-needed (file-name)
+  (-if-let ((virtual-buffer &as &plist :buffer) (gethash file-name lsp--virtual-buffer-mappings))
+      (propertize (buffer-local-value 'buffer-file-name buffer)
+                  'lsp-virtual-buffer virtual-buffer)
+    file-name))
+
+(defun lsp--uri-to-path-1 (uri)
+  "Convert URI to a file path."
+  (let* ((url (url-generic-parse-url (url-unhex-string uri)))
+         (type (url-type url))
+         (file (decode-coding-string (url-filename url)
+                                     (or locale-coding-system 'utf-8)))
+         (file-name (if (and type (not (string= type "file")))
+                        (if-let ((handler (lsp--get-uri-handler type)))
+                            (funcall handler uri)
+                          uri)
+                      ;; `url-generic-parse-url' is buggy on windows:
+                      ;; https://github.com/emacs-lsp/lsp-mode/pull/265
+                      (or (and (eq system-type 'windows-nt)
+                               (eq (elt file 0) ?\/)
+                               (substring file 1))
+                          file))))
+    (->> file-name
+         (concat (-some #'lsp--workspace-host-root (lsp-workspaces)))
+         (lsp-remap-path-if-needed))))
+
+(defun lsp--buffer-uri ()
+  "Return URI of the current buffer."
+  (or lsp-buffer-uri
+      (plist-get lsp--virtual-buffer :buffer-uri)
+      (lsp--path-to-uri
+       (or (buffer-file-name) (buffer-file-name (buffer-base-buffer))))))
+
+(defun lsp-register-client-capabilities (&rest _args)
+  "Implemented only to make `company-lsp' happy.
+DELETE when `lsp-mode.el' is deleted.")
+
+(defconst lsp--url-path-allowed-chars
+  (url--allowed-chars (append '(?/) url-unreserved-chars))
+  "`url-unreserved-chars' with additional delim ?/.
+This set of allowed chars is enough for hexifying local file paths.")
+
+(defun lsp--path-to-uri-1 (path)
+  (concat lsp--uri-file-prefix
+          (--> path
+            (expand-file-name it)
+            (or (file-remote-p it 'localname t) it)
+            (url-hexify-string it lsp--url-path-allowed-chars))))
+
+(defun lsp--path-to-uri (path)
+  "Convert PATH to a uri."
+  (if-let ((uri-fn (->> (lsp-workspaces)
+                        (-keep (-compose #'lsp--client-path->uri-fn #'lsp--workspace-client))
+                        (cl-first))))
+      (funcall uri-fn path)
+    (lsp--path-to-uri-1 path)))
+
+(defun lsp--string-match-any (regex-list str)
+  "Return the first regex, if any, within REGEX-LIST matching STR."
+  (--first (string-match it str) regex-list))
+
+(cl-defstruct lsp-watch
+  (descriptors (make-hash-table :test 'equal))
+  root-directory)
+
+(defun lsp--folder-watch-callback (event callback watch ignored-files ignored-directories)
+  (let ((file-name (cl-third event))
+        (event-type (cl-second event)))
+    (cond
+     ((and (file-directory-p file-name)
+           (equal 'created event-type)
+           (not (lsp--string-match-any ignored-directories file-name)))
+
+      (lsp-watch-root-folder (file-truename file-name) callback ignored-files ignored-directories watch)
+
+      ;; process the files that are already present in
+      ;; the directory.
+      (->> (directory-files-recursively file-name ".*" t)
+           (seq-do (lambda (f)
+                     (unless (file-directory-p f)
+                       (funcall callback (list nil 'created f)))))))
+     ((and (memq event-type '(created deleted changed))
+           (not (file-directory-p file-name))
+           (not (lsp--string-match-any ignored-files file-name)))
+      (funcall callback event))
+     ((and (memq event-type '(renamed))
+           (not (file-directory-p file-name))
+           (not (lsp--string-match-any ignored-files file-name)))
+      (funcall callback `(,(cl-first event) deleted ,(cl-third event)))
+      (funcall callback `(,(cl-first event) created ,(cl-fourth event)))))))
+
+(defun lsp--ask-about-watching-big-repo (number-of-directories dir)
+  "Ask the user if they want to watch NUMBER-OF-DIRECTORIES from a repository DIR.
+This is useful when there is a lot of files in a repository, as
+that may slow Emacs down. Returns t if the user wants to watch
+the entire repository, nil otherwise."
+  (prog1
+      (yes-or-no-p
+       (format
+        "Watching all the files in %s would require adding watches to %s directories, so watching the repo may slow Emacs down.
+Do you want to watch all files in %s? "
+        dir
+        number-of-directories
+        dir))
+    (lsp--info
+     (concat "You can configure this warning with the `lsp-enable-file-watchers' "
+             "and `lsp-file-watch-threshold' variables"))))
+
+
+(defun lsp--path-is-watchable-directory (path dir ignored-directories)
+  "Figure out whether PATH (inside of DIR) is meant to have a file watcher set.
+IGNORED-DIRECTORIES is a list of regexes to filter out directories we don't want to watch."
+  (let
+      ((full-path (f-join dir path)))
+    (and (f-dir-p full-path)
+         (not (equal path "."))
+         (not (equal path ".."))
+         (not (lsp--string-match-any ignored-directories full-path)))))
+
+
+(defun lsp--all-watchable-directories (dir ignored-directories)
+  "Traverse DIR recursively and return a list of paths that should have watchers set on them.
+IGNORED-DIRECTORIES will be used for exclusions"
+  (let* ((dir (if (f-symlink? dir)
+                  (file-truename dir)
+                dir)))
+    (apply #'nconc
+           ;; the directory itself is assumed to be part of the set
+           (list dir)
+           ;; collect all subdirectories that are watchable
+           (-map
+            (lambda (path) (lsp--all-watchable-directories (f-join dir path) ignored-directories))
+            ;; but only look at subdirectories that are watchable
+            (-filter (lambda (path) (lsp--path-is-watchable-directory path dir ignored-directories))
+                     (directory-files dir))))))
+
+(defun lsp-watch-root-folder (dir callback ignored-files ignored-directories &optional watch warn-big-repo?)
+  "Create recursive file notification watch in DIR.
+CALLBACK will be called when there are changes in any of
+the monitored files. WATCHES is a hash table directory->file
+notification handle which contains all of the watch that
+already have been created. Watches will not be created for
+any directory that matches any regex in IGNORED-DIRECTORIES.
+Watches will not be created for any file that matches any
+regex in IGNORED-FILES."
+  (let* ((dir (if (f-symlink? dir)
+                  (file-truename dir)
+                dir))
+         (watch (or watch (make-lsp-watch :root-directory dir)))
+         (dirs-to-watch (lsp--all-watchable-directories dir ignored-directories)))
+    (lsp-log "Creating watchers for following %s folders:\n  %s"
+             (length dirs-to-watch)
+             (s-join "\n  " dirs-to-watch))
+    (when (or
+           (not warn-big-repo?)
+           (not lsp-file-watch-threshold)
+           (let ((number-of-directories (length dirs-to-watch)))
+             (or
+              (< number-of-directories lsp-file-watch-threshold)
+              (condition-case _err
+                  (lsp--ask-about-watching-big-repo number-of-directories dir)
+                ('quit)))))
+      (dolist (current-dir dirs-to-watch)
+        (condition-case err
+            (progn
+              (puthash
+               current-dir
+               (file-notify-add-watch current-dir
+                                      '(change)
+                                      (lambda (event)
+                                        (lsp--folder-watch-callback event callback watch ignored-files ignored-directories)))
+               (lsp-watch-descriptors watch)))
+          (error (lsp-log "Failed to create a watch for %s: message" (error-message-string err)))
+          (file-missing (lsp-log "Failed to create a watch for %s: message" (error-message-string err))))))
+    watch))
+
+(defun lsp-kill-watch (watch)
+  "Delete WATCH."
+  (-> watch lsp-watch-descriptors hash-table-values (-each #'file-notify-rm-watch))
+  (ht-clear! (lsp-watch-descriptors watch)))
+
+(defun lsp-json-bool (val)
+  "Convert VAL to JSON boolean."
+  (if val t :json-false))
+
+(defmacro with-lsp-workspace (workspace &rest body)
+  "Helper macro for invoking BODY in WORKSPACE context."
+  (declare (debug (form body))
+           (indent 1))
+  `(let ((lsp--cur-workspace ,workspace)) ,@body))
+
+(defmacro with-lsp-workspaces (workspaces &rest body)
+  "Helper macro for invoking BODY against multiple WORKSPACES."
+  (declare (debug (form body))
+           (indent 1))
+  `(let ((lsp--buffer-workspaces ,workspaces)) ,@body))
+
+\f
+
+(defconst lsp-downstream-deps
+  '(;; external packages
+    ccls consult-lsp dap-mode helm-lsp lsp-dart lsp-docker lsp-focus lsp-grammarly
+    lsp-haskell lsp-ivy lsp-java lsp-javacomp lsp-jedi lsp-julia lsp-latex lsp-ltex
+    lsp-metals lsp-mssql lsp-origami lsp-p4 lsp-pascal lsp-pyre lsp-pyright
+    lsp-python-ms lsp-rescript lsp-sonarlint lsp-sourcekit lsp-tailwindcss lsp-treemacs
+    lsp-ui swift-helpful
+    ;; clients
+    lsp-actionscript lsp-ada lsp-angular lsp-bash lsp-beancount lsp-clangd
+    lsp-clojure lsp-cmake lsp-crystal lsp-csharp lsp-css lsp-d lsp-dhall
+    lsp-dockerfile lsp-elixir lsp-elm lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript
+    lsp-go lsp-graphql lsp-groovy lsp-hack lsp-haxe lsp-html lsp-javascript lsp-json lsp-kotlin lsp-lua
+    lsp-markdown lsp-nginx lsp-nim lsp-nix lsp-ocaml lsp-perl lsp-php lsp-prolog lsp-purescript lsp-pwsh
+    lsp-pyls lsp-pylsp lsp-racket lsp-r lsp-rf lsp-rust lsp-solargraph lsp-sorbet lsp-sqls
+    lsp-steep lsp-svelte lsp-terraform lsp-tex lsp-toml lsp-v lsp-vala lsp-verilog lsp-vetur lsp-vhdl
+    lsp-vimscript lsp-xml lsp-yaml lsp-zig)
+  "List of downstream deps.")
+
+(defmacro lsp-consistency-check (package)
+  `(defconst ,(intern (concat (symbol-name package)
+                              "-plist-value-when-compiled"))
+     (eval-when-compile lsp-use-plists)))
+
+;; (mapc
+;;  (lambda (package)
+;;    (with-eval-after-load package
+;;      (let ((symbol-name (intern
+;;                          (concat (symbol-name package)
+;;                                  "-plist-value-when-compiled"))))
+;;        (cond
+;;         ((not (boundp symbol-name))
+;;          (warn "We have detected that you are using version of %s that is not compatible with current version of lsp-mode.el, please update it." (propertize (symbol-name package)
+;;                                                                                                                                                              'face 'bold)))
+;;         ((not (eq (symbol-value symbol-name) lsp-use-plists))
+;;          (warn "Package %s is inconsistent with lsp-mode.el. This is indication of race during installation. In order to solve that please delete all packages related to lsp-mode, restar Emacs and install them again." (propertize (symbol-name package) 'face 'bold)))))))
+;;  lsp-downstream-deps)
+
+\f
+;; loading code-workspace files
+
+;;;###autoload
+(defun lsp-load-vscode-workspace (file)
+  "Load vscode workspace from FILE"
+  (interactive "fSelect file to import: ")
+  (mapc #'lsp-workspace-folders-remove (lsp-session-folders (lsp-session)))
+
+  (let ((dir (f-dirname file)))
+    (->> file
+         (json-read-file)
+         (alist-get 'folders)
+         (-map (-lambda ((&alist 'path))
+                 (lsp-workspace-folders-add (expand-file-name path dir)))))))
+
+;;;###autoload
+(defun lsp-save-vscode-workspace (file)
+  "Save vscode workspace to FILE"
+  (interactive "FSelect file to save to: ")
+
+  (let ((json-encoding-pretty-print t))
+    (f-write-text (json-encode
+                   `((folders . ,(->> (lsp-session)
+                                      (lsp-session-folders)
+                                      (--map `((path . ,it)))))))
+                  'utf-8
+                  file)))
+
+\f
+(defmacro lsp-foreach-workspace (&rest body)
+  "Execute BODY for each of the current workspaces."
+  (declare (debug (form body)))
+  `(--map (with-lsp-workspace it ,@body) (lsp-workspaces)))
+
+(defmacro when-lsp-workspace (workspace &rest body)
+  "Helper macro for invoking BODY in WORKSPACE context if present."
+  (declare (debug (form body))
+           (indent 1))
+  `(when-let ((lsp--cur-workspace ,workspace)) ,@body))
+
+(lsp-defun lsp--window-show-message (_workspace (&ShowMessageRequestParams :message :type))
+  "Send the server's messages to log.
+PARAMS - the data sent from _WORKSPACE."
+  (funcall (cl-case type
+             (1 'lsp--error)
+             (2 'lsp--warn)
+             (t 'lsp--info))
+           "%s"
+           message))
+
+(lsp-defun lsp--window-log-message (workspace (&ShowMessageRequestParams :message :type))
+  "Send the server's messages to log.
+PARAMS - the data sent from WORKSPACE."
+  (ignore
+   (let ((client (lsp--workspace-client workspace)))
+     (when (or (not client)
+               (cl-notany (-rpartial #'string-match-p message)
+                          (lsp--client-ignore-messages client)))
+       (lsp-log "%s" (lsp--propertize message type))))))
+
+(lsp-defun lsp--window-log-message-request ((&ShowMessageRequestParams :message :type :actions?))
+  "Display a message request to the user and send the user's selection back to the server."
+  (let* ((message (lsp--propertize message type))
+         (choices (seq-map #'lsp:message-action-item-title actions?)))
+    (if choices
+        (completing-read (concat message " ") (seq-into choices 'list) nil t)
+      (lsp-log message))))
+
+(lsp-defun lsp--window-show-document ((&ShowDocumentParams :uri :selection?))
+  "Show document URI in a buffer and go to SELECTION if any."
+  (let ((path (lsp--uri-to-path uri)))
+    (when (f-exists? path)
+      (with-current-buffer (find-file path)
+        (when selection?
+          (goto-char (lsp--position-to-point (lsp:range-start selection?))))
+        t))))
+
+(defcustom lsp-progress-prefix " ⌛ "
+  "Progress prefix."
+  :group 'lsp-mode
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-progress-function #'lsp-on-progress-modeline
+  "Function for handling the progress notifications."
+  :group 'lsp-mode
+  :type '(choice
+          (const :tag "Use modeline" lsp-on-progress-modeline)
+          (const :tag "Legacy(uses either `progress-reporter' or `spinner' based on `lsp-progress-via-spinner')"
+                 lsp-on-progress-legacy)
+          (const ignore :tag "Ignore")
+          (function :tag "Other function"))
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp--progress-status ()
+  "Returns the status of the progress for the current workspaces."
+  (-let ((progress-status
+          (s-join
+           "|"
+           (-keep
+            (lambda (workspace)
+              (let ((tokens (lsp--workspace-work-done-tokens workspace)))
+                (unless (ht-empty? tokens)
+                  (mapconcat
+                   (-lambda ((&WorkDoneProgressBegin :message? :title :percentage?))
+                     (concat (if percentage?
+                                 (if (numberp percentage?)
+                                     (format "%.0f%%%% " percentage?)
+                                   (format "%s%%%% " percentage?))
+                               "")
+                             (or message? title)))
+                   (ht-values tokens)
+                   "|"))))
+            (lsp-workspaces)))))
+    (unless (s-blank? progress-status)
+      (concat lsp-progress-prefix progress-status))))
+
+(lsp-defun lsp-on-progress-modeline (workspace (&ProgressParams :token :value
+                                                                (value &as &WorkDoneProgress :kind)))
+  "PARAMS contains the progress data.
+WORKSPACE is the workspace that contains the progress token."
+  (add-to-list 'global-mode-string '(t (:eval (lsp--progress-status))))
+  (pcase kind
+    ("begin" (lsp-workspace-set-work-done-token token value workspace))
+    ("report" (lsp-workspace-set-work-done-token token value workspace))
+    ("end" (lsp-workspace-rem-work-done-token token workspace)))
+  (force-mode-line-update))
+
+(lsp-defun lsp-on-progress-legacy (workspace (&ProgressParams :token :value
+                                                              (value &as &WorkDoneProgress :kind)))
+  "PARAMS contains the progress data.
+WORKSPACE is the workspace that contains the progress token."
+  (pcase kind
+    ("begin"
+     (-let* (((&WorkDoneProgressBegin :title :percentage?) value)
+             (reporter
+              (if lsp-progress-via-spinner
+                  (let* ((spinner-strings (alist-get 'progress-bar spinner-types))
+                         ;; Set message as a tooltip for the spinner strings
+                         (propertized-strings
+                          (seq-map (lambda (string) (propertize string 'help-echo title))
+                                   spinner-strings))
+                         (spinner-type (vconcat propertized-strings)))
+                    ;; The progress relates to the server as a whole,
+                    ;; display it on all buffers.
+                    (mapcar (lambda (buffer)
+                              (lsp-with-current-buffer buffer
+                                (spinner-start spinner-type))
+                              buffer)
+                            (lsp--workspace-buffers workspace)))
+                (if percentage?
+                    (make-progress-reporter title 0 100 percentage?)
+                  ;; No percentage, just progress
+                  (make-progress-reporter title nil nil)))))
+       (lsp-workspace-set-work-done-token token reporter workspace)))
+    ("report"
+     (when-let ((reporter (lsp-workspace-get-work-done-token token workspace)))
+       (unless lsp-progress-via-spinner
+         (progress-reporter-update reporter (lsp:work-done-progress-report-percentage? value)))))
+
+    ("end"
+     (when-let ((reporter (lsp-workspace-get-work-done-token token workspace)))
+       (if lsp-progress-via-spinner
+           (mapc (lambda (buffer)
+                   (when (lsp-buffer-live-p buffer)
+                     (lsp-with-current-buffer buffer
+                       (spinner-stop))))
+                 reporter)
+         (progress-reporter-done reporter))
+       (lsp-workspace-rem-work-done-token token workspace)))))
+
+\f
+;; diagnostics
+
+(defvar lsp-diagnostic-filter nil
+  "A a function which will be called with
+  `&PublishDiagnosticsParams' and `workspace' which can be used
+  to filter out the diagnostics. The function should return
+  `&PublishDiagnosticsParams'.
+
+Common usecase are:
+1. Filter the diagnostics for a particular language server.
+2. Filter out the diagnostics under specific level.")
+
+(defvar lsp-diagnostic-stats (ht))
+
+(defun lsp-diagnostics (&optional current-workspace?)
+  "Return the diagnostics from all workspaces."
+  (or (pcase (if current-workspace?
+                 (lsp-workspaces)
+               (lsp--session-workspaces (lsp-session)))
+        (`() ())
+        (`(,workspace) (lsp--workspace-diagnostics workspace))
+        (`,workspaces (let ((result (make-hash-table :test 'equal)))
+                        (mapc (lambda (workspace)
+                                (->> workspace
+                                     (lsp--workspace-diagnostics)
+                                     (maphash (lambda (file-name diagnostics)
+                                                (puthash file-name
+                                                         (append (gethash file-name result) diagnostics)
+                                                         result)))))
+                              workspaces)
+                        result)))
+      (ht)))
+
+(defun lsp-diagnostics-stats-for (path)
+  "Get diagnostics statistics for PATH.
+The result format is vector [_ errors warnings infos hints] or nil."
+  (gethash (lsp--fix-path-casing path) lsp-diagnostic-stats))
+
+(defun lsp-diagnostics--update-path (path new-stats)
+  (let ((new-stats (copy-sequence new-stats))
+        (path (lsp--fix-path-casing (directory-file-name path))))
+    (if-let ((old-data (gethash path lsp-diagnostic-stats)))
+        (dotimes (idx 5)
+          (cl-callf + (aref old-data idx)
+            (aref new-stats idx)))
+      (puthash path new-stats lsp-diagnostic-stats))))
+
+(lsp-defun lsp--on-diagnostics-update-stats (workspace
+                                             (&PublishDiagnosticsParams :uri :diagnostics))
+  (let ((path (lsp--fix-path-casing (lsp--uri-to-path uri)))
+        (new-stats (make-vector 5 0)))
+    (mapc (-lambda ((&Diagnostic :severity?))
+            (cl-incf (aref new-stats (or severity? 1))))
+          diagnostics)
+    (when-let ((old-diags (gethash path (lsp--workspace-diagnostics workspace))))
+      (mapc (-lambda ((&Diagnostic :severity?))
+              (cl-decf (aref new-stats (or severity? 1))))
+            old-diags))
+    (lsp-diagnostics--update-path path new-stats)
+    (while (not (string= path (setf path (file-name-directory
+                                          (directory-file-name path)))))
+      (lsp-diagnostics--update-path path new-stats))))
+
+(defun lsp--on-diagnostics (workspace params)
+  "Callback for textDocument/publishDiagnostics.
+interface PublishDiagnosticsParams {
+    uri: string;
+    diagnostics: Diagnostic[];
+}
+PARAMS contains the diagnostics data.
+WORKSPACE is the workspace that contains the diagnostics."
+  (when lsp-diagnostic-filter
+    (setf params (funcall lsp-diagnostic-filter params workspace)))
+
+  (lsp--on-diagnostics-update-stats workspace params)
+
+  (-let* (((&PublishDiagnosticsParams :uri :diagnostics) params)
+          (lsp--virtual-buffer-mappings (ht))
+          (file (lsp--fix-path-casing (lsp--uri-to-path uri)))
+          (workspace-diagnostics (lsp--workspace-diagnostics workspace)))
+
+    (if (seq-empty-p diagnostics)
+        (remhash file workspace-diagnostics)
+      (puthash file (append diagnostics nil) workspace-diagnostics))
+
+    (run-hooks 'lsp-diagnostics-updated-hook)))
+
+(defun lsp-diagnostics--workspace-cleanup (workspace)
+  (->> workspace
+       (lsp--workspace-diagnostics)
+       (maphash (lambda (key _)
+                  (lsp--on-diagnostics-update-stats
+                   workspace
+                   (lsp-make-publish-diagnostics-params
+                    :uri (lsp--path-to-uri key)
+                    :diagnostics [])))))
+  (clrhash (lsp--workspace-diagnostics workspace)))
+
+\f
+
+;; textDocument/foldingRange support
+
+(cl-defstruct lsp--folding-range beg end kind children)
+
+(defvar-local lsp--cached-folding-ranges nil)
+(defvar-local lsp--cached-nested-folding-ranges nil)
+
+(defun lsp--folding-range-width (range)
+  (- (lsp--folding-range-end range)
+     (lsp--folding-range-beg range)))
+
+(defun lsp--get-folding-ranges ()
+  "Get the folding ranges for the current buffer."
+  (unless (eq (buffer-chars-modified-tick) (car lsp--cached-folding-ranges))
+    (let* ((ranges (lsp-request "textDocument/foldingRange"
+                                `(:textDocument ,(lsp--text-document-identifier))))
+           (sorted-line-col-pairs (->> ranges
+                                       (cl-mapcan (-lambda ((&FoldingRange :start-line
+                                                                           :start-character?
+                                                                           :end-line
+                                                                           :end-character?))
+                                                    (list (cons start-line start-character?)
+                                                          (cons end-line end-character?))))
+                                       (-sort #'lsp--line-col-comparator)))
+           (line-col-to-point-map (lsp--convert-line-col-to-points-batch
+                                   sorted-line-col-pairs)))
+      (setq lsp--cached-folding-ranges
+            (cons (buffer-chars-modified-tick)
+                  (--> ranges
+                    (seq-map (-lambda ((range &as
+                                              &FoldingRange :start-line
+                                              :start-character?
+                                              :end-line
+                                              :end-character?
+                                              :kind?))
+                               (make-lsp--folding-range
+                                :beg (ht-get line-col-to-point-map
+                                             (cons start-line start-character?))
+                                :end (ht-get line-col-to-point-map
+                                             (cons end-line end-character?))
+                                :kind kind?))
+                             it)
+                    (seq-filter (lambda (folding-range)
+                                  (< (lsp--folding-range-beg folding-range)
+                                     (lsp--folding-range-end folding-range)))
+                                it)
+                    (seq-into it 'list)
+                    (delete-dups it))))))
+  (cdr lsp--cached-folding-ranges))
+
+(defun lsp--get-nested-folding-ranges ()
+  "Get a list of nested folding ranges for the current buffer."
+  (-let [(tick . _) lsp--cached-folding-ranges]
+    (if (and (eq tick (buffer-chars-modified-tick))
+             lsp--cached-nested-folding-ranges)
+        lsp--cached-nested-folding-ranges
+      (setq lsp--cached-nested-folding-ranges
+            (lsp--folding-range-build-trees (lsp--get-folding-ranges))))))
+
+(defun lsp--folding-range-build-trees (ranges)
+  (setq ranges (seq-sort #'lsp--range-before-p ranges))
+  (let* ((dummy-node (make-lsp--folding-range
+                      :beg most-negative-fixnum
+                      :end most-positive-fixnum))
+         (stack (list dummy-node)))
+    (dolist (range ranges)
+      (while (not (lsp--range-inside-p range (car stack)))
+        (pop stack))
+      (push range (lsp--folding-range-children (car stack)))
+      (push range stack))
+    (lsp--folding-range-children dummy-node)))
+
+(defun lsp--range-inside-p (r1 r2)
+  "Return non-nil if folding range R1 lies inside R2"
+  (and (>= (lsp--folding-range-beg r1) (lsp--folding-range-beg r2))
+       (<= (lsp--folding-range-end r1) (lsp--folding-range-end r2))))
+
+(defun lsp--range-before-p (r1 r2)
+  "Return non-nil if folding range R1 ends before R2"
+  ;; Ensure r1 comes before r2
+  (or (< (lsp--folding-range-beg r1)
+         (lsp--folding-range-beg r2))
+      ;; If beg(r1) == beg(r2) make sure r2 ends first
+      (and (= (lsp--folding-range-beg r1)
+              (lsp--folding-range-beg r2))
+           (< (lsp--folding-range-end r2)
+              (lsp--folding-range-end r1)))))
+
+(defun lsp--point-inside-range-p (point range)
+  "Return non-nil if POINT lies inside folding range RANGE."
+  (and (>= point (lsp--folding-range-beg range))
+       (<= point (lsp--folding-range-end range))))
+
+(cl-defun lsp--get-current-innermost-folding-range (&optional (point (point)))
+  "Return the innermost folding range POINT lies in."
+  (seq-reduce (lambda (innermost-range curr-range)
+                (if (and (lsp--point-inside-range-p point curr-range)
+                         (or (null innermost-range)
+                             (lsp--range-inside-p curr-range innermost-range)))
+                    curr-range
+                  innermost-range))
+              (lsp--get-folding-ranges)
+              nil))
+
+(cl-defun lsp--get-current-outermost-folding-range (&optional (point (point)))
+  "Return the outermost folding range POINT lies in."
+  (cdr (seq-reduce (-lambda ((best-pair &as outermost-width . _) curr-range)
+                     (let ((curr-width (lsp--folding-range-width curr-range)))
+                       (if (and (lsp--point-inside-range-p point curr-range)
+                                (or (null best-pair)
+                                    (> curr-width outermost-width)))
+                           (cons curr-width curr-range)
+                         best-pair)))
+                   (lsp--get-folding-ranges)
+                   nil)))
+
+(defun lsp--folding-range-at-point-bounds ()
+  (if (and (or (lsp--capability :foldingRangeProvider)
+               (lsp--registered-capability "textDocument/foldingRange"))
+           lsp-enable-folding)
+      (if-let ((range (lsp--get-current-innermost-folding-range)))
+          (cons (lsp--folding-range-beg range)
+                (lsp--folding-range-end range)))
+    nil))
+(put 'lsp--folding-range 'bounds-of-thing-at-point
+     #'lsp--folding-range-at-point-bounds)
+
+(defun lsp--get-nearest-folding-range (&optional backward)
+  (let ((point (point))
+        (found nil))
+    (while (not
+            (or found
+                (if backward
+                    (<= point (point-min))
+                  (>= point (point-max)))))
+      (if backward (cl-decf point) (cl-incf point))
+      (setq found (lsp--get-current-innermost-folding-range point)))
+    found))
+
+(defun lsp--folding-range-at-point-forward-op (n)
+  (when (and (or (lsp--capability :foldingRangeProvider)
+                 (lsp--registered-capability "textDocument/foldingRange"))
+             lsp-enable-folding
+             (not (zerop n)))
+    (cl-block break
+      (dotimes (_ (abs n))
+        (if-let ((range (lsp--get-nearest-folding-range (< n 0))))
+            (goto-char (if (< n 0)
+                           (lsp--folding-range-beg range)
+                         (lsp--folding-range-end range)))
+          (cl-return-from break))))))
+(put 'lsp--folding-range 'forward-op
+     #'lsp--folding-range-at-point-forward-op)
+
+(defun lsp--folding-range-at-point-beginning-op ()
+  (goto-char (car (lsp--folding-range-at-point-bounds))))
+(put 'lsp--folding-range 'beginning-op
+     #'lsp--folding-range-at-point-beginning-op)
+
+(defun lsp--folding-range-at-point-end-op ()
+  (goto-char (cdr (lsp--folding-range-at-point-bounds))))
+(put 'lsp--folding-range 'end-op
+     #'lsp--folding-range-at-point-end-op)
+
+(defun lsp--range-at-point-bounds ()
+  (or (lsp--folding-range-at-point-bounds)
+      (when-let ((range (and
+                         (lsp--capability :hoverProvider)
+                         (->> (lsp--text-document-position-params)
+                              (lsp-request "textDocument/hover")
+                              (lsp:hover-range?)))))
+        (lsp--range-to-region range))))
+
+;; A more general purpose "thing", useful for applications like focus.el
+(put 'lsp--range 'bounds-of-thing-at-point
+     #'lsp--range-at-point-bounds)
+
+(defun lsp--log-io-p (method)
+  "Return non nil if should log for METHOD."
+  (and lsp-log-io
+       (or (not lsp-log-io-allowlist-methods)
+           (member method lsp-log-io-allowlist-methods))))
+
+\f
+;; toggles
+
+(defun lsp-toggle-trace-io ()
+  "Toggle client-server protocol logging."
+  (interactive)
+  (setq lsp-log-io (not lsp-log-io))
+  (lsp--info "Server logging %s." (if lsp-log-io "enabled" "disabled")))
+
+(defun lsp-toggle-signature-auto-activate ()
+  "Toggle signature auto activate."
+  (interactive)
+  (setq lsp-signature-auto-activate
+        (unless lsp-signature-auto-activate '(:on-trigger-char)))
+  (lsp--info "Signature autoactivate %s." (if lsp-signature-auto-activate "enabled" "disabled"))
+  (lsp--update-signature-help-hook))
+
+(defun lsp-toggle-on-type-formatting ()
+  "Toggle on type formatting."
+  (interactive)
+  (setq lsp-enable-on-type-formatting (not lsp-enable-on-type-formatting))
+  (lsp--info "On type formatting is %s." (if lsp-enable-on-type-formatting "enabled" "disabled"))
+  (lsp--update-on-type-formatting-hook))
+
+(defun lsp-toggle-symbol-highlight ()
+  "Toggle symbol highlighting."
+  (interactive)
+  (setq lsp-enable-symbol-highlighting (not lsp-enable-symbol-highlighting))
+
+  (cond
+   ((and lsp-enable-symbol-highlighting
+         (lsp-feature? "textDocument/documentHighlight"))
+    (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t)
+    (lsp--info "Symbol highlighting enabled in current buffer."))
+   ((not lsp-enable-symbol-highlighting)
+    (remove-hook 'lsp-on-idle-hook #'lsp--document-highlight t)
+    (lsp--remove-overlays 'lsp-highlight)
+    (lsp--info "Symbol highlighting disabled in current buffer."))))
+
+\f
+;; keybindings
+(defvar lsp--binding-descriptions nil
+  "List of key binding/short description pair.")
+
+(defmacro lsp-define-conditional-key (keymap key def desc cond &rest bindings)
+  "In KEYMAP, define key sequence KEY as DEF conditionally.
+This is like `define-key', except the definition disappears
+whenever COND evaluates to nil.
+DESC is the short-description for the binding.
+BINDINGS is a list of (key def desc cond)."
+  (declare (indent defun)
+           (debug (form form form form form &rest sexp)))
+  (->> (cl-list* key def desc cond bindings)
+       (-partition 4)
+       (-mapcat (-lambda ((key def desc cond))
+                  `((define-key ,keymap ,key
+                      '(menu-item
+                        ,(format "maybe-%s" def)
+                        ,def
+                        :filter
+                        (lambda (item)
+                          (when (with-current-buffer (or (when (buffer-live-p lsp--describe-buffer)
+                                                           lsp--describe-buffer)
+                                                         (current-buffer))
+                                  ,cond)
+                            item))))
+                    (when (stringp ,key)
+                      (setq lsp--binding-descriptions
+                            (append lsp--binding-descriptions '(,key ,desc)))))))
+       macroexp-progn))
+
+(defvar lsp--describe-buffer nil)
+
+(defun lsp-describe-buffer-bindings-advice (fn buffer &optional prefix menus)
+  (let ((lsp--describe-buffer buffer))
+    (funcall fn buffer prefix menus)))
+
+(advice-add 'describe-buffer-bindings
+            :around
+            #'lsp-describe-buffer-bindings-advice)
+
+(defun lsp--prepend-prefix (mappings)
+  (->> mappings
+       (-partition 2)
+       (-mapcat (-lambda ((key description))
+                  (list (concat lsp-keymap-prefix " " key)
+                        description)))))
+
+(defvar lsp-command-map
+  (-doto (make-sparse-keymap)
+    (lsp-define-conditional-key
+      ;; workspaces
+      "wD" lsp-disconnect "disconnect" (lsp-workspaces)
+      "wd" lsp-describe-session "describe session" t
+      "wq" lsp-workspace-shutdown "shutdown server" (lsp-workspaces)
+      "wr" lsp-workspace-restart "restart server" (lsp-workspaces)
+      "ws" lsp "start server" t
+
+      ;; formatting
+      "==" lsp-format-buffer "format buffer" (or (lsp-feature? "textDocument/rangeFormatting")
+                                                 (lsp-feature? "textDocument/formatting"))
+      "=r" lsp-format-region "format region" (lsp-feature? "textDocument/rangeFormatting")
+
+      ;; folders
+      "Fa" lsp-workspace-folders-add "add folder" t
+      "Fb" lsp-workspace-blacklist-remove "un-blacklist folder" t
+      "Fr" lsp-workspace-folders-remove "remove folder" t
+
+      ;; toggles
+      "TD" lsp-modeline-diagnostics-mode "toggle modeline diagnostics" (lsp-feature?
+                                                                        "textDocument/publishDiagnostics")
+      "TL" lsp-toggle-trace-io "toggle log io" t
+      "TS" lsp-ui-sideline-mode "toggle sideline" (featurep 'lsp-ui-sideline)
+      "TT" lsp-treemacs-sync-mode "toggle treemacs integration" (featurep 'lsp-treemacs)
+      "Ta" lsp-modeline-code-actions-mode "toggle modeline code actions" (lsp-feature?
+                                                                          "textDocument/codeAction")
+      "Tb" lsp-headerline-breadcrumb-mode "toggle breadcrumb" (lsp-feature?
+                                                               "textDocument/documentSymbol")
+      "Td" lsp-ui-doc-mode "toggle documentation popup" (featurep 'lsp-ui-doc)
+      "Tf" lsp-toggle-on-type-formatting "toggle on type formatting" (lsp-feature?
+                                                                      "textDocument/onTypeFormatting")
+      "Th" lsp-toggle-symbol-highlight "toggle highlighting" (lsp-feature? "textDocument/documentHighlight")
+      "Tl" lsp-lens-mode "toggle lenses" (lsp-feature? "textDocument/codeLens")
+      "Ts" lsp-toggle-signature-auto-activate "toggle signature" (lsp-feature? "textDocument/signatureHelp")
+
+      ;; goto
+      "ga" xref-find-apropos "find symbol in workspace" (lsp-feature? "workspace/symbol")
+      "gd" lsp-find-declaration "find declarations" (lsp-feature? "textDocument/declaration")
+      "ge" lsp-treemacs-errors-list "show errors" (fboundp 'lsp-treemacs-errors-list)
+      "gg" lsp-find-definition "find definitions" (lsp-feature? "textDocument/definition")
+      "gh" lsp-treemacs-call-hierarchy "call hierarchy" (and (lsp-feature? "callHierarchy/incomingCalls")
+                                                             (fboundp 'lsp-treemacs-call-hierarchy))
+      "gi" lsp-find-implementation "find implementations" (lsp-feature? "textDocument/implementation")
+      "gr" lsp-find-references "find references" (lsp-feature? "textDocument/references")
+      "gt" lsp-find-type-definition "find type definition" (lsp-feature? "textDocument/typeDefinition")
+
+      ;; help
+      "hg" lsp-ui-doc-glance "glance symbol" (and (featurep 'lsp-ui-doc)
+                                                  (lsp-feature? "textDocument/hover"))
+      "hh" lsp-describe-thing-at-point "describe symbol at point" (lsp-feature? "textDocument/hover")
+      "hs" lsp-signature-activate "signature help" (lsp-feature? "textDocument/signatureHelp")
+
+      ;; refactoring
+      "ro" lsp-organize-imports "organize imports" (lsp-feature? "textDocument/codeAction")
+      "rr" lsp-rename "rename" (lsp-feature? "textDocument/rename")
+
+      ;; actions
+      "aa" lsp-execute-code-action "code actions" (lsp-feature? "textDocument/codeAction")
+      "ah" lsp-document-highlight "highlight symbol" (lsp-feature? "textDocument/documentHighlight")
+      "al" lsp-avy-lens "lens" (and (bound-and-true-p lsp-lens-mode) (featurep 'avy))
+
+      ;; peeks
+      "Gg" lsp-ui-peek-find-definitions "peek definitions" (and (lsp-feature? "textDocument/definition")
+                                                                (fboundp 'lsp-ui-peek-find-definitions))
+      "Gi" lsp-ui-peek-find-implementation "peek implementations" (and
+                                                                   (fboundp 'lsp-ui-peek-find-implementation)
+                                                                   (lsp-feature? "textDocument/implementation"))
+      "Gr" lsp-ui-peek-find-references "peek references" (and (fboundp 'lsp-ui-peek-find-references)
+                                                              (lsp-feature? "textDocument/references"))
+      "Gs" lsp-ui-peek-find-workspace-symbol "peek workspace symbol" (and (fboundp
+                                                                           'lsp-ui-peek-find-workspace-symbol)
+                                                                          (lsp-feature? "workspace/symbol")))))
+
+\f
+;; which-key integration
+
+(declare-function which-key-add-major-mode-key-based-replacements "ext:which-key")
+(declare-function which-key-add-key-based-replacements "ext:which-key")
+
+(defun lsp-enable-which-key-integration (&optional all-modes)
+  "Adds descriptions for `lsp-mode-map' to `which-key-mode' for the current
+active `major-mode', or for all major modes when ALL-MODES is t."
+  (cl-flet ((which-key-fn (if all-modes
+                              'which-key-add-key-based-replacements
+                            (apply-partially 'which-key-add-major-mode-key-based-replacements major-mode))))
+    (apply
+     #'which-key-fn
+     (lsp--prepend-prefix
+      (cl-list*
+       ""    "lsp"
+       "w"   "workspaces"
+       "F"   "folders"
+       "="   "formatting"
+       "T"   "toggle"
+       "g"   "goto"
+       "h"   "help"
+       "r"   "refactor"
+       "a"   "code actions"
+       "G"   "peek"
+       lsp--binding-descriptions)))))
+
+\f
+;; Globbing syntax
+
+;; We port VSCode's glob-to-regexp code
+;; (https://github.com/Microsoft/vscode/blob/466da1c9013c624140f6d1473b23a870abc82d44/src/vs/base/common/glob.ts)
+;; since the LSP globbing syntax seems to be the same as that of
+;; VSCode.
+
+(defconst lsp-globstar "**"
+  "Globstar pattern.")
+
+(defconst lsp-glob-split ?/
+  "The character by which we split path components in a glob
+pattern.")
+
+(defconst lsp-path-regexp "[/\\\\]"
+  "Forward or backslash to be used as a path separator in
+computed regexps.")
+
+(defconst lsp-non-path-regexp "[^/\\\\]"
+  "A regexp matching anything other than a slash.")
+
+(defconst lsp-globstar-regexp
+  (format "\\(?:%s\\|%s+%s\\|%s%s+\\)*?"
+          lsp-path-regexp
+          lsp-non-path-regexp lsp-path-regexp
+          lsp-path-regexp lsp-non-path-regexp)
+  "Globstar in regexp form.")
+
+(defun lsp-split-glob-pattern (pattern split-char)
+  "Split PATTERN at SPLIT-CHAR while respecting braces and brackets."
+  (when pattern
+    (let ((segments nil)
+          (in-braces nil)
+          (in-brackets nil)
+          (current-segment ""))
+      (dolist (char (string-to-list pattern))
+        (cl-block 'exit-point
+          (if (eq char split-char)
+              (when (and (null in-braces)
+                         (null in-brackets))
+                (push current-segment segments)
+                (setq current-segment "")
+                (cl-return-from 'exit-point))
+            (pcase char
+              (?{
+               (setq in-braces t))
+              (?}
+               (setq in-braces nil))
+              (?\[
+               (setq in-brackets t))
+              (?\]
+               (setq in-brackets nil))))
+          (setq current-segment (concat current-segment
+                                        (char-to-string char)))))
+      (unless (string-empty-p current-segment)
+        (push current-segment segments))
+      (nreverse segments))))
+
+(defun lsp--glob-to-regexp (pattern)
+  "Helper function to convert a PATTERN from LSP's glob syntax to
+an Elisp regexp."
+  (if (string-empty-p pattern)
+      ""
+    (let ((current-regexp "")
+          (glob-segments (lsp-split-glob-pattern pattern lsp-glob-split)))
+      (if (-all? (lambda (segment) (eq segment lsp-globstar))
+                 glob-segments)
+          ".*"
+        (let ((prev-segment-was-globstar nil))
+          (seq-do-indexed
+           (lambda (segment index)
+             (if (string-equal segment lsp-globstar)
+                 (unless prev-segment-was-globstar
+                   (setq current-regexp (concat current-regexp
+                                                lsp-globstar-regexp))
+                   (setq prev-segment-was-globstar t))
+               (let ((in-braces nil)
+                     (brace-val "")
+                     (in-brackets nil)
+                     (bracket-val ""))
+                 (dolist (char (string-to-list segment))
+                   (cond
+                    ((and (not (char-equal char ?\}))
+                          in-braces)
+                     (setq brace-val (concat brace-val
+                                             (char-to-string char))))
+                    ((and in-brackets
+                          (or (not (char-equal char ?\]))
+                              (string-empty-p bracket-val)))
+                     (let ((curr (cond
+                                  ((char-equal char ?-)
+                                   "-")
+                                  ;; NOTE: ?\^ and ?^ are different characters
+                                  ((and (memq char '(?^ ?!))
+                                        (string-empty-p bracket-val))
+                                   "^")
+                                  ((char-equal char lsp-glob-split)
+                                   "")
+                                  (t
+                                   (regexp-quote (char-to-string char))))))
+                       (setq bracket-val (concat bracket-val curr))))
+                    (t
+                     (cl-case char
+                       (?{
+                        (setq in-braces t))
+                       (?\[
+                        (setq in-brackets t))
+                       (?}
+                        (let* ((choices (lsp-split-glob-pattern brace-val ?\,))
+                               (brace-regexp (concat "\\(?:"
+                                                     (mapconcat #'lsp--glob-to-regexp choices "\\|")
+                                                     "\\)")))
+                          (setq current-regexp (concat current-regexp
+                                                       brace-regexp))
+                          (setq in-braces nil)
+                          (setq brace-val "")))
+                       (?\]
+                        (setq current-regexp
+                              (concat current-regexp
+                                      "[" bracket-val "]"))
+                        (setq in-brackets nil)
+                        (setq bracket-val ""))
+                       (??
+                        (setq current-regexp
+                              (concat current-regexp
+                                      lsp-non-path-regexp)))
+                       (?*
+                        (setq current-regexp
+                              (concat current-regexp
+                                      lsp-non-path-regexp "*?")))
+                       (t
+                        (setq current-regexp
+                              (concat current-regexp
+                                      (regexp-quote (char-to-string char)))))))))
+                 (when (and (< index (1- (length glob-segments)))
+                            (or (not (string-equal (nth (1+ index) glob-segments)
+                                                   lsp-globstar))
+                                (< (+ index 2)
+                                   (length glob-segments))))
+                   (setq current-regexp
+                         (concat current-regexp
+                                 lsp-path-regexp)))
+                 (setq prev-segment-was-globstar nil))))
+           glob-segments)
+          current-regexp)))))
+
+;; See https://github.com/emacs-lsp/lsp-mode/issues/2365
+(defun lsp-glob-unbrace-at-top-level (glob-pattern)
+  "If GLOB-PATTERN does not start with a brace, return a singleton list containing GLOB-PATTERN.
+
+If GLOB-PATTERN does start with a brace, return a list of the
+comma-separated globs within the top-level braces."
+  (if (not (string-prefix-p "{" glob-pattern))
+      (list glob-pattern)
+    (lsp-split-glob-pattern (substring glob-pattern 1 -1) ?\,)))
+
+(defun lsp-glob-convert-to-wrapped-regexp (glob-pattern)
+  "Convert GLOB-PATTERN to a regexp wrapped with the beginning-
+and end-of-string meta-characters."
+  (concat "\\`" (lsp--glob-to-regexp (string-trim glob-pattern)) "\\'"))
+
+(defun lsp-glob-to-regexps (glob-pattern)
+  "Convert a GLOB-PATTERN to a list of Elisp regexps."
+  (let* ((trimmed-pattern (string-trim glob-pattern))
+         (top-level-unbraced-patterns (lsp-glob-unbrace-at-top-level trimmed-pattern)))
+    (seq-map #'lsp-glob-convert-to-wrapped-regexp
+             top-level-unbraced-patterns)))
+
+\f
+
+(defvar lsp-mode-menu)
+
+(defun lsp-mouse-click (event)
+  (interactive "e")
+  (let* ((ec (event-start event))
+         (choice (x-popup-menu event lsp-mode-menu))
+         (action (lookup-key lsp-mode-menu (apply 'vector choice))))
+
+    (select-window (posn-window ec))
+
+    (unless (and (region-active-p) (eq action 'lsp-execute-code-action))
+      (goto-char (posn-point ec)))
+    (run-with-idle-timer
+     0.001 nil
+     (lambda ()
+       (cl-labels ((check (value) (not (null value))))
+         (when choice
+           (call-interactively action)))))))
+
+(defvar lsp-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "C-<down-mouse-1>") #'lsp-find-definition-mouse)
+    (define-key map (kbd "C-<mouse-1>") #'ignore)
+    (define-key map (kbd "<mouse-3>") #'lsp-mouse-click)
+    (define-key map (kbd "C-S-SPC") #'lsp-signature-activate)
+    (when lsp-keymap-prefix
+      (define-key map (kbd lsp-keymap-prefix) lsp-command-map))
+    map)
+  "Keymap for `lsp-mode'.")
+
+(define-minor-mode lsp-mode ""
+  :keymap lsp-mode-map
+  :lighter
+  (" LSP["
+   (lsp--buffer-workspaces
+    (:eval (mapconcat #'lsp--workspace-print lsp--buffer-workspaces "]["))
+    (:propertize "Disconnected" face warning))
+   "]")
+  :group 'lsp-mode)
+
+(defvar lsp-mode-menu
+  (easy-menu-create-menu
+   nil
+   `(["Go to definition" lsp-find-definition
+      :active (lsp-feature? "textDocument/definition")]
+     ["Find references" lsp-find-references
+      :active (lsp-feature? "textDocument/references")]
+     ["Find implementations" lsp-find-implementation
+      :active (lsp-feature? "textDocument/implementation")]
+     ["Find declarations" lsp-find-declaration
+      :active (lsp-feature? "textDocument/declaration")]
+     ["Go to type declaration" lsp-find-type-definition
+      :active (lsp-feature? "textDocument/typeDefinition")]
+     "--"
+     ["Describe" lsp-describe-thing-at-point]
+     ["Code action" lsp-execute-code-action]
+     ["Format" lsp-format-buffer]
+     ["Highlight references" lsp-document-highlight]
+     ["Type Hierarchy" lsp-java-type-hierarchy
+      :visible (lsp-can-execute-command? "java.navigate.resolveTypeHierarchy")]
+     ["Type Hierarchy" lsp-treemacs-type-hierarchy
+      :visible (and (not (lsp-can-execute-command? "java.navigate.resolveTypeHierarchy"))
+                    (functionp 'lsp-treemacs-type-hierarchy)
+                    (lsp-feature? "textDocument/typeHierarchy"))]
+     ["Call Hierarchy" lsp-treemacs-call-hierarchy
+      :visible (and (functionp 'lsp-treemacs-call-hierarchy)
+                    (lsp-feature? "textDocument/callHierarchy"))]
+     ["Rename" lsp-rename
+      :active (lsp-feature? "textDocument/rename")]
+     "--"
+     ("Session"
+      ["View logs" lsp-workspace-show-log]
+      ["Describe" lsp-describe-session]
+      ["Shutdown" lsp-shutdown-workspace]
+      ["Restart" lsp-restart-workspace])
+     ("Workspace Folders"
+      ["Add" lsp-workspace-folders-add]
+      ["Remove" lsp-workspace-folders-remove]
+      ["Open" lsp-workspace-folders-open])
+     ("Toggle features"
+      ["Lenses" lsp-lens-mode]
+      ["Headerline breadcrumb" lsp-headerline-breadcrumb-mode]
+      ["Modeline code actions" lsp-modeline-code-actions-mode]
+      ["Modeline diagnostics" lsp-modeline-diagnostics-mode])
+     "---"
+     ("Debug"
+      :active (bound-and-true-p dap-ui-mode)
+      :filter ,(lambda (_)
+                 (and (boundp 'dap-ui-menu-items)
+                      (nthcdr 3 dap-ui-menu-items))))))
+  "Menu for lsp-mode.")
+
+(defalias 'make-lsp-client 'make-lsp--client)
+
+(cl-defstruct lsp--registered-capability
+  (id "")
+  (method " ")
+  (options nil))
+
+;; A ‘lsp--workspace’ object represents exactly one language server process.
+(cl-defstruct lsp--workspace
+  ;; the `ewoc' object for displaying I/O to and from the server
+  (ewoc nil)
+
+  ;; ‘server-capabilities’ is a hash table of the language server capabilities.
+  ;; It is the hash table representation of a LSP ServerCapabilities structure;
+  ;; cf. https://microsoft.github.io/language-server-protocol/specification#initialize.
+  (server-capabilities nil)
+
+  ;; ‘registered-server-capabilities’ is a list of hash tables that represent
+  ;; dynamically-registered Registration objects.  See
+  ;; https://microsoft.github.io/language-server-protocol/specification#client_registerCapability.
+  (registered-server-capabilities nil)
+
+  ;; ‘root’ is a directory name or a directory file name for the workspace
+  ;; root.  ‘lsp-mode’ passes this directory to the ‘initialize’ method of the
+  ;; language server; see
+  ;; https://microsoft.github.io/language-server-protocol/specification#initialize.
+  (root nil)
+
+  ;; ‘client’ is the ‘lsp--client’ object associated with this workspace.
+  (client nil)
+
+  ;; ‘host-root’ contains the host root info as derived from `file-remote-p'. It
+  ;; used to derive the file path in `lsp--uri-to-path' when using tramp
+  ;; connection.
+  (host-root nil)
+
+  ;; ‘proc’ is a process object; it may represent a regular process, a pipe, or
+  ;; a network connection.  ‘lsp-mode’ communicates with ‘proc’ using the
+  ;; language server protocol.  ‘proc’ corresponds to the COMMUNICATION-PROCESS
+  ;; element of the return value of the client’s ‘get-root’ field, which see.
+  (proc nil)
+
+  ;; ‘proc’ is a process object; it must represent a regular process, not a
+  ;; pipe or network process.  It represents the actual server process that
+  ;; corresponds to this workspace.  ‘cmd-proc’ corresponds to the
+  ;; COMMAND-PROCESS element of the return value of the client’s ‘get-root’
+  ;; field, which see.
+  (cmd-proc nil)
+
+  ;; ‘buffers’ is a list of buffers associated with this workspace.
+  (buffers nil)
+
+  ;; if semantic tokens is enabled, `semantic-tokens-faces' contains
+  ;; one face (or nil) for each token type supported by the language server.
+  (semantic-tokens-faces nil)
+
+  ;; If semantic highlighting is enabled, `semantic-tokens-modifier-faces'
+  ;; contains one face (or nil) for each modifier type supported by the language
+  ;; server
+  (semantic-tokens-modifier-faces nil)
+
+  ;; Extra client capabilities provided by third-party packages using
+  ;; `lsp-register-client-capabilities'. It's value is an alist of (PACKAGE-NAME
+  ;; . CAPS), where PACKAGE-NAME is a symbol of the third-party package name,
+  ;; and CAPS is either a plist of the client capabilities, or a function that
+  ;; takes no argument and returns a plist of the client capabilities or nil.")
+  (extra-client-capabilities nil)
+
+  ;; Workspace status
+  (status nil)
+
+  ;; ‘metadata’ is a generic storage for workspace specific data. It is
+  ;; accessed via `lsp-workspace-set-metadata' and `lsp-workspace-set-metadata'
+  (metadata (make-hash-table :test 'equal))
+
+  ;; contains all the file notification watches that have been created for the
+  ;; current workspace in format filePath->file notification handle.
+  (watches (make-hash-table :test 'equal))
+
+  ;; list of workspace folders
+  (workspace-folders nil)
+
+  ;; ‘last-id’ the last request id for the current workspace.
+  (last-id 0)
+
+  ;; ‘status-string’ allows extensions to specify custom status string based on
+  ;; the Language Server specific messages.
+  (status-string nil)
+
+  ;; ‘shutdown-action’ flag used to mark that workspace should not be restarted (e.g. it
+  ;; was stopped).
+  shutdown-action
+
+  ;; ‘diagnostics’ a hashmap with workspace diagnostics.
+  (diagnostics (make-hash-table :test 'equal))
+
+  ;; contains all the workDone progress tokens that have been created
+  ;; for the current workspace.
+  (work-done-tokens (make-hash-table :test 'equal)))
+
+
+(cl-defstruct lsp-session
+  ;; contains the folders that are part of the current session
+  folders
+  ;; contains the folders that must not be imported in the current workspace.
+  folders-blacklist
+  ;; contains the list of folders that must be imported in a project in case of
+  ;; multi root LSP server.
+  (server-id->folders (make-hash-table :test 'equal))
+  ;; folder to list of the servers that are associated with the folder.
+  (folder->servers (make-hash-table :test 'equal))
+  ;; ‘metadata’ is a generic storage for workspace specific data. It is
+  ;; accessed via `lsp-workspace-set-metadata' and `lsp-workspace-set-metadata'
+  (metadata (make-hash-table :test 'equal)))
+
+(defun lsp-workspace-status (status-string &optional workspace)
+  "Set current workspace status to STATUS-STRING.
+If WORKSPACE is not specified defaults to lsp--cur-workspace."
+  (let ((status-string (when status-string (replace-regexp-in-string "%" "%%" status-string))))
+    (setf (lsp--workspace-status-string (or workspace lsp--cur-workspace)) status-string)))
+
+(defun lsp-session-set-metadata (key value &optional _workspace)
+  "Associate KEY with VALUE in the WORKSPACE metadata.
+If WORKSPACE is not provided current workspace will be used."
+  (puthash key value (lsp-session-metadata (lsp-session))))
+
+(defalias 'lsp-workspace-set-metadata 'lsp-session-set-metadata)
+
+(defun lsp-session-get-metadata (key &optional _workspace)
+  "Lookup KEY in WORKSPACE metadata.
+If WORKSPACE is not provided current workspace will be used."
+  (gethash key (lsp-session-metadata (lsp-session))))
+
+(defalias 'lsp-workspace-get-metadata 'lsp-session-get-metadata)
+
+(defun lsp-workspace-set-work-done-token (token value workspace)
+  "Associate TOKEN with VALUE in the WORKSPACE work-done-tokens."
+  (puthash token value (lsp--workspace-work-done-tokens workspace)))
+
+(defun lsp-workspace-get-work-done-token (token workspace)
+  "Lookup TOKEN in the WORKSPACE work-done-tokens."
+  (gethash token (lsp--workspace-work-done-tokens workspace)))
+
+(defun lsp-workspace-rem-work-done-token (token workspace)
+  "Remove TOKEN from the WORKSPACE work-done-tokens."
+  (remhash token (lsp--workspace-work-done-tokens workspace)))
+
+
+(defun lsp--make-notification (method &optional params)
+  "Create notification body for method METHOD and parameters PARAMS."
+  (list :jsonrpc "2.0" :method method :params params))
+
+(defalias 'lsp--make-request 'lsp--make-notification)
+(defalias 'lsp-make-request 'lsp--make-notification)
+
+(defun lsp--make-response (id result)
+  "Create response for REQUEST with RESULT."
+  `(:jsonrpc "2.0" :id ,id :result ,result))
+
+(defun lsp-make-notification (method &optional params)
+  "Create notification body for method METHOD and parameters PARAMS."
+  (lsp--make-notification method params))
+
+(defmacro lsp--json-serialize (params)
+  (if (progn
+        (require 'json)
+        (fboundp 'json-serialize))
+      `(json-serialize ,params
+                       :null-object nil
+                       :false-object :json-false)
+    `(let ((json-false :json-false))
+       (json-encode ,params))))
+
+(defun lsp--make-message (params)
+  "Create a LSP message from PARAMS, after encoding it to a JSON string."
+  (let ((body (lsp--json-serialize params)))
+    (concat "Content-Length: "
+            (number-to-string (1+ (string-bytes body)))
+            "\r\n\r\n"
+            body
+            "\n")))
+
+(cl-defstruct lsp--log-entry timestamp process-time type method id body)
+
+(defun lsp--make-log-entry (method id body type &optional process-time)
+  "Create an outgoing log object from BODY with method METHOD and id ID.
+If ID is non-nil, then the body is assumed to be a notification.
+TYPE can either be 'incoming or 'outgoing"
+  (cl-assert (memq type '(incoming-req outgoing-req incoming-notif
+                                       outgoing-notif incoming-resp
+                                       outgoing-resp)))
+  (make-lsp--log-entry
+   :timestamp (format-time-string "%I:%M:%S %p")
+   :process-time process-time
+   :method method
+   :id id
+   :type type
+   :body body))
+
+(defun lsp--log-entry-pp (entry)
+  (cl-assert (lsp--log-entry-p entry))
+  (pcase-let (((cl-struct lsp--log-entry timestamp method id type process-time
+                          body)
+               entry)
+              (json-false :json-false)
+              (json-encoding-pretty-print t)
+              (str nil))
+    (setq str
+          (concat (format "[Trace - %s] " timestamp)
+                  (pcase type
+                    ('incoming-req (format "Received request '%s - (%s)." method id))
+                    ('outgoing-req (format "Sending request '%s - (%s)'." method id))
+
+                    ('incoming-notif (format "Received notification '%s'." method))
+                    ('outgoing-notif (format "Sending notification '%s'." method))
+
+                    ('incoming-resp (format "Received response '%s - (%s)' in %dms."
+                                            method id process-time))
+                    ('outgoing-resp
+                     (format
+                      "Sending response '%s - (%s)'. Processing request took %dms"
+                      method id process-time)))
+                  "\n"
+                  (if (memq type '(incoming-resp ougoing-resp))
+                      "Result: "
+                    "Params: ")
+                  (json-encode body)
+                  "\n\n\n"))
+    (setq str (propertize str 'mouse-face 'highlight 'read-only t))
+    (insert str)))
+
+(defvar-local lsp--log-io-ewoc nil)
+
+(defun lsp--get-create-io-ewoc (workspace)
+  (if (and (lsp--workspace-ewoc workspace)
+           (buffer-live-p (ewoc-buffer (lsp--workspace-ewoc workspace))))
+      (lsp--workspace-ewoc workspace)
+    (with-current-buffer (lsp--get-log-buffer-create workspace)
+      (unless (eq 'lsp-log-io-mode major-mode) (lsp-log-io-mode))
+      (setq-local window-point-insertion-type t)
+      (setq lsp--log-io-ewoc (ewoc-create #'lsp--log-entry-pp nil nil t))
+      (setf (lsp--workspace-ewoc workspace) lsp--log-io-ewoc))
+    (lsp--workspace-ewoc workspace)))
+
+(defun lsp--ewoc-count (ewoc)
+  (let* ((count 0)
+         (count-fn (lambda (_) (setq count (1+ count)))))
+    (ewoc-map count-fn ewoc)
+    count))
+
+(defun lsp--log-entry-new (entry workspace)
+  (let* ((ewoc (lsp--get-create-io-ewoc workspace))
+         (count (and (not (eq lsp-io-messages-max t)) (lsp--ewoc-count ewoc)))
+         (node (if (or (eq lsp-io-messages-max t)
+                       (>= lsp-io-messages-max count))
+                   nil
+                 (ewoc-nth ewoc (1- lsp-io-messages-max))))
+         (prev nil)
+         (inhibit-read-only t))
+    (while node
+      (setq prev (ewoc-prev ewoc node))
+      (ewoc-delete ewoc node)
+      (setq node prev))
+    (ewoc-enter-last ewoc entry)))
+
+(defun lsp--send-notification (body)
+  "Send BODY as a notification to the language server."
+  (lsp-foreach-workspace
+   (when (lsp--log-io-p (plist-get body :method))
+     (lsp--log-entry-new (lsp--make-log-entry
+                          (plist-get body :method)
+                          nil (plist-get body :params) 'outgoing-notif)
+                         lsp--cur-workspace))
+   (lsp--send-no-wait (lsp--make-message body)
+                      (lsp--workspace-proc lsp--cur-workspace))))
+
+(defalias 'lsp-send-notification 'lsp--send-notification)
+
+(defun lsp-notify (method params)
+  "Send notification METHOD with PARAMS."
+  (lsp--send-notification (lsp--make-notification method params)))
+
+(defun lsp--cur-workspace-check ()
+  "Check whether buffer lsp workspace(s) are set."
+  (cl-assert (lsp-workspaces) nil
+             "No language server(s) is associated with this buffer."))
+
+(defun lsp--send-request (body &optional no-wait no-merge)
+  "Send BODY as a request to the language server, get the response.
+If NO-WAIT is non-nil, don't synchronously wait for a response.
+If NO-MERGE is non-nil, don't merge the results but return an
+alist mapping workspace->result."
+  (lsp-request (plist-get body :method)
+               (plist-get body :params)
+               :no-wait no-wait
+               :no-merge no-merge))
+
+(defalias 'lsp-send-request 'lsp--send-request
+  "Send BODY as a request to the language server and return the response
+synchronously.
+\n(fn BODY)")
+
+(cl-defun lsp-request (method params &key no-wait no-merge)
+  "Send request METHOD with PARAMS.
+If NO-MERGE is non-nil, don't merge the results but return alist workspace->result.
+If NO-WAIT is non-nil send the request as notification."
+  (if no-wait
+      (lsp-notify method params)
+    (let* ((send-time (time-to-seconds (current-time)))
+           ;; max time by which we must get a response
+           (expected-time
+            (and
+             lsp-response-timeout
+             (+ send-time lsp-response-timeout)))
+           resp-result resp-error done?)
+      (unwind-protect
+          (progn
+            (lsp-request-async method params
+                               (lambda (res) (setf resp-result (or res :finished)) (throw 'lsp-done '_))
+                               :error-handler (lambda (err) (setf resp-error err) (throw 'lsp-done '_))
+                               :no-merge no-merge
+                               :mode 'detached
+                               :cancel-token :sync-request)
+            (while (not (or resp-error resp-result))
+              (catch 'lsp-done
+                (accept-process-output
+                 nil
+                 (if expected-time (- expected-time send-time) 1)))
+              (setq send-time (time-to-seconds (current-time)))
+              (when (and expected-time (< expected-time send-time))
+                (error "Timeout while waiting for response.  Method: %s" method)))
+            (setq done? t)
+            (cond
+             ((eq resp-result :finished) nil)
+             (resp-result resp-result)
+             ((lsp-json-error? resp-error) (error (lsp:json-error-message resp-error)))
+             ((lsp-json-error? (cl-first resp-error))
+              (error (lsp:json-error-message (cl-first resp-error))))))
+        (unless done?
+          (lsp-cancel-request-by-token :sync-request))))))
+
+(cl-defun lsp-request-while-no-input (method params)
+  "Send request METHOD with PARAMS and waits until there is no input.
+Return same value as `lsp--while-no-input' and respecting `non-essential'."
+  (if non-essential
+    (let* ((send-time (time-to-seconds (current-time)))
+           ;; max time by which we must get a response
+           (expected-time
+            (and
+             lsp-response-timeout
+             (+ send-time lsp-response-timeout)))
+           resp-result resp-error done?)
+        (unwind-protect
+            (progn
+              (lsp-request-async method params
+                                 (lambda (res) (setf resp-result (or res :finished)) (throw 'lsp-done '_))
+                                 :error-handler (lambda (err) (setf resp-error err) (throw 'lsp-done '_))
+                                 :mode 'detached
+                                 :cancel-token :sync-request)
+              (while (not (or resp-error resp-result (input-pending-p)))
+                (catch 'lsp-done
+                  (sit-for
+                   (if expected-time (- expected-time send-time) 1)))
+                (setq send-time (time-to-seconds (current-time)))
+                (when (and expected-time (< expected-time send-time))
+                  (error "Timeout while waiting for response.  Method: %s" method)))
+              (setq done? (or resp-error resp-result))
+              (cond
+               ((eq resp-result :finished) nil)
+               (resp-result resp-result)
+               ((lsp-json-error? resp-error) (error (lsp:json-error-message resp-error)))
+               ((lsp-json-error? (cl-first resp-error))
+                (error (lsp:json-error-message (cl-first resp-error))))))
+          (unless done?
+            (lsp-cancel-request-by-token :sync-request))
+          (when (and (input-pending-p) lsp--throw-on-input)
+            (throw 'input :interrupted))))
+    (lsp-request method params)))
+
+(defvar lsp--cancelable-requests (ht))
+
+(cl-defun lsp-request-async (method params callback
+                                    &key mode error-handler cancel-handler no-merge cancel-token)
+  "Send METHOD with PARAMS as a request to the language server.
+Call CALLBACK with the response received from the server
+asynchronously.
+MODE determines when the callback will be called depending on the
+condition of the original buffer.  It could be:
+- `detached' which means that the callback will be executed no
+matter what has happened to the buffer.
+- `alive' - the callback will be executed only if the buffer from
+which the call was executed is still alive.
+- `current' the callback will be executed only if the original buffer
+is still selected.
+- `tick' - the callback will be executed only if the buffer was not modified.
+- `unchanged' - the callback will be executed only if the buffer hasn't
+changed and if the buffer is not modified.
+
+ERROR-HANDLER will be called in case the request has failed.
+CANCEL-HANDLER will be called in case the request is being canceled.
+If NO-MERGE is non-nil, don't merge the results but return alist
+workspace->result.
+CANCEL-TOKEN is the token that can be used to cancel request."
+  (lsp--send-request-async `(:jsonrpc "2.0" :method ,method :params ,params)
+                           callback mode error-handler cancel-handler no-merge cancel-token))
+
+(defun lsp--create-request-cancel (id workspaces hook buf method cancel-callback)
+  (lambda (&rest _)
+    (unless (and (equal 'post-command-hook hook)
+                 (equal (current-buffer) buf))
+      (lsp--request-cleanup-hooks id)
+      (with-lsp-workspaces workspaces
+        (lsp--cancel-request id)
+        (when cancel-callback (funcall cancel-callback)))
+      (lsp-log "Cancelling %s(%s) in hook %s" method id hook))))
+
+(defun lsp--create-async-callback
+    (callback method no-merge workspaces)
+  "Create async handler expecting COUNT results, merge them and call CALLBACK.
+MODE determines when the callback will be called depending on the
+condition of the original buffer. METHOD is the invoked method.
+If NO-MERGE is non-nil, don't merge the results but return alist workspace->result.
+ID is the request id. "
+  (let (results errors)
+    (lambda (result)
+      (push (cons lsp--cur-workspace result)
+            (if (eq result :error) errors results))
+      (when (and (not (eq (length errors) (length workspaces)))
+                 (eq (+ (length errors) (length results)) (length workspaces)))
+        (funcall callback
+                 (if no-merge
+                     results
+                   (lsp--merge-results (-map #'cl-rest results) method)))))))
+
+(defcustom lsp-default-create-error-handler-fn nil
+  "Default error handler customization.
+Handler should give METHOD as argument and return function of one argument
+ERROR."
+  :type 'function
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defun lsp--create-default-error-handler (method)
+  "Default error handler.
+METHOD is the executed method."
+  (if lsp-default-create-error-handler-fn
+      (funcall lsp-default-create-error-handler-fn method)
+    (lambda (error)
+      (lsp--warn "%s" (or (lsp--error-string error)
+                          (format "%s Request has failed" method))))))
+
+(defvar lsp--request-cleanup-hooks (ht))
+
+(defun lsp--request-cleanup-hooks (request-id)
+  (when-let ((cleanup-function (gethash request-id lsp--request-cleanup-hooks)))
+    (funcall cleanup-function)
+    (remhash request-id lsp--request-cleanup-hooks)))
+
+(defun lsp-cancel-request-by-token (cancel-token)
+  "Cancel request using CANCEL-TOKEN."
+  (-when-let ((request-id . workspaces) (gethash cancel-token lsp--cancelable-requests))
+    (with-lsp-workspaces workspaces
+      (lsp--cancel-request request-id))
+    (remhash cancel-token lsp--cancelable-requests)
+    (lsp--request-cleanup-hooks request-id)))
+
+(defun lsp--send-request-async (body callback
+                                     &optional mode error-callback cancel-callback
+                                     no-merge cancel-token)
+  "Send BODY as a request to the language server.
+Call CALLBACK with the response received from the server
+asynchronously.
+MODE determines when the callback will be called depending on the
+condition of the original buffer.  It could be:
+- `detached' which means that the callback will be executed no
+matter what has happened to the buffer.
+- `alive' - the callback will be executed only if the buffer from
+which the call was executed is still alive.
+- `current' the callback will be executed only if the original buffer
+is still selected.
+- `tick' - the callback will be executed only if the buffer was not modified.
+- `unchanged' - the callback will be executed only if the buffer hasn't
+changed and if the buffer is not modified.
+
+ERROR-CALLBACK will be called in case the request has failed.
+CANCEL-CALLBACK will be called in case the request is being canceled.
+If NO-MERGE is non-nil, don't merge the results but return alist
+workspace->result.
+CANCEL-TOKEN is the token that can be used to cancel request."
+  (when cancel-token
+    (lsp-cancel-request-by-token cancel-token))
+
+  (if-let ((target-workspaces (lsp--find-workspaces-for body)))
+      (let* ((start-time (current-time))
+             (method (plist-get body :method))
+             (id (cl-incf lsp-last-id))
+             ;; calculate what are the (hook . local) pairs which will cancel
+             ;; the request
+             (hooks (pcase mode
+                      ('alive     '((kill-buffer-hook . t)))
+                      ('tick      '((kill-buffer-hook . t) (after-change-functions . t)))
+                      ('unchanged '((after-change-functions . t) (post-command-hook . nil)))
+                      ('current   '((post-command-hook . nil)))))
+             (buf (current-buffer))
+             ;; note: lambdas in emacs can be compared but we should make sure
+             ;; that all of the captured arguments are the same - in our case
+             ;; `lsp--create-request-cancel' will return the same lambda when
+             ;; called with the same params.
+             (cleanup-hooks
+              (lambda () (mapc
+                          (-lambda ((hook . local))
+                            (if local
+                                (when (buffer-live-p buf)
+                                  (with-current-buffer buf
+                                    (remove-hook hook
+                                                 (lsp--create-request-cancel
+                                                  id target-workspaces hook buf method cancel-callback)
+                                                 t)))
+                              (remove-hook hook (lsp--create-request-cancel
+                                                 id target-workspaces hook buf method cancel-callback))))
+                          hooks)
+                (remhash cancel-token lsp--cancelable-requests)))
+             (callback (pcase mode
+                         ((or 'alive 'tick) (lambda (&rest args)
+                                              (with-current-buffer buf
+                                                (apply callback args))))
+                         (_ callback)))
+             (callback (lsp--create-async-callback callback
+                                                   method
+                                                   no-merge
+                                                   target-workspaces))
+             (callback (lambda (result)
+                         (lsp--request-cleanup-hooks id)
+                         (funcall callback result)))
+             (error-callback (lsp--create-async-callback
+                              (or error-callback
+                                  (lsp--create-default-error-handler method))
+                              method
+                              nil
+                              target-workspaces))
+             (error-callback (lambda (error)
+                               (funcall callback :error)
+                               (lsp--request-cleanup-hooks id)
+                               (funcall error-callback error)))
+             (cancel-callback (when cancel-callback
+                                (pcase mode
+                                  ((or 'alive 'tick 'unchanged)
+                                   (lambda ()
+                                     (with-current-buffer buf
+                                       (funcall cancel-callback))))
+                                  (_ cancel-callback))))
+             (body (plist-put body :id id)))
+
+        ;; cancel request in any of the hooks
+        (mapc (-lambda ((hook . local))
+                (add-hook hook
+                          (lsp--create-request-cancel
+                           id target-workspaces hook buf method cancel-callback)
+                          nil local))
+              hooks)
+        (puthash id cleanup-hooks lsp--request-cleanup-hooks)
+
+        (setq lsp--last-active-workspaces target-workspaces)
+
+        (when cancel-token
+          (puthash cancel-token (cons id target-workspaces) lsp--cancelable-requests))
+
+        (seq-doseq (workspace target-workspaces)
+          (when (lsp--log-io-p method)
+            (lsp--log-entry-new (lsp--make-log-entry method id
+                                                     (plist-get body :params)
+                                                     'outgoing-req)
+                                workspace))
+          (let ((message (lsp--make-message body)))
+            (puthash id
+                     (list callback error-callback method start-time (current-time))
+                     (-> workspace
+                         (lsp--workspace-client)
+                         (lsp--client-response-handlers)))
+            (lsp--send-no-wait message (lsp--workspace-proc workspace))))
+        body)
+    (error "The connected server(s) does not support method %s.
+To find out what capabilities support your server use `M-x lsp-describe-session'
+and expand the capabilities section"
+           (plist-get body :method))))
+
+;; deprecated, use lsp-request-async.
+(defalias 'lsp-send-request-async 'lsp--send-request-async)
+(make-obsolete 'lsp-send-request-async 'lsp-request-async "lsp-mode 7.0.1")
+
+;; Clean up the entire state of lsp mode when Emacs is killed, to get rid of any
+;; pending language servers.
+(add-hook 'kill-emacs-hook #'lsp--global-teardown)
+
+(defun lsp--global-teardown ()
+  "Unload working workspaces."
+  (lsp-foreach-workspace (lsp--shutdown-workspace)))
+
+(defun lsp--shutdown-workspace (&optional restart)
+  "Shut down the language server process for ‘lsp--cur-workspace’."
+  (with-demoted-errors "LSP error: %S"
+    (let ((lsp-response-timeout 0.5))
+      (condition-case _err
+          (lsp-request "shutdown" lsp--empty-ht)
+        (error (lsp--error "Timeout while sending shutdown request"))))
+    (lsp-notify "exit" nil))
+  (setf (lsp--workspace-shutdown-action lsp--cur-workspace) (or (and restart 'restart) 'shutdown))
+  (lsp--uninitialize-workspace))
+
+(defun lsp--uninitialize-workspace ()
+  "Cleanup buffer state.
+When a workspace is shut down, by request or from just
+disappearing, unset all the variables related to it."
+  (let ((proc (lsp--workspace-cmd-proc lsp--cur-workspace))
+        (buffers (lsp--workspace-buffers lsp--cur-workspace)))
+    (when (process-live-p proc)
+      (kill-process proc))
+    (mapc (lambda (buf)
+            (when (lsp-buffer-live-p buf)
+              (lsp-with-current-buffer buf
+                (lsp-managed-mode -1))))
+          buffers)
+    (lsp-diagnostics--workspace-cleanup lsp--cur-workspace)))
+
+(defun lsp--client-capabilities (&optional custom-capabilities)
+  "Return the client capabilities appending CUSTOM-CAPABILITIES."
+  (append
+   `((workspace . ((workspaceEdit . ((documentChanges . t)
+                                     (resourceOperations . ["create" "rename" "delete"])))
+                   (applyEdit . t)
+                   (symbol . ((symbolKind . ((valueSet . ,(apply 'vector (number-sequence 1 26)))))))
+                   (executeCommand . ((dynamicRegistration . :json-false)))
+                   ,@(when lsp-enable-file-watchers '((didChangeWatchedFiles . ((dynamicRegistration . t)))))
+                   (workspaceFolders . t)
+                   (configuration . t)
+                   ,@(when lsp-semantic-tokens-enable
+                       `((semanticTokens . ((refreshSupport . ,(or (and (boundp 'lsp-semantic-tokens-honor-refresh-requests)
+                                                                        lsp-semantic-tokens-honor-refresh-requests)
+                                                                   :json-false))))))
+                   ,@(when lsp-lens-enable '((codeLens . ((refreshSupport . t)))))
+                   (fileOperations . ((didCreate . :json-false)
+                                      (willCreate . :json-false)
+                                      (didRename . :json-false)
+                                      (willRename . :json-false)
+                                      (didDelete . :json-false)
+                                      (willDelete . :json-false)))))
+     (textDocument . ((declaration . ((linkSupport . t)))
+                      (definition . ((linkSupport . t)))
+                      (implementation . ((linkSupport . t)))
+                      (typeDefinition . ((linkSupport . t)))
+                      (synchronization . ((willSave . t) (didSave . t) (willSaveWaitUntil . t)))
+                      (documentSymbol . ((symbolKind . ((valueSet . ,(apply 'vector (number-sequence 1 26)))))
+                                         (hierarchicalDocumentSymbolSupport . t)))
+                      (formatting . ((dynamicRegistration . t)))
+                      (rangeFormatting . ((dynamicRegistration . t)))
+                      ,@(when (and lsp-semantic-tokens-enable
+                                   (boundp 'lsp-semantic-tokens-capabilities))
+                          lsp-semantic-tokens-capabilities)
+                      (rename . ((dynamicRegistration . t) (prepareSupport . t)))
+                      (codeAction . ((dynamicRegistration . t)
+                                     (isPreferredSupport . t)
+                                     (codeActionLiteralSupport . ((codeActionKind . ((valueSet . [""
+                                                                                                  "quickfix"
+                                                                                                  "refactor"
+                                                                                                  "refactor.extract"
+                                                                                                  "refactor.inline"
+                                                                                                  "refactor.rewrite"
+                                                                                                  "source"
+                                                                                                  "source.organizeImports"])))))
+                                     (resolveSupport . ((properties . ["edit" "command"])))
+                                     (dataSupport . t)))
+                      (completion . ((completionItem . ((snippetSupport . ,(cond
+                                                                            ((and lsp-enable-snippet (not (featurep 'yasnippet)) t)
+                                                                             (lsp--warn (concat
+                                                                                         "Yasnippet is not installed, but `lsp-enable-snippet' is set to `t'. "
+                                                                                         "You must either install yasnippet, or disable snippet support."))
+                                                                             :json-false)
+                                                                            (lsp-enable-snippet t)
+                                                                            (t :json-false)))
+                                                        (documentationFormat . ["markdown" "plaintext"])
+                                                        ;; Remove this after jdtls support resolveSupport
+                                                        (resolveAdditionalTextEditsSupport . t)
+                                                        (insertReplaceSupport . t)
+                                                        (deprecatedSupport . t)
+                                                        (resolveSupport
+                                                         . ((properties . ["documentation"
+                                                                           "details"
+                                                                           "additionalTextEdits"
+                                                                           "command"])))
+                                                        (insertTextModeSupport . ((valueSet . [1 2])))))
+                                     (contextSupport . t)))
+                      (signatureHelp . ((signatureInformation . ((parameterInformation . ((labelOffsetSupport . t)))))))
+                      (documentLink . ((dynamicRegistration . t)
+                                       (tooltipSupport . t)))
+                      (hover . ((contentFormat . ["markdown" "plaintext"])))
+                      (foldingRange . ,(when lsp-enable-folding
+                                         `((dynamicRegistration . t)
+                                           ,@(when lsp-folding-range-limit
+                                               `((rangeLimit . ,lsp-folding-range-limit)))
+                                           ,@(when lsp-folding-line-folding-only
+                                               `((lineFoldingOnly . t))))))
+                      (callHierarchy . ((dynamicRegistration . :json-false)))
+                      (publishDiagnostics . ((relatedInformation . t)
+                                             (tagSupport . ((valueSet . [1 2])))
+                                             (versionSupport . t)))
+                      (linkedEditingRange . ((dynamicRegistration . t)))))
+     (window . ((workDoneProgress . t)
+                (showMessage . nil)
+                (showDocument . ((support . t))))))
+   custom-capabilities))
+
+(defun lsp-find-roots-for-workspace (workspace session)
+  "Get all roots for the WORKSPACE."
+  (-filter #'identity (ht-map (lambda (folder workspaces)
+                                (when (-contains? workspaces workspace)
+                                  folder))
+                              (lsp-session-folder->servers session))))
+
+(defun lsp-session-watches (&optional session)
+  "Get watches created for SESSION."
+  (or (gethash "__watches" (lsp-session-metadata (or session (lsp-session))))
+      (-let [res (make-hash-table :test 'equal)]
+        (puthash "__watches" res (lsp-session-metadata (or session (lsp-session))))
+        res)))
+
+(defun lsp--file-process-event (session root-folder event)
+  "Process file event."
+  (let* ((changed-file (cl-third event))
+         (rel-changed-file (f-relative changed-file root-folder))
+         (event-numeric-kind (alist-get (cl-second event) lsp--file-change-type))
+         (bit-position (1- event-numeric-kind))
+         (watch-bit (ash 1 bit-position)))
+    (->>
+     session
+     lsp-session-folder->servers
+     (gethash root-folder)
+     (seq-do (lambda (workspace)
+               (when (->>
+                      workspace
+                      lsp--workspace-registered-server-capabilities
+                      (-any?
+                       (lambda (capability)
+                         (and
+                          (equal (lsp--registered-capability-method capability)
+                                 "workspace/didChangeWatchedFiles")
+                          (->>
+                           capability
+                           lsp--registered-capability-options
+                           (lsp:did-change-watched-files-registration-options-watchers)
+                           (seq-find
+                            (-lambda ((fs-watcher &as &FileSystemWatcher :glob-pattern :kind? :_cachedRegexp cached-regexp))
+                              (when (or (null kind?)
+                                        (> (logand kind? watch-bit) 0))
+                                (-let [regexes (or cached-regexp
+                                                   (let ((regexp (lsp-glob-to-regexps glob-pattern)))
+                                                     (lsp-put fs-watcher :_cachedRegexp regexp)
+                                                     regexp))]
+                                  (-any? (lambda (re)
+                                           (or (string-match re changed-file)
+                                               (string-match re rel-changed-file)))
+                                         regexes))))))))))
+                 (with-lsp-workspace workspace
+                   (lsp-notify
+                    "workspace/didChangeWatchedFiles"
+                    `((changes . [((type . ,event-numeric-kind)
+                                   (uri . ,(lsp--path-to-uri changed-file)))]))))))))))
+
+(lsp-defun lsp--server-register-capability ((&Registration :method :id :register-options?))
+  "Register capability REG."
+  (when (and lsp-enable-file-watchers
+             (equal method "workspace/didChangeWatchedFiles"))
+    (-let* ((created-watches (lsp-session-watches (lsp-session)))
+            (root-folders (cl-set-difference
+                           (lsp-find-roots-for-workspace lsp--cur-workspace (lsp-session))
+                           (ht-keys created-watches))))
+      ;; create watch for each root folder without such
+      (dolist (folder root-folders)
+        (let* ((watch (make-lsp-watch :root-directory folder))
+               (ignored-things (lsp--get-ignored-regexes-for-workspace-root folder))
+               (ignored-files-regex-list (car ignored-things))
+               (ignored-directories-regex-list (cadr ignored-things)))
+          (puthash folder watch created-watches)
+          (lsp-watch-root-folder (file-truename folder)
+                                 (-partial #'lsp--file-process-event (lsp-session) folder)
+                                 ignored-files-regex-list
+                                 ignored-directories-regex-list
+                                 watch
+                                 t)))))
+
+  (push
+   (make-lsp--registered-capability :id id :method method :options register-options?)
+   (lsp--workspace-registered-server-capabilities lsp--cur-workspace)))
+
+(defmacro lsp--with-workspace-temp-buffer (workspace-root &rest body)
+  "With a temp-buffer under `WORKSPACE-ROOT' and evaluate `BODY', useful to access dir-local variables."
+  (declare (indent 1) (debug t))
+  `(with-temp-buffer
+     ;; Set the buffer's name to something under the root so that we can hack the local variables
+     ;; This file doesn't need to exist and will not be created due to this.
+     (setq-local buffer-file-name (expand-file-name "lsp-mode-temp" (expand-file-name ,workspace-root)))
+     (hack-local-variables)
+     (prog1 ,@body
+       (setq-local buffer-file-name nil))))
+
+(defun lsp--get-ignored-regexes-for-workspace-root (workspace-root)
+  "Return a list of the form (lsp-file-watch-ignored-files lsp-file-watch-ignored-directories) for the given WORKSPACE-ROOT."
+  ;; The intent of this function is to provide per-root workspace-level customization of the
+  ;; lsp-file-watch-ignored-directories and lsp-file-watch-ignored-files variables.
+  (lsp--with-workspace-temp-buffer workspace-root
+    (list lsp-file-watch-ignored-files (lsp-file-watch-ignored-directories))))
+
+
+(defun lsp--cleanup-hanging-watches ()
+  "Cleanup watches in case there are no more workspaces that are interested
+in that particular folder."
+  (let* ((session (lsp-session))
+         (watches (lsp-session-watches session)))
+    (dolist (watched-folder (ht-keys watches))
+      (when (-none? (lambda (workspace)
+                      (with-lsp-workspace workspace
+                        (lsp--registered-capability "workspace/didChangeWatchedFiles")))
+                    (gethash watched-folder (lsp-session-folder->servers (lsp-session))))
+        (lsp-log "Cleaning up watches for folder %s. There is no workspace watching this folder..." watched-folder)
+        (lsp-kill-watch (gethash watched-folder watches))
+        (remhash watched-folder watches)))))
+
+(lsp-defun lsp--server-unregister-capability ((&Unregistration :id :method))
+  "Unregister capability UNREG."
+  (setf (lsp--workspace-registered-server-capabilities lsp--cur-workspace)
+        (seq-remove (lambda (e) (equal (lsp--registered-capability-id e) id))
+                    (lsp--workspace-registered-server-capabilities lsp--cur-workspace)))
+  (when (equal method "workspace/didChangeWatchedFiles")
+    (lsp--cleanup-hanging-watches)))
+
+(defun lsp--server-capabilities ()
+  "Return the capabilities of the language server associated with the buffer."
+  (->> (lsp-workspaces)
+       (-keep #'lsp--workspace-server-capabilities)
+       (apply #'lsp-merge)))
+
+(defun lsp--send-open-close-p ()
+  "Return whether open and close notifications should be sent to the server."
+  (let ((sync (lsp:server-capabilities-text-document-sync? (lsp--server-capabilities))))
+    (or (memq sync '(1 2))
+        (lsp:text-document-sync-options-open-close? sync))))
+
+(defun lsp--send-will-save-p ()
+  "Return whether willSave notifications should be sent to the server."
+  (-> (lsp--server-capabilities)
+      (lsp:server-capabilities-text-document-sync?)
+      (lsp:text-document-sync-options-will-save?)))
+
+(defun lsp--send-will-save-wait-until-p ()
+  "Return whether willSaveWaitUntil notifications should be sent to the server."
+  (-> (lsp--server-capabilities)
+      (lsp:server-capabilities-text-document-sync?)
+      (lsp:text-document-sync-options-will-save-wait-until?)))
+
+(defun lsp--send-did-save-p ()
+  "Return whether didSave notifications should be sent to the server."
+  (let ((sync (lsp:server-capabilities-text-document-sync? (lsp--server-capabilities))))
+    (or (memq sync '(1 2))
+        (lsp:text-document-sync-options-save? sync))))
+
+(defun lsp--save-include-text-p ()
+  "Return whether save notifications should include the text document's contents."
+  (->> (lsp--server-capabilities)
+       (lsp:server-capabilities-text-document-sync?)
+       (lsp:text-document-sync-options-save?)
+       (lsp:text-document-save-registration-options-include-text?)))
+
+(declare-function project-roots "ext:project" (project) t)
+(declare-function project-root "ext:project" (project) t)
+
+(defun lsp--suggest-project-root ()
+  "Get project root."
+  (or
+   (when (featurep 'projectile) (condition-case nil
+                                    (projectile-project-root)
+                                  (error nil)))
+   (when (featurep 'project)
+     (when-let ((project (project-current)))
+       (if (fboundp 'project-root)
+           (project-root project)
+         (car (with-no-warnings
+                (project-roots project))))))
+   default-directory))
+
+(defun lsp--read-from-file (file)
+  "Read FILE content."
+  (when (file-exists-p file)
+    (cl-first (read-from-string (f-read-text file 'utf-8)))))
+
+(defun lsp--persist (file-name to-persist)
+  "Persist TO-PERSIST in FILE-NAME.
+
+This function creates the parent directories if they don't exist
+yet."
+  (let ((print-length nil)
+        (print-level nil))
+    ;; Create all parent directories:
+    (make-directory (f-parent file-name) t)
+    (f-write-text (prin1-to-string to-persist) 'utf-8 file-name)))
+
+(defun lsp-workspace-folders-add (project-root)
+  "Add PROJECT-ROOT to the list of workspace folders."
+  (interactive
+   (list (read-directory-name "Select folder to add: "
+                              (or (lsp--suggest-project-root) default-directory) nil t)))
+  (cl-pushnew (lsp-f-canonical project-root)
+              (lsp-session-folders (lsp-session)) :test 'equal)
+  (lsp--persist-session (lsp-session))
+
+  (run-hook-with-args 'lsp-workspace-folders-changed-functions (list project-root) nil))
+
+(defun lsp-workspace-folders-remove (project-root)
+  "Remove PROJECT-ROOT from the list of workspace folders."
+  (interactive (list (completing-read "Select folder to remove: "
+                                      (lsp-session-folders (lsp-session))
+                                      nil t nil nil
+                                      (lsp-find-session-folder (lsp-session) default-directory))))
+
+  (setq project-root (lsp-f-canonical project-root))
+
+  ;; send remove folder to each multiroot workspace associated with the folder
+  (dolist (wks (->> (lsp-session)
+                    (lsp-session-folder->servers)
+                    (gethash project-root)
+                    (--filter (lsp--client-multi-root (lsp--workspace-client it)))))
+    (with-lsp-workspace wks
+      (lsp-notify "workspace/didChangeWorkspaceFolders"
+                  (lsp-make-did-change-workspace-folders-params
+                   :event (lsp-make-workspace-folders-change-event
+                           :removed (vector (lsp-make-workspace-folder
+                                             :uri (lsp--path-to-uri project-root)
+                                             :name (f-filename project-root)))
+                           :added [])))))
+
+  ;; turn off servers in the removed directory
+  (let* ((session (lsp-session))
+         (folder->servers (lsp-session-folder->servers session))
+         (server-id->folders (lsp-session-server-id->folders session))
+         (workspaces (gethash project-root folder->servers)))
+
+    (remhash project-root folder->servers)
+
+    ;; turn off the servers without root folders
+    (dolist (workspace workspaces)
+      (when (--none? (-contains? it workspace) (ht-values folder->servers))
+        (lsp--info "Shutdown %s since folder %s is removed..."
+                   (lsp--workspace-print workspace) project-root)
+        (with-lsp-workspace workspace (lsp--shutdown-workspace))))
+
+    (setf (lsp-session-folders session)
+          (-remove-item project-root (lsp-session-folders session)))
+
+    (ht-aeach (puthash key
+                       (-remove-item project-root value)
+                       server-id->folders)
+              server-id->folders)
+    (lsp--persist-session (lsp-session)))
+
+  (run-hook-with-args 'lsp-workspace-folders-changed-functions nil (list project-root)))
+
+(defun lsp-workspace-blacklist-remove (project-root)
+  "Remove PROJECT-ROOT from the workspace blacklist."
+  (interactive (list (completing-read "Select folder to remove:"
+                                      (lsp-session-folders-blacklist (lsp-session))
+                                      nil t)))
+  (setf (lsp-session-folders-blacklist (lsp-session))
+        (delete project-root
+                (lsp-session-folders-blacklist (lsp-session))))
+  (lsp--persist-session (lsp-session)))
+
+(define-obsolete-function-alias 'lsp-workspace-folders-switch
+  'lsp-workspace-folders-open "lsp-mode 6.1")
+
+(defun lsp-workspace-folders-open (project-root)
+  "Open the directory located at PROJECT-ROOT"
+  (interactive (list (completing-read "Open folder: "
+                                      (lsp-session-folders (lsp-session))
+                                      nil t)))
+  (find-file project-root))
+
+(defun lsp--maybe-enable-signature-help (trigger-characters)
+  (let ((ch last-command-event))
+    (when (cl-find ch trigger-characters :key #'string-to-char)
+      (lsp-signature-activate))))
+
+(defun lsp--on-type-formatting-handler-create ()
+  (when-let ((provider (lsp--capability :documentOnTypeFormattingProvider)))
+    (-let [(&DocumentOnTypeFormattingOptions :more-trigger-character?
+                                             :first-trigger-character) provider]
+      (lambda ()
+        (lsp--on-type-formatting first-trigger-character
+                                 more-trigger-character?)))))
+
+(defun lsp--update-on-type-formatting-hook (&optional cleanup?)
+  (let ((on-type-formatting-handler (lsp--on-type-formatting-handler-create)))
+    (cond
+     ((and lsp-enable-on-type-formatting on-type-formatting-handler (not cleanup?))
+      (add-hook 'post-self-insert-hook on-type-formatting-handler nil t))
+     ((or cleanup?
+          (not lsp-enable-on-type-formatting))
+      (remove-hook 'post-self-insert-hook on-type-formatting-handler t)))))
+
+(defun lsp--signature-help-handler-create ()
+  (-when-let ((&SignatureHelpOptions? :trigger-characters?)
+              (lsp--capability :signatureHelpProvider))
+    (lambda ()
+      (lsp--maybe-enable-signature-help trigger-characters?))))
+
+(defun lsp--update-signature-help-hook (&optional cleanup?)
+  (let ((signature-help-handler (lsp--signature-help-handler-create)))
+    (cond
+     ((and (or (equal lsp-signature-auto-activate t)
+               (memq :on-trigger-char lsp-signature-auto-activate))
+           signature-help-handler)
+      (add-hook 'post-self-insert-hook signature-help-handler nil t))
+
+     ((or cleanup?
+          (not (or (equal lsp-signature-auto-activate t)
+                   (memq :on-trigger-char lsp-signature-auto-activate))))
+      (remove-hook 'post-self-insert-hook signature-help-handler t)))))
+
+(defun lsp--after-set-visited-file-name ()
+  (lsp-disconnect)
+  (lsp))
+
+(define-minor-mode lsp-managed-mode
+  "Mode for source buffers managed by lsp-mode."
+  :lighter nil
+  (cond
+   (lsp-managed-mode
+    (when (lsp-feature? "textDocument/hover")
+      (add-function :before-until (local 'eldoc-documentation-function) #'lsp-eldoc-function)
+      (eldoc-mode 1))
+
+    (add-hook 'after-change-functions #'lsp-on-change nil t)
+    (add-hook 'after-revert-hook #'lsp-on-revert nil t)
+    (add-hook 'after-save-hook #'lsp-on-save nil t)
+    (add-hook 'auto-save-hook #'lsp--on-auto-save nil t)
+    (add-hook 'before-change-functions #'lsp-before-change nil t)
+    (add-hook 'before-save-hook #'lsp--before-save nil t)
+    (add-hook 'kill-buffer-hook #'lsp--text-document-did-close nil t)
+    (add-hook 'post-command-hook #'lsp--post-command nil t)
+
+    (lsp--update-on-type-formatting-hook)
+    (lsp--update-signature-help-hook)
+
+    (when lsp-enable-xref
+      (add-hook 'xref-backend-functions #'lsp--xref-backend nil t))
+
+    (lsp-configure-buffer)
+
+    ;; make sure we turn off lsp-mode in case major mode changes, because major
+    ;; mode change will wipe the buffer locals.
+    (add-hook 'change-major-mode-hook #'lsp-disconnect nil t)
+    (add-hook 'after-set-visited-file-name-hook #'lsp--after-set-visited-file-name nil t)
+
+    (let ((buffer (lsp-current-buffer)))
+      (run-with-idle-timer
+       0.0 nil
+       (lambda ()
+         (when (lsp-buffer-live-p buffer)
+           (lsp-with-current-buffer buffer
+             (lsp--on-change-debounce buffer)
+             (lsp--on-idle buffer)))))))
+   (t
+    (lsp-unconfig-buffer)
+    (remove-function (local 'eldoc-documentation-function) #'lsp-eldoc-function)
+
+    (remove-hook 'post-command-hook #'lsp--post-command t)
+    (remove-hook 'after-change-functions #'lsp-on-change t)
+    (remove-hook 'after-revert-hook #'lsp-on-revert t)
+    (remove-hook 'after-save-hook #'lsp-on-save t)
+    (remove-hook 'auto-save-hook #'lsp--on-auto-save t)
+    (remove-hook 'before-change-functions #'lsp-before-change t)
+    (remove-hook 'before-save-hook #'lsp--before-save t)
+    (remove-hook 'kill-buffer-hook #'lsp--text-document-did-close t)
+
+    (lsp--update-on-type-formatting-hook :cleanup)
+    (lsp--update-signature-help-hook :cleanup)
+
+    (when lsp--on-idle-timer
+      (cancel-timer lsp--on-idle-timer)
+      (setq lsp--on-idle-timer nil))
+
+    (remove-hook 'lsp-on-idle-hook #'lsp--document-links t)
+    (remove-hook 'lsp-on-idle-hook #'lsp--document-highlight t)
+
+    (lsp--remove-overlays 'lsp-highlight)
+    (lsp--remove-overlays 'lsp-links)
+
+    (remove-hook 'xref-backend-functions #'lsp--xref-backend t)
+    (remove-hook 'change-major-mode-hook #'lsp-disconnect t)
+    (remove-hook 'after-set-visited-file-name-hook #'lsp--after-set-visited-file-name t)
+    (setq-local lsp-buffer-uri nil))))
+
+(defun lsp-configure-buffer ()
+  "Configure LSP features for current buffer."
+  ;; make sure the core is running in the context of all available workspaces
+  ;; to avoid misconfiguration in case we are running in `with-lsp-workspace' context
+  (let ((lsp--buffer-workspaces (cond
+                                 (lsp--buffer-workspaces)
+                                 (lsp--cur-workspace (list lsp--cur-workspace))))
+        lsp--cur-workspace)
+    (when lsp-auto-configure
+      (when (and lsp-enable-text-document-color
+                 (lsp-feature? "textDocument/documentColor"))
+        (add-hook 'lsp-on-change-hook #'lsp--document-color nil t))
+
+      (when (and lsp-enable-imenu
+                 (lsp-feature? "textDocument/documentSymbol"))
+        (lsp-enable-imenu))
+
+      (when (and lsp-enable-indentation
+                 (lsp-feature? "textDocument/rangeFormatting"))
+        (setq-local indent-region-function #'lsp-format-region))
+
+      (when (and lsp-enable-symbol-highlighting
+                 (lsp-feature? "textDocument/documentHighlight"))
+        (add-hook 'lsp-on-idle-hook #'lsp--document-highlight nil t))
+
+      (when (and lsp-enable-links
+                 (lsp-feature? "textDocument/documentLink"))
+        (add-hook 'lsp-on-idle-hook #'lsp--document-links nil t))
+
+      (when (and lsp-enable-dap-auto-configure
+                 (functionp 'dap-mode))
+        (dap-auto-configure-mode 1)))
+    (run-hooks 'lsp-configure-hook)))
+
+(defun lsp-unconfig-buffer ()
+  "Unconfigure LSP features for buffer."
+  (run-hooks 'lsp-unconfigure-hook)
+
+  (lsp--remove-overlays 'lsp-color)
+  (when (eq indent-region-function #'lsp-format-region)
+    (setq-local indent-region-function nil))
+  (remove-hook 'lsp-on-change-hook #'lsp--document-color t)
+  (remove-hook 'lsp-on-idle-hook #'lsp--document-highlight t)
+  (remove-hook 'lsp-on-idle-hook #'lsp--document-links t))
+
+(defun lsp--buffer-content ()
+  (lsp-save-restriction-and-excursion
+    (or (lsp-virtual-buffer-call :buffer-string)
+        (buffer-substring-no-properties (point-min)
+                                        (point-max)))))
+
+(defun lsp--text-document-did-open ()
+  "'document/didOpen' event."
+  (run-hooks 'lsp-before-open-hook)
+  (when (and lsp-auto-touch-files
+             (not (f-exists? (lsp--uri-to-path (lsp--buffer-uri)))))
+    (lsp--info "Saving file '%s' because it is not present on the disk." (lsp--buffer-uri))
+    (save-buffer))
+
+  (setq lsp--cur-version (or lsp--cur-version 0))
+  (cl-pushnew (lsp-current-buffer) (lsp--workspace-buffers lsp--cur-workspace))
+  (lsp-notify
+   "textDocument/didOpen"
+   (list :textDocument
+         (list :uri (lsp--buffer-uri)
+               :languageId (lsp-buffer-language)
+               :version lsp--cur-version
+               :text (lsp--buffer-content))))
+
+  (lsp-managed-mode 1)
+
+  (run-hooks 'lsp-after-open-hook)
+  (when-let ((client (-some-> lsp--cur-workspace (lsp--workspace-client))))
+    (-some-> (lsp--client-after-open-fn client)
+      (funcall))
+    (-some-> (format "lsp-%s-after-open-hook" (lsp--client-server-id client))
+      (intern-soft)
+      (run-hooks))))
+
+(defun lsp--text-document-identifier ()
+  "Make TextDocumentIdentifier."
+  (list :uri (lsp--buffer-uri)))
+
+(defun lsp--versioned-text-document-identifier ()
+  "Make VersionedTextDocumentIdentifier."
+  (plist-put (lsp--text-document-identifier) :version lsp--cur-version))
+
+(defun lsp--cur-line (&optional point)
+  (1- (line-number-at-pos point)))
+
+(defun lsp--cur-position ()
+  "Make a Position object for the current point."
+  (or (lsp-virtual-buffer-call :cur-position)
+      (lsp-save-restriction-and-excursion
+        (list :line (lsp--cur-line)
+              :character (- (point) (line-beginning-position))))))
+
+(defun lsp--point-to-position (point)
+  "Convert POINT to Position."
+  (lsp-save-restriction-and-excursion
+    (goto-char point)
+    (lsp--cur-position)))
+
+(defun lsp--range (start end)
+  "Make Range body from START and END."
+  ;; make sure start and end are Position objects
+  (list :start start :end end))
+
+(defun lsp--region-to-range (start end)
+  "Make Range object for the current region."
+  (lsp--range (lsp--point-to-position start)
+              (lsp--point-to-position end)))
+
+(defun lsp--region-or-line ()
+  "The active region or the current line."
+  (if (use-region-p)
+      (lsp--region-to-range (region-beginning) (region-end))
+    (lsp--region-to-range (point-at-bol) (point-at-eol))))
+
+(defun lsp--check-document-changes-version (document-changes)
+  "Verify that DOCUMENT-CHANGES have the proper version."
+  (unless (seq-every-p
+           (-lambda ((&TextDocumentEdit :text-document))
+             (or
+              (not text-document)
+              (let* ((filename (-> text-document
+                                   lsp:versioned-text-document-identifier-uri
+                                   lsp--uri-to-path))
+                     (version (lsp:versioned-text-document-identifier-version? text-document)))
+                (with-current-buffer (find-file-noselect filename)
+                  (or (null version) (zerop version) (= -1 version)
+                      (equal version lsp--cur-version))))))
+           document-changes)
+    (error "Document changes cannot be applied")))
+
+(defun lsp--apply-workspace-edit (workspace-edit &optional operation)
+  "Apply the WorkspaceEdit object WORKSPACE-EDIT.
+OPERATION is symbol representing the source of this text edit."
+  (-let (((&WorkspaceEdit :document-changes? :changes?) workspace-edit))
+    (if-let ((document-changes (seq-reverse document-changes?)))
+        (progn
+          (lsp--check-document-changes-version document-changes)
+          (->> document-changes
+               (seq-filter (-lambda ((&CreateFile :kind)) (equal kind "create")))
+               (seq-do (lambda (change) (lsp--apply-text-document-edit change operation))))
+          (->> document-changes
+               (seq-filter (-lambda ((&CreateFile :kind))
+                             (and (or (not kind) (equal kind "edit"))
+                                  (not (equal kind "create")))))
+               (seq-do (lambda (change) (lsp--apply-text-document-edit change operation))))
+          (->> document-changes
+               (seq-filter (-lambda ((&CreateFile :kind))
+                             (and (not (or (not kind) (equal kind "edit")))
+                                  (not (equal kind "create")))))
+               (seq-do (lambda (change) (lsp--apply-text-document-edit change operation)))))
+      (lsp-map
+       (lambda (uri text-edits)
+         (with-current-buffer (-> uri lsp--uri-to-path find-file-noselect)
+           (lsp--apply-text-edits text-edits operation)))
+       changes?))))
+
+(defmacro lsp-with-filename (file &rest body)
+  "Execute BODY with FILE as a context.
+Need to handle the case when FILE indicates virtual buffer."
+  (declare (indent 1) (debug t))
+  `(if-let ((lsp--virtual-buffer (get-text-property 0 'lsp-virtual-buffer ,file)))
+       (lsp-with-current-buffer lsp--virtual-buffer
+         ,@body)
+     ,@body))
+
+(defun lsp--apply-text-document-edit (edit &optional operation)
+  "Apply the TextDocumentEdit object EDIT.
+OPERATION is symbol representing the source of this text edit.
+If the file is not being visited by any buffer, it is opened with
+`find-file-noselect'.
+Because lsp-mode does not store previous document versions, the edit is only
+applied if the version of the textDocument matches the version of the
+corresponding file.
+
+interface TextDocumentEdit {
+  textDocument: VersionedTextDocumentIdentifier;
+  edits: TextEdit[];
+}"
+  (pcase (lsp:edit-kind edit)
+    ("create" (-let* (((&CreateFile :uri :options?) edit)
+                      (file-name (lsp--uri-to-path uri)))
+                (mkdir (f-dirname file-name) t)
+                (f-touch file-name)
+                (when (lsp:create-file-options-overwrite? options?)
+                  (f-write-text "" nil file-name))
+                (find-file-noselect file-name)))
+    ("delete" (-let (((&DeleteFile :uri :options? (&DeleteFileOptions? :recursive?)) edit))
+                (f-delete (lsp--uri-to-path uri) recursive?)))
+    ("rename" (-let* (((&RenameFile :old-uri :new-uri :options? (&RenameFileOptions? :overwrite?)) edit)
+                      (old-file-name (lsp--uri-to-path old-uri))
+                      (new-file-name (lsp--uri-to-path new-uri))
+                      (buf (find-buffer-visiting old-file-name)))
+                (when buf
+                  (lsp-with-current-buffer buf
+                    (save-buffer)
+                    (lsp--text-document-did-close)))
+                (mkdir (f-dirname new-file-name) t)
+                (rename-file old-file-name new-file-name overwrite?)
+                (when buf
+                  (lsp-with-current-buffer buf
+                    (set-buffer-modified-p nil)
+                    (setq lsp-buffer-uri nil)
+                    (set-visited-file-name new-file-name)
+                    (lsp)))))
+    (_ (let ((file-name (->> edit
+                             (lsp:text-document-edit-text-document)
+                             (lsp:versioned-text-document-identifier-uri)
+                             (lsp--uri-to-path))))
+         (lsp-with-current-buffer (find-buffer-visiting file-name)
+           (lsp-with-filename file-name
+             (lsp--apply-text-edits (lsp:text-document-edit-edits edit) operation)))))))
+
+(lsp-defun lsp--position-compare ((&Position :line left-line
+                                             :character left-character)
+                                  (&Position :line right-line
+                                             :character right-character))
+  "Return t if position LEFT is greater than RIGHT."
+  (if (= left-line right-line)
+      (> left-character right-character)
+    (> left-line right-line)))
+
+(lsp-defun lsp-point-in-range? (position (&Range :start :end))
+  "Returns if POINT is in RANGE."
+  (not (or (lsp--position-compare start position)
+           (lsp--position-compare position end))))
+
+(lsp-defun lsp--position-equal ((&Position :line left-line
+                                           :character left-character)
+                                (&Position :line right-line
+                                           :character right-character))
+  "Return whether LEFT and RIGHT positions are equal."
+  (and (= left-line right-line)
+       (= left-character right-character)))
+
+(lsp-defun lsp--text-edit-sort-predicate ((&TextEdit :range (&Range :start left-start :end left-end))
+                                          (&TextEdit :range (&Range :start right-start :end right-end)))
+  (if (lsp--position-equal left-start right-start)
+      (lsp--position-compare left-end right-end)
+    (lsp--position-compare left-start right-start)))
+
+(lsp-defun lsp--apply-text-edit ((edit &as &TextEdit :range (&RangeToPoint :start :end) :new-text))
+  "Apply the edits described in the TextEdit object in TEXT-EDIT."
+  ;; We sort text edits so as to apply edits that modify latter parts of the
+  ;; document first. Furthermore, because the LSP spec dictates that:
+  ;; "If multiple inserts have the same position, the order in the array
+  ;; defines which edit to apply first."
+  ;; We reverse the initial list and sort stably to make sure the order among
+  ;; edits with the same position is preserved.
+  (setq new-text (s-replace "\r" "" (or new-text "")))
+  (lsp:set-text-edit-new-text edit new-text)
+  (goto-char start)
+  (delete-region start end)
+  (insert new-text))
+
+;; WORKAROUND: typescript-language might send -1 when applying code actions.
+;; see https://github.com/emacs-lsp/lsp-mode/issues/1582
+(lsp-defun lsp--fix-point ((point &as &Position :character :line))
+  (-doto point
+    (lsp:set-position-line (max 0 line))
+    (lsp:set-position-character (max 0 character))))
+
+(lsp-defun lsp--apply-text-edit-replace-buffer-contents ((edit &as
+                                                               &TextEdit
+                                                               :range (&Range :start :end)
+                                                               :new-text))
+  "Apply the edits described in the TextEdit object in TEXT-EDIT.
+The method uses `replace-buffer-contents'."
+  (setq new-text (s-replace "\r" "" (or new-text "")))
+  (lsp:set-text-edit-new-text edit new-text)
+  (-let* ((source (current-buffer))
+          ((beg . end) (lsp--range-to-region (lsp-make-range :start (lsp--fix-point start)
+                                                             :end (lsp--fix-point end)))))
+    (with-temp-buffer
+      (insert new-text)
+      (let ((temp (current-buffer)))
+        (with-current-buffer source
+          (save-excursion
+            (save-restriction
+              (narrow-to-region beg end)
+
+              ;; On emacs versions < 26.2,
+              ;; `replace-buffer-contents' is buggy - it calls
+              ;; change functions with invalid arguments - so we
+              ;; manually call the change functions here.
+              ;;
+              ;; See emacs bugs #32237, #32278:
+              ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32237
+              ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32278
+              (let ((inhibit-modification-hooks t)
+                    (length (- end beg)))
+                (run-hook-with-args 'before-change-functions
+                                    beg end)
+                (replace-buffer-contents temp)
+                (run-hook-with-args 'after-change-functions
+                                    beg (+ beg (length new-text))
+                                    length)))))))))
+
+(defun lsp--to-yasnippet-snippet (snippet)
+  "Convert LSP SNIPPET to yasnippet snippet."
+  ;; LSP snippet doesn't escape "{" and "`", but yasnippet requires escaping it.
+  (replace-regexp-in-string (rx (or bos (not (any "$" "\\"))) (group (or "{" "`")))
+                            (rx "\\" (backref 1))
+                            snippet
+                            nil nil 1))
+
+(defvar-local lsp-enable-relative-indentation nil
+  "Enable relative indentation when insert texts, snippets ...
+from language server.")
+
+(defun lsp--expand-snippet (snippet &optional start end expand-env)
+  "Wrapper of `yas-expand-snippet' with all of it arguments.
+The snippet will be convert to LSP style and indent according to
+LSP server result."
+  (let* ((inhibit-field-text-motion t)
+         (yas-wrap-around-region nil)
+         (yas-indent-line 'none)
+         (yas-also-auto-indent-first-line nil))
+    (yas-expand-snippet
+     (lsp--to-yasnippet-snippet snippet)
+     start end expand-env)))
+
+(defun lsp--indent-lines (start end &optional insert-text-mode?)
+  "Indent from START to END based on INSERT-TEXT-MODE? value.
+- When INSERT-TEXT-MODE? is provided
+  - if it's `lsp/insert-text-mode-as-it', do no editor indentation.
+  - if it's `lsp/insert-text-mode-adjust-indentation', adjust leading
+    whitespaces to match the line where text is inserted.
+- When it's not provided, using `indent-line-function' for each line."
+  (save-excursion
+    (goto-char end)
+    (let* ((end-line (line-number-at-pos))
+           (offset (save-excursion
+                     (goto-char start)
+                     (current-indentation)))
+           (indent-line-function
+            (cond ((equal insert-text-mode? lsp/insert-text-mode-as-it)
+                   #'ignore)
+                  ((or (equal insert-text-mode? lsp/insert-text-mode-adjust-indentation)
+                       lsp-enable-relative-indentation
+                       ;; Indenting snippets is extremely slow in `org-mode' buffers
+                       ;; since it has to calculate indentation based on SRC block
+                       ;; position.  Thus we use relative indentation as default.
+                       (derived-mode-p 'org-mode))
+                   (lambda () (save-excursion
+                                (beginning-of-line)
+                                (indent-to-column offset))))
+                  (t indent-line-function))))
+      (goto-char start)
+      (forward-line)
+      (while (and (not (eobp))
+                  (<= (line-number-at-pos) end-line))
+        (funcall indent-line-function)
+        (forward-line)))))
+
+(defun lsp--apply-text-edits (edits &optional operation)
+  "Apply the EDITS described in the TextEdit[] object.
+OPERATION is symbol representing the source of this text edit."
+  (unless (seq-empty-p edits)
+    (atomic-change-group
+      (run-hooks 'lsp-before-apply-edits-hook)
+      (let* ((change-group (prepare-change-group))
+             (howmany (length edits))
+             (message (format "Applying %s edits to `%s' ..." howmany (current-buffer)))
+             (_ (lsp--info message))
+             (reporter (make-progress-reporter message 0 howmany))
+             (done 0)
+             (apply-edit (if (not lsp--virtual-buffer)
+                             #'lsp--apply-text-edit-replace-buffer-contents
+                           #'lsp--apply-text-edit)))
+        (unwind-protect
+            (->> edits
+                 (nreverse)
+                 (seq-sort #'lsp--text-edit-sort-predicate)
+                 (mapc (lambda (edit)
+                         (progress-reporter-update reporter (cl-incf done))
+                         (funcall apply-edit edit)
+                         (when (lsp:snippet-text-edit-insert-text-format? edit)
+                           (-when-let ((&SnippetTextEdit :range (&RangeToPoint :start)
+                                                         :insert-text-format? :new-text) edit)
+                             (when (eq insert-text-format? lsp/insert-text-format-snippet)
+                               ;; No `save-excursion' needed since expand snippet will change point anyway
+                               (goto-char (+ start (length new-text)))
+                               (lsp--indent-lines start (point))
+                               (lsp--expand-snippet new-text start (point)))))
+                         (run-hook-with-args 'lsp-after-apply-edits-hook operation))))
+          (undo-amalgamate-change-group change-group)
+          (progress-reporter-done reporter))))))
+
+(defun lsp--create-apply-text-edits-handlers ()
+  "Create (handler cleanup-fn) for applying text edits in async request.
+Only works when mode is 'tick or 'alive."
+  (let* (first-edited
+         (func (lambda (start &rest _)
+                 (setq first-edited (if first-edited
+                                        (min start first-edited)
+                                      start)))))
+    (add-hook 'before-change-functions func nil t)
+    (list
+     (lambda (edits)
+       (if (and first-edited
+                (seq-find (-lambda ((&TextEdit :range (&RangeToPoint :end)))
+                            ;; Text edit region is overlapped
+                            (> end first-edited))
+                          edits))
+           (lsp--warn "TextEdits will not be applied since document has been modified before of them.")
+         (lsp--apply-text-edits edits 'completion-cleanup)))
+     (lambda ()
+       (remove-hook 'before-change-functions func t)))))
+
+(defun lsp--capability (cap &optional capabilities)
+  "Get the value of capability CAP.  If CAPABILITIES is non-nil, use them instead."
+  (when (stringp cap)
+    (setq cap (intern (concat ":" cap))))
+
+  (lsp-get (or capabilities
+               (lsp--server-capabilities))
+           cap))
+
+(defun lsp--registered-capability (method)
+  "Check whether there is workspace providing METHOD."
+  (->> (lsp-workspaces)
+       (--keep (seq-find (lambda (reg)
+                           (equal (lsp--registered-capability-method reg) method))
+                         (lsp--workspace-registered-server-capabilities it)))
+       cl-first))
+
+(defvar-local lsp--before-change-vals nil
+  "Store the positions from the `lsp-before-change' function call, for
+validation and use in the `lsp-on-change' function.")
+
+(defun lsp--text-document-content-change-event (start end length)
+  "Make a TextDocumentContentChangeEvent body for START to END, of length LENGTH."
+  ;; So (47 54 0) means add    7 chars starting at pos 47
+  ;; must become
+  ;;   {"range":{"start":{"line":5,"character":6}
+  ;;             ,"end" :{"line":5,"character":6}}
+  ;;             ,"rangeLength":0
+  ;;             ,"text":"\nbb = 5"}
+  ;;
+  ;; And (47 47 7) means delete 7 chars starting at pos 47
+  ;; must become
+  ;;   {"range":{"start":{"line":6,"character":0}
+  ;;            ,"end"  :{"line":7,"character":0}}
+  ;;            ,"rangeLength":7
+  ;;            ,"text":""}
+  ;;
+  ;; (208 221 3) means delete 3 chars starting at pos 208, and replace them with
+  ;; 13 chars. So it must become
+  ;;   {"range":{"start":{"line":5,"character":8}
+  ;;             ,"end" :{"line":5,"character":11}}
+  ;;             ,"rangeLength":3
+  ;;             ,"text":"new-chars-xxx"}
+  ;;
+
+  ;; Adding text:
+  ;;   lsp-before-change:(start,end)=(33,33)
+  ;;   lsp-on-change:(start,end,length)=(33,34,0)
+  ;;
+  ;; Changing text:
+  ;;   lsp-before-change:(start,end)=(208,211)
+  ;;   lsp-on-change:(start,end,length)=(208,221,3)
+  ;;
+  ;; Deleting text:
+  ;;   lsp-before-change:(start,end)=(19,27)
+  ;;   lsp-on-change:(start,end,length)=(19,19,8)
+  (if (zerop length)
+      ;; Adding something only, work from start only
+      `( :range ,(lsp--range
+                  (lsp--point-to-position start)
+                  (lsp--point-to-position start))
+         :rangeLength 0
+         :text ,(buffer-substring-no-properties start end))
+
+    (if (eq start end)
+        ;; Deleting something only
+        (if (lsp--bracketed-change-p start length)
+            ;; The before-change value is bracketed, use it
+            `( :range ,(lsp--range
+                        (lsp--point-to-position start)
+                        (plist-get lsp--before-change-vals :end-pos))
+               :rangeLength ,length
+               :text "")
+          ;; If the change is not bracketed, send a full change event instead.
+          (lsp--full-change-event))
+
+      ;; Deleting some things, adding others
+      (if (lsp--bracketed-change-p start length)
+          ;; The before-change value is valid, use it
+          `( :range ,(lsp--range
+                      (lsp--point-to-position start)
+                      (plist-get lsp--before-change-vals :end-pos))
+             :rangeLength ,length
+             :text ,(buffer-substring-no-properties start end))
+        (lsp--full-change-event)))))
+
+(defun lsp--bracketed-change-p (start length)
+  "If the before and after positions are the same, and the length
+is the size of the start range, we are probably good."
+  (-let [(&plist :end before-end :start before-start) lsp--before-change-vals]
+    (and (eq start before-start)
+         (eq length (- before-end before-start)))))
+
+(defun lsp--full-change-event ()
+  `(:text ,(lsp--buffer-content)))
+
+(defun lsp-before-change (start end)
+  "Executed before a file is changed.
+Added to `before-change-functions'."
+  ;; Note:
+  ;;
+  ;; This variable holds a list of functions to call when Emacs is about to
+  ;; modify a buffer. Each function gets two arguments, the beginning and end of
+  ;; the region that is about to change, represented as integers. The buffer
+  ;; that is about to change is always the current buffer when the function is
+  ;; called.
+  ;;
+  ;; WARNING:
+  ;;
+  ;; Do not expect the before-change hooks and the after-change hooks be called
+  ;; in balanced pairs around each buffer change. Also don't expect the
+  ;; before-change hooks to be called for every chunk of text Emacs is about to
+  ;; delete. These hooks are provided on the assumption that Lisp programs will
+  ;; use either before- or the after-change hooks, but not both, and the
+  ;; boundaries of the region where the changes happen might include more than
+  ;; just the actual changed text, or even lump together several changes done
+  ;; piecemeal.
+  (save-match-data
+    (lsp-save-restriction-and-excursion
+      (setq lsp--before-change-vals
+            (list :start start
+                  :end end
+                  :end-pos (lsp--point-to-position end))))))
+
+(defun lsp--flush-delayed-changes ()
+  (let ((inhibit-quit t))
+    (when lsp--delay-timer
+      (cancel-timer lsp--delay-timer))
+    (mapc (-lambda ((workspace buffer document change))
+            (with-current-buffer buffer
+              (with-lsp-workspace workspace
+                (lsp-notify "textDocument/didChange"
+                            (list :textDocument document
+                                  :contentChanges (vector change))))))
+          (prog1 (nreverse lsp--delayed-requests)
+            (setq lsp--delayed-requests nil)))))
+
+(defun lsp--workspace-sync-method (workspace)
+  (let* ((sync (-> workspace
+                   (lsp--workspace-server-capabilities)
+                   (lsp:server-capabilities-text-document-sync?))))
+    (if (lsp-text-document-sync-options? sync)
+        (lsp:text-document-sync-options-change? sync)
+      sync)))
+
+(defun lsp-on-change (start end length &optional content-change-event-fn)
+  "Executed when a file is changed.
+Added to `after-change-functions'."
+  ;; Note:
+  ;;
+  ;; Each function receives three arguments: the beginning and end of the region
+  ;; just changed, and the length of the text that existed before the change.
+  ;; All three arguments are integers. The buffer that has been changed is
+  ;; always the current buffer when the function is called.
+  ;;
+  ;; The length of the old text is the difference between the buffer positions
+  ;; before and after that text as it was before the change. As for the
+  ;; changed text, its length is simply the difference between the first two
+  ;; arguments.
+  ;;
+  ;; So (47 54 0) means add    7 chars starting at pos 47
+  ;; So (47 47 7) means delete 7 chars starting at pos 47
+  (save-match-data
+    (let ((inhibit-quit t)
+          ;; make sure that `lsp-on-change' is called in multi-workspace context
+          ;; see #2901
+          lsp--cur-workspace)
+      ;; A (revert-buffer) call with the 'preserve-modes parameter (eg, as done
+      ;; by auto-revert-mode) will cause this handler to get called with a nil
+      ;; buffer-file-name. We need the buffer-file-name to send notifications;
+      ;; so we skip handling revert-buffer-caused changes and instead handle
+      ;; reverts separately in lsp-on-revert
+      (when (not revert-buffer-in-progress-p)
+        (cl-incf lsp--cur-version)
+        (mapc
+         (lambda (workspace)
+           (pcase (or lsp-document-sync-method
+                      (lsp--workspace-sync-method workspace))
+             (1
+              (if lsp-debounce-full-sync-notifications
+                  (setq lsp--delayed-requests
+                        (->> lsp--delayed-requests
+                             (-remove (-lambda ((_ buffer))
+                                        (equal (current-buffer) buffer)))
+                             (cons (list workspace
+                                         (current-buffer)
+                                         (lsp--versioned-text-document-identifier)
+                                         (lsp--full-change-event)))))
+                (with-lsp-workspace workspace
+                  (lsp-notify "textDocument/didChange"
+                              (list :contentChanges (vector (lsp--full-change-event))
+                                    :textDocument (lsp--versioned-text-document-identifier))))))
+             (2
+              (with-lsp-workspace workspace
+                (lsp-notify
+                 "textDocument/didChange"
+                 (list :textDocument (lsp--versioned-text-document-identifier)
+                       :contentChanges (vector
+                                        (if content-change-event-fn
+                                            (funcall content-change-event-fn start end length)
+                                          (lsp--text-document-content-change-event
+                                           start end length)))))))))
+         (lsp-workspaces))
+        (when lsp--delay-timer (cancel-timer lsp--delay-timer))
+        (setq lsp--delay-timer (run-with-idle-timer
+                                lsp-debounce-full-sync-notifications-interval
+                                nil
+                                #'lsp--flush-delayed-changes))
+        ;; force cleanup overlays after each change
+        (lsp--remove-overlays 'lsp-highlight)
+        (lsp--after-change (current-buffer))
+        (setq lsp--signature-last-index nil
+              lsp--signature-last nil)
+        ;; cleanup diagnostics
+        (when lsp-diagnostic-clean-after-change
+          (lsp-foreach-workspace
+           (-let [diagnostics (lsp--workspace-diagnostics lsp--cur-workspace)]
+             (remhash (lsp--fix-path-casing (buffer-file-name)) diagnostics))))))))
+
+\f
+
+;; facilities for on change hooks. We do not want to make lsp calls on each
+;; change event so we add debounce to avoid flooding the server with events.
+;; Additionally, we want to have a mechanism for stopping the server calls in
+;; particular cases like, e. g. when performing completion.
+
+(defvar lsp-inhibit-lsp-hooks nil
+  "Flag to control.")
+
+(defcustom lsp-on-change-hook nil
+  "Hooks to run when buffer has changed."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defcustom lsp-idle-delay 0.500
+  "Debounce interval for `after-change-functions'."
+  :type 'number
+  :group 'lsp-mode)
+
+(defcustom lsp-on-idle-hook nil
+  "Hooks to run after `lsp-idle-delay'."
+  :type 'hook
+  :group 'lsp-mode)
+
+(defun lsp--idle-reschedule (buffer)
+  (when lsp--on-idle-timer
+    (cancel-timer lsp--on-idle-timer))
+
+  (setq lsp--on-idle-timer (run-with-idle-timer
+                            lsp-idle-delay
+                            nil
+                            #'lsp--on-idle
+                            buffer)))
+
+(defun lsp--post-command ()
+  (lsp--cleanup-highlights-if-needed)
+  (lsp--idle-reschedule (current-buffer)))
+
+(defun lsp--on-idle (buffer)
+  "Start post command loop."
+  (when (and (buffer-live-p buffer)
+             (equal buffer (current-buffer))
+             (not lsp-inhibit-lsp-hooks)
+             lsp-managed-mode)
+    (run-hooks 'lsp-on-idle-hook)))
+
+(defun lsp--on-change-debounce (buffer)
+  (when (and (buffer-live-p buffer)
+             (equal buffer (current-buffer))
+             (not lsp-inhibit-lsp-hooks)
+             lsp-managed-mode)
+    (run-hooks 'lsp-on-change-hook)))
+
+(defun lsp--after-change (buffer)
+  (when (fboundp 'lsp--semantic-tokens-refresh-if-enabled)
+    (lsp--semantic-tokens-refresh-if-enabled buffer))
+  (when lsp--on-change-timer
+    (cancel-timer lsp--on-change-timer))
+  (setq lsp--on-change-timer (run-with-idle-timer
+                              lsp-idle-delay
+                              nil
+                              #'lsp--on-change-debounce
+                              buffer))
+  (lsp--idle-reschedule buffer))
+
+\f
+
+(defun lsp--on-type-formatting (first-trigger-characters more-trigger-characters)
+  "Self insert handling.
+Applies on type formatting."
+  (let ((ch last-command-event))
+    (when (or (eq (string-to-char first-trigger-characters) ch)
+              (cl-find ch more-trigger-characters :key #'string-to-char))
+      (lsp-request-async "textDocument/onTypeFormatting"
+                         (lsp-make-document-on-type-formatting-params
+                          :text-document (lsp--text-document-identifier)
+                          :options (lsp-make-formatting-options
+                                    :tab-size (symbol-value (lsp--get-indent-width major-mode))
+                                    :insert-spaces (if indent-tabs-mode :json-false t))
+                          :ch (char-to-string ch)
+                          :position (lsp--cur-position))
+                         (lambda (data) (lsp--apply-text-edits data 'format))
+                         :mode 'tick))))
+
+\f
+;; links
+(defun lsp--document-links ()
+  (when (lsp-feature? "textDocument/documentLink")
+    (lsp-request-async
+     "textDocument/documentLink"
+     `(:textDocument ,(lsp--text-document-identifier))
+     (lambda (links)
+       (lsp--remove-overlays 'lsp-link)
+       (seq-do
+        (-lambda ((link &as &DocumentLink :range (&Range :start :end)))
+          (-doto (make-button (lsp--position-to-point start)
+                              (lsp--position-to-point end)
+                              'action (lsp--document-link-keymap link)
+                              'keymap (let ((map (make-sparse-keymap)))
+                                        (define-key map [M-return] 'push-button)
+                                        (define-key map [mouse-2] 'push-button)
+                                        map)
+                              'help-echo "mouse-2, M-RET: Visit this link")
+            (overlay-put 'lsp-link t)))
+        links))
+     :mode 'unchanged)))
+
+(defun lsp--document-link-handle-target (url)
+  (let* ((parsed-url (url-generic-parse-url (url-unhex-string url)))
+         (type (url-type parsed-url)))
+    (pcase type
+      ("file"
+       (find-file (lsp--uri-to-path url))
+       (-when-let ((_ line column) (s-match (rx "#" (group (1+ num)) "," (group (1+ num))) url))
+         (goto-char (lsp--position-to-point
+                     (lsp-make-position :character (1- (string-to-number column))
+                                        :line (1- (string-to-number line)))))))
+      ((or "http" "https") (browse-url url))
+      (type (if-let ((handler (lsp--get-uri-handler type)))
+                (funcall handler url)
+              (signal 'lsp-file-scheme-not-supported (list url)))))))
+
+(lsp-defun lsp--document-link-keymap ((link &as &DocumentLink :target?))
+  (if target?
+      (lambda (_)
+        (interactive)
+        (lsp--document-link-handle-target target?))
+    (lambda (_)
+      (interactive)
+      (when (lsp:document-link-registration-options-resolve-provider?
+             (lsp--capability :documentLinkProvider))
+        (lsp-request-async
+         "documentLink/resolve"
+         link
+         (-lambda ((&DocumentLink :target?))
+           (lsp--document-link-handle-target target?)))))))
+
+\f
+
+(defun lsp-buffer-language ()
+  "Get language corresponding current buffer."
+  (or (->> lsp-language-id-configuration
+           (-first (-lambda ((mode-or-pattern . language))
+                     (cond
+                      ((and (stringp mode-or-pattern)
+                            (s-matches? mode-or-pattern (buffer-file-name))) language)
+                      ((eq mode-or-pattern major-mode) language))))
+           cl-rest)
+      (lsp-warn "Unable to calculate the languageId for buffer `%s'. Take a look at `lsp-language-id-configuration'. The `major-mode' is %s"
+                (buffer-name)
+                major-mode)))
+
+(defun lsp-activate-on (&rest languages)
+  "Returns language activation function.
+The function will return t when the `lsp-buffer-language' returns
+one of the LANGUAGES."
+  (lambda (_file-name _mode)
+    (-contains? languages (lsp-buffer-language))))
+
+(defun lsp-workspace-root (&optional path)
+  "Find the workspace root for the current file or PATH."
+  (-when-let* ((file-name (or path (buffer-file-name)))
+               (file-name (lsp-f-canonical file-name)))
+    (->> (lsp-session)
+         (lsp-session-folders)
+         (--filter (and (lsp--files-same-host it file-name)
+                        (or (lsp-f-ancestor-of? it file-name)
+                            (equal it file-name))))
+         (--max-by (> (length it) (length other))))))
+
+(defun lsp-on-revert ()
+  "Executed when a file is reverted.
+Added to `after-revert-hook'."
+  (let ((n (buffer-size))
+        (revert-buffer-in-progress-p nil))
+    (lsp-on-change 0 n n)))
+
+(defun lsp--text-document-did-close (&optional keep-workspace-alive)
+  "Executed when the file is closed, added to `kill-buffer-hook'.
+
+If KEEP-WORKSPACE-ALIVE is non-nil, do not shutdown the workspace
+if it's closing the last buffer in the workspace."
+  (lsp-foreach-workspace
+   (cl-callf2 delq (lsp-current-buffer) (lsp--workspace-buffers lsp--cur-workspace))
+   (with-demoted-errors "Error sending didClose notification in ‘lsp--text-document-did-close’: %S"
+     (lsp-notify "textDocument/didClose"
+                 `(:textDocument ,(lsp--text-document-identifier))))
+   (when (and (not lsp-keep-workspace-alive)
+              (not keep-workspace-alive)
+              (not (lsp--workspace-buffers lsp--cur-workspace)))
+     (lsp--shutdown-workspace))))
+
+(defun lsp--will-save-text-document-params (reason)
+  (list :textDocument (lsp--text-document-identifier)
+        :reason reason))
+
+(defun lsp--before-save ()
+  "Before save handler."
+  (with-demoted-errors "Error in ‘lsp--before-save’: %S"
+    (let ((params (lsp--will-save-text-document-params 1)))
+      (when (lsp--send-will-save-p)
+        (lsp-notify "textDocument/willSave" params))
+      (when (and (lsp--send-will-save-wait-until-p) lsp-before-save-edits)
+        (let ((lsp-response-timeout 0.1))
+          (condition-case nil
+              (lsp--apply-text-edits
+               (lsp-request "textDocument/willSaveWaitUntil"
+                            params)
+               'before-save)
+            (error)))))))
+
+(defun lsp--on-auto-save ()
+  "Handler for auto-save."
+  (when (lsp--send-will-save-p)
+    (with-demoted-errors "Error in ‘lsp--on-auto-save’: %S"
+      (lsp-notify "textDocument/willSave" (lsp--will-save-text-document-params 2)))))
+
+(defun lsp--text-document-did-save ()
+  "Executed when the file is closed, added to `after-save-hook''."
+  (when (lsp--send-did-save-p)
+    (with-demoted-errors "Error on ‘lsp--text-document-did-save: %S’"
+      (lsp-notify "textDocument/didSave"
+                  `( :textDocument ,(lsp--versioned-text-document-identifier)
+                     ,@(when (lsp--save-include-text-p)
+                         (list :text (lsp--buffer-content))))))))
+
+(defun lsp--text-document-position-params (&optional identifier position)
+  "Make TextDocumentPositionParams for the current point in the current document.
+If IDENTIFIER and POSITION are non-nil, they will be used as the document identifier
+and the position respectively."
+  (list :textDocument (or identifier (lsp--text-document-identifier))
+        :position (or position (lsp--cur-position))))
+
+(defun lsp--get-buffer-diagnostics ()
+  "Return buffer diagnostics."
+  (gethash (or
+            (plist-get lsp--virtual-buffer :buffer-file-name)
+            (lsp--fix-path-casing (buffer-file-name)))
+           (lsp-diagnostics t)))
+
+(defun lsp-cur-line-diagnostics ()
+  "Return any diagnostics that apply to the current line."
+  (-let [(&plist :start (&plist :line start) :end (&plist :line end)) (lsp--region-or-line)]
+    (cl-coerce (-filter
+                (-lambda ((&Diagnostic :range (&Range :start (&Position :line))))
+                  (and (>= line start) (<= line end)))
+                (lsp--get-buffer-diagnostics))
+               'vector)))
+
+(defalias 'lsp--cur-line-diagnotics 'lsp-cur-line-diagnostics)
+
+(defun lsp--extract-line-from-buffer (pos)
+  "Return the line pointed to by POS (a Position object) in the current buffer."
+  (let* ((point (lsp--position-to-point pos))
+         (inhibit-field-text-motion t))
+    (save-excursion
+      (goto-char point)
+      (buffer-substring (line-beginning-position) (line-end-position)))))
+
+(lsp-defun lsp--xref-make-item (filename (&Range :start (start &as &Position :character start-char :line start-line)
+                                                 :end (end &as &Position :character end-char)))
+  "Return a xref-item from a RANGE in FILENAME."
+  (let* ((line (lsp--extract-line-from-buffer start))
+         (len (length line)))
+    (add-face-text-property (max (min start-char len) 0)
+                            (max (min end-char len) 0)
+                            'highlight t line)
+    ;; LINE is nil when FILENAME is not being current visited by any buffer.
+    (xref-make (or line filename)
+               (xref-make-file-location
+                filename
+                (lsp-translate-line (1+ start-line))
+                (lsp-translate-column start-char)))))
+
+(defun lsp--location-uri (loc)
+  (if (lsp-location? loc)
+      (lsp:location-uri loc)
+    (lsp:location-link-target-uri loc)))
+
+(lsp-defun lsp-goto-location ((loc &as &Location :uri :range (&Range :start)))
+  "Go to location."
+  (let ((path (lsp--uri-to-path uri)))
+    (if (f-exists? path)
+        (with-current-buffer (find-file path)
+          (goto-char (lsp--position-to-point start)))
+      (error "There is no file %s" path))))
+
+(defun lsp--location-range (loc)
+  (if (lsp-location? loc)
+      (lsp:location-range loc)
+    (lsp:location-link-target-selection-range loc)))
+
+(defun lsp--locations-to-xref-items (locations)
+  "Return a list of `xref-item' given LOCATIONS, which can be of
+type Location, LocationLink, Location[] or LocationLink[]."
+  (setq locations
+        (pcase locations
+          ((seq (or (Location)
+                    (LocationLink)))
+           (append locations nil))
+          ((or (Location)
+               (LocationLink))
+           (list locations))))
+
+  (cl-labels ((get-xrefs-in-file
+               (file-locs)
+               (-let [(filename . matches) file-locs]
+                 (condition-case err
+                     (let ((visiting (find-buffer-visiting filename))
+                           (fn (lambda (loc)
+                                 (lsp-with-filename filename
+                                   (lsp--xref-make-item filename
+                                                        (lsp--location-range loc))))))
+                       (if visiting
+                           (with-current-buffer visiting
+                             (seq-map fn matches))
+                         (when (file-readable-p filename)
+                           (with-temp-buffer
+                             (insert-file-contents-literally filename)
+                             (seq-map fn matches)))))
+                   (error (lsp-warn "Failed to process xref entry for filename '%s': %s"
+                                    filename (error-message-string err)))
+                   (file-error (lsp-warn "Failed to process xref entry, file-error, '%s': %s"
+                                         filename (error-message-string err)))))))
+
+    (->> locations
+         (seq-sort #'lsp--location-before-p)
+         (seq-group-by (-compose #'lsp--uri-to-path #'lsp--location-uri))
+         (seq-map #'get-xrefs-in-file)
+         (apply #'nconc))))
+
+(defun lsp--location-before-p (left right)
+  "Sort first by file, then by line, then by column."
+  (let ((left-uri (lsp--location-uri left))
+        (right-uri (lsp--location-uri right)))
+    (if (not (string= left-uri right-uri))
+        (string< left-uri right-uri)
+      (-let (((&Range :start left-start) (lsp--location-range left))
+             ((&Range :start right-start) (lsp--location-range right)))
+        (lsp--position-compare right-start left-start)))))
+
+(defun lsp--make-reference-params (&optional td-position include-declaration)
+  "Make a ReferenceParam object.
+If TD-POSITION is non-nil, use it as TextDocumentPositionParams object instead.
+If INCLUDE-DECLARATION is non-nil, request the server to include declarations."
+  (let ((json-false :json-false))
+    (plist-put (or td-position (lsp--text-document-position-params))
+               :context `(:includeDeclaration ,(or include-declaration json-false)))))
+
+(defun lsp--cancel-request (id)
+  "Cancel request with ID in all workspaces."
+  (lsp-foreach-workspace
+   (->> lsp--cur-workspace lsp--workspace-client lsp--client-response-handlers (remhash id))
+   (lsp-notify "$/cancelRequest" `(:id ,id))))
+
+(defun lsp-eldoc-function ()
+  "`lsp-mode' eldoc function."
+  (run-hooks 'lsp-eldoc-hook)
+  eldoc-last-message)
+
+(defun lsp--point-on-highlight? ()
+  (-some? (lambda (overlay)
+            (overlay-get overlay 'lsp-highlight))
+          (overlays-at (point))))
+
+(defun lsp--cleanup-highlights-if-needed ()
+  (when (and lsp-enable-symbol-highlighting
+             lsp--have-document-highlights
+             (not (lsp--point-on-highlight?)))
+    (lsp--remove-overlays 'lsp-highlight)
+    (setq lsp--have-document-highlights nil)
+    (lsp-cancel-request-by-token :highlights)))
+
+(defvar-local lsp--symbol-bounds-of-last-highlight-invocation nil
+  "The bounds of the symbol from which `lsp--document-highlight'
+  most recently requested highlights.")
+
+(defun lsp--document-highlight ()
+  (when (lsp-feature? "textDocument/documentHighlight")
+    (let ((curr-sym-bounds (bounds-of-thing-at-point 'symbol)))
+      (unless (or (looking-at "[[:space:]\n]")
+                  (not lsp-enable-symbol-highlighting)
+                  (and lsp--have-document-highlights
+                       curr-sym-bounds
+                       (equal curr-sym-bounds
+                              lsp--symbol-bounds-of-last-highlight-invocation)))
+        (setq lsp--symbol-bounds-of-last-highlight-invocation
+              curr-sym-bounds)
+        (lsp-request-async "textDocument/documentHighlight"
+                           (lsp--text-document-position-params)
+                           #'lsp--document-highlight-callback
+                           :mode 'tick
+                           :cancel-token :highlights)))))
+
+(defun lsp-describe-thing-at-point ()
+  "Display the type signature and documentation of the thing at
+point."
+  (interactive)
+  (let ((contents (-some->> (lsp--text-document-position-params)
+                    (lsp--make-request "textDocument/hover")
+                    (lsp--send-request)
+                    (lsp:hover-contents))))
+    (if (and contents (not (equal contents "")))
+        (let ((lsp-help-buf-name "*lsp-help*"))
+          (with-current-buffer (get-buffer-create lsp-help-buf-name)
+            (with-help-window lsp-help-buf-name
+              (insert (string-trim-right (lsp--render-on-hover-content contents t))))))
+      (lsp--info "No content at point."))))
+
+(defun lsp--point-in-bounds-p (bounds)
+  "Return whether the current point is within BOUNDS."
+  (and (<= (car bounds) (point)) (< (point) (cdr bounds))))
+
+(defun lsp-get-renderer (language)
+  "Get renderer for LANGUAGE."
+  (lambda (str)
+    (lsp--render-string str language)))
+
+(defun lsp--setup-markdown (mode)
+  "Setup the ‘markdown-mode’ in the frame.
+MODE is the mode used in the parent frame."
+  (make-local-variable 'markdown-code-lang-modes)
+  (dolist (mark (alist-get mode lsp-custom-markup-modes))
+    (add-to-list 'markdown-code-lang-modes (cons mark mode)))
+  (setq-local markdown-fontify-code-blocks-natively t)
+  (setq-local markdown-fontify-code-block-default-mode mode)
+  (setq-local markdown-hide-markup t)
+
+  ;; Render some common HTML entities.
+  ;; This should really happen in markdown-mode instead,
+  ;; but it doesn't, so we do it here for now.
+  (setq prettify-symbols-alist
+        (cl-loop for i from 0 to 255
+                 collect (cons (format "&#x%02X;" i) i)))
+  (push '("&lt;" . ?<) prettify-symbols-alist)
+  (push '("&gt;" . ?>) prettify-symbols-alist)
+  (push '("&amp;" . ?&) prettify-symbols-alist)
+  (push '("&nbsp;" . ? ) prettify-symbols-alist)
+  (setq prettify-symbols-compose-predicate
+        (lambda (_start _end _match) t))
+  (prettify-symbols-mode 1))
+
+(defun lsp--buffer-string-visible ()
+  "Return visible buffer string.
+Stolen from `org-copy-visible'."
+  (let ((temp (generate-new-buffer " *temp*"))
+        (beg (point-min))
+        (end (point-max)))
+    (while (/= beg end)
+      (when (get-char-property beg 'invisible)
+        (setq beg (next-single-char-property-change beg 'invisible nil end)))
+      (let* ((next (next-single-char-property-change beg 'invisible nil end))
+             (substring (buffer-substring beg next)))
+        (with-current-buffer temp (insert substring))
+        ;; (setq result (concat result substring))
+        (setq beg next)))
+    (setq deactivate-mark t)
+    (prog1 (with-current-buffer temp
+             (s-chop-suffix "\n" (buffer-string)))
+      (kill-buffer temp))))
+
+(defvar lsp-buffer-major-mode nil
+  "Holds the major mode when fontification function is running.
+See #2588")
+
+(defvar view-inhibit-help-message)
+
+(defun lsp--render-markdown ()
+  "Render markdown."
+
+  (let ((markdown-enable-math nil))
+    (goto-char (point-min))
+    (while (re-search-forward
+            (rx (and "\\" (group (or "\\" "`" "*" "_" ":" "/"
+                                     "{" "}" "[" "]" "(" ")"
+                                     "#" "+" "-" "." "!" "|"))))
+            nil t)
+      (replace-match (rx (backref 1))))
+
+    ;; markdown-mode v2.3 does not yet provide gfm-view-mode
+    (if (fboundp 'gfm-view-mode)
+        (let ((view-inhibit-help-message t))
+          (gfm-view-mode))
+      (gfm-mode))
+
+    (lsp--setup-markdown lsp-buffer-major-mode)))
+
+(defvar lsp--display-inline-image-alist
+  '((lsp--render-markdown
+     (:regexp
+      "!\\[.*?\\](data:image/[a-zA-Z]+;base64,\\([A-Za-z0-9+/\n]+?=*?\\)\\(|[^)]+\\)?)"
+      :sexp
+      (create-image
+       (base64-decode-string
+        (buffer-substring-no-properties (match-beginning 1) (match-end 1)))
+       nil t))))
+  "Replaced string regexp and function returning image.
+Each element should have the form (MODE . (PROPERTY-LIST...)).
+MODE (car) is function which is defined in `lsp-language-id-configuration'.
+Cdr should be list of PROPERTY-LIST.
+
+Each PROPERTY-LIST should have properties:
+:regexp  Regexp which determines what string is relpaced to image.
+         You should also get information of image, by parenthesis constructs.
+         By default, all matched string is replaced to image, but you can
+         change index of replaced string by keyword :replaced-index.
+
+:sexp    Return image when evaluated. You can use information of regexp
+         by using (match-beggining N), (match-end N) or (match-substring N).
+
+In addition, each can have property:
+:replaced-index  Determine index which is used to replace regexp to image.
+                 The value means first argument of `match-beginning' and
+                 `match-end'. If omitted, interpreted as index 0.")
+
+(defcustom lsp-display-inline-image t
+  "Showing inline image or not."
+  :group 'lsp-mode
+  :type 'boolean)
+
+(defcustom lsp-enable-suggest-server-download t
+  "When non-nil enable server downloading suggestions."
+  :group 'lsp-mode
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defun lsp--display-inline-image (mode)
+  "Add image property if available."
+  (let ((plist-list (cdr (assq mode lsp--display-inline-image-alist))))
+    (when (and (display-images-p) lsp-display-inline-image)
+      (cl-loop
+       for plist in plist-list
+       with regexp with replaced-index
+       do
+       (setq regexp (plist-get plist :regexp))
+       (setq replaced-index (or (plist-get plist :replaced-index) 0))
+
+       (font-lock-remove-keywords nil (list regexp replaced-index))
+       (let ((inhibit-read-only t))
+         (save-excursion
+           (goto-char (point-min))
+           (while (re-search-forward regexp nil t)
+             (set-text-properties
+              (match-beginning replaced-index) (match-end replaced-index)
+              nil)
+             (add-text-properties
+              (match-beginning replaced-index) (match-end replaced-index)
+              `(display ,(eval (plist-get plist :sexp)))))))))))
+
+(defun lsp--fontlock-with-mode (str mode)
+  "Fontlock STR with MODE."
+  (let ((lsp-buffer-major-mode major-mode))
+    (condition-case nil
+        (with-temp-buffer
+          (insert str)
+          (delay-mode-hooks (funcall mode))
+          (cl-flet ((window-body-width () lsp-window-body-width))
+            ;; This can go wrong in some cases, and the fontification would
+            ;; not work as expected.
+            ;;
+            ;; See #2984
+            (ignore-errors (font-lock-ensure))
+            (lsp--display-inline-image mode))
+          (lsp--buffer-string-visible))
+      (error str))))
+
+(defun lsp--render-string (str language)
+  "Render STR using `major-mode' corresponding to LANGUAGE.
+When language is nil render as markup if `markdown-mode' is loaded."
+  (setq str (s-replace "\r" "" (or str "")))
+  (if-let ((mode (-some (-lambda ((mode . lang))
+                          (when (and (equal lang language) (functionp mode))
+                            mode))
+                        lsp-language-id-configuration)))
+      (lsp--fontlock-with-mode str mode)
+    str))
+
+(defun lsp--render-element (content)
+  "Render CONTENT element."
+  (let ((inhibit-message t))
+    (or
+     (pcase content
+       ((MarkedString :value :language)
+        (lsp--render-string value language))
+       ((MarkupContent :value :kind)
+        (lsp--render-string value kind))
+       ;; plain string
+       ((pred stringp) (lsp--render-string content "markdown"))
+       ((pred null) "")
+       (_ (error "Failed to handle %s" content)))
+     "")))
+
+(defun lsp--create-unique-string-fn ()
+  (let (elements)
+    (lambda (element)
+      (let ((count (cl-count element elements :test #'string=)))
+        (prog1 (if (zerop count)
+                   element
+                 (format "%s (%s)" element count))
+          (push element elements))))))
+
+(defun lsp--select-action (actions)
+  "Select an action to execute from ACTIONS."
+  (cond
+   ((seq-empty-p actions) (signal 'lsp-no-code-actions nil))
+   ((and (eq (seq-length actions) 1) lsp-auto-execute-action)
+    (lsp-seq-first actions))
+   (t (let ((completion-ignore-case t))
+        (lsp--completing-read "Select code action: "
+                              (seq-into actions 'list)
+                              (-compose (lsp--create-unique-string-fn)
+                                        #'lsp:code-action-title)
+                              nil t)))))
+
+(defun lsp--workspace-server-id (workspace)
+  "Return the server ID of WORKSPACE."
+  (-> workspace lsp--workspace-client lsp--client-server-id))
+
+(defun lsp--handle-rendered-for-echo-area (contents)
+  "Return a single line from RENDERED, appropriate for display in the echo area."
+  (pcase (lsp-workspaces)
+    (`(,workspace)
+     (lsp-clients-extract-signature-on-hover contents (lsp--workspace-server-id workspace)))
+    ;; For projects with multiple active workspaces we also default to
+    ;; render the first line.
+    (_ (lsp-clients-extract-signature-on-hover contents nil))))
+
+(cl-defgeneric lsp-clients-extract-signature-on-hover (contents _server-id)
+  "Extract a representative line from CONTENTS, to show in the echo area."
+  (car (s-lines (s-trim (lsp--render-element contents)))))
+
+(defun lsp--render-on-hover-content (contents render-all)
+  "Render the content received from 'document/onHover' request.
+CONTENTS  - MarkedString | MarkedString[] | MarkupContent
+RENDER-ALL - nil if only the signature should be rendered."
+  (cond
+   ((lsp-markup-content? contents)
+    ;; MarkupContent.
+    ;; It tends to be long and is not suitable to display fully in the echo area.
+    ;; Just display the first line which is typically the signature.
+    (if render-all
+        (lsp--render-element contents)
+      (lsp--handle-rendered-for-echo-area contents)))
+   ((and (stringp contents) (not (string-match-p "\n" contents)))
+    ;; If the contents is a single string containing a single line,
+    ;; render it always.
+    (lsp--render-element contents))
+   (t
+    ;; MarkedString -> MarkedString[]
+    (when (or (lsp-marked-string? contents) (stringp contents))
+      (setq contents (list contents)))
+    ;; Consider the signature consisting of the elements who have a renderable
+    ;; "language" property. When render-all is nil, ignore other elements.
+    (string-join
+     (seq-map
+      #'lsp--render-element
+      (if render-all
+          contents
+        ;; Only render contents that have an available renderer.
+        (seq-filter
+         (-andfn #'lsp-marked-string?
+                 (-compose #'lsp-get-renderer #'lsp:marked-string-language))
+         contents)))
+     (if (bound-and-true-p page-break-lines-mode)
+         "\n\f\n"
+       "\n")))))
+
+\f
+
+(defvar lsp-signature-mode-map
+  (-doto (make-sparse-keymap)
+    (define-key (kbd "M-n") #'lsp-signature-next)
+    (define-key (kbd "M-p") #'lsp-signature-previous)
+    (define-key (kbd "M-a") #'lsp-signature-toggle-full-docs)
+    (define-key (kbd "C-c C-k") #'lsp-signature-stop)
+    (define-key (kbd "C-g") #'lsp-signature-stop))
+  "Keymap for `lsp-signature-mode-map'.")
+
+(define-minor-mode lsp-signature-mode
+  "Mode used to show signature popup."
+  :keymap lsp-signature-mode-map
+  :lighter ""
+  :group 'lsp-mode)
+
+(defun lsp-signature-stop ()
+  "Stop showing current signature help."
+  (interactive)
+  (lsp-cancel-request-by-token :signature)
+  (remove-hook 'post-command-hook #'lsp-signature)
+  (funcall lsp-signature-function nil)
+  (lsp-signature-mode -1))
+
+(declare-function page-break-lines--update-display-tables "ext:page-break-lines")
+
+(defun lsp--setup-page-break-mode-if-present ()
+  "Enable `page-break-lines-mode' in current buffer."
+  (when (fboundp 'page-break-lines-mode)
+    (page-break-lines-mode)
+    ;; force page-break-lines-mode to update the display tables.
+    (page-break-lines--update-display-tables)))
+
+(defun lsp-lv-message (message)
+  (add-hook 'lv-window-hook #'lsp--setup-page-break-mode-if-present)
+  (if message
+      (progn
+        (setq lsp--signature-last-buffer (current-buffer))
+        (let ((lv-force-update t))
+          (lv-message "%s" message)))
+    (lv-delete-window)
+    (remove-hook 'lv-window-hook #'lsp--setup-page-break-mode-if-present)))
+
+(declare-function posframe-show "ext:posframe")
+(declare-function posframe-hide "ext:posframe")
+(declare-function posframe-poshandler-point-bottom-left-corner-upward "ext:posframe")
+
+(defface lsp-signature-posframe
+  '((t :inherit tooltip))
+  "Background and foreground for `lsp-signature-posframe'."
+  :group 'lsp-mode)
+
+(defvar lsp-signature-posframe-params
+  (list :poshandler #'posframe-poshandler-point-bottom-left-corner-upward
+        :height 10
+        :width 60
+        :border-width 1
+        :min-width 60)
+  "Params for signature and `posframe-show'.")
+
+(defun lsp-signature-posframe (str)
+  "Use posframe to show the STR signatureHelp string."
+  (if str
+      (apply #'posframe-show
+             (with-current-buffer (get-buffer-create " *lsp-signature*")
+               (erase-buffer)
+               (insert str)
+               (visual-line-mode 1)
+               (lsp--setup-page-break-mode-if-present)
+               (current-buffer))
+             (append
+              lsp-signature-posframe-params
+              (list :position (point)
+                    :background-color (face-attribute 'lsp-signature-posframe :background nil t)
+                    :foreground-color (face-attribute 'lsp-signature-posframe :foreground nil t)
+                    :border-color (face-attribute 'font-lock-comment-face :foreground nil t))))
+    (posframe-hide " *lsp-signature*")))
+
+(defun lsp--handle-signature-update (signature)
+  (let ((message
+         (if (lsp-signature-help? signature)
+             (lsp--signature->message signature)
+           (mapconcat #'lsp--signature->message signature "\n"))))
+    (if (s-present? message)
+        (funcall lsp-signature-function message)
+      (lsp-signature-stop))))
+
+(defun lsp-signature-activate ()
+  "Activate signature help.
+It will show up only if current point has signature help."
+  (interactive)
+  (setq lsp--signature-last nil
+        lsp--signature-last-index nil
+        lsp--signature-last-buffer (current-buffer))
+  (add-hook 'post-command-hook #'lsp-signature)
+  (lsp-signature-mode t))
+
+(defcustom lsp-signature-cycle t
+  "Whether `lsp-signature-next' and prev should cycle."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defun lsp-signature-next ()
+  "Show next signature."
+  (interactive)
+  (let ((nsigs (length (lsp:signature-help-signatures lsp--signature-last))))
+    (when (and lsp--signature-last-index
+               lsp--signature-last
+               (or lsp-signature-cycle (< (1+ lsp--signature-last-index) nsigs)))
+      (setq lsp--signature-last-index (% (1+ lsp--signature-last-index) nsigs))
+      (funcall lsp-signature-function (lsp--signature->message lsp--signature-last)))))
+
+(defun lsp-signature-previous ()
+  "Next signature."
+  (interactive)
+  (when (and lsp--signature-last-index
+             lsp--signature-last
+             (or lsp-signature-cycle (not (zerop lsp--signature-last-index))))
+    (setq lsp--signature-last-index (1- (if (zerop lsp--signature-last-index)
+                                            (length (lsp:signature-help-signatures lsp--signature-last))
+                                          lsp--signature-last-index)))
+    (funcall lsp-signature-function (lsp--signature->message lsp--signature-last))))
+
+(defun lsp-signature-toggle-full-docs ()
+  "Toggle full/partial signature documentation."
+  (interactive)
+  (let ((all? (not (numberp lsp-signature-doc-lines))))
+    (setq lsp-signature-doc-lines (if all?
+                                      (or (car-safe lsp-signature-doc-lines)
+                                          20)
+                                    (list lsp-signature-doc-lines))))
+  (lsp-signature-activate))
+
+(defun lsp--signature->message (signature-help)
+  "Generate eldoc message from SIGNATURE-HELP response."
+  (setq lsp--signature-last signature-help)
+
+  (when (and signature-help (not (seq-empty-p (lsp:signature-help-signatures signature-help))))
+    (-let* (((&SignatureHelp :active-signature?
+                             :active-parameter?
+                             :signatures) signature-help)
+            (active-signature? (or lsp--signature-last-index active-signature? 0))
+            (_ (setq lsp--signature-last-index active-signature?))
+            ((signature &as &SignatureInformation? :label :parameters?) (seq-elt signatures active-signature?))
+            (prefix (if (= (length signatures) 1)
+                        ""
+                      (concat (propertize (format " %s/%s"
+                                                  (1+ active-signature?)
+                                                  (length signatures))
+                                          'face 'success)
+                              " ")))
+            (method-docs (when
+                             (and lsp-signature-render-documentation
+                                  (or (not (numberp lsp-signature-doc-lines)) (< 0 lsp-signature-doc-lines)))
+                           (let ((docs (lsp--render-element
+                                        (lsp:parameter-information-documentation? signature))))
+                             (when (s-present? docs)
+                               (concat
+                                "\n"
+                                (if (fboundp 'page-break-lines-mode)
+                                    "\f\n"
+                                  "")
+                                (if (and (numberp lsp-signature-doc-lines)
+                                         (> (length (s-lines docs)) lsp-signature-doc-lines))
+                                    (concat (s-join "\n" (-take lsp-signature-doc-lines (s-lines docs)))
+                                            (propertize "\nTruncated..." 'face 'highlight))
+                                  docs)))))))
+      (when (and active-parameter? (not (seq-empty-p parameters?)))
+        (-when-let* ((param (when (and (< -1 active-parameter? (length parameters?)))
+                              (seq-elt parameters? active-parameter?)))
+                     (selected-param-label (let ((label (lsp:parameter-information-label param)))
+                                             (if (stringp label) label (append label nil))))
+                     (start (if (stringp selected-param-label)
+                                (s-index-of selected-param-label label)
+                              (cl-first selected-param-label)))
+                     (end (if (stringp selected-param-label)
+                              (+ start (length selected-param-label))
+                            (cl-second selected-param-label))))
+          (add-face-text-property start end 'eldoc-highlight-function-argument nil label)))
+      (concat prefix label method-docs))))
+
+(defun lsp-signature ()
+  "Display signature info (based on `textDocument/signatureHelp')"
+  (if (and lsp--signature-last-buffer
+           (not (equal (current-buffer) lsp--signature-last-buffer)))
+      (lsp-signature-stop)
+    (lsp-request-async "textDocument/signatureHelp"
+                       (lsp--text-document-position-params)
+                       #'lsp--handle-signature-update
+                       :cancel-token :signature)))
+
+\f
+(defcustom lsp-overlay-document-color-char "■"
+  "Display the char represent the document color in overlay"
+  :type 'string
+  :group 'lsp-mode)
+
+;; color presentation
+(defun lsp--color-create-interactive-command (color range)
+  (lambda ()
+    (interactive)
+    (-let [(&ColorPresentation? :text-edit?
+                                :additional-text-edits?)
+           (lsp--completing-read
+            "Select color presentation: "
+            (lsp-request
+             "textDocument/colorPresentation"
+             `( :textDocument ,(lsp--text-document-identifier)
+                :color ,color
+                :range ,range))
+            #'lsp:color-presentation-label
+            nil
+            t)]
+      (when text-edit?
+        (lsp--apply-text-edit text-edit?))
+      (when additional-text-edits?
+        (lsp--apply-text-edits additional-text-edits? 'color-presentation)))))
+
+(defun lsp--number->color (number)
+  (let ((result (format "%x"
+                        (round (* (or number 0) 255.0)))))
+    (if (= 1 (length result))
+        (concat "0" result)
+      result)))
+
+(defun lsp--document-color ()
+  "Document color handler."
+  (when (lsp-feature? "textDocument/documentColor")
+    (lsp-request-async
+     "textDocument/documentColor"
+     `(:textDocument ,(lsp--text-document-identifier))
+     (lambda (result)
+       (lsp--remove-overlays 'lsp-color)
+       (seq-do
+        (-lambda ((&ColorInformation :color (color &as &Color :red :green :blue)
+                                     :range))
+          (-let* (((beg . end) (lsp--range-to-region range))
+                  (overlay (make-overlay beg end))
+                  (command (lsp--color-create-interactive-command color range)))
+            (overlay-put overlay 'lsp-color t)
+            (overlay-put overlay 'evaporate t)
+            (overlay-put overlay
+                         'before-string
+                         (propertize
+                          lsp-overlay-document-color-char
+                          'face `((:foreground ,(format
+                                                 "#%s%s%s"
+                                                 (lsp--number->color red)
+                                                 (lsp--number->color green)
+                                                 (lsp--number->color blue))))
+                          'action command
+                          'mouse-face 'lsp-lens-mouse-face
+                          'local-map (-doto (make-sparse-keymap)
+                                       (define-key [mouse-1] command))))))
+        result))
+     :mode 'unchanged
+     :cancel-token :document-color-token)))
+
+\f
+;; hover
+
+(defvar-local lsp--hover-saved-bounds nil)
+
+(defun lsp-hover ()
+  "Display hover info (based on `textDocument/signatureHelp')."
+  (if (and lsp--hover-saved-bounds
+           (lsp--point-in-bounds-p lsp--hover-saved-bounds))
+      (lsp--eldoc-message lsp--eldoc-saved-message)
+    (setq lsp--hover-saved-bounds nil
+          lsp--eldoc-saved-message nil)
+    (if (looking-at "[[:space:]\n]")
+        (lsp--eldoc-message nil)
+      (when (and lsp-eldoc-enable-hover (lsp--capability :hoverProvider))
+        (lsp-request-async
+         "textDocument/hover"
+         (lsp--text-document-position-params)
+         (-lambda ((hover &as &Hover? :range? :contents))
+           (when hover
+             (when range?
+               (setq lsp--hover-saved-bounds (lsp--range-to-region range?)))
+             (lsp--eldoc-message (and contents
+                                      (lsp--render-on-hover-content
+                                       contents
+                                       lsp-eldoc-render-all)))))
+         :error-handler #'ignore
+         :mode 'tick
+         :cancel-token :eldoc-hover)))))
+
+\f
+
+(defun lsp--action-trigger-parameter-hints (_command)
+  "Handler for editor.action.triggerParameterHints."
+  (when (member :on-server-request lsp-signature-auto-activate)
+    (lsp-signature-activate)))
+
+(defun lsp--action-trigger-suggest (_command)
+  "Handler for editor.action.triggerSuggest."
+  (cond
+   ((and (bound-and-true-p company-mode)
+         (fboundp 'company-auto-begin)
+         (fboundp 'company-post-command))
+    (run-at-time 0 nil
+                 (lambda ()
+                   (let ((this-command 'company-idle-begin)
+                         (company-minimum-prefix-length 0))
+                     (company-auto-begin)
+                     (company-post-command)))))
+   (t
+    (completion-at-point))))
+
+(defconst lsp--default-action-handlers
+  (ht ("editor.action.triggerParameterHints" #'lsp--action-trigger-parameter-hints)
+      ("editor.action.triggerSuggest" #'lsp--action-trigger-suggest))
+  "Default action handlers.")
+
+(defun lsp--find-action-handler (command)
+  "Find action handler for particular COMMAND."
+  (or
+   (--some (-some->> it
+             (lsp--workspace-client)
+             (lsp--client-action-handlers)
+             (gethash command))
+           (lsp-workspaces))
+   (gethash command lsp--default-action-handlers)))
+
+(defun lsp--text-document-code-action-params (&optional kind)
+  "Code action params."
+  (list :textDocument (lsp--text-document-identifier)
+        :range (if (use-region-p)
+                   (lsp--region-to-range (region-beginning) (region-end))
+                 (lsp--region-to-range (point) (point)))
+        :context `( :diagnostics ,(lsp-cur-line-diagnostics)
+                    ,@(when kind (list :only (vector kind))))))
+
+(defun lsp-code-actions-at-point (&optional kind)
+  "Retrieve the code actions for the active region or the current line.
+It will filter by KIND if non nil."
+  (lsp-request "textDocument/codeAction" (lsp--text-document-code-action-params kind)))
+
+(defun lsp-execute-code-action-by-kind (command-kind)
+  "Execute code action by COMMAND-KIND."
+  (if-let ((action (->> (lsp-get-or-calculate-code-actions command-kind)
+                        (-filter (-lambda ((&CodeAction :kind?))
+                                   (and kind? (s-prefix? command-kind kind?))))
+                        lsp--select-action)))
+      (lsp-execute-code-action action)
+    (signal 'lsp-no-code-actions '(command-kind))))
+
+(defalias 'lsp-get-or-calculate-code-actions 'lsp-code-actions-at-point)
+
+(lsp-defun lsp--execute-command ((action &as &Command :command :arguments?))
+  "Parse and execute a code ACTION represented as a Command LSP type."
+  (let ((server-id (->> (lsp-workspaces)
+                        (cl-first)
+                        (or lsp--cur-workspace)
+                        (lsp--workspace-client)
+                        (lsp--client-server-id))))
+    (condition-case nil
+        (with-no-warnings
+          (lsp-execute-command server-id (intern command) arguments?))
+      (cl-no-applicable-method
+       (if-let ((action-handler (lsp--find-action-handler command)))
+           (funcall action-handler action)
+         (lsp-send-execute-command command arguments?))))))
+
+(lsp-defun lsp-execute-code-action ((action &as &CodeAction :command? :edit?))
+  "Execute code action ACTION.
+If ACTION is not set it will be selected from `lsp-code-actions-at-point'.
+Request codeAction/resolve for more info if server supports."
+  (interactive (list (lsp--select-action (lsp-code-actions-at-point))))
+  (if (and (lsp-feature? "codeAction/resolve")
+           (not command?)
+           (not edit?))
+      (lsp--execute-code-action (lsp-request "codeAction/resolve" action))
+    (lsp--execute-code-action action)))
+
+(lsp-defun lsp--execute-code-action ((action &as &CodeAction :command? :edit?))
+  "Execute code action ACTION."
+  (when edit?
+    (lsp--apply-workspace-edit edit? 'code-action))
+
+  (cond
+   ((stringp command?) (lsp--execute-command action))
+   ((lsp-command? command?) (lsp--execute-command command?))))
+
+(defvar lsp--formatting-indent-alist
+  ;; Taken from `dtrt-indent-mode'
+  '((c-mode                     . c-basic-offset)                   ; C
+    (c++-mode                   . c-basic-offset)                   ; C++
+    (csharp-mode                . c-basic-offset)                   ; C#
+    (csharp-tree-sitter-mode    . csharp-tree-sitter-indent-offset) ; C#
+    (d-mode                     . c-basic-offset)                   ; D
+    (java-mode                  . c-basic-offset)                   ; Java
+    (jde-mode                   . c-basic-offset)                   ; Java (JDE)
+    (js-mode                    . js-indent-level)                  ; JavaScript
+    (js2-mode                   . js2-basic-offset)                 ; JavaScript-IDE
+    (js3-mode                   . js3-indent-level)                 ; JavaScript-IDE
+    (json-mode                  . js-indent-level)                  ; JSON
+    (lua-mode                   . lua-indent-level)                 ; Lua
+    (objc-mode                  . c-basic-offset)                   ; Objective C
+    (php-mode                   . c-basic-offset)                   ; PHP
+    (perl-mode                  . perl-indent-level)                ; Perl
+    (cperl-mode                 . cperl-indent-level)               ; Perl
+    (raku-mode                  . raku-indent-offset)               ; Perl6/Raku
+    (erlang-mode                . erlang-indent-level)              ; Erlang
+    (ada-mode                   . ada-indent)                       ; Ada
+    (sgml-mode                  . sgml-basic-offset)                ; SGML
+    (nxml-mode                  . nxml-child-indent)                ; XML
+    (pascal-mode                . pascal-indent-level)              ; Pascal
+    (typescript-mode            . typescript-indent-level)          ; Typescript
+    (sh-mode                    . sh-basic-offset)                  ; Shell Script
+    (ruby-mode                  . ruby-indent-level)                ; Ruby
+    (enh-ruby-mode              . enh-ruby-indent-level)            ; Ruby
+    (crystal-mode               . crystal-indent-level)             ; Crystal (Ruby)
+    (css-mode                   . css-indent-offset)                ; CSS
+    (rust-mode                  . rust-indent-offset)               ; Rust
+    (rustic-mode                . rustic-indent-offset)             ; Rust
+    (scala-mode                 . scala-indent:step)                ; Scala
+    (powershell-mode            . powershell-indent)                ; PowerShell
+    (ess-mode                   . ess-indent-offset)                ; ESS (R)
+    (yaml-mode                  . yaml-indent-offset)               ; YAML
+    (hack-mode                  . hack-indent-offset)               ; Hack
+
+    (default                    . standard-indent))                 ; default fallback
+  "A mapping from `major-mode' to its indent variable.")
+
+(defun lsp--get-indent-width (mode)
+  "Get indentation offset for MODE."
+  (or (alist-get mode lsp--formatting-indent-alist)
+      (lsp--get-indent-width (or (get mode 'derived-mode-parent) 'default))))
+
+(defun lsp--make-document-formatting-params ()
+  "Create document formatting params."
+  (lsp-make-document-formatting-params
+   :text-document (lsp--text-document-identifier)
+   :options (lsp-make-formatting-options
+             :tab-size (symbol-value (lsp--get-indent-width major-mode))
+             :insert-spaces (if indent-tabs-mode :json-false t))))
+
+(defun lsp-format-buffer ()
+  "Ask the server to format this document."
+  (interactive "*")
+  (cond ((lsp-feature? "textDocument/formatting")
+         (let ((edits (lsp-request "textDocument/formatting"
+                                   (lsp--make-document-formatting-params))))
+           (if (seq-empty-p edits)
+               (lsp--info "No formatting changes provided")
+             (lsp--apply-text-edits edits 'format))))
+        ((lsp-feature? "textDocument/rangeFormatting")
+         (save-restriction
+           (widen)
+           (lsp-format-region (point-min) (point-max))))
+        (t (signal 'lsp-capability-not-supported (list "documentFormattingProvider")))))
+
+(defun lsp-format-region (s e)
+  "Ask the server to format the region, or if none is selected, the current line."
+  (interactive "r")
+  (let ((edits (lsp-request
+                "textDocument/rangeFormatting"
+                (lsp--make-document-range-formatting-params s e))))
+    (if (seq-empty-p edits)
+        (lsp--info "No formatting changes provided")
+      (lsp--apply-text-edits edits 'format))))
+
+(defmacro lsp-make-interactive-code-action (func-name code-action-kind)
+  "Define an interactive function FUNC-NAME that attempts to
+execute a CODE-ACTION-KIND action."
+  `(defun ,(intern (concat "lsp-" (symbol-name func-name))) ()
+     ,(format "Perform the %s code action, if available." code-action-kind)
+     (interactive)
+     (condition-case nil
+         (lsp-execute-code-action-by-kind ,code-action-kind)
+       (lsp-no-code-actions
+        (when (called-interactively-p 'any)
+          (lsp--info ,(format "%s action not available" code-action-kind)))))))
+
+(lsp-make-interactive-code-action organize-imports "source.organizeImports")
+
+(defun lsp--make-document-range-formatting-params (start end)
+  "Make DocumentRangeFormattingParams for selected region."
+  (lsp:set-document-range-formatting-params-range (lsp--make-document-formatting-params)
+                                                  (lsp--region-to-range start end)))
+
+(defconst lsp--highlight-kind-face
+  '((1 . lsp-face-highlight-textual)
+    (2 . lsp-face-highlight-read)
+    (3 . lsp-face-highlight-write)))
+
+(defun lsp--remove-overlays (name)
+  (save-restriction
+    (widen)
+    (remove-overlays (point-min) (point-max) name t)))
+
+(defun lsp-document-highlight ()
+  "Highlight all relevant references to the symbol under point."
+  (interactive)
+  (lsp--remove-overlays 'lsp-highlight) ;; clear any previous highlights
+  (setq lsp--have-document-highlights nil
+        lsp--symbol-bounds-of-last-highlight-invocation nil)
+  (let ((lsp-enable-symbol-highlighting t))
+    (lsp--document-highlight)))
+
+(defun lsp--document-highlight-callback (highlights)
+  "Create a callback to process the reply of a
+'textDocument/documentHighlight' message for the buffer BUF.
+A reference is highlighted only if it is visible in a window."
+  (lsp--remove-overlays 'lsp-highlight)
+
+  (let* ((wins-visible-pos (-map (lambda (win)
+                                   (cons (1- (line-number-at-pos (window-start win) t))
+                                         (1+ (line-number-at-pos (window-end win) t))))
+                                 (get-buffer-window-list nil nil 'visible))))
+    (setq lsp--have-document-highlights t)
+    (-map
+     (-lambda ((&DocumentHighlight :range (&Range :start (start &as &Position :line start-line)
+                                                  :end (end &as &Position :line end-line))
+                                   :kind?))
+       (-map
+        (-lambda ((start-window . end-window))
+          ;; Make the overlay only if the reference is visible
+          (let ((start-point (lsp--position-to-point start))
+                (end-point (lsp--position-to-point end)))
+            (when (and (> (1+ start-line) start-window)
+                       (< (1+ end-line) end-window)
+                       (not (and lsp-symbol-highlighting-skip-current
+                                 (<= start-point (point) end-point))))
+              (-doto (make-overlay start-point end-point)
+                (overlay-put 'face (cdr (assq (or kind? 1) lsp--highlight-kind-face)))
+                (overlay-put 'lsp-highlight t)))))
+        wins-visible-pos))
+     highlights)))
+
+(defcustom lsp-symbol-kinds
+  '((1 . "File")
+    (2 . "Module")
+    (3 . "Namespace")
+    (4 . "Package")
+    (5 . "Class")
+    (6 . "Method")
+    (7 . "Property")
+    (8 . "Field")
+    (9 . "Constructor")
+    (10 . "Enum")
+    (11 . "Interface")
+    (12 . "Function")
+    (13 . "Variable")
+    (14 . "Constant")
+    (15 . "String")
+    (16 . "Number")
+    (17 . "Boolean")
+    (18 . "Array")
+    (19 . "Object")
+    (20 . "Key")
+    (21 . "Null")
+    (22 . "Enum Member")
+    (23 . "Struct")
+    (24 . "Event")
+    (25 . "Operator")
+    (26 . "Type Parameter"))
+  "Alist mapping SymbolKinds to human-readable strings.
+Various Symbol objects in the LSP protocol have an integral type,
+specifying what they are. This alist maps such type integrals to
+readable representations of them. See
+`https://microsoft.github.io/language-server-protocol/specifications/specification-current/',
+namespace SymbolKind."
+  :group 'lsp-mode
+  :type '(alist :key-type integer :value-type string))
+(defalias 'lsp--symbol-kind 'lsp-symbol-kinds)
+
+(lsp-defun lsp--symbol-information-to-xref
+  ((&SymbolInformation :kind :name
+                       :location (&Location :uri :range (&Range :start
+                                                                (&Position :line :character)))))
+  "Return a `xref-item' from SYMBOL information."
+  (xref-make (format "[%s] %s" (alist-get kind lsp-symbol-kinds) name)
+             (xref-make-file-location (lsp--uri-to-path uri)
+                                      line
+                                      character)))
+
+(defun lsp--get-document-symbols ()
+  "Get document symbols.
+
+If the buffer has not been modified since symbols were last
+retrieved, simply return the latest result.
+
+Else, if the request was initiated by Imenu updating its menu-bar
+entry, perform it asynchronously; i.e., give Imenu the latest
+result and then force a refresh when a new one is available.
+
+Else (e.g., due to interactive use of `imenu' or `xref'),
+perform the request synchronously."
+  (if (= (buffer-chars-modified-tick) lsp--document-symbols-tick)
+      lsp--document-symbols
+    (let ((method "textDocument/documentSymbol")
+          (params `(:textDocument ,(lsp--text-document-identifier)))
+          (tick (buffer-chars-modified-tick)))
+      (if (not lsp--document-symbols-request-async)
+          (prog1
+              (setq lsp--document-symbols (lsp-request method params))
+            (setq lsp--document-symbols-tick tick))
+        (lsp-request-async method params
+                           (lambda (document-symbols)
+                             (setq lsp--document-symbols document-symbols
+                                   lsp--document-symbols-tick tick)
+                             (lsp--imenu-refresh))
+                           :mode 'alive)
+        lsp--document-symbols))))
+
+(advice-add 'imenu-update-menubar :around
+            (lambda (oldfun &rest r)
+              (let ((lsp--document-symbols-request-async t))
+                (apply oldfun r))))
+
+(defun lsp--document-symbols->document-symbols-hierarchy (document-symbols current-position)
+  "Convert DOCUMENT-SYMBOLS to symbols hierarchy on CURRENT-POSITION."
+  (-let (((symbol &as &DocumentSymbol? :children?)
+          (seq-find (-lambda ((&DocumentSymbol :range))
+                      (lsp-point-in-range? current-position range))
+                    document-symbols)))
+    (if children?
+        (cons symbol (lsp--document-symbols->document-symbols-hierarchy children? current-position))
+      (when symbol
+        (list symbol)))))
+
+(lsp-defun lsp--symbol-information->document-symbol ((&SymbolInformation :name :kind :location :container-name? :deprecated?))
+  "Convert a SymbolInformation to a DocumentInformation"
+  (lsp-make-document-symbol :name name
+                            :kind kind
+                            :range (lsp:location-range location)
+                            :children? nil
+                            :deprecated? deprecated?
+                            :selection-range (lsp:location-range location)
+                            :detail? container-name?))
+
+(defun lsp--symbols-informations->document-symbols-hierarchy (symbols-informations current-position)
+  "Convert SYMBOLS-INFORMATIONS to symbols hierarchy on CURRENT-POSITION."
+  (--> symbols-informations
+    (-keep (-lambda ((symbol &as &SymbolInformation :location (&Location :range)))
+             (when (lsp-point-in-range? current-position range)
+               (lsp--symbol-information->document-symbol symbol)))
+           it)
+    (sort it (-lambda ((&DocumentSymbol :range (&Range :start a-start-position :end a-end-position))
+                       (&DocumentSymbol :range (&Range :start b-start-position :end b-end-position)))
+               (and (lsp--position-compare b-start-position a-start-position)
+                    (lsp--position-compare a-end-position b-end-position))))))
+
+(defun lsp--symbols->document-symbols-hierarchy (symbols)
+  "Convert SYMBOLS to symbols-hierarchy."
+  (when-let ((first-symbol (lsp-seq-first symbols)))
+    (let ((cur-position (lsp-make-position :line (plist-get (lsp--cur-position) :line)
+                                           :character (plist-get (lsp--cur-position) :character))))
+      (if (lsp-symbol-information? first-symbol)
+          (lsp--symbols-informations->document-symbols-hierarchy symbols cur-position)
+        (lsp--document-symbols->document-symbols-hierarchy symbols cur-position)))))
+
+(defun lsp--xref-backend () 'xref-lsp)
+
+(cl-defmethod xref-backend-identifier-at-point ((_backend (eql xref-lsp)))
+  (propertize (or (thing-at-point 'symbol) "")
+              'identifier-at-point t))
+
+(defun lsp--xref-elements-index (symbols path)
+  (-mapcat
+   (-lambda (sym)
+     (pcase-exhaustive sym
+       ((DocumentSymbol :name :children? :selection-range (Range :start))
+        (cons (cons (concat path name)
+                    (lsp--position-to-point start))
+              (lsp--xref-elements-index children? (concat path name " / "))))
+       ((SymbolInformation :name :location (Location :range (Range :start)))
+        (list (cons (concat path name)
+                    (lsp--position-to-point start))))))
+   symbols))
+
+(defvar-local lsp--symbols-cache nil)
+
+(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql xref-lsp)))
+  (if (lsp--find-workspaces-for "textDocument/documentSymbol")
+      (progn
+        (setq lsp--symbols-cache (lsp--xref-elements-index
+                                  (lsp--get-document-symbols) nil))
+        lsp--symbols-cache)
+    (list (propertize (or (thing-at-point 'symbol) "")
+                      'identifier-at-point t))))
+
+(cl-defmethod xref-backend-definitions ((_backend (eql xref-lsp)) identifier)
+  (save-excursion
+    (unless (get-text-property 0 'identifier-at-point identifier)
+      (goto-char (cl-rest (or (assoc identifier lsp--symbols-cache)
+                              (user-error "Unable to find symbol %s in current document" identifier)))))
+    (lsp--locations-to-xref-items (lsp-request "textDocument/definition"
+                                               (lsp--text-document-position-params)))))
+
+(cl-defmethod xref-backend-references ((_backend (eql xref-lsp)) identifier)
+  (save-excursion
+    (unless (get-text-property 0 'identifier-at-point identifier)
+      (goto-char (cl-rest (or (assoc identifier lsp--symbols-cache)
+                              (user-error "Unable to find symbol %s" identifier)))))
+    (lsp--locations-to-xref-items (lsp-request "textDocument/references"
+                                               (lsp--make-reference-params)))))
+
+(cl-defmethod xref-backend-apropos ((_backend (eql xref-lsp)) pattern)
+  (seq-map #'lsp--symbol-information-to-xref
+           (lsp-request "workspace/symbol" `(:query ,pattern))))
+
+(defcustom lsp-rename-use-prepare t
+  "Whether `lsp-rename' should do a prepareRename first.
+For some language servers, textDocument/prepareRename might be
+too slow, in which case this variable may be set to nil.
+`lsp-rename' will then use `thing-at-point' `symbol' to determine
+the symbol to rename at point."
+  :group 'lsp-mode
+  :type 'boolean)
+
+(defun lsp--get-symbol-to-rename ()
+  "Get a symbol to rename and placeholder at point.
+Returns a cons ((START . END) . PLACEHOLDER?), and nil if
+renaming is generally supported but cannot be done at point.
+START and END are the bounds of the identifiers being renamed,
+while PLACEHOLDER?, is either nil or a string suggested by the
+language server as the initial input of a new-name prompt."
+  (unless (lsp-feature? "textDocument/rename")
+    (error "The connected server(s) doesn't support renaming"))
+  (if (and lsp-rename-use-prepare (lsp-feature? "textDocument/prepareRename"))
+      (when-let ((response
+                  (lsp-request "textDocument/prepareRename"
+                               (lsp--text-document-position-params))))
+        (let* ((bounds (lsp--range-to-region
+                        (if (lsp-range? response)
+                            response
+                          (lsp:prepare-rename-result-range response))))
+               (placeholder
+                (and (not (lsp-range? response))
+                     (lsp:prepare-rename-result-placeholder response))))
+          (cons bounds placeholder)))
+    (when-let ((bounds (bounds-of-thing-at-point 'symbol)))
+      (cons bounds nil))))
+
+(defface lsp-face-rename '((t :underline t))
+  "Face used to highlight the identifier being renamed.
+Renaming can be done using `lsp-rename'."
+  :group 'lsp-mode)
+
+(defface lsp-rename-placeholder-face '((t :inherit font-lock-variable-name-face))
+  "Face used to display the rename placeholder in.
+When calling `lsp-rename' interactively, this will be the face of
+the new name."
+  :group 'lsp-mode)
+
+(defvar lsp-rename-history '()
+  "History for `lsp--read-rename'.")
+
+(defun lsp--read-rename (at-point)
+  "Read a new name for a `lsp-rename' at `point' from the user.
+AT-POINT shall be a structure as returned by
+`lsp--get-symbol-to-rename'.
+
+Returns a string, which should be the new name for the identifier
+at point. If renaming cannot be done at point (as determined from
+AT-POINT), throw a `user-error'.
+
+This function is for use in `lsp-rename' only, and shall not be
+relied upon."
+  (unless at-point
+    (user-error "`lsp-rename' is invalid here"))
+  (-let* ((((start . end) . placeholder?) at-point)
+          ;; Do the `buffer-substring' first to not include `lsp-face-rename'
+          (rename-me (buffer-substring start end))
+          (placeholder (or placeholder? rename-me))
+          (placeholder (propertize placeholder 'face 'lsp-rename-placeholder-face))
+
+          overlay)
+    ;; We need unwind protect, as the user might cancel here, causing the
+    ;; overlay to linger.
+    (unwind-protect
+        (progn
+          (setq overlay (make-overlay start end))
+          (overlay-put overlay 'face 'lsp-face-rename)
+
+          (read-string (format "Rename %s to: " rename-me) placeholder
+                       'lsp-rename-history))
+      (and overlay (delete-overlay overlay)))))
+
+(defun lsp-rename (newname)
+  "Rename the symbol (and all references to it) under point to NEWNAME."
+  (interactive (list (lsp--read-rename (lsp--get-symbol-to-rename))))
+  (when-let ((edits (lsp-request "textDocument/rename"
+                                 `( :textDocument ,(lsp--text-document-identifier)
+                                    :position ,(lsp--cur-position)
+                                    :newName ,newname))))
+    (lsp--apply-workspace-edit edits 'rename)))
+
+(defun lsp-show-xrefs (xrefs display-action references?)
+  (unless (region-active-p) (push-mark nil t))
+  (if (boundp 'xref-show-definitions-function)
+      (with-no-warnings
+        (xref-push-marker-stack)
+        (funcall (if references? xref-show-xrefs-function xref-show-definitions-function)
+                 (-const xrefs)
+                 `((window . ,(selected-window))
+                   (display-action . ,display-action))))
+    (xref--show-xrefs xrefs display-action)))
+
+(cl-defmethod seq-empty-p ((ht hash-table))
+  "Function `seq-empty-p' for hash-table."
+  (hash-table-empty-p ht))
+
+(cl-defun lsp-find-locations (method &optional extra &key display-action references?)
+  "Send request named METHOD and get cross references of the symbol under point.
+EXTRA is a plist of extra parameters.
+REFERENCES? t when METHOD returns references."
+  (let ((loc (lsp-request method
+                          (append (lsp--text-document-position-params) extra))))
+    (if (seq-empty-p loc)
+        (lsp--error "Not found for: %s" (or (thing-at-point 'symbol t) ""))
+      (lsp-show-xrefs (lsp--locations-to-xref-items loc) display-action references?))))
+
+(cl-defun lsp-find-declaration (&key display-action)
+  "Find declarations of the symbol under point."
+  (interactive)
+  (lsp-find-locations "textDocument/declaration" nil :display-action display-action))
+
+(cl-defun lsp-find-definition (&key display-action)
+  "Find definitions of the symbol under point."
+  (interactive)
+  (lsp-find-locations "textDocument/definition" nil :display-action display-action))
+
+(defun lsp-find-definition-mouse (click)
+  "Click to start `lsp-find-definition' at clicked point."
+  (interactive "e")
+  (let* ((ec (event-start click))
+         (p1 (posn-point ec))
+         (w1 (posn-window ec)))
+    (select-window w1)
+    (goto-char p1)
+    (lsp-find-definition)))
+
+(cl-defun lsp-find-implementation (&key display-action)
+  "Find implementations of the symbol under point."
+  (interactive)
+  (lsp-find-locations "textDocument/implementation"
+                      nil
+                      :display-action display-action
+                      :references? t))
+
+(cl-defun lsp-find-references (&optional include-declaration &key display-action)
+  "Find references of the symbol under point."
+  (interactive "P")
+  (lsp-find-locations "textDocument/references"
+                      (list :context `(:includeDeclaration ,(lsp-json-bool include-declaration)))
+                      :display-action display-action
+                      :references? t))
+
+(cl-defun lsp-find-type-definition (&key display-action)
+  "Find type definitions of the symbol under point."
+  (interactive)
+  (lsp-find-locations "textDocument/typeDefinition" nil :display-action display-action))
+
+(defalias 'lsp-find-custom #'lsp-find-locations)
+(defalias 'lsp-goto-implementation #'lsp-find-implementation)
+(defalias 'lsp-goto-type-definition #'lsp-find-type-definition)
+
+(with-eval-after-load 'evil
+  (evil-set-command-property 'lsp-find-definition :jump t)
+  (evil-set-command-property 'lsp-find-implementation :jump t)
+  (evil-set-command-property 'lsp-find-references :jump t)
+  (evil-set-command-property 'lsp-find-type-definition :jump t))
+
+(defun lsp--find-workspaces-for (msg-or-method)
+  "Find all workspaces in the current project that can handle MSG."
+  (let ((method (if (stringp msg-or-method)
+                    msg-or-method
+                  (plist-get msg-or-method :method))))
+    (-if-let (reqs (cdr (assoc method lsp-method-requirements)))
+        (-let (((&plist :capability :check-command) reqs))
+          (--filter
+           (with-lsp-workspace it
+             (or
+              (when check-command (funcall check-command it))
+              (when capability (lsp--capability capability))
+              (lsp--registered-capability method)
+              (and (not capability) (not check-command))))
+           (lsp-workspaces)))
+      (lsp-workspaces))))
+
+(defun lsp-can-execute-command? (command-name)
+  "Returns non-nil if current language server(s) can execute COMMAND-NAME.
+The command is executed via `workspace/executeCommand'"
+  (cl-position
+   command-name
+   (lsp:execute-command-options-commands
+    (lsp:server-capabilities-execute-command-provider?
+     (lsp--server-capabilities)))
+   :test #'equal))
+
+(defalias 'lsp-feature? 'lsp--find-workspaces-for)
+
+(cl-defmethod lsp-execute-command (_server _command _arguments)
+  "Dispatch COMMAND execution."
+  (signal 'cl-no-applicable-method nil))
+
+(defun lsp-workspace-command-execute (command &optional args)
+  "Execute workspace COMMAND with ARGS."
+  (condition-case-unless-debug err
+      (let ((params (if args
+                        (list :command command :arguments args)
+                      (list :command command))))
+        (lsp-request "workspace/executeCommand" params))
+    (error
+     (error "`workspace/executeCommand' with `%s' failed.\n\n%S"
+            command err))))
+
+(defun lsp-send-execute-command (command &optional args)
+  "Create and send a 'workspace/executeCommand' message having command COMMAND and optional ARGS."
+  (lsp-workspace-command-execute command args))
+
+(defalias 'lsp-point-to-position #'lsp--point-to-position)
+(defalias 'lsp-text-document-identifier #'lsp--text-document-identifier)
+(defalias 'lsp--send-execute-command #'lsp-send-execute-command)
+(defalias 'lsp-on-open #'lsp--text-document-did-open)
+(defalias 'lsp-on-save #'lsp--text-document-did-save)
+
+(defun lsp--set-configuration (settings)
+  "Set the SETTINGS for the lsp server."
+  (lsp-notify "workspace/didChangeConfiguration" `(:settings ,settings)))
+
+(defun lsp-current-buffer ()
+  (or lsp--virtual-buffer
+      (current-buffer)))
+
+(defun lsp-buffer-live-p (buffer-id)
+  (if-let ((buffer-live (plist-get buffer-id :buffer-live?)))
+      (funcall buffer-live buffer-id)
+    (buffer-live-p buffer-id)))
+
+(defun lsp--on-set-visited-file-name (old-func &rest args)
+  "Advice around function `set-visited-file-name'.
+
+This advice sends textDocument/didClose for the old file and
+textDocument/didOpen for the new file."
+  (when lsp--cur-workspace
+    (lsp--text-document-did-close t))
+  (prog1 (apply old-func args)
+    (when lsp--cur-workspace
+      (lsp--text-document-did-open))))
+
+(advice-add 'set-visited-file-name :around #'lsp--on-set-visited-file-name)
+
+(defvar lsp--flushing-delayed-changes nil)
+
+(defun lsp--send-no-wait (message proc)
+  "Send MESSAGE to PROC without waiting for further output."
+
+  (unless lsp--flushing-delayed-changes
+    (let ((lsp--flushing-delayed-changes t))
+      (lsp--flush-delayed-changes)))
+
+  (condition-case err
+      (process-send-string proc message)
+    ('error (lsp--error "Sending to process failed with the following error: %s"
+                        (error-message-string err)))))
+
+(define-error 'lsp-parse-error
+  "Error parsing message from language server" 'lsp-error)
+(define-error 'lsp-unknown-message-type
+  "Unknown message type" '(lsp-error lsp-parse-error))
+(define-error 'lsp-unknown-json-rpc-version
+  "Unknown JSON-RPC protocol version" '(lsp-error lsp-parse-error))
+(define-error 'lsp-no-content-length
+  "Content-Length header missing in message" '(lsp-error lsp-parse-error))
+(define-error 'lsp-invalid-header-name
+  "Invalid header name" '(lsp-error lsp-parse-error))
+
+;;  id  method
+;;   x    x     request
+;;   x    .     response
+;;   .    x     notification
+(defun lsp--get-message-type (json-data)
+  "Get the message type from JSON-DATA."
+  (if (lsp:json-message-id? json-data)
+      (if (lsp:json-message-error? json-data)
+          'response-error
+        (if (lsp:json-message-method? json-data)
+            'request
+          'response))
+    'notification))
+
+(defconst lsp--default-notification-handlers
+  (ht ("window/showMessage" #'lsp--window-show-message)
+      ("window/logMessage" #'lsp--window-log-message)
+      ("textDocument/publishDiagnostics" #'lsp--on-diagnostics)
+      ("textDocument/diagnosticsEnd" #'ignore)
+      ("textDocument/diagnosticsBegin" #'ignore)
+      ("telemetry/event" #'ignore)
+      ("$/progress" (lambda (workspace params)
+                      (funcall lsp-progress-function workspace params)))))
+
+(lsp-defun lsp--on-notification (workspace (&JSONNotification :params :method))
+  "Call the appropriate handler for NOTIFICATION."
+  (-let ((client (lsp--workspace-client workspace)))
+    (when (lsp--log-io-p method)
+      (lsp--log-entry-new (lsp--make-log-entry method nil params 'incoming-notif)
+                          lsp--cur-workspace))
+    (if-let ((handler (or (gethash method (lsp--client-notification-handlers client))
+                          (gethash method lsp--default-notification-handlers))))
+        (funcall handler workspace params)
+      (when (and method (not (string-prefix-p "$" method)))
+        (lsp-warn "Unknown notification: %s" method)))))
+
+(lsp-defun lsp--build-workspace-configuration-response ((&ConfigurationParams :items))
+  "Get section configuration.
+PARAMS are the `workspace/configuration' request params"
+  (->> items
+       (-map (-lambda ((&ConfigurationItem :section?))
+               (-let* ((path-parts (split-string section? "\\."))
+                       (path-without-last (s-join "." (-slice path-parts 0 -1)))
+                       (path-parts-len (length path-parts)))
+                 (cond
+                  ((<= path-parts-len 1)
+                   (ht-get (lsp-configuration-section section?)
+                           (car-safe path-parts)
+                           (ht-create)))
+                  ((> path-parts-len 1)
+                   (when-let ((section (lsp-configuration-section path-without-last))
+                              (keys path-parts))
+                     (while (and keys section)
+                       (setf section (ht-get section (pop keys))))
+                     section))))))
+       (apply #'vector)))
+
+(defun lsp--send-request-response (workspace recv-time request response)
+  "Send the RESPONSE for REQUEST in WORKSPACE and log if needed."
+  (-let* (((&JSONResponse :params :method :id) request)
+          (process (lsp--workspace-proc workspace))
+          (response (lsp--make-response id response))
+          (req-entry (and lsp-log-io
+                          (lsp--make-log-entry method id params 'incoming-req)))
+          (resp-entry (and lsp-log-io
+                           (lsp--make-log-entry method id response 'outgoing-resp
+                                                (/ (nth 2 (time-since recv-time)) 1000)))))
+    ;; Send response to the server.
+    (when (lsp--log-io-p method)
+      (lsp--log-entry-new req-entry workspace)
+      (lsp--log-entry-new resp-entry workspace))
+    (lsp--send-no-wait (lsp--make-message response) process)))
+
+(lsp-defun lsp--on-request (workspace (request &as &JSONRequest :params :method))
+  "Call the appropriate handler for REQUEST, and send the return value to the server.
+WORKSPACE is the active workspace."
+  (-let* ((recv-time (current-time))
+          (client (lsp--workspace-client workspace))
+          (buffers (lsp--workspace-buffers workspace))
+          handler
+          (response (cond
+                     ((setq handler (gethash method (lsp--client-request-handlers client) nil))
+                      (funcall handler workspace params))
+                     ((setq handler (gethash method (lsp--client-async-request-handlers client) nil))
+                      (funcall handler workspace params
+                               (-partial #'lsp--send-request-response
+                                         workspace recv-time request))
+                      'delay-response)
+                     ((equal method "client/registerCapability")
+                      (mapc #'lsp--server-register-capability
+                            (lsp:registration-params-registrations params))
+                      (mapc (lambda (buf)
+                              (when (lsp-buffer-live-p buf)
+                                (lsp-with-current-buffer buf
+                                  (lsp-unconfig-buffer)
+                                  (lsp-configure-buffer))))
+                            buffers)
+                      nil)
+                     ((equal method "window/showMessageRequest")
+                      (let ((choice (lsp--window-log-message-request params)))
+                        `(:title ,choice)))
+                     ((equal method "window/showDocument")
+                      (let ((success? (lsp--window-show-document params)))
+                        (lsp-make-show-document-result :success (or success?
+                                                                    :json-false))))
+                     ((equal method "client/unregisterCapability")
+                      (mapc #'lsp--server-unregister-capability
+                            (lsp:unregistration-params-unregisterations params))
+                      (mapc (lambda (buf)
+                              (when (lsp-buffer-live-p buf)
+                                (lsp-with-current-buffer buf
+                                  (lsp-unconfig-buffer)
+                                  (lsp-configure-buffer))))
+                            buffers)
+                      nil)
+                     ((equal method "workspace/applyEdit")
+                      (list :applied (condition-case err
+                                         (prog1 t
+                                           (lsp--apply-workspace-edit (lsp:apply-workspace-edit-params-edit params) 'server-requested))
+                                       (error
+                                        (lsp--error "Failed to apply edits with message %s"
+                                                    (error-message-string err))
+                                        :json-false))))
+                     ((equal method "workspace/configuration")
+                      (with-lsp-workspace workspace
+                        (if-let ((buf (car buffers)))
+                            (lsp-with-current-buffer buf
+                              (lsp--build-workspace-configuration-response params))
+                          (lsp--with-workspace-temp-buffer (lsp--workspace-root workspace)
+                            (lsp--build-workspace-configuration-response params)))))
+                     ((equal method "workspace/workspaceFolders")
+                      (let ((folders (or (-> workspace
+                                             (lsp--workspace-client)
+                                             (lsp--client-server-id)
+                                             (gethash (lsp-session-server-id->folders (lsp-session))))
+                                         (lsp-session-folders (lsp-session)))))
+                        (->> folders
+                             (-distinct)
+                             (-map (lambda (folder)
+                                     (list :uri (lsp--path-to-uri folder))))
+                             (apply #'vector))))
+                     ((equal method "window/workDoneProgress/create")
+                      nil ;; no specific reply, no processing required
+                      )
+                     ((equal method "workspace/semanticTokens/refresh")
+                      (when (and lsp-semantic-tokens-enable
+                                 (fboundp 'lsp--semantic-tokens-on-refresh))
+                        (lsp--semantic-tokens-on-refresh workspace))
+                      nil)
+                     ((equal method "workspace/codeLens/refresh")
+                      (when (and lsp-lens-enable
+                                 (fboundp 'lsp--lens-on-refresh))
+                        (lsp--lens-on-refresh workspace))
+                      nil)
+                     (t (lsp-warn "Unknown request method: %s" method) nil))))
+    ;; Send response to the server.
+    (unless (eq response 'delay-response)
+      (lsp--send-request-response workspace recv-time request response))))
+
+(lsp-defun lsp--error-string ((&JSONError :message :code))
+  "Format ERR as a user friendly string."
+  (format "Error from the Language Server: %s (%s)"
+          message
+          (or (car (alist-get code lsp--errors)) "Unknown error")))
+
+(defun lsp--get-body-length (headers)
+  (let ((content-length (cdr (assoc "Content-Length" headers))))
+    (if content-length
+        (string-to-number content-length)
+
+      ;; This usually means either the server or our parser is
+      ;; screwed up with a previous Content-Length
+      (error "No Content-Length header"))))
+
+(defun lsp--parse-header (s)
+  "Parse string S as a LSP (KEY . VAL) header."
+  (let ((pos (string-match "\:" s))
+        key val)
+    (unless pos
+      (signal 'lsp-invalid-header-name (list s)))
+    (setq key (substring s 0 pos)
+          val (s-trim-left (substring s (+ 1 pos))))
+    (when (equal key "Content-Length")
+      (cl-assert (cl-loop for c across val
+                          when (or (> c ?9) (< c ?0)) return nil
+                          finally return t)
+                 nil (format "Invalid Content-Length value: %s" val)))
+    (cons key val)))
+
+(defmacro lsp--read-json (str)
+  "Read json string STR."
+  (if (progn
+        (require 'json)
+        (fboundp 'json-parse-string))
+      `(json-parse-string ,str
+                          :object-type (if lsp-use-plists
+                                           'plist
+                                         'hash-table)
+                          :null-object nil
+                          :false-object nil)
+    `(let ((json-array-type 'vector)
+           (json-object-type (if lsp-use-plists
+                                 'plist
+                               'hash-table))
+           (json-false nil))
+       (json-read-from-string ,str))))
+
+(defmacro lsp-json-read-buffer ()
+  "Read json from the current buffer."
+  (if (progn
+        (require 'json)
+        (fboundp 'json-parse-string))
+      `(json-parse-buffer :object-type (if lsp-use-plists
+                                           'plist
+                                         'hash-table)
+                          :null-object nil
+                          :false-object nil)
+    `(let ((json-array-type 'vector)
+           (json-object-type (if lsp-use-plists
+                                 'plist
+                               'hash-table))
+           (json-false nil))
+       (json-read))))
+
+(defun lsp--read-json-file (file-path)
+  "Read json file."
+  (-> file-path
+    (f-read-text)
+    (lsp--read-json)))
+
+(defun lsp--parser-on-message (json-data workspace)
+  "Called when the parser P read a complete MSG from the server."
+  (with-demoted-errors "Error processing message %S."
+    (with-lsp-workspace workspace
+      (let* ((client (lsp--workspace-client workspace))
+             (id (--when-let (lsp:json-response-id json-data)
+                   (if (stringp it) (string-to-number it) it)))
+             (data (lsp:json-response-result json-data)))
+        (pcase (lsp--get-message-type json-data)
+          ('response
+           (cl-assert id)
+           (-let [(callback _ method _ before-send) (gethash id (lsp--client-response-handlers client))]
+             (when (lsp--log-io-p method)
+               (lsp--log-entry-new
+                (lsp--make-log-entry method id data 'incoming-resp
+                                     (/ (nth 2 (time-since before-send)) 1000))
+                workspace))
+             (when callback
+               (remhash id (lsp--client-response-handlers client))
+               (funcall callback (lsp:json-response-result json-data)))))
+          ('response-error
+           (cl-assert id)
+           (-let [(_ callback method _ before-send) (gethash id (lsp--client-response-handlers client))]
+             (when (lsp--log-io-p method)
+               (lsp--log-entry-new
+                (lsp--make-log-entry method id (lsp:json-response-error-error json-data)
+                                     'incoming-resp (/ (nth 2 (time-since before-send)) 1000))
+                workspace))
+             (when callback
+               (remhash id (lsp--client-response-handlers client))
+               (funcall callback (lsp:json-response-error-error json-data)))))
+          ('notification
+           (lsp--on-notification workspace json-data))
+          ('request (lsp--on-request workspace json-data)))))))
+
+(defvar lsp-parsed-message nil
+  "This will store the string representation of the json message.
+
+In some cases like #1807 we lose information during json
+deserialization.")
+
+(defun lsp--create-filter-function (workspace)
+  "Make filter for the workspace."
+  (let ((body-received 0)
+        leftovers body-length body chunk)
+    (lambda (_proc input)
+      (setf chunk (if (s-blank? leftovers)
+                      input
+                    (concat leftovers input)))
+
+      (let (messages)
+        (while (not (s-blank? chunk))
+          (if (not body-length)
+              ;; Read headers
+              (if-let ((body-sep-pos (string-match-p "\r\n\r\n" chunk)))
+                  ;; We've got all the headers, handle them all at once:
+                  (setf body-length (lsp--get-body-length
+                                     (mapcar #'lsp--parse-header
+                                             (split-string
+                                              (substring-no-properties chunk
+                                                                       (or (string-match-p "Content-Length" chunk)
+                                                                           (error "Unable to find Content-Length header."))
+                                                                       body-sep-pos)
+                                              "\r\n")))
+                        body-received 0
+                        leftovers nil
+                        chunk (substring-no-properties chunk (+ body-sep-pos 4)))
+
+                ;; Haven't found the end of the headers yet. Save everything
+                ;; for when the next chunk arrives and await further input.
+                (setf leftovers chunk
+                      chunk nil))
+            (let* ((chunk-length (string-bytes chunk))
+                   (left-to-receive (- body-length body-received))
+                   (this-body (if (< left-to-receive chunk-length)
+                                  (prog1 (substring-no-properties chunk 0 left-to-receive)
+                                    (setf chunk (substring-no-properties chunk left-to-receive)))
+                                (prog1 chunk
+                                  (setf chunk nil))))
+                   (body-bytes (string-bytes this-body)))
+              (push this-body body)
+              (setf body-received (+ body-received body-bytes))
+              (when (>= chunk-length left-to-receive)
+                (condition-case err
+                    (with-temp-buffer
+                      (apply #'insert
+                             (nreverse
+                              (prog1 body
+                                (setf leftovers nil
+                                      body-length nil
+                                      body-received nil
+                                      body nil))))
+                      (decode-coding-region (point-min)
+                                            (point-max)
+                                            'utf-8)
+                      (goto-char (point-min))
+                      (push (lsp-json-read-buffer) messages))
+
+                  (error
+                   (lsp-warn "Failed to parse the following chunk:\n'''\n%s\n'''\nwith message %s"
+                             (concat leftovers input)
+                             err)))))))
+        (mapc (lambda (msg)
+                (lsp--parser-on-message msg workspace))
+              (nreverse messages))))))
+
+(defvar-local lsp--line-col-to-point-hash-table nil
+  "Hash table with keys (line . col) and values that are either point positions
+or markers.")
+
+(defcustom lsp-imenu-detailed-outline t
+  "Whether `lsp-imenu' should include signatures.
+This will be ignored if the server doesn't provide the necessary
+information, for example if it doesn't support DocumentSymbols."
+  :group 'lsp-imenu
+  :type 'boolean)
+
+(defface lsp-details-face '((t :height 0.8 :inherit shadow))
+  "Used to display additional information troughout `lsp'.
+Things like line numbers, signatures, ... are considered
+additional information. Often, additional faces are defined that
+inherit from this face by default, like `lsp-signature-face', and
+they may be customized for finer control."
+  :group 'lsp-mode)
+
+(defface lsp-signature-face '((t :inherit lsp-details-face))
+  "Used to display signatures in `imenu', ...."
+  :group 'lsp-mode)
+
+(lsp-defun lsp-render-symbol ((&DocumentSymbol :name :detail? :deprecated?)
+                              show-detail?)
+  "Render INPUT0, an `&DocumentSymbol', to a string.
+If SHOW-DETAIL? is set, make use of its `:detail?' field (often
+the signature)."
+  (let ((detail (and show-detail? (s-present? detail?)
+                     (propertize (concat " " (s-trim-left detail?))
+                                 'face 'lsp-signature-face)))
+        (name (if deprecated?
+                  (propertize name 'face 'lsp-face-semhl-deprecated) name)))
+    (concat name detail)))
+
+(lsp-defun lsp-render-symbol-information ((&SymbolInformation :name :deprecated? :container-name?)
+                                          separator)
+  "Render a piece of SymbolInformation.
+Handle :deprecated?. If SEPARATOR is non-nil, the
+symbol's (optional) parent, SEPARATOR and the symbol itself are
+concatenated."
+  (when (and separator container-name? (not (string-empty-p container-name?)))
+    (setq name (concat name separator container-name?)))
+  (if deprecated? (propertize name 'face 'lsp-face-semhl-deprecated) name))
+
+(defun lsp--symbol-to-imenu-elem (sym)
+  "Convert SYM to imenu element.
+
+SYM is a SymbolInformation message.
+
+Return a cons cell (full-name . start-point)."
+  (let ((start-point (ht-get lsp--line-col-to-point-hash-table
+                             (lsp--get-line-and-col sym))))
+    (cons (lsp-render-symbol-information
+           sym (and lsp-imenu-show-container-name
+                    lsp-imenu-container-name-separator))
+          start-point)))
+
+(lsp-defun lsp--symbol-to-hierarchical-imenu-elem ((sym &as &DocumentSymbol :children?))
+  "Convert SYM to hierarchical imenu elements.
+
+SYM is a DocumentSymbol message.
+
+Return cons cell (\"symbol-name (symbol-kind)\" . start-point) if
+SYM doesn't have any children. Otherwise return a cons cell with
+an alist
+
+  (\"symbol-name\" . ((\"(symbol-kind)\" . start-point)
+                    cons-cells-from-children))"
+  (let ((filtered-children (lsp--imenu-filter-symbols children?))
+        (signature (lsp-render-symbol sym lsp-imenu-detailed-outline)))
+    (if (seq-empty-p filtered-children)
+        (cons signature
+              (ht-get lsp--line-col-to-point-hash-table
+                      (lsp--get-line-and-col sym)))
+      (cons signature
+            (lsp--imenu-create-hierarchical-index filtered-children)))))
+
+(lsp-defun lsp--symbol-ignore ((&SymbolInformation :kind))
+  "Determine if SYM is for the current document and is to be shown."
+  ;; It's a SymbolInformation or DocumentSymbol, which is always in the
+  ;; current buffer file.
+  (and lsp-imenu-index-symbol-kinds
+       (numberp kind)
+       (let ((clamped-kind (if (< 0 kind (length lsp/symbol-kind-lookup))
+                               kind
+                             0)))
+         (not (memql (aref lsp/symbol-kind-lookup clamped-kind)
+                     lsp-imenu-index-symbol-kinds)))))
+
+(lsp-defun lsp--get-symbol-type ((&SymbolInformation :kind))
+  "The string name of the kind of SYM."
+  (alist-get kind lsp-symbol-kinds "Other"))
+
+(defun lsp--get-line-and-col (sym)
+  "Obtain the line and column corresponding to SYM."
+  (-let* ((location (lsp:symbol-information-location sym))
+          (name-range (or (and location (lsp:location-range location))
+                          (lsp:document-symbol-selection-range sym)))
+          ((&Range :start (&Position :line :character)) name-range))
+    (cons line character)))
+
+(defun lsp--collect-lines-and-cols (symbols)
+  "Return a sorted list ((line . col) ...) of the locations of SYMBOLS."
+  (let ((stack (mapcar 'identity symbols))
+        line-col-list)
+    (while stack
+      (let ((sym (pop stack)))
+        (push (lsp--get-line-and-col sym) line-col-list)
+        (unless (seq-empty-p (lsp:document-symbol-children? sym))
+          (setf stack (nconc (lsp--imenu-filter-symbols (lsp:document-symbol-children? sym)) stack)))))
+    (-sort #'lsp--line-col-comparator line-col-list)))
+
+(defun lsp--convert-line-col-to-points-batch (line-col-list)
+  "Convert a sorted list of positions from line-column
+representation to point representation."
+  (let ((line-col-to-point-map (ht-create))
+        (inhibit-field-text-motion t)
+        (curr-line 0))
+    (lsp-save-restriction-and-excursion
+      (goto-char (point-min))
+      (cl-loop for (line . col) in line-col-list do
+               (forward-line (- line curr-line))
+               (setq curr-line line)
+               (let ((line-end (line-end-position)))
+                 (if (or (not col) (> col (- line-end (point))))
+                     (goto-char line-end)
+                   (forward-char col)))
+               (ht-set! line-col-to-point-map (cons line col) (if imenu-use-markers
+                                                                  (point-marker)
+                                                                (point)))))
+    line-col-to-point-map))
+
+(cl-defun lsp--line-col-comparator ((l1 . c1) (l2 . c2))
+  (or (< l1 l2)
+      (and (= l1 l2)
+           (cond ((and c1 c2)
+                  (< c1 c2))
+                 (c1 t)))))
+
+(defun lsp-imenu-create-uncategorized-index (symbols)
+  "Create imenu index from document SYMBOLS.
+This function, unlike `lsp-imenu-create-categorized-index', does
+not categorize by type, but instead returns an `imenu' index
+corresponding to the symbol hierarchy returned by the server
+directly."
+  (let* ((lsp--line-col-to-point-hash-table (-> symbols
+                                                lsp--collect-lines-and-cols
+                                                lsp--convert-line-col-to-points-batch)))
+    (if (lsp--imenu-hierarchical-p symbols)
+        (lsp--imenu-create-hierarchical-index symbols)
+      (lsp--imenu-create-non-hierarchical-index symbols))))
+
+(defcustom lsp-imenu-symbol-kinds
+  '((1 . "Files")
+    (2 . "Modules")
+    (3 . "Namespaces")
+    (4 . "Packages")
+    (5 . "Classes")
+    (6 . "Methods")
+    (7 . "Properties")
+    (8 . "Fields")
+    (9 . "Constructors")
+    (10 . "Enums")
+    (11 . "Interfaces")
+    (12 . "Functions")
+    (13 . "Variables")
+    (14 . "Constants")
+    (15 . "Strings")
+    (16 . "Numbers")
+    (17 . "Booleans")
+    (18 . "Arrays")
+    (19 . "Objects")
+    (20 . "Keys")
+    (21 . "Nulls")
+    (22 . "Enum Members")
+    (23 . "Structs")
+    (24 . "Events")
+    (25 . "Operators")
+    (26 . "Type Parameters"))
+  "`lsp-symbol-kinds', but only used by `imenu'.
+A new variable is needed, as it is `imenu' convention to use
+pluralized categories, which `lsp-symbol-kinds' doesn't. If the
+non-pluralized names are preferred, this can be set to
+`lsp-symbol-kinds'."
+  :type '(alist :key-type integer :value-type string))
+
+(defun lsp--imenu-kind->name (kind)
+  (alist-get kind lsp-imenu-symbol-kinds "?"))
+
+(defun lsp-imenu-create-top-level-categorized-index (symbols)
+  "Create an `imenu' index categorizing SYMBOLS by type.
+Only root symbols are categorized.
+
+See `lsp-symbol-kinds' to customize the category naming. SYMBOLS
+shall be a list of DocumentSymbols or SymbolInformation."
+  (mapcan
+   (-lambda ((type . symbols))
+     (let ((cat (lsp--imenu-kind->name type))
+           (symbols (lsp-imenu-create-uncategorized-index symbols)))
+       ;; If there is no :kind (this is being defensive), or we couldn't look it
+       ;; up, just display the symbols inline, without categories.
+       (if cat (list (cons cat symbols)) symbols)))
+   (sort (seq-group-by #'lsp:document-symbol-kind symbols)
+         (-lambda ((kinda) (kindb)) (< kinda kindb)))))
+
+(lsp-defun lsp--symbol->imenu ((sym &as &DocumentSymbol :selection-range (&RangeToPoint :start)))
+  "Convert an `&DocumentSymbol' to an `imenu' entry."
+  (cons (lsp-render-symbol sym lsp-imenu-detailed-outline) start))
+
+(defun lsp--imenu-create-categorized-index-1 (symbols)
+  "Returns an `imenu' index from SYMBOLS categorized by type.
+The result looks like this: ((\"Variables\" . (...)))."
+  (->>
+   symbols
+   (mapcan
+    (-lambda ((sym &as &DocumentSymbol :kind :children?))
+      (if (seq-empty-p children?)
+          (list (list kind (lsp--symbol->imenu sym)))
+        (let ((parent (lsp-render-symbol sym lsp-imenu-detailed-outline)))
+          (cons
+           (list kind (lsp--symbol->imenu sym))
+           (mapcar (-lambda ((type .  imenu-items))
+                     (list type (cons parent (mapcan #'cdr imenu-items))))
+                   (-group-by #'car (lsp--imenu-create-categorized-index-1 children?))))))))
+   (-group-by #'car)
+   (mapcar
+    (-lambda ((kind . syms))
+      (cons kind (mapcan #'cdr syms))))))
+
+(defun lsp--imenu-create-categorized-index (symbols)
+  (let ((syms (lsp--imenu-create-categorized-index-1 symbols)))
+    (dolist (sym syms)
+      (setcar sym (lsp--imenu-kind->name (car sym))))
+    syms))
+
+(lsp-defun lsp--symbol-information->imenu ((sym &as &SymbolInformation :location (&Location :range (&RangeToPoint :start))))
+  (cons (lsp-render-symbol-information sym nil) start))
+
+(defun lsp--imenu-create-categorized-index-flat (symbols)
+  "Create a kind-categorized index for SymbolInformation."
+  (mapcar (-lambda ((kind . syms))
+            (cons (lsp--imenu-kind->name kind)
+                  (mapcan (-lambda ((parent . children))
+                            (let ((children (mapcar #'lsp--symbol-information->imenu children)))
+                              (if parent (list (cons parent children)) children)))
+                          (-group-by #'lsp:symbol-information-container-name? syms))))
+          (seq-group-by #'lsp:symbol-information-kind symbols)))
+
+(defun lsp-imenu-create-categorized-index (symbols)
+  (if (lsp--imenu-hierarchical-p symbols)
+      (lsp--imenu-create-categorized-index symbols)
+    (lsp--imenu-create-categorized-index-flat symbols)))
+
+(defcustom lsp-imenu-index-function #'lsp-imenu-create-uncategorized-index
+  "Function that should create an `imenu' index.
+It will be called with a list of SymbolInformation or
+DocumentSymbols, whose first level is already filtered. It shall
+then return an appropriate `imenu' index (see
+`imenu-create-index-function').
+
+Note that this interface is not stable, and subject to change any
+time."
+  :group 'lsp-imenu
+  :type '(radio
+          (const :tag "Categorize by type"
+                 lsp-imenu-create-categorized-index)
+          (const :tag "Categorize root symbols by type"
+                 lsp-imenu-create-top-level-categorized-index)
+          (const :tag "Uncategorized, inline entries"
+                 lsp-imenu-create-uncategorized-index)
+          (function :tag "Custom function")))
+
+(defun lsp--imenu-create-index ()
+  "Create an `imenu' index based on the language server.
+Respects `lsp-imenu-index-function'."
+  (let ((symbols (lsp--imenu-filter-symbols (lsp--get-document-symbols))))
+    (funcall lsp-imenu-index-function symbols)))
+
+(defun lsp--imenu-filter-symbols (symbols)
+  "Filter out unsupported symbols from SYMBOLS."
+  (seq-remove #'lsp--symbol-ignore symbols))
+
+(defun lsp--imenu-hierarchical-p (symbols)
+  "Determine whether any element in SYMBOLS has children."
+  (seq-some #'lsp-document-symbol? symbols))
+
+(defun lsp--imenu-create-non-hierarchical-index (symbols)
+  "Create imenu index for non-hierarchical SYMBOLS.
+
+SYMBOLS are a list of DocumentSymbol messages.
+
+Return a nested alist keyed by symbol names. e.g.
+
+   ((\"SomeClass\" (\"(Class)\" . 10)
+                 (\"someField (Field)\" . 20)
+                 (\"someFunction (Function)\" . 25)
+                 (\"SomeSubClass\" (\"(Class)\" . 30)
+                                  (\"someSubField (Field)\" . 35))
+    (\"someFunction (Function)\" . 40))"
+  (seq-map (lambda (nested-alist)
+             (cons (car nested-alist)
+                   (seq-map #'lsp--symbol-to-imenu-elem (cdr nested-alist))))
+           (seq-group-by #'lsp--get-symbol-type symbols)))
+
+(defun lsp--imenu-create-hierarchical-index (symbols)
+  "Create imenu index for hierarchical SYMBOLS.
+
+SYMBOLS are a list of DocumentSymbol messages.
+
+Return a nested alist keyed by symbol names. e.g.
+
+   ((\"SomeClass\" (\"(Class)\" . 10)
+                 (\"someField (Field)\" . 20)
+                 (\"someFunction (Function)\" . 25)
+                 (\"SomeSubClass\" (\"(Class)\" . 30)
+                                  (\"someSubField (Field)\" . 35))
+    (\"someFunction (Function)\" . 40))"
+  (seq-map #'lsp--symbol-to-hierarchical-imenu-elem
+           (seq-sort #'lsp--imenu-symbol-lessp symbols)))
+
+(defun lsp--imenu-symbol-lessp (sym1 sym2)
+  (let* ((compare-results (mapcar (lambda (method)
+                                    (funcall (alist-get method lsp--imenu-compare-function-alist)
+                                             sym1 sym2))
+                                  lsp-imenu-sort-methods))
+         (result (seq-find (lambda (result)
+                             (not (= result 0)))
+                           compare-results
+                           0)))
+    (and (numberp result) (< result 0))))
+
+(lsp-defun lsp--imenu-compare-kind ((&SymbolInformation :kind left)
+                                    (&SymbolInformation :kind right))
+  "Compare SYM1 and SYM2 by kind."
+  (- left right))
+
+(defun lsp--imenu-compare-line-col (sym1 sym2)
+  (if (lsp--line-col-comparator
+       (lsp--get-line-and-col sym1)
+       (lsp--get-line-and-col sym2))
+      -1
+    1))
+
+(lsp-defun lsp--imenu-compare-name ((&SymbolInformation :name name1)
+                                    (&SymbolInformation :name name2))
+  "Compare SYM1 and SYM2 by name."
+  (let ((result (compare-strings name1 0 (length name1) name2 0 (length name2))))
+    (if (numberp result) result 0)))
+
+(defun lsp--imenu-refresh ()
+  "Force Imenu to refresh itself."
+  (imenu--menubar-select imenu--rescan-item))
+
+(defun lsp-enable-imenu ()
+  "Use lsp-imenu for the current buffer."
+  (imenu--cleanup)
+  (setq-local imenu-create-index-function #'lsp--imenu-create-index)
+  (setq-local imenu-menubar-modified-tick -1)
+  (setq-local imenu--index-alist nil)
+  (when menu-bar-mode
+    (lsp--imenu-refresh)))
+
+(defun lsp-resolve-final-function (command)
+  "Resolve final function COMMAND."
+  (-let [command (if (functionp command) (funcall command) command)]
+    (cl-etypecase command
+      (list
+       (cl-assert (seq-every-p (apply-partially #'stringp) command) nil
+                  "Invalid command list")
+       command)
+      (string (list command)))))
+
+(defun lsp-server-present? (final-command)
+  "Check whether FINAL-COMMAND is present."
+  ;; executable-find only gained support for remote checks after 27 release
+  (or (and (cond
+            ((not (file-remote-p default-directory))
+             (executable-find (cl-first final-command)))
+            ((version<= "27.0" emacs-version)
+             (with-no-warnings (executable-find (cl-first final-command) (file-remote-p default-directory))))
+            (t))
+           (prog1 t
+             (lsp-log "Command \"%s\" is present on the path." (s-join " " final-command))))
+      (ignore (lsp-log "Command \"%s\" is not present on the path." (s-join " " final-command)))))
+
+(defun lsp--value-to-string (value)
+  "Convert VALUE to a string that can be set as value in an environment variable."
+  (cond
+   ((stringp value) value)
+   ((booleanp value) (if value
+                         "1"
+                       "0"))
+   ((and (sequencep value)
+         (seq-every-p #'stringp value)) (string-join value ":"))
+   (t (user-error "Only strings, booleans, and sequences of strings are supported as environment variables"))))
+
+(defun lsp--compute-process-environment (environment-fn)
+  "Append a list of KEY=VALUE from the alist ENVIRONMENT to `process-environment'.
+Ignore non-boolean keys whose value is nil."
+  (let ((environment (if environment-fn
+                         (funcall environment-fn)
+                       nil)))
+    (-flatten (cons (cl-loop for (key . value) in environment
+                             if (or (eval value)
+                                    (eq (get value 'custom-type) 'boolean))
+                             collect (concat key "=" (lsp--value-to-string
+                                                      (eval value))))
+                    process-environment))))
+
+(defun lsp-stdio-connection (command &optional test-command)
+  "Returns a connection property list using COMMAND.
+COMMAND can be: A string, denoting the command to launch the
+language server. A list of strings, denoting an executable with
+its command line arguments. A function, that either returns a
+string or a list of strings. In all cases, the launched language
+server should send and receive messages on standard I/O.
+TEST-COMMAND is a function with no arguments which returns
+whether the command is present or not. When not specified
+`lsp-mode' will check whether the first element of the list
+returned by COMMAND is available via `executable-find'"
+  (cl-check-type command (or string
+                             function
+                             (and list
+                                  (satisfies (lambda (l)
+                                               (seq-every-p (lambda (el)
+                                                              (stringp el))
+                                                            l))))))
+  (list :connect (lambda (filter sentinel name environment-fn)
+                   (let ((final-command (lsp-resolve-final-function command))
+                         (process-name (generate-new-buffer-name name))
+                         (process-environment
+                          (lsp--compute-process-environment environment-fn)))
+                     (let* ((stderr-buf (format "*%s::stderr*" process-name))
+                            (proc (make-process
+                                   :name process-name
+                                   :connection-type 'pipe
+                                   :buffer (format "*%s*" process-name)
+                                   :coding 'no-conversion
+                                   :command final-command
+                                   :filter filter
+                                   :sentinel sentinel
+                                   :stderr stderr-buf
+                                   :noquery t)))
+                       (set-process-query-on-exit-flag proc nil)
+                       (set-process-query-on-exit-flag (get-buffer-process stderr-buf) nil)
+                       (with-current-buffer (get-buffer stderr-buf)
+                         ;; Make the *NAME::stderr* buffer buffer-read-only, q to bury, etc.
+                         (special-mode))
+                       (cons proc proc))))
+        :test? (or
+                test-command
+                (lambda () (-> command lsp-resolve-final-function lsp-server-present?)))))
+
+(defun lsp--open-network-stream (host port name)
+  "Open network stream to HOST:PORT.
+  NAME will be passed to `open-network-stream'.
+  RETRY-COUNT is the number of the retries.
+  SLEEP-INTERVAL is the sleep interval between each retry."
+  (let* ((retries 0)
+         (sleep-interval 0.01)
+         (number-of-retries (/ lsp-tcp-connection-timeout sleep-interval))
+         connection)
+    (while (and (not connection) (< retries number-of-retries))
+      (condition-case err
+          (setq connection (open-network-stream name nil host port
+                                                :type 'plain
+                                                :coding 'no-conversion))
+        (file-error
+         (let ((inhibit-message t))
+           (lsp--warn "Failed to connect to %s:%s with error message %s"
+                      host
+                      port
+                      (error-message-string err))
+           (sleep-for sleep-interval)
+           (cl-incf retries)))))
+    (or connection (error "Port %s was never taken. Consider increasing `lsp-tcp-connection-timeout'." port))))
+
+(defun lsp--find-available-port (host starting-port)
+  "Find available port on HOST starting from STARTING-PORT."
+  (let ((success nil)
+        (port starting-port))
+    (while (and (not success))
+      (condition-case _err
+          (progn
+            (delete-process (open-network-stream "*connection-test*" nil host port :type 'plain))
+            (cl-incf port))
+        (file-error (setq success t))))
+    port))
+
+(defun lsp-tcp-connection (command-fn)
+  "Returns a connection property list similar to `lsp-stdio-connection'.
+COMMAND-FN can only be a function that takes a single argument, a
+port number. It should return a command for launches a language server
+process listening for TCP connections on the provided port."
+  (cl-check-type command-fn function)
+  (list
+   :connect (lambda (filter sentinel name environment-fn)
+              (let* ((host "localhost")
+                     (port (lsp--find-available-port host (cl-incf lsp--tcp-port)))
+                     (command (funcall command-fn port))
+                     (final-command (if (consp command) command (list command)))
+                     (_ (unless (executable-find (cl-first final-command))
+                          (user-error (format "Couldn't find executable %s" (cl-first final-command)))))
+                     (process-environment
+                      (lsp--compute-process-environment environment-fn))
+                     (proc (make-process :name name :connection-type 'pipe :coding 'no-conversion
+                                         :command final-command :sentinel sentinel :stderr (format "*%s::stderr*" name) :noquery t))
+                     (tcp-proc (lsp--open-network-stream host port (concat name "::tcp"))))
+
+                ;; TODO: Same :noquery issue (see above)
+                (set-process-query-on-exit-flag proc nil)
+                (set-process-query-on-exit-flag tcp-proc nil)
+                (set-process-filter tcp-proc filter)
+                (cons tcp-proc proc)))
+   :test? (lambda () (executable-find (cl-first (funcall command-fn 0))))))
+
+(defalias 'lsp-tcp-server 'lsp-tcp-server-command)
+
+(defun lsp-tcp-server-command (command-fn)
+  "Create tcp server connection.
+In this mode Emacs is TCP server and the language server connects
+to it. COMMAND is function with one parameter(the port) and it
+should return the command to start the LS server."
+  (cl-check-type command-fn function)
+  (list
+   :connect (lambda (filter sentinel name environment-fn)
+              (let* (tcp-client-connection
+                     (tcp-server (make-network-process :name (format "*tcp-server-%s*" name)
+                                                       :buffer (format "*tcp-server-%s*" name)
+                                                       :family 'ipv4
+                                                       :service lsp--tcp-server-port
+                                                       :sentinel (lambda (proc _string)
+                                                                   (lsp-log "Language server %s is connected." name)
+                                                                   (setf tcp-client-connection proc))
+                                                       :server 't))
+                     (port (process-contact tcp-server :service))
+                     (final-command (funcall command-fn port))
+                     (process-environment
+                      (lsp--compute-process-environment environment-fn))
+                     (cmd-proc (make-process :name name
+                                             :connection-type 'pipe
+                                             :coding 'no-conversion
+                                             :command final-command
+                                             :stderr (format "*tcp-server-%s*::stderr" name)
+                                             :noquery t)))
+                (let ((retries 0))
+                  ;; wait for the client to connect (we sit-for 500 ms, so have to double lsp--tcp-server-wait-seconds)
+                  (while (and (not tcp-client-connection) (< retries (* 2 lsp--tcp-server-wait-seconds)))
+                    (lsp--info "Waiting for connection for %s, retries: %s" name retries)
+                    (sit-for 0.500)
+                    (cl-incf retries)))
+
+                (unless tcp-client-connection
+                  (condition-case nil (delete-process tcp-server) (error))
+                  (condition-case nil (delete-process cmd-proc) (error))
+                  (error "Failed to create connection to %s on port %s" name port))
+                (lsp--info "Successfully connected to %s" name)
+
+                (set-process-query-on-exit-flag cmd-proc nil)
+                (set-process-query-on-exit-flag tcp-client-connection nil)
+                (set-process-query-on-exit-flag tcp-server nil)
+
+                (set-process-filter tcp-client-connection filter)
+                (set-process-sentinel tcp-client-connection sentinel)
+                (cons tcp-client-connection cmd-proc)))
+   :test? (lambda () (executable-find (cl-first (funcall command-fn 0))))))
+
+(defun lsp-tramp-connection (local-command &optional generate-error-file-fn)
+  "Create LSP stdio connection named name.
+LOCAL-COMMAND is either list of strings, string or function which
+returns the command to execute."
+  (list :connect (lambda (filter sentinel name environment-fn)
+                   (let* ((final-command (lsp-resolve-final-function local-command))
+                          ;; wrap with stty to disable converting \r to \n
+                          (process-name (generate-new-buffer-name name))
+                          (wrapped-command (s-join
+                                            " "
+                                            (append '("stty" "raw" ";")
+                                                    final-command
+                                                    (list
+                                                     (concat "2>"
+                                                             (or (when generate-error-file-fn
+                                                                   (funcall generate-error-file-fn name))
+                                                                 (format "/tmp/%s-%s-stderr" name
+                                                                         (cl-incf lsp--stderr-index))))))))
+                          (process-environment
+                           (lsp--compute-process-environment environment-fn)))
+                     (let ((proc (start-file-process-shell-command process-name
+                                                                   (format "*%s*" process-name)
+                                                                   wrapped-command)))
+                       (set-process-sentinel proc sentinel)
+                       (set-process-filter proc filter)
+                       (set-process-query-on-exit-flag proc nil)
+                       (set-process-coding-system proc 'binary 'binary)
+                       (cons proc proc))))
+        :test? (lambda () (-> local-command lsp-resolve-final-function lsp-server-present?))))
+
+(defun lsp--auto-configure ()
+  "Autoconfigure `company', `flycheck', `lsp-ui', etc if they are installed."
+  (when (functionp 'lsp-ui-mode)
+    (lsp-ui-mode))
+
+  (when lsp-headerline-breadcrumb-enable
+    (add-hook 'lsp-configure-hook 'lsp-headerline-breadcrumb-mode))
+  (when lsp-modeline-code-actions-enable
+    (add-hook 'lsp-configure-hook 'lsp-modeline-code-actions-mode))
+  (when lsp-modeline-diagnostics-enable
+    (add-hook 'lsp-configure-hook 'lsp-modeline-diagnostics-mode))
+  (when lsp-modeline-workspace-status-enable
+    (add-hook 'lsp-configure-hook 'lsp-modeline-workspace-status-mode))
+  (when lsp-lens-enable
+    (add-hook 'lsp-configure-hook 'lsp-lens--enable))
+  (when lsp-semantic-tokens-enable
+    (add-hook 'lsp-configure-hook 'lsp-semantic-tokens--enable))
+
+  ;; yas-snippet config
+  (setq-local yas-inhibit-overlay-modification-protection t))
+
+(defvar-local lsp--buffer-deferred nil
+  "Whether buffer was loaded via `lsp-deferred'.")
+
+(defun lsp--restart-if-needed (workspace)
+  "Handler restart for WORKSPACE."
+  (when (or (eq lsp-restart 'auto-restart)
+            (eq (lsp--workspace-shutdown-action workspace) 'restart)
+            (and (eq lsp-restart 'interactive)
+                 (let ((query (format
+                               "Server %s exited with status %s(check corresponding stderr buffer for details). Do you want to restart it?"
+                               (lsp--workspace-print workspace)
+                               (process-status (lsp--workspace-proc workspace)))))
+                   (y-or-n-p query))))
+    (--each (lsp--workspace-buffers workspace)
+      (when (lsp-buffer-live-p it)
+        (lsp-with-current-buffer it
+          (if lsp--buffer-deferred
+              (lsp-deferred)
+            (lsp--info "Restarting LSP in buffer %s" (buffer-name))
+            (lsp)))))))
+
+(defun lsp--update-key (table key fn)
+  "Apply FN on value corresponding to KEY in TABLE."
+  (let ((existing-value (gethash key table)))
+    (if-let ((new-value (funcall fn existing-value)))
+        (puthash key new-value table)
+      (remhash key table))))
+
+(defun lsp--process-sentinel (workspace process exit-str)
+  "Create the sentinel for WORKSPACE."
+  (unless (process-live-p process)
+    (let* ((status (process-status process))
+           (folder->workspaces (lsp-session-folder->servers (lsp-session)))
+           (stderr (-> workspace lsp--workspace-proc process-name get-buffer)))
+
+      (lsp--warn "%s has exited (%s)"
+                 (process-name (lsp--workspace-proc workspace))
+                 (string-trim-right exit-str))
+
+      (with-lsp-workspace workspace
+        ;; Clean workspace related data in each of the buffers
+        ;; in the workspace.
+        (--each (lsp--workspace-buffers workspace)
+          (when (lsp-buffer-live-p it)
+            (lsp-with-current-buffer it
+              (setq lsp--buffer-workspaces (delete workspace lsp--buffer-workspaces))
+              (lsp--uninitialize-workspace)
+              (lsp--spinner-stop)
+              (lsp--remove-overlays 'lsp-highlight))))
+
+        ;; Cleanup session from references to the closed workspace.
+        (--each (hash-table-keys folder->workspaces)
+          (lsp--update-key folder->workspaces it (apply-partially 'delete workspace)))
+
+        ;; Kill standard error buffer only if the process exited normally.
+        ;; Leave it intact otherwise for debugging purposes.
+        (when (and (eq status 'exit) (zerop (process-exit-status process)) (buffer-live-p stderr))
+          (kill-buffer stderr)))
+
+      (run-hook-with-args 'lsp-after-uninitialized-functions workspace)
+
+      (if (eq (lsp--workspace-shutdown-action workspace) 'shutdown)
+          (lsp--info "Workspace %s shutdown." (lsp--workspace-print workspace))
+        (lsp--restart-if-needed workspace))
+      (lsp--cleanup-hanging-watches))))
+
+(defun lsp-workspace-folders (workspace)
+  "Return all folders associated with WORKSPACE."
+  (let (result)
+    (->> (lsp-session)
+      (lsp-session-folder->servers)
+      (maphash (lambda (folder workspaces)
+                 (when (-contains? workspaces workspace)
+                   (push folder result)))))
+    result))
+
+(defun lsp--start-workspace (session client-template root &optional initialization-options)
+  "Create new workspace for CLIENT-TEMPLATE with project root ROOT.
+INITIALIZATION-OPTIONS are passed to initialize function.
+SESSION is the active session."
+  (lsp--spinner-start)
+  (-let* ((default-directory root)
+          (client (copy-lsp--client client-template))
+          (workspace (make-lsp--workspace
+                      :root root
+                      :client client
+                      :status 'starting
+                      :buffers (list (lsp-current-buffer))
+                      :host-root (file-remote-p root)))
+          ((&lsp-cln 'server-id 'environment-fn 'new-connection 'custom-capabilities
+                     'multi-root 'initialized-fn) client)
+          ((proc . cmd-proc) (funcall
+                              (or (plist-get new-connection :connect)
+                                  (user-error "Client %s is configured incorrectly" client))
+                              (lsp--create-filter-function workspace)
+                              (apply-partially #'lsp--process-sentinel workspace)
+                              (format "%s" server-id)
+                              environment-fn))
+          (workspace-folders (gethash server-id (lsp-session-server-id->folders session))))
+    (setf (lsp--workspace-proc workspace) proc
+          (lsp--workspace-cmd-proc workspace) cmd-proc)
+
+    ;; update (lsp-session-folder->servers) depending on whether we are starting
+    ;; multi/single folder workspace
+    (mapc (lambda (project-root)
+            (->> session
+                 (lsp-session-folder->servers)
+                 (gethash project-root)
+                 (cl-pushnew workspace)))
+          (or workspace-folders (list root)))
+
+    (with-lsp-workspace workspace
+      (run-hooks 'lsp-before-initialize-hook)
+      (lsp-request-async
+       "initialize"
+       (append
+        (list :processId nil
+              :rootPath (lsp-file-local-name (expand-file-name root))
+              :clientInfo (list :name "emacs"
+                                :version (emacs-version))
+              :rootUri (lsp--path-to-uri root)
+              :capabilities (lsp--client-capabilities custom-capabilities)
+              :initializationOptions initialization-options
+              :workDoneToken "1")
+        (when lsp-server-trace
+          (list :trace lsp-server-trace))
+        (when multi-root
+          (->> workspace-folders
+               (-distinct)
+               (-map (lambda (folder)
+                       (list :uri (lsp--path-to-uri folder)
+                             :name (f-filename folder))))
+               (apply 'vector)
+               (list :workspaceFolders))))
+       (lambda (response)
+         (unless response
+           (lsp--spinner-stop)
+           (signal 'lsp-empty-response-error (list "initialize")))
+
+         (let* ((capabilities (lsp:initialize-result-capabilities response))
+                (json-object-type 'hash-table)
+                (text-document-sync (-some-> lsp-parsed-message
+                                      (json-read-from-string)
+                                      (ht-get "result")
+                                      (ht-get "capabilities")
+                                      (ht-get "textDocumentSync")))
+                (save (when (ht? text-document-sync)
+                        (ht-get text-document-sync "save"))))
+           ;; see #1807
+           (when (and (ht? save) (ht-empty? save))
+             (-> capabilities
+                 (lsp:server-capabilities-text-document-sync?)
+                 (lsp:set-text-document-sync-options-save? save)))
+
+           (setf (lsp--workspace-server-capabilities workspace) capabilities
+                 (lsp--workspace-status workspace) 'initialized)
+
+           (with-lsp-workspace workspace
+             (lsp-notify "initialized" lsp--empty-ht))
+
+           (when initialized-fn (funcall initialized-fn workspace))
+
+           (cl-callf2 -filter #'lsp-buffer-live-p (lsp--workspace-buffers workspace))
+           (->> workspace
+                (lsp--workspace-buffers)
+                (mapc (lambda (buffer)
+                        (lsp-with-current-buffer buffer
+                          (lsp--open-in-workspace workspace)))))
+
+           (with-lsp-workspace workspace
+             (run-hooks 'lsp-after-initialize-hook))
+           (lsp--info "%s initialized successfully in folders: %s"
+                      (lsp--workspace-print workspace)
+                      (lsp-workspace-folders workspace))))
+       :mode 'detached))
+    workspace))
+
+(defun lsp--load-default-session ()
+  "Load default session."
+  (setq lsp--session (or (condition-case err
+                             (lsp--read-from-file lsp-session-file)
+                           (error (lsp--error "Failed to parse the session %s, starting with clean one."
+                                              (error-message-string err))
+                                  nil))
+                         (make-lsp-session))))
+
+(defun lsp-session ()
+  "Get the session associated with the current buffer."
+  (or lsp--session (setq lsp--session (lsp--load-default-session))))
+
+(defun lsp--client-disabled-p (buffer-major-mode client)
+  (seq-some
+   (lambda (entry)
+     (pcase entry
+       ((pred symbolp) (eq entry client))
+       (`(,mode . ,client-or-list)
+        (and (eq mode buffer-major-mode)
+             (if (listp client-or-list)
+                 (memq client client-or-list)
+               (eq client client-or-list))))))
+   lsp-disabled-clients))
+
+\f
+;; download server
+
+(defcustom lsp-server-install-dir (expand-file-name
+                                   (locate-user-emacs-file (f-join ".cache" "lsp")))
+  "Directory in which the servers will be installed."
+  :risky t
+  :type 'directory
+  :package-version '(lsp-mode . "6.3")
+  :group 'lsp-mode)
+
+(defcustom lsp-verify-signature t
+  "Whether to check GPG signatures of downloaded files."
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0")
+  :group 'lsp-mode)
+
+(defvar lsp--dependencies (ht))
+
+(defun lsp-dependency (name &rest definitions)
+  "Used to specify a language server DEPENDENCY, the server
+executable or other required file path. Typically, the
+DEPENDENCY is found by locating it on the system path using
+`executable-find'.
+
+You can explicitly call lsp-dependency in your environment to
+specify the absolute path to the DEPENDENCY. For example, the
+typescript-language-server requires both the server and the
+typescript compiler. If you've installed them in a team shared
+read-only location, you can instruct lsp-mode to use them via
+
+ (eval-after-load 'lsp-mode
+   '(progn
+      (require 'lsp-javascript)
+      (lsp-dependency 'typescript-language-server `(:system ,tls-exe))
+      (lsp-dependency 'typescript `(:system ,ts-js))))
+
+where tls-exe is the absolute path to the typescript-language-server
+executable and ts-js is the absolute path to the typescript compiler
+JavaScript file, tsserver.js (the *.js is required for Windows)."
+  (ht-set lsp--dependencies name definitions))
+
+(defun lsp--server-binary-present? (client)
+  (unless (equal (lsp--client-server-id client) 'lsp-pwsh)
+    (condition-case ()
+        (-some-> client lsp--client-new-connection (plist-get :test?) funcall)
+      (error nil)
+      (args-out-of-range nil))))
+
+(define-minor-mode lsp-installation-buffer-mode
+  "Mode used in *lsp-installation* buffers.
+It can be used to set-up keybindings, etc. Disabling this mode
+detaches the installation buffer from commands like
+`lsp-select-installation-buffer'."
+  :init-value nil
+  :lighter nil)
+
+(defface lsp-installation-finished-buffer-face '((t :foreground "orange"))
+  "Face used for finished installation buffers.
+Used in `lsp-select-installation-buffer'."
+  :group 'lsp-mode)
+
+(defface lsp-installation-buffer-face '((t :foreground "green"))
+  "Face used for installation buffers still in progress.
+Used in `lsp-select-installation-buffer'."
+  :group 'lsp-mode)
+
+(defun lsp--installation-buffer? (buf)
+  "Check whether BUF is an `lsp-async-start-process' buffer."
+  (buffer-local-value 'lsp-installation-buffer-mode buf))
+
+(defun lsp-select-installation-buffer (&optional show-finished)
+  "Interactively choose an installation buffer.
+If SHOW-FINISHED is set, leftover (finished) installation buffers
+are still shown."
+  (interactive "P")
+  (let ((bufs (--filter (and (lsp--installation-buffer? it)
+                             (or show-finished (get-buffer-process it)))
+                        (buffer-list))))
+    (pcase bufs
+      (`nil (user-error "No installation buffers"))
+      (`(,buf) (pop-to-buffer buf))
+      (bufs (pop-to-buffer (completing-read "Select installation buffer: "
+                                            (--map (propertize (buffer-name it) 'face
+                                                               (if (get-buffer-process it)
+                                                                   'lsp-installation-buffer-face
+                                                                 'lsp-installation-finished-buffer-face))
+                                                   bufs)))))))
+
+(defun lsp-cleanup-installation-buffers ()
+  "Delete finished *lsp-installation* buffers."
+  (interactive)
+  (dolist (buf (buffer-list))
+    (when (and (lsp--installation-buffer? buf) (not (get-buffer-process buf)))
+      (kill-buffer buf))))
+
+(defun lsp--download-status ()
+  (-some--> #'lsp--client-download-in-progress?
+    (lsp--filter-clients it)
+    (-map (-compose #'symbol-name #'lsp--client-server-id) it)
+    (format "%s" it)
+    (propertize it 'face 'success)
+    (format " Installing following servers: %s" it)
+    (propertize it
+                'local-map (make-mode-line-mouse-map
+                            'mouse-1 #'lsp-select-installation-buffer)
+                'mouse-face 'highlight)))
+
+(defun lsp--install-server-internal (client &optional update?)
+  (unless (lsp--client-download-server-fn client)
+    (user-error "There is no automatic installation for `%s', you have to install it manually following lsp-mode's documentation."
+                (lsp--client-server-id client)))
+
+  (setf (lsp--client-download-in-progress? client) t)
+  (add-to-list 'global-mode-string '(t (:eval (lsp--download-status))))
+  (cl-flet ((done
+             (success? &optional error-message)
+             ;; run with idle timer to make sure the lsp command is executed in
+             ;; the main thread, see #2739.
+             (run-with-timer
+              0.0
+              nil
+              (lambda ()
+                (-let [(&lsp-cln 'server-id 'buffers) client]
+                  (setf (lsp--client-download-in-progress? client) nil
+                        (lsp--client-buffers client) nil)
+                  (if success?
+                      (lsp--info "Server %s downloaded, auto-starting in %s buffers." server-id
+                                 (length buffers))
+                    (lsp--error "Server %s install process failed with the following error message: %s.
+Check `*lsp-install*' and `*lsp-log*' buffer."
+                                server-id
+                                error-message))
+                  (seq-do
+                   (lambda (buffer)
+                     (when (lsp-buffer-live-p buffer)
+                       (lsp-with-current-buffer buffer
+                         (cl-callf2 -remove-item '(t (:eval (lsp--download-status)))
+                                    global-mode-string)
+                         (when success? (lsp)))))
+                   buffers)
+                  (unless (lsp--filter-clients #'lsp--client-download-in-progress?)
+                    (cl-callf2 -remove-item '(t (:eval (lsp--download-status)))
+                               global-mode-string)))))))
+    (lsp--info "Download %s started." (lsp--client-server-id client))
+    (condition-case err
+        (funcall
+         (lsp--client-download-server-fn client)
+         client
+         (lambda () (done t))
+         (lambda (msg) (done nil msg))
+         update?)
+      (error
+       (done nil (error-message-string err))))))
+
+(defun lsp--require-packages ()
+  "Load `lsp-client-packages' if needed."
+  (when (and lsp-auto-configure (not lsp--client-packages-required))
+    (seq-do (lambda (package)
+              ;; loading client is slow and `lsp' can be called repeatedly
+              (unless (featurep package)
+                (require package nil t)))
+            lsp-client-packages)
+    (setq lsp--client-packages-required t)))
+
+;;;###autoload
+(defun lsp-install-server (update? &optional server-id)
+  "Interactively install or re-install server.
+When prefix UPDATE? is t force installation even if the server is present."
+  (interactive "P")
+  (lsp--require-packages)
+  (let* ((chosen-client (or (gethash server-id lsp-clients)
+                            (lsp--completing-read
+                             "Select server to install/re-install: "
+                             (or (->> lsp-clients
+                                      (ht-values)
+                                      (-filter (-andfn
+                                                (-not #'lsp--client-download-in-progress?)
+                                                #'lsp--client-download-server-fn)))
+                                 (user-error "There are no servers with automatic installation"))
+                             (lambda (client)
+                               (let ((server-name (-> client lsp--client-server-id symbol-name)))
+                                 (if (lsp--server-binary-present? client)
+                                     (concat server-name " (Already installed)")
+                                   server-name)))
+                             nil
+                             t)))
+         (update? (or update?
+                      (and (not (lsp--client-download-in-progress? chosen-client))
+                           (lsp--server-binary-present? chosen-client)))))
+    (lsp--install-server-internal chosen-client update?)))
+
+;;;###autoload
+(defun lsp-update-server (&optional server-id)
+  "Interactively update a server."
+  (interactive)
+  (lsp--require-packages)
+  (let ((chosen-client (or (gethash server-id lsp-clients)
+                           (lsp--completing-read
+                            "Select server to update (if not on the list, probably you need to `lsp-install-server`): "
+                            (or (->> lsp-clients
+                                     (ht-values)
+                                     (-filter (-andfn
+                                               (-not #'lsp--client-download-in-progress?)
+                                               #'lsp--client-download-server-fn
+                                               #'lsp--server-binary-present?)))
+                                (user-error "There are no servers to update"))
+                            (lambda (client)
+                              (-> client lsp--client-server-id symbol-name))
+                            nil
+                            t))))
+    (lsp--install-server-internal chosen-client t)))
+
+;;;###autoload
+(defun lsp-ensure-server (server-id)
+  "Ensure server SERVER-ID"
+  (lsp--require-packages)
+  (if-let ((client (gethash server-id lsp-clients)))
+      (unless (lsp--server-binary-present? client)
+        (lsp--info "Server `%s' is not preset, installing..." server-id)
+        (lsp-install-server nil server-id))
+    (warn "Unable to find server registration with id %s" server-id)))
+
+(defun lsp-async-start-process (callback error-callback &rest command)
+  "Start async process COMMAND with CALLBACK and ERROR-CALLBACK."
+  (let ((name (cl-first command)))
+    (with-current-buffer (compilation-start (mapconcat #'shell-quote-argument command " ") t
+                                            (lambda (&rest _)
+                                              (generate-new-buffer-name (format "*lsp-install: %s*" name))))
+      (lsp-installation-buffer-mode +1)
+      (view-mode +1)
+      (add-hook
+       'compilation-finish-functions
+       (lambda (_buf status)
+         (if (string= "finished\n" status)
+             (condition-case err
+                 (funcall callback)
+               (error
+                (funcall error-callback (error-message-string err))))
+           (funcall error-callback (s-trim-right status))))
+       nil t))))
+
+(defun lsp-resolve-value (value)
+  "Resolve VALUE's value.
+If it is function - call it.
+If it is symbol - return it's value
+Otherwise returns value itself."
+  (cond
+   ((functionp value) (funcall value))
+   ((symbolp value) (symbol-value value))
+   (value)))
+
+(defvar lsp-deps-providers
+  (list :npm (list :path #'lsp--npm-dependency-path
+                   :install #'lsp--npm-dependency-install)
+        :system (list :path #'lsp--system-path)
+        :download (list :path #'lsp-download-path
+                        :install #'lsp-download-install)))
+
+(defun lsp--system-path (path)
+  "If PATH is absolute and exists return it as is. Otherwise,
+return the absolute path to the executable defined by PATH or
+nil."
+  ;; For node.js 'sub-packages' PATH may point to a *.js file. Consider the
+  ;; typescript-language-server. When lsp invokes the server, lsp needs to
+  ;; supply the path to the typescript compiler, tsserver.js, as an argument. To
+  ;; make code platform independent, one must pass the absolute path to the
+  ;; tsserver.js file (Windows requires a *.js file - see help on the JavaScript
+  ;; child process spawn command that is invoked by the
+  ;; typescript-language-server). This is why we check for existence and not
+  ;; that the path is executable.
+  (let ((path (lsp-resolve-value path)))
+    (if (and (f-absolute? path)
+             (f-exists? path))
+        path
+      (executable-find path))))
+
+(defun lsp-package-path (dependency)
+  "Path to the DEPENDENCY each of the registered providers."
+  (let (path)
+    (-first (-lambda ((provider . rest))
+              (setq path (-some-> lsp-deps-providers
+                           (plist-get provider)
+                           (plist-get :path)
+                           (apply rest))))
+            (gethash dependency lsp--dependencies))
+    path))
+
+(defun lsp-package-ensure (dependency callback error-callback)
+  "Asynchronously ensure a package."
+  (or (-first (-lambda ((provider . rest))
+                (-some-> lsp-deps-providers
+                  (plist-get provider)
+                  (plist-get :install)
+                  (apply (cl-list* callback error-callback rest))))
+              (gethash dependency lsp--dependencies))
+      (funcall error-callback (format "Unable to find a way to install %s" dependency))))
+
+\f
+;; npm handling
+
+;; https://docs.npmjs.com/files/folders#executables
+(cl-defun lsp--npm-dependency-path (&key package path &allow-other-keys)
+  "Return npm dependency PATH for PACKAGE."
+  (let ((path (executable-find
+               (f-join lsp-server-install-dir "npm" package
+                       (cond ((eq system-type 'windows-nt) "")
+                             (t "bin"))
+                       path))))
+    (unless (and path (f-exists? path))
+      (error "The package %s is not installed.  Unable to find %s" package path))
+    path))
+
+(cl-defun lsp--npm-dependency-install (callback error-callback &key package &allow-other-keys)
+  (if-let ((npm-binary (executable-find "npm")))
+      (progn
+        ;; Explicitly `make-directory' to work around NPM bug in
+        ;; versions 7.0.0 through 7.4.1. See
+        ;; https://github.com/emacs-lsp/lsp-mode/issues/2364 for
+        ;; discussion.
+        (make-directory (f-join lsp-server-install-dir "npm" package "lib") 'parents)
+        (lsp-async-start-process callback
+                                 error-callback
+                                 npm-binary
+                                 "-g"
+                                 "--prefix"
+                                 (f-join lsp-server-install-dir "npm" package)
+                                 "install"
+                                 package))
+    (lsp-log "Unable to install %s via `npm' because it is not present" package)
+    nil))
+
+\f
+;; Download URL handling
+(cl-defun lsp-download-install (callback error-callback &key url asc-url pgp-key store-path decompress &allow-other-keys)
+  (let* ((url (lsp-resolve-value url))
+         (store-path (lsp-resolve-value store-path))
+         ;; (decompress (lsp-resolve-value decompress))
+         (download-path
+          (pcase decompress
+            (:gzip (concat store-path ".gz"))
+            (:zip (concat store-path ".zip"))
+            (`nil store-path)
+            (_ (error ":decompress must be `:gzip', `:zip' or `nil'")))))
+    (make-thread
+     (lambda ()
+       (condition-case err
+           (progn
+             (when (f-exists? download-path)
+               (f-delete download-path))
+             (when (f-exists? store-path)
+               (f-delete store-path))
+             (lsp--info "Starting to download %s to %s..." url download-path)
+             (mkdir (f-parent download-path) t)
+             (url-copy-file url download-path)
+             (lsp--info "Finished downloading %s..." download-path)
+             (when (and lsp-verify-signature asc-url pgp-key)
+               (if (executable-find epg-gpg-program)
+                   (let ((asc-download-path (concat download-path ".asc"))
+                         (context (epg-make-context))
+                         (fingerprint)
+                         (signature))
+                     (when (f-exists? asc-download-path)
+                       (f-delete asc-download-path))
+                     (lsp--info "Starting to download %s to %s..." asc-url asc-download-path)
+                     (url-copy-file asc-url asc-download-path)
+                     (lsp--info "Finished downloading %s..." asc-download-path)
+                     (epg-import-keys-from-string context pgp-key)
+                     (setq fingerprint (epg-import-status-fingerprint
+                                        (car
+                                         (epg-import-result-imports
+                                          (epg-context-result-for context 'import)))))
+                     (lsp--info "Verifying signature %s..." asc-download-path)
+                     (epg-verify-file context asc-download-path download-path)
+                     (setq signature (car (epg-context-result-for context 'verify)))
+                     (unless (and
+                              (eq (epg-signature-status signature) 'good)
+                              (equal (epg-signature-fingerprint signature) fingerprint))
+                       (error "Failed to verify GPG signature: %s" (epg-signature-to-string signature))))
+                 (lsp--warn "GPG is not installed, skipping the signature check.")))
+             (when decompress
+               (lsp--info "Decompressing %s..." download-path)
+               (pcase decompress
+                 (:gzip
+                  (lsp-gunzip download-path))
+                 (:zip (lsp-unzip download-path (f-parent store-path))))
+               (lsp--info "Decompressed %s..." store-path))
+             (funcall callback))
+         (error (funcall error-callback err)))))))
+
+(cl-defun lsp-download-path (&key store-path binary-path set-executable? &allow-other-keys)
+  "Download URL and store it into STORE-PATH.
+
+SET-EXECUTABLE? when non-nil change the executable flags of
+STORE-PATH to make it executable. BINARY-PATH can be specified
+when the binary to start does not match the name of the
+archieve(e. g. when the archieve has multiple files)"
+  (let ((store-path (or (lsp-resolve-value binary-path)
+                        (lsp-resolve-value store-path))))
+    (cond
+     ((executable-find store-path) store-path)
+     ((and set-executable? (f-exists? store-path))
+      (set-file-modes store-path #o0700)
+      store-path)
+     ((f-exists? store-path) store-path))))
+\f
+;; unzip
+
+(defconst lsp-ext-pwsh-script "powershell -noprofile -noninteractive \
+-nologo -ex bypass Expand-Archive -path '%s' -dest '%s'"
+  "Powershell script to unzip file.")
+
+(defconst lsp-ext-unzip-script "bash -c 'mkdir -p %2$s && unzip -qq -o %1$s -d %2$s'"
+  "Unzip script to unzip file.")
+
+(defcustom lsp-unzip-script (cond ((executable-find "powershell") lsp-ext-pwsh-script)
+                                  ((executable-find "unzip") lsp-ext-unzip-script)
+                                  (t nil))
+  "The script to unzip."
+  :group 'lsp-mode
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-unzip (zip-file dest)
+  "Unzip ZIP-FILE to DEST."
+  (unless lsp-unzip-script
+    (error "Unable to find `unzip' or `powershell' on the path, please customize `lsp-unzip-script'"))
+  (shell-command (format lsp-unzip-script zip-file dest)))
+\f
+;; gunzip
+
+(defconst lsp-ext-gunzip-script "gzip -d %1$s"
+  "Script to decompress a gzippped file with gzip.")
+
+(defcustom lsp-gunzip-script (cond ((executable-find "gzip") lsp-ext-gunzip-script)
+                                   (t nil))
+  "The script to decompress a gzipped file.
+Should be a format string with one argument for the file to be decompressed
+in place."
+  :group 'lsp-mode
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-gunzip (gz-file)
+  "Decompress GZ-FILE in place."
+  (unless lsp-gunzip-script
+    (error "Unable to find `gzip' on the path, please either customize `lsp-gunzip-script' or manually decompress %s" gz-file))
+  (shell-command (format lsp-gunzip-script gz-file)))
+\f
+;; VSCode marketplace
+
+(defcustom lsp-vscode-ext-url
+  "https://marketplace.visualstudio.com/_apis/public/gallery/publishers/%s/vsextensions/%s/%s/vspackage"
+  "Vscode extension template url."
+  :group 'lsp-mode
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-vscode-extension-url (publisher name &optional version)
+  "Return the URL to vscode extension.
+PUBLISHER is the extension publisher.
+NAME is the name of the extension.
+VERSION is the version of the extension, defaults to `latest'"
+  (format lsp-vscode-ext-url publisher name (or version "latest")))
+
+\f
+
+;; Queueing prompts
+
+(defvar lsp--question-queue nil
+  "List of questions yet to be asked by `lsp-ask-question'.")
+
+(defun lsp-ask-question (question options callback)
+  "Prompt the user to answer the QUESTION with one of the OPTIONS from the
+minibuffer. Once the user selects an option, the CALLBACK function will be
+called, passing the selected option to it.
+
+If the user is currently being shown a question, the question will be stored in
+`lsp--question-queue', and will be asked once the user has answered the current
+question."
+  (add-to-list 'lsp--question-queue `(("question" . ,question)
+                                      ("options" . ,options)
+                                      ("callback" . ,callback)) t)
+  (when (eq (length lsp--question-queue) 1)
+    (lsp--process-question-queue)))
+
+(defun lsp--process-question-queue ()
+  "Take the first question from `lsp--question-queue', process it, then process
+the next question until the queue is empty."
+  (-let* (((&alist "question" "options" "callback") (car lsp--question-queue))
+          (answer (completing-read question options nil t)))
+    (pop lsp--question-queue)
+    (funcall callback answer)
+    (when lsp--question-queue
+      (lsp--process-question-queue))))
+
+(defun lsp--supports-buffer? (client)
+  (and
+   ;; both file and client remote or both local
+   (eq (---truthy? (file-remote-p (buffer-file-name)))
+       (---truthy? (lsp--client-remote? client)))
+
+   ;; activation function or major-mode match.
+   (if-let ((activation-fn (lsp--client-activation-fn client)))
+       (funcall activation-fn (buffer-file-name) major-mode)
+     (-contains? (lsp--client-major-modes client) major-mode))
+
+   ;; check whether it is enabled if `lsp-enabled-clients' is not null
+   (or (null lsp-enabled-clients)
+       (or (member (lsp--client-server-id client) lsp-enabled-clients)
+           (ignore (lsp--info "Client %s is not in lsp-enabled-clients"
+                              (lsp--client-server-id client)))))
+
+   ;; check whether it is not disabled.
+   (not (lsp--client-disabled-p major-mode (lsp--client-server-id client)))))
+
+(defun lsp--filter-clients (pred)
+  (->> lsp-clients hash-table-values (-filter pred)))
+
+(defun lsp--find-clients ()
+  "Find clients which can handle BUFFER-MAJOR-MODE.
+SESSION is the currently active session. The function will also
+pick only remote enabled clients in case the FILE-NAME is on
+remote machine and vice versa."
+  (-when-let (matching-clients (lsp--filter-clients (-andfn #'lsp--supports-buffer?
+                                                            #'lsp--server-binary-present?)))
+    (lsp-log "Found the following clients for %s: %s"
+             (buffer-file-name)
+             (s-join ", "
+                     (-map (lambda (client)
+                             (format "(server-id %s, priority %s)"
+                                     (lsp--client-server-id client)
+                                     (lsp--client-priority client)))
+                           matching-clients)))
+    (-let* (((add-on-clients main-clients) (-separate #'lsp--client-add-on? matching-clients))
+            (selected-clients (if-let ((main-client (and main-clients
+                                                         (--max-by (> (lsp--client-priority it)
+                                                                      (lsp--client-priority other))
+                                                                   main-clients))))
+                                  (cons main-client add-on-clients)
+                                add-on-clients)))
+      (lsp-log "The following clients were selected based on priority: %s"
+               (s-join ", "
+                       (-map (lambda (client)
+                               (format "(server-id %s, priority %s)"
+                                       (lsp--client-server-id client)
+                                       (lsp--client-priority client)))
+                             selected-clients)))
+      selected-clients)))
+
+(defun lsp-register-client (client)
+  "Registers LSP client CLIENT."
+  (cl-assert (symbolp (lsp--client-server-id client)) t)
+  (cl-assert (or
+              (functionp (lsp--client-activation-fn client))
+              (and (listp (lsp--client-major-modes client))
+                   (seq-every-p (apply-partially #'symbolp)
+                                (lsp--client-major-modes client))))
+             nil "Invalid activation-fn and/or major-modes.")
+  (let ((client-id (lsp--client-server-id client)))
+    (puthash client-id client lsp-clients)
+    (setplist (intern (format "lsp-%s-after-open-hook" client-id))
+              `( standard-value (nil) custom-type hook
+                 custom-package-version (lsp-mode . "7.0.1")
+                 variable-documentation ,(format "Hooks to run after `%s' server is run." client-id)
+                 custom-requests nil))))
+
+(defun lsp--create-initialization-options (_session client)
+  "Create initialization-options from SESSION and CLIENT.
+Add workspace folders depending on server being multiroot and
+session workspace 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)))
+
+(defvar lsp-client-settings nil
+  "For internal use, any external users please use
+  `lsp-register-custom-settings' function instead")
+
+(defun lsp--compare-setting-path (a b)
+  (equal (car a) (car b)))
+
+(defun lsp-register-custom-settings (props)
+  "Register PROPS.
+PROPS is list of triple (path value boolean?) where PATH is the path to the
+property; VALUE can be a literal value, symbol to be evaluated, or either a
+function or lambda function to be called without arguments; BOOLEAN? is an
+optional flag that should be non-nil for boolean settings, when it is nil the
+property will be ignored if the VALUE is nil.
+
+Example: `(lsp-register-custom-settings '((\"foo.bar.buzz.enabled\" t t)))'
+\(note the double parentheses)"
+  (let ((-compare-fn #'lsp--compare-setting-path))
+    (setq lsp-client-settings (-uniq (append props lsp-client-settings)))))
+
+(defun lsp-region-text (region)
+  "Get the text for REGION in current buffer."
+  (-let (((start . end) (lsp--range-to-region region)))
+    (buffer-substring-no-properties start end)))
+
+(defun lsp-ht-set (tbl paths value)
+  "Set nested hash table value.
+TBL - a hash table, PATHS is the path to the nested VALUE."
+  (pcase paths
+    (`(,path) (ht-set! tbl path value))
+    (`(,path . ,rst) (let ((nested-tbl (or (gethash path tbl)
+                                           (let ((temp-tbl (ht)))
+                                             (ht-set! tbl path temp-tbl)
+                                             temp-tbl))))
+                       (lsp-ht-set nested-tbl rst value)))))
+\f
+;; sections
+
+(defmacro defcustom-lsp (symbol standard doc &rest args)
+  "Defines `lsp-mode' server property."
+  (let ((path (plist-get args :lsp-path)))
+    (cl-remf args :lsp-path)
+    `(progn
+       (lsp-register-custom-settings
+        (quote ((,path ,symbol ,(equal ''boolean (plist-get args :type))))))
+
+       (defcustom ,symbol ,standard ,doc
+         :set (lambda (sym val)
+                (lsp--set-custom-property sym val ,path))
+         ,@args))))
+
+(defun lsp--set-custom-property (sym val path)
+  (set sym val)
+  (let ((section (cl-first (s-split "\\." path))))
+    (mapc (lambda (workspace)
+            (when (-contains? (lsp--client-synchronize-sections (lsp--workspace-client workspace))
+                              section)
+              (with-lsp-workspace workspace
+                (lsp--set-configuration (lsp-configuration-section section)))))
+          (lsp--session-workspaces (lsp-session)))))
+
+(defun lsp-configuration-section (section)
+  "Get settings for SECTION."
+  (let ((ret (ht-create)))
+    (mapc (-lambda ((path variable boolean?))
+            (when (s-matches? (concat (regexp-quote section) "\\..*") path)
+              (let* ((symbol-value (-> variable
+                                       lsp-resolve-value
+                                       lsp-resolve-value))
+                     (value (if (and boolean? (not symbol-value))
+                                :json-false
+                              symbol-value)))
+                (when (or boolean? value)
+                  (lsp-ht-set ret (s-split "\\." path) value)))))
+          lsp-client-settings)
+    ret))
+
+\f
+(defun lsp--start-connection (session client project-root)
+  "Initiates connection created from CLIENT for PROJECT-ROOT.
+SESSION is the active session."
+  (when (lsp--client-multi-root client)
+    (cl-pushnew project-root (gethash (lsp--client-server-id client)
+                                      (lsp-session-server-id->folders session))))
+  (run-hook-with-args 'lsp-workspace-folders-changed-functions (list project-root) nil)
+
+  (unwind-protect
+      (lsp--start-workspace session client project-root (lsp--create-initialization-options session client))
+    (lsp--spinner-stop)))
+
+;; lsp-log-io-mode
+
+(defvar lsp-log-io-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "M-n") #'lsp-log-io-next)
+    (define-key map (kbd "M-p") #'lsp-log-io-prev)
+    (define-key map (kbd "k") #'lsp--erase-log-buffer)
+    (define-key map (kbd "K") #'lsp--erase-session-log-buffers)
+    map)
+  "Keymap for lsp log buffer mode.")
+
+(define-derived-mode lsp-log-io-mode special-mode "LspLogIo"
+  "Special mode for viewing IO logs.")
+
+(defun lsp-workspace-show-log (workspace)
+  "Display the log buffer of WORKSPACE."
+  (interactive
+   (list (if lsp-log-io
+             (if (eq (length (lsp-workspaces)) 1)
+                 (cl-first (lsp-workspaces))
+               (lsp--completing-read "Workspace: " (lsp-workspaces)
+                                     #'lsp--workspace-print nil t))
+           (user-error "IO logging is disabled"))))
+  (pop-to-buffer (lsp--get-log-buffer-create workspace)))
+
+(defalias 'lsp-switch-to-io-log-buffer 'lsp-workspace-show-log)
+
+(defun lsp--get-log-buffer-create (workspace)
+  "Return the lsp log buffer of WORKSPACE, creating a new one if needed."
+  (let ((server-id (-> workspace lsp--workspace-client lsp--client-server-id symbol-name))
+        (pid (format "%s" (process-id (lsp--workspace-cmd-proc workspace)))))
+    (get-buffer-create (format "*lsp-log: %s:%s*" server-id pid))))
+
+(defun lsp--erase-log-buffer (&optional all)
+  "Delete contents of current lsp log buffer.
+When ALL is t, erase all log buffers of the running session."
+  (interactive)
+  (let* ((workspaces (lsp--session-workspaces (lsp-session)))
+         (current-log-buffer (current-buffer)))
+    (dolist (w workspaces)
+      (let ((b (lsp--get-log-buffer-create w)))
+        (when (or all (eq b current-log-buffer))
+          (with-current-buffer b
+            (let ((inhibit-read-only t))
+              (erase-buffer))))))))
+
+(defun lsp--erase-session-log-buffers ()
+  "Erase log buffers of the running session."
+  (interactive)
+  (lsp--erase-log-buffer t))
+
+(defun lsp-log-io-next (arg)
+  "Move to next log entry."
+  (interactive "P")
+  (ewoc-goto-next lsp--log-io-ewoc (or arg 1)))
+
+(defun lsp-log-io-prev (arg)
+  "Move to previous log entry."
+  (interactive "P")
+  (ewoc-goto-prev lsp--log-io-ewoc (or arg 1)))
+
+(defun lsp--workspace-print (workspace)
+  "Visual representation WORKSPACE."
+  (let* ((proc (lsp--workspace-cmd-proc workspace))
+         (status (lsp--workspace-status workspace))
+         (server-id (-> workspace lsp--workspace-client lsp--client-server-id symbol-name))
+         (pid (process-id proc)))
+
+    (if (eq 'initialized status)
+        (format "%s:%s" server-id pid)
+      (format "%s:%s/%s" server-id pid status))))
+
+(defun lsp--map-tree-widget (m)
+  "Build `tree-widget' from a hash-table M."
+  (when (hash-table-p m)
+    (let (nodes)
+      (maphash (lambda (k v)
+                 (push `(tree-widget
+                         :tag ,(if (hash-table-p v)
+                                   (format "%s:" k)
+                                 (format "%s: %s" k
+                                         (propertize (format "%s" v)
+                                                     'face
+                                                     'font-lock-string-face)))
+                         :open t
+                         ,@(lsp--map-tree-widget v))
+                       nodes))
+               m)
+      nodes)))
+
+(defun lsp-buffer-name (buffer-id)
+  (if-let ((buffer-name (plist-get buffer-id :buffer-name)))
+      (funcall buffer-name buffer-id)
+    (buffer-name buffer-id)))
+
+(defun lsp--render-workspace (workspace)
+  "Tree node representation of WORKSPACE."
+  `(tree-widget :tag ,(lsp--workspace-print workspace)
+                :open t
+                (tree-widget :tag ,(propertize "Buffers" 'face 'font-lock-function-name-face)
+                             :open t
+                             ,@(->> workspace
+                                    (lsp--workspace-buffers)
+                                    (--map `(tree-widget
+                                             :tag ,(when (lsp-buffer-live-p it)
+                                                     (let ((buffer-name (lsp-buffer-name it)))
+                                                       (if (lsp-with-current-buffer it buffer-read-only)
+                                                           (propertize buffer-name 'face 'font-lock-constant-face)
+                                                         buffer-name)))))))
+                (tree-widget :tag ,(propertize "Capabilities" 'face 'font-lock-function-name-face)
+                             ,@(-> workspace lsp--workspace-server-capabilities lsp--map-tree-widget))))
+
+(define-derived-mode lsp-browser-mode special-mode "LspBrowser"
+  "Define mode for displaying lsp sessions."
+  (setq-local display-buffer-base-action '(nil . ((inhibit-same-window . t)))))
+
+(defun lsp-describe-session ()
+  "Describes current `lsp-session'."
+  (interactive)
+  (let ((session (lsp-session))
+        (buf (get-buffer-create "*lsp session*")))
+    (with-current-buffer buf
+      (lsp-browser-mode)
+      (let ((inhibit-read-only t))
+        (erase-buffer)
+        (--each (lsp-session-folders session)
+          (widget-create
+           `(tree-widget
+             :tag ,(propertize it 'face 'font-lock-keyword-face)
+             :open t
+             ,@(->> session
+                    (lsp-session-folder->servers)
+                    (gethash it)
+                    (-map 'lsp--render-workspace)))))))
+    (pop-to-buffer buf)))
+
+(defun lsp--session-workspaces (session)
+  "Get all workspaces that are part of the SESSION."
+  (-> session lsp-session-folder->servers hash-table-values -flatten -uniq))
+
+(defun lsp--find-multiroot-workspace (session client project-root)
+  "Look for a multiroot connection in SESSION created from CLIENT for PROJECT-ROOT and BUFFER-MAJOR-MODE."
+  (when (lsp--client-multi-root client)
+    (-when-let (multi-root-workspace (->> session
+                                          (lsp--session-workspaces)
+                                          (--first (eq (-> it lsp--workspace-client lsp--client-server-id)
+                                                       (lsp--client-server-id client)))))
+      (with-lsp-workspace multi-root-workspace
+        (lsp-notify "workspace/didChangeWorkspaceFolders"
+                    (lsp-make-did-change-workspace-folders-params
+                     :event (lsp-make-workspace-folders-change-event
+                             :added (vector (lsp-make-workspace-folder
+                                             :uri (lsp--path-to-uri project-root)
+                                             :name (f-filename project-root)))
+                             :removed []))))
+
+      (->> session (lsp-session-folder->servers) (gethash project-root) (cl-pushnew multi-root-workspace))
+      (->> session (lsp-session-server-id->folders) (gethash (lsp--client-server-id client)) (cl-pushnew project-root))
+
+      (lsp--persist-session session)
+
+      (lsp--info "Opened folder %s in workspace %s" project-root (lsp--workspace-print multi-root-workspace))
+      (lsp--open-in-workspace multi-root-workspace)
+
+      multi-root-workspace)))
+
+(defun lsp--ensure-lsp-servers (session clients project-root ignore-multi-folder)
+  "Ensure that SESSION contain server CLIENTS created for PROJECT-ROOT.
+IGNORE-MULTI-FOLDER to ignore multi folder server."
+  (-map (lambda (client)
+          (or
+           (lsp--find-workspace session client project-root)
+           (unless ignore-multi-folder
+             (lsp--find-multiroot-workspace session client project-root))
+           (lsp--start-connection session client project-root)))
+        clients))
+
+(defun lsp--spinner-stop ()
+  "Stop the spinner in case all of the workspaces are started."
+  (when (--all? (eq (lsp--workspace-status it) 'initialized)
+                lsp--buffer-workspaces)
+    (spinner-stop)))
+
+(defun lsp--open-in-workspace (workspace)
+  "Open in existing WORKSPACE."
+  (if (eq 'initialized (lsp--workspace-status workspace))
+      ;; when workspace is initialized just call document did open.
+      (progn
+        (with-lsp-workspace workspace
+          (when-let ((before-document-open-fn (-> workspace
+                                                  lsp--workspace-client
+                                                  lsp--client-before-file-open-fn)))
+            (funcall before-document-open-fn workspace))
+          (lsp--text-document-did-open))
+        (lsp--spinner-stop))
+    ;; when it is not initialized
+    (lsp--spinner-start)
+    (cl-pushnew (lsp-current-buffer) (lsp--workspace-buffers workspace))))
+
+(defun lsp--find-workspace (session client project-root)
+  "Find server connection created with CLIENT in SESSION for PROJECT-ROOT."
+  (when-let ((workspace (->> session
+                             (lsp-session-folder->servers)
+                             (gethash project-root)
+                             (--first (eql (-> it lsp--workspace-client lsp--client-server-id)
+                                           (lsp--client-server-id client))))))
+    (lsp--open-in-workspace workspace)
+    workspace))
+
+(defun lsp--find-root-interactively (session)
+  "Find project interactively.
+Returns nil if the project should not be added to the current SESSION."
+  (condition-case nil
+      (let* ((project-root-suggestion (or (lsp--suggest-project-root) default-directory))
+             (action (read-key (format
+                                "%s is not part of any project. Select action:
+
+%s==>Import project root %s.
+%s==>Import project by selecting root directory interactively.
+%s==>Import project at current directory %s.
+%s==>Do not ask again for the current project by adding %s to lsp-session-folders-blacklist.
+%s==>Do not ask again for the current project by selecting ignore path interactively.
+%s==>Do nothing: ask again when opening other files from the current project."
+                                (propertize (buffer-name) 'face 'bold)
+                                (propertize "i" 'face 'success)
+                                (propertize project-root-suggestion 'face 'bold)
+                                (propertize "I" 'face 'success)
+                                (propertize "." 'face 'success)
+                                (propertize default-directory 'face 'bold)
+                                (propertize "d" 'face 'warning)
+                                (propertize project-root-suggestion 'face 'bold)
+                                (propertize "D" 'face 'warning)
+                                (propertize "n" 'face 'warning)))))
+        (cl-case action
+          (?i project-root-suggestion)
+          (?\r project-root-suggestion)
+          (?I (read-directory-name "Select workspace folder to add: "
+                                   (or project-root-suggestion default-directory)
+                                   nil
+                                   t))
+          (?. default-directory)
+          (?d (push project-root-suggestion (lsp-session-folders-blacklist session))
+              (lsp--persist-session session)
+              nil)
+          (?D (push (read-directory-name "Select folder to blacklist: "
+                                         (or project-root-suggestion default-directory)
+                                         nil
+                                         t)
+                    (lsp-session-folders-blacklist session))
+              (lsp--persist-session session)
+              nil)
+          (t nil)))
+    ('quit)))
+
+(declare-function tramp-file-name-host "ext:tramp" (file) t)
+(declare-function tramp-dissect-file-name "ext:tramp" (file &optional nodefault))
+
+(defun lsp--files-same-host (f1 f2)
+  "Predicate on whether or not two files are on the same host."
+  (or (not (or (file-remote-p f1) (file-remote-p f2)))
+      (and (file-remote-p f1)
+           (file-remote-p f2)
+           (progn (require 'tramp)
+                  (equal (tramp-file-name-host (tramp-dissect-file-name f1))
+                         (tramp-file-name-host (tramp-dissect-file-name f2)))))))
+
+(defun lsp-find-session-folder (session file-name)
+  "Look in the current SESSION for folder containing FILE-NAME."
+  (let ((file-name-canonical (lsp-f-canonical file-name)))
+    (->> session
+         (lsp-session-folders)
+         (--filter (and (lsp--files-same-host it file-name-canonical)
+                        (or (lsp-f-same? it file-name-canonical)
+                            (and (f-dir? it)
+                                 (lsp-f-ancestor-of? it file-name-canonical)))))
+         (--max-by (> (length it)
+                      (length other))))))
+
+(defun lsp-find-workspace (server-id &optional file-name)
+  "Find workspace for SERVER-ID for FILE-NAME."
+  (-when-let* ((session (lsp-session))
+               (folder->servers (lsp-session-folder->servers session))
+               (workspaces (if file-name
+                               (gethash (lsp-find-session-folder session file-name) folder->servers)
+                             (lsp--session-workspaces session))))
+
+    (--first (eq (lsp--client-server-id (lsp--workspace-client it)) server-id) workspaces)))
+
+(defun lsp--calculate-root (session file-name)
+  "Calculate project root for FILE-NAME in SESSION."
+  (and
+   (->> session
+        (lsp-session-folders-blacklist)
+        (--first (and (lsp--files-same-host it file-name)
+                      (lsp-f-ancestor-of? it file-name)
+                      (prog1 t
+                        (lsp--info "File %s is in blacklisted directory %s" file-name it))))
+        not)
+   (or
+    (when lsp-auto-guess-root
+      (lsp--suggest-project-root))
+    (lsp-find-session-folder session file-name)
+    (unless lsp-auto-guess-root
+      (when-let ((root-folder (lsp--find-root-interactively session)))
+        (if (or (not (f-equal? root-folder (expand-file-name "~/")))
+                (yes-or-no-p
+                 (concat
+                  (propertize "[WARNING] " 'face 'warning)
+                  "You are trying to import your home folder as project root. This may cause performance issue because some language servers (python, lua, etc) will try to scan all files under project root. To avoid that you may:
+
+1. Use `I' option from the interactive project import to select subfolder(e. g. `~/foo/bar' instead of `~/').
+2. If your file is under `~/' then create a subfolder and move that file in this folder.
+
+Type `No' to go back to project selection.
+Type `Yes' to confirm `HOME' as project root.
+Type `C-g' to cancel project import process and stop `lsp'")))
+            root-folder
+          (lsp--calculate-root session file-name)))))))
+
+(defun lsp--try-open-in-library-workspace ()
+  "Try opening current file as library file in any of the active workspace.
+The library folders are defined by each client for each of the active workspace."
+  (when-let ((workspace (->> (lsp-session)
+                             (lsp--session-workspaces)
+                             ;; Sort the last active workspaces first as they are more likely to be
+                             ;; the correct ones, especially when jumping to a definition.
+                             (-sort (lambda (a _b)
+                                      (-contains? lsp--last-active-workspaces a)))
+                             (--first
+                              (and (-> it lsp--workspace-client lsp--supports-buffer?)
+                                   (when-let ((library-folders-fn
+                                               (-> it lsp--workspace-client lsp--client-library-folders-fn)))
+                                     (-first (lambda (library-folder)
+                                               (lsp-f-ancestor-of? library-folder (buffer-file-name)))
+                                             (funcall library-folders-fn it))))))))
+    (lsp--open-in-workspace workspace)
+    (view-mode t)
+    (lsp--info "Opening read-only library file %s." (buffer-file-name))
+    (list workspace)))
+
+(defun lsp--persist-session (session)
+  "Persist SESSION to `lsp-session-file'."
+  (lsp--persist lsp-session-file (make-lsp-session
+                                  :folders (lsp-session-folders session)
+                                  :folders-blacklist (lsp-session-folders-blacklist session)
+                                  :server-id->folders (lsp-session-server-id->folders session))))
+
+(defun lsp--try-project-root-workspaces (ask-for-client ignore-multi-folder)
+  "Try create opening file as a project file.
+When IGNORE-MULTI-FOLDER is t the lsp mode will start new
+language server even if there is language server which can handle
+current language. When IGNORE-MULTI-FOLDER is nil current file
+will be opened in multi folder language server if there is
+such."
+  (-let ((session (lsp-session)))
+    (-if-let (clients (if ask-for-client
+                          (list (lsp--completing-read "Select server to start: "
+                                                      (ht-values lsp-clients)
+                                                      (-compose 'symbol-name 'lsp--client-server-id) nil t))
+                        (lsp--find-clients)))
+        (-if-let (project-root (-some-> session
+                                 (lsp--calculate-root (buffer-file-name))
+                                 (lsp-f-canonical)))
+            (progn
+              ;; update project roots if needed and persist the lsp session
+              (unless (-contains? (lsp-session-folders session) project-root)
+                (cl-pushnew project-root (lsp-session-folders session))
+                (lsp--persist-session session))
+              (lsp--ensure-lsp-servers session clients project-root ignore-multi-folder))
+          (lsp--warn "%s not in project or it is blacklisted." (buffer-name))
+          nil)
+      (lsp--warn "No LSP server for %s(check *lsp-log*)." major-mode)
+      nil)))
+
+(defun lsp-shutdown-workspace ()
+  "Shutdown language server."
+  (interactive)
+  (--when-let (pcase (lsp-workspaces)
+                (`nil (user-error "There are no active servers in the current buffer"))
+                (`(,workspace) (when (y-or-n-p (format "Are you sure you want to stop the server %s?"
+                                                       (lsp--workspace-print workspace)))
+                                 workspace))
+                (workspaces (lsp--completing-read "Select server: "
+                                                  workspaces
+                                                  'lsp--workspace-print nil t)))
+    (lsp-workspace-shutdown it)))
+
+(make-obsolete 'lsp-shutdown-workspace 'lsp-workspace-shutdown "lsp-mode 6.1")
+
+(defcustom lsp-auto-select-workspace t
+  "Shutdown or restart a single workspace.
+If set and the current buffer has only a single workspace
+associated with it, `lsp-shutdown-workspace' and
+`lsp-restart-workspace' will act on it without asking."
+  :type 'boolean
+  :group 'lsp-mode)
+
+(defun lsp--read-workspace ()
+  "Ask the user to select a workspace.
+Errors if there are none."
+  (pcase (lsp-workspaces)
+    (`nil (error "No workspaces associated with the current buffer"))
+    ((and `(,workspace) (guard lsp-auto-select-workspace)) workspace)
+    (workspaces (lsp--completing-read "Select workspace: " workspaces
+                                      #'lsp--workspace-print nil t))))
+
+(defun lsp-workspace-shutdown (workspace)
+  "Shut the workspace WORKSPACE and the language server associated with it"
+  (interactive (list (lsp--read-workspace)))
+  (lsp--warn "Stopping %s" (lsp--workspace-print workspace))
+  (with-lsp-workspace workspace (lsp--shutdown-workspace)))
+
+(defun lsp-disconnect ()
+  "Disconnect the buffer from the language server."
+  (interactive)
+  (lsp--text-document-did-close t)
+  (lsp-managed-mode -1)
+  (lsp-mode -1)
+  (setq lsp--buffer-workspaces nil)
+  (lsp--info "Disconnected"))
+
+(defun lsp-restart-workspace ()
+  (interactive)
+  (--when-let (pcase (lsp-workspaces)
+                (`nil (user-error "There are no active servers in the current buffer"))
+                (`(,workspace) workspace)
+                (workspaces (lsp--completing-read "Select server: "
+                                                  workspaces
+                                                  'lsp--workspace-print nil t)))
+    (lsp-workspace-restart it)))
+
+(make-obsolete 'lsp-restart-workspace 'lsp-workspace-restart "lsp-mode 6.1")
+
+(defun lsp-workspace-restart (workspace)
+  "Restart the workspace WORKSPACE and the language server associated with it"
+  (interactive (list (lsp--read-workspace)))
+  (lsp--warn "Restarting %s" (lsp--workspace-print workspace))
+  (with-lsp-workspace workspace (lsp--shutdown-workspace t)))
+
+;;;###autoload
+(defun lsp (&optional arg)
+  "Entry point for the server startup.
+When ARG is t the lsp mode will start new language server even if
+there is language server which can handle current language. When
+ARG is nil current file will be opened in multi folder language
+server if there is such. When `lsp' is called with prefix
+argument ask the user to select which language server to start."
+  (interactive "P")
+
+  (lsp--require-packages)
+
+  (when (buffer-file-name)
+    (let (clients
+          (matching-clients (lsp--filter-clients
+                             (-andfn #'lsp--supports-buffer?
+                                     #'lsp--server-binary-present?))))
+      (cond
+       (matching-clients
+        (when (setq lsp--buffer-workspaces
+                    (or (and
+                         ;; Don't open as library file if file is part of a project.
+                         (not (lsp-find-session-folder (lsp-session) (buffer-file-name)))
+                         (lsp--try-open-in-library-workspace))
+                        (lsp--try-project-root-workspaces (equal arg '(4))
+                                                          (and arg (not (equal arg 1))))))
+          (lsp-mode 1)
+          (when lsp-auto-configure (lsp--auto-configure))
+          (setq lsp-buffer-uri (lsp--buffer-uri))
+          (lsp--info "Connected to %s."
+                     (apply 'concat (--map (format "[%s]" (lsp--workspace-print it))
+                                           lsp--buffer-workspaces)))))
+       ;; look for servers which are currently being downloaded.
+       ((setq clients (lsp--filter-clients (-andfn #'lsp--supports-buffer?
+                                                   #'lsp--client-download-in-progress?)))
+        (lsp--info "There are language server(%s) installation in progress.
+The server(s) will be started in the buffer when it has finished."
+                   (-map #'lsp--client-server-id clients))
+        (seq-do (lambda (client)
+                  (cl-pushnew (current-buffer) (lsp--client-buffers client)))
+                clients))
+       ;; look for servers to install
+       ((setq clients (lsp--filter-clients
+                       (-andfn #'lsp--supports-buffer?
+                               (-const lsp-enable-suggest-server-download)
+                               #'lsp--client-download-server-fn
+                               (-not #'lsp--client-download-in-progress?))))
+        (let ((client (lsp--completing-read
+                       (concat "Unable to find installed server supporting this file. "
+                               "The following servers could be installed automatically: ")
+                       clients
+                       (-compose #'symbol-name #'lsp--client-server-id)
+                       nil
+                       t)))
+          (cl-pushnew (current-buffer) (lsp--client-buffers client))
+          (lsp--install-server-internal client)))
+       ;; automatic installation disabled
+       ((setq clients (unless matching-clients
+                        (lsp--filter-clients (-andfn #'lsp--supports-buffer?
+                                                     #'lsp--client-download-server-fn
+                                                     (-not (-const lsp-enable-suggest-server-download))
+                                                     (-not #'lsp--server-binary-present?)))))
+        (lsp--warn "The following servers support current file but automatic download is disabled: %s
+\(If you have already installed the server check *lsp-log*)."
+                   (mapconcat (lambda (client)
+                                (symbol-name (lsp--client-server-id client)))
+                              clients
+                              " ")))
+       ;; no clients present
+       ((setq clients (unless matching-clients
+                        (lsp--filter-clients (-andfn #'lsp--supports-buffer?
+                                                     (-not #'lsp--server-binary-present?)))))
+        (lsp--warn "The following servers support current file but do not have automatic installation: %s
+You may find the installation instructions at https://emacs-lsp.github.io/lsp-mode/page/languages.
+\(If you have already installed the server check *lsp-log*)."
+                   (mapconcat (lambda (client)
+                                (symbol-name (lsp--client-server-id client)))
+                              clients
+                              " ")))
+       ;; no matches
+       ((-> #'lsp--supports-buffer? lsp--filter-clients not)
+        (lsp--error "There are no language servers supporting current mode `%s' registered with `lsp-mode'.
+This issue might be caused by:
+1. The language you are trying to use does not have built-in support in `lsp-mode'. You must install the required support manually. Examples of this are `lsp-java' or `lsp-metals'.
+2. The language server that you expect to run is not configured to run for major mode `%s'. You may check that by checking the `:major-modes' that are passed to `lsp-register-client'.
+3. `lsp-mode' doesn't have any integration for the language behind `%s'. Refer to https://emacs-lsp.github.io/lsp-mode/page/languages and https://langserver.org/ .
+4. You are over `tramp'. In this case follow https://emacs-lsp.github.io/lsp-mode/page/remote/.
+5. You have disabled the `lsp-mode' clients for that file. (Check `lsp-enabled-clients' and `lsp-disabled-clients')."
+                    major-mode major-mode major-mode))))))
+
+(defun lsp--buffer-visible-p ()
+  "Return non nil if current buffer is visible."
+  (or (buffer-modified-p) (get-buffer-window nil t)))
+
+(defun lsp--init-if-visible ()
+  "Run `lsp' for the current buffer if the buffer is visible.
+Returns non nil if `lsp' was run for the buffer."
+  (when (lsp--buffer-visible-p)
+    (remove-hook 'window-configuration-change-hook #'lsp--init-if-visible t)
+    (lsp)
+    t))
+
+;;;###autoload
+(defun lsp-deferred ()
+  "Entry point that defers server startup until buffer is visible.
+`lsp-deferred' will wait until the buffer is visible before invoking `lsp'.
+This avoids overloading the server with many files when starting Emacs."
+  ;; Workspace may not be initialized yet. Use a buffer local variable to
+  ;; remember that we deferred loading of this buffer.
+  (setq lsp--buffer-deferred t)
+  (let ((buffer (current-buffer)))
+    ;; Avoid false positives as desktop-mode restores buffers by deferring
+    ;; visibility check until the stack clears.
+    (run-with-idle-timer 0 nil (lambda ()
+                                 (when (buffer-live-p buffer)
+                                   (with-current-buffer buffer
+                                     (unless (lsp--init-if-visible)
+                                       (add-hook 'window-configuration-change-hook #'lsp--init-if-visible nil t))))))))
+
+\f
+
+(defvar lsp-file-truename-cache (ht))
+
+(defmacro lsp-with-cached-filetrue-name (&rest body)
+  "Executes BODY caching the `file-truename' calls."
+  `(let ((old-fn (symbol-function 'file-truename)))
+     (unwind-protect
+         (progn
+           (fset 'file-truename
+                 (lambda (file-name &optional counter prev-dirs)
+                   (or (gethash file-name lsp-file-truename-cache)
+                       (puthash file-name (apply old-fn (list file-name counter prev-dirs))
+                                lsp-file-truename-cache))))
+           ,@body)
+       (fset 'file-truename old-fn))))
+\f
+
+(defun lsp-virtual-buffer-call (key &rest args)
+  (when lsp--virtual-buffer
+    (when-let ((fn (plist-get lsp--virtual-buffer key)))
+      (apply fn args))))
+
+(defun lsp-translate-column (column)
+  "Translate COLUMN taking into account virtual buffers."
+  (or (lsp-virtual-buffer-call :real->virtual-char column)
+      column))
+
+(defun lsp-translate-line (line)
+  "Translate LINE taking into account virtual buffers."
+  (or (lsp-virtual-buffer-call :real->virtual-line line)
+      line))
+
+\f
+;; lsp internal validation.
+
+(defmacro lsp--doctor (&rest checks)
+  `(-let [buf (current-buffer)]
+     (with-current-buffer (get-buffer-create "*lsp-performance*")
+       (with-help-window (current-buffer)
+         ,@(-map (-lambda ((msg form))
+                   `(insert (format "%s: %s\n" ,msg
+                                    (let ((res (with-current-buffer buf
+                                                 ,form)))
+                                      (cond
+                                       ((eq res :optional) (propertize "OPTIONAL" 'face 'warning))
+                                       (res (propertize "OK" 'face 'success))
+                                       (t (propertize "ERROR" 'face 'error)))))))
+                 (-partition 2 checks))))))
+
+(define-obsolete-function-alias 'lsp-diagnose
+  'lsp-doctor "lsp-mode 8.0.0")
+
+(defun lsp-doctor ()
+  "Validate performance settings."
+  (interactive)
+  (lsp--doctor
+   "Checking for Native JSON support" (functionp 'json-serialize)
+   "Check emacs supports `read-process-output-max'" (boundp 'read-process-output-max)
+   "Check `read-process-output-max' default has been changed from 4k"
+   (and (boundp 'read-process-output-max)
+        (> read-process-output-max 4096))
+   "Byte compiled against Native JSON (recompile lsp-mode if failing when Native JSON available)"
+   (condition-case _err
+       (progn (lsp--make-message (list "a" "b"))
+              nil)
+     (error t))
+   "`gc-cons-threshold' increased?" (> gc-cons-threshold 800000)
+   "Using `plist' for deserialized objects? (refer to https://emacs-lsp.github.io/lsp-mode/page/performance/#use-plists-for-deserialization)" (or lsp-use-plists :optional)
+   "Using emacs 28+ with native compilation?"
+   (or (and (fboundp 'native-comp-available-p)
+            (native-comp-available-p))
+       :optional)))
+
+(declare-function package-version-join "ext:package")
+(declare-function package-desc-version "ext:package")
+(declare-function package--alist "ext:package")
+
+(defun lsp-version ()
+  "Return string describing current version of `lsp-mode'."
+  (interactive)
+  (unless (featurep 'package)
+    (require 'package))
+  (let ((ver (format "lsp-mode %s, Emacs %s, %s"
+                     (package-version-join
+                      (package-desc-version
+                       (car (alist-get 'lsp-mode (package--alist)))))
+                     emacs-version
+                     system-type)))
+    (if (called-interactively-p 'interactive)
+        (lsp--info "%s" ver)
+      ver)))
+
+\f
+
+;; org-mode/virtual-buffer
+
+(declare-function org-babel-get-src-block-info "ext:ob-core")
+(declare-function org-do-remove-indentation "ext:org-macs")
+(declare-function org-src-get-lang-mode "ext:org-src")
+(declare-function org-element-context "ext:org-element")
+
+(defun lsp--virtual-buffer-update-position ()
+  (-if-let (virtual-buffer (-first (-lambda ((&plist :in-range))
+                                     (funcall in-range))
+                                   lsp--virtual-buffer-connections))
+      (unless (equal virtual-buffer lsp--virtual-buffer)
+        (lsp-org))
+    (when lsp-managed-mode
+      (lsp-managed-mode -1)
+      (lsp-mode -1)
+      (setq lsp--buffer-workspaces nil)
+      (setq lsp--virtual-buffer nil)
+      (setq lsp-buffer-uri nil)
+
+      ;; force refresh of diagnostics
+      (run-hooks 'lsp-after-diagnostics-hook))))
+
+(defun lsp-virtual-buffer-on-change (start end length)
+  "Adjust on change event to be executed against the proper language server."
+  (let ((max-point (max end
+                        (or (plist-get lsp--before-change-vals :end) 0)
+                        (+ start length))))
+    (when-let ((virtual-buffer (-first (lambda (vb)
+                                         (let ((lsp--virtual-buffer vb))
+                                           (and (lsp-virtual-buffer-call :in-range start)
+                                                (lsp-virtual-buffer-call :in-range max-point))))
+                                       lsp--virtual-buffer-connections)))
+      (lsp-with-current-buffer virtual-buffer
+        (lsp-on-change start end length
+                       (lambda (&rest _)
+                         (list :range (lsp--range (list :character 0 :line 0)
+                                                  lsp--virtual-buffer-point-max)
+                               :text (lsp--buffer-content))))))))
+
+(defun lsp-virtual-buffer-before-change (start _end)
+  (when-let ((virtual-buffer (-first (lambda (vb)
+                                       (lsp-with-current-buffer vb
+                                         (lsp-virtual-buffer-call :in-range start)))
+                                     lsp--virtual-buffer-connections)))
+    (lsp-with-current-buffer virtual-buffer
+      (setq lsp--virtual-buffer-point-max
+            (lsp--point-to-position (lsp-virtual-buffer-call :last-point))))))
+
+(defun lsp-patch-on-change-event ()
+  (remove-hook 'after-change-functions #'lsp-on-change t)
+  (add-hook 'after-change-functions #'lsp-virtual-buffer-on-change nil t)
+  (add-hook 'before-change-functions #'lsp-virtual-buffer-before-change nil t))
+
+(defun lsp-kill-virtual-buffers ()
+  (mapc #'lsp-virtual-buffer-disconnect lsp--virtual-buffer-connections))
+
+(defun lsp--move-point-in-indentation (point indentation)
+  (save-excursion
+    (goto-char point)
+    (if (<= point (+ (point-at-bol) indentation))
+        (point-at-bol)
+      point)))
+
+(declare-function flycheck-checker-supports-major-mode-p "ext:flycheck")
+(declare-function flycheck-add-mode "ext:flycheck")
+(declare-function lsp-diagnostics-lsp-checker-if-needed "lsp-diagnostics")
+
+(defalias 'lsp-client-download-server-fn 'lsp--client-download-server-fn)
+
+(defun lsp-flycheck-add-mode (mode)
+  "Register flycheck support for MODE."
+  (lsp-diagnostics-lsp-checker-if-needed)
+  (unless (flycheck-checker-supports-major-mode-p 'lsp mode)
+    (flycheck-add-mode 'lsp mode)))
+
+(defun lsp-org ()
+  (interactive)
+  (-if-let ((virtual-buffer &as &plist :workspaces) (-first (-lambda ((&plist :in-range))
+                                                              (funcall in-range))
+                                                            lsp--virtual-buffer-connections))
+      (unless (equal lsp--virtual-buffer virtual-buffer)
+        (setq lsp--buffer-workspaces workspaces)
+        (setq lsp--virtual-buffer virtual-buffer)
+        (setq lsp-buffer-uri nil)
+        (lsp-mode 1)
+        (lsp-managed-mode 1)
+        (lsp-patch-on-change-event))
+
+    (save-excursion
+      (-let* (virtual-buffer
+              (wcb (lambda (f)
+                     (with-current-buffer (plist-get virtual-buffer :buffer)
+                       (-let* (((&plist :major-mode :buffer-file-name
+                                        :goto-buffer :workspaces) virtual-buffer)
+                               (lsp--virtual-buffer virtual-buffer)
+                               (lsp--buffer-workspaces workspaces))
+                         (save-excursion
+                           (funcall goto-buffer)
+                           (funcall f))))))
+              ((&plist :begin :end :post-blank :language) (cl-second (org-element-context)))
+              ((&alist :tangle file-name) (cl-third (org-babel-get-src-block-info 'light)))
+
+              (file-name (if file-name
+                             (f-expand file-name)
+                           (user-error "You should specify file name in the src block header.")))
+              (begin-marker (progn
+                              (goto-char begin)
+                              (forward-line)
+                              (set-marker (make-marker) (point))))
+              (end-marker (progn
+                            (goto-char end)
+                            (forward-line (1- (- post-blank)))
+                            (set-marker (make-marker) (1+ (point)))))
+              (buf (current-buffer))
+              (src-block (buffer-substring-no-properties begin-marker
+                                                         (1- end-marker)))
+              (indentation (with-temp-buffer
+                             (insert src-block)
+
+                             (goto-char (point-min))
+                             (let ((indentation (current-indentation)))
+                               (plist-put lsp--virtual-buffer :indentation indentation)
+                               (org-do-remove-indentation)
+                               (goto-char (point-min))
+                               (- indentation (current-indentation))))))
+        (add-hook 'post-command-hook #'lsp--virtual-buffer-update-position nil t)
+
+        (when (fboundp 'flycheck-add-mode)
+          (lsp-flycheck-add-mode 'org-mode))
+
+        (setq lsp--virtual-buffer
+              (list
+               :in-range (lambda (&optional point)
+                           (<= begin-marker (or point (point)) (1- end-marker)))
+               :goto-buffer (lambda () (goto-char begin-marker))
+               :buffer-string
+               (lambda ()
+                 (let ((src-block (buffer-substring-no-properties
+                                   begin-marker
+                                   (1- end-marker))))
+                   (with-temp-buffer
+                     (insert src-block)
+
+                     (goto-char (point-min))
+                     (while (not (eobp))
+                       (delete-region (point) (if (> (+ (point) indentation) (point-at-eol))
+                                                  (point-at-eol)
+                                                (+ (point) indentation)))
+                       (forward-line))
+                     (buffer-substring-no-properties (point-min)
+                                                     (point-max)))))
+               :buffer buf
+               :begin begin-marker
+               :end end-marker
+               :indentation indentation
+               :last-point (lambda () (1- end-marker))
+               :cur-position (lambda ()
+                               (lsp-save-restriction-and-excursion
+                                 (list :line (- (lsp--cur-line)
+                                                (lsp--cur-line begin-marker))
+                                       :character (let ((character (- (point)
+                                                                      (line-beginning-position)
+                                                                      indentation)))
+                                                    (if (< character 0)
+                                                        0
+                                                      character)))))
+               :line/character->point (-lambda (line character)
+                                        (-let [inhibit-field-text-motion t]
+                                          (+ indentation
+                                             (lsp-save-restriction-and-excursion
+                                               (goto-char begin-marker)
+                                               (forward-line line)
+                                               (-let [line-end (line-end-position)]
+                                                 (if (> character (- line-end (point)))
+                                                     line-end
+                                                   (forward-char character)
+                                                   (point)))))))
+               :major-mode (org-src-get-lang-mode language)
+               :buffer-file-name file-name
+               :buffer-uri (lsp--path-to-uri file-name)
+               :with-current-buffer wcb
+               :buffer-live? (lambda (_) (buffer-live-p buf))
+               :buffer-name (lambda (_)
+                              (propertize (format "%s(%s:%s)%s"
+                                                  (buffer-name buf)
+                                                  begin-marker
+                                                  end-marker
+                                                  language)
+                                          'face 'italic))
+               :real->virtual-line (lambda (line)
+                                     (+ line (line-number-at-pos begin-marker) -1))
+               :real->virtual-char (lambda (char) (+ char indentation))
+               :cleanup (lambda ()
+                          (set-marker begin-marker nil)
+                          (set-marker end-marker nil))))
+        (setf virtual-buffer lsp--virtual-buffer)
+        (puthash file-name virtual-buffer lsp--virtual-buffer-mappings)
+        (push virtual-buffer lsp--virtual-buffer-connections)
+
+        ;; TODO: tangle only connected sections
+        (add-hook 'after-save-hook 'org-babel-tangle nil t)
+        (add-hook 'lsp-after-open-hook #'lsp-patch-on-change-event nil t)
+        (add-hook 'kill-buffer-hook #'lsp-kill-virtual-buffers nil t)
+
+        (setq lsp--buffer-workspaces
+              (lsp-with-current-buffer virtual-buffer
+                (lsp)
+                (plist-put virtual-buffer :workspaces (lsp-workspaces))
+                (lsp-workspaces)))))))
+
+(defun lsp-virtual-buffer-disconnect (virtual-buffer)
+  (interactive (list (or
+                      lsp--virtual-buffer
+                      (when lsp--virtual-buffer-connections
+                        (lsp--completing-read "Select virtual buffer to disconnect: "
+                                              lsp--virtual-buffer-connections
+                                              (-lambda ((&plist :buffer-file-name))
+                                                buffer-file-name))))))
+  (-if-let ((&plist :buffer-file-name file-name :cleanup) virtual-buffer)
+      (progn
+        (lsp-with-current-buffer virtual-buffer
+          (lsp--text-document-did-close))
+        (setq lsp--virtual-buffer-connections (-remove-item virtual-buffer lsp--virtual-buffer-connections))
+        (when (eq virtual-buffer lsp--virtual-buffer)
+          (setf lsp--virtual-buffer nil))
+        (when cleanup (funcall cleanup))
+        (remhash file-name lsp--virtual-buffer-mappings)
+
+        (lsp--virtual-buffer-update-position)
+        (lsp--info "Disconnected from buffer %s" file-name))
+    (lsp--error "Nothing to disconnect from?")))
+
+\f
+
+;;;###autoload
+(defun lsp-start-plain ()
+  "Start `lsp-mode' using mininal configuration using the latest `melpa' version of the packages.
+
+In case the major-mode that you are using for "
+  (interactive)
+  (let ((start-plain (make-temp-file "plain" nil ".el")))
+    (url-copy-file "https://raw.githubusercontent.com/emacs-lsp/lsp-mode/master/scripts/lsp-start-plain.el"
+                   start-plain t)
+    (async-shell-command
+     (format "%s -q -l %s %s"
+             (expand-file-name invocation-name invocation-directory)
+             start-plain
+             (or (buffer-file-name) ""))
+     (generate-new-buffer " *lsp-start-plain*"))))
+
+\f
+
+(provide 'lsp-mode)
+;;; lsp-mode.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-modeline.el b/elpa/lsp-mode-20220201.852/lsp-modeline.el
new file mode 100644 (file)
index 0000000..9449f5c
--- /dev/null
@@ -0,0 +1,354 @@
+;;; lsp-modeline.el --- LSP modeline features -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;;  LSP modeline
+;;
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-modeline nil
+  "LSP support for modeline"
+  :prefix "lsp-modeline-"
+  :group 'lsp-mode
+  :tag "LSP Modeline")
+
+(defcustom lsp-modeline-code-actions-kind-regex "$\\|quickfix.*\\|refactor.*"
+  "Regex for the code actions kinds to show in the modeline."
+  :type 'string
+  :group 'lsp-modeline)
+
+(defcustom lsp-modeline-code-actions-segments '(count icon)
+  "Define what should display on the modeline when code actions are available."
+  :type '(repeat (choice
+                  (const :tag "Show the lightbulb icon" icon)
+                  (const :tag "Show the name of the preferred code action" name)
+                  (const :tag "Show the count of how many code actions available" count)))
+  :group 'lsp-modeline
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-modeline-code-action-fallback-icon "💡"
+  "Define what should display on the modeline when code actions are available."
+  :type 'string
+  :group 'lsp-modeline
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defface lsp-modeline-code-actions-face
+  '((t :inherit homoglyph))
+  "Face used to code action text on modeline."
+  :group 'lsp-modeline)
+
+(defface lsp-modeline-code-actions-preferred-face
+  '((t :foreground "yellow"))
+  "Face used to code action text on modeline."
+  :group 'lsp-modeline)
+
+;;;###autoload
+(define-obsolete-variable-alias 'lsp-diagnostics-modeline-scope
+  'lsp-modeline-diagnostics-scope  "lsp-mode 7.0.1")
+
+(defcustom lsp-modeline-diagnostics-scope :workspace
+  "The modeline diagnostics scope."
+  :group 'lsp-modeline
+  :type '(choice (const :tag "File" :file)
+                 (const :tag "Project" :workspace)
+                 (const :tag "All Projects" :global))
+  :package-version '(lsp-mode . "6.3"))
+
+(declare-function all-the-icons-octicon "ext:all-the-icons" t t)
+(declare-function lsp-treemacs-errors-list "ext:lsp-treemacs" t)
+
+\f
+;; code actions
+
+(defvar-local lsp-modeline--code-actions-string nil
+  "Holds the current code action string on modeline.")
+
+(defun lsp-modeline--code-action-face (preferred-code-action)
+  "Return the face checking if there is any PREFERRED-CODE-ACTION."
+  (if preferred-code-action
+      'lsp-modeline-code-actions-preferred-face
+    'lsp-modeline-code-actions-face))
+
+(defun lsp-modeline--code-actions-icon (face)
+  "Build the icon for modeline code actions using FACE."
+  (if (require 'all-the-icons nil t)
+      (all-the-icons-octicon "light-bulb"
+                             :face face
+                             :v-adjust -0.0575)
+    (propertize lsp-modeline-code-action-fallback-icon 'face face)))
+
+(defun lsp-modeline--code-action-name (actions preferred-code-action-title)
+  "Return the code action name from ACTIONS and PREFERRED-CODE-ACTION-TITLE."
+  (or preferred-code-action-title
+      (->> actions
+           lsp-seq-first
+           lsp-modeline--code-action->string)))
+
+(defun lsp-modeline--code-action->string (action)
+  "Convert code ACTION to friendly string."
+  (->> action
+       lsp:code-action-title
+       (replace-regexp-in-string "[\n\t ]+" " ")))
+
+(defun lsp-modeline--build-code-actions-segments (actions)
+  "Build the code ACTIONS string from the defined segments."
+  (let* ((preferred-code-action (-some->> actions
+                                  (-first #'lsp:code-action-is-preferred?)
+                                  lsp-modeline--code-action->string))
+         (face (lsp-modeline--code-action-face preferred-code-action)))
+    (mapconcat
+     (lambda (segment)
+       (pcase segment
+         ('icon (lsp-modeline--code-actions-icon face))
+         ('name (propertize (lsp-modeline--code-action-name actions preferred-code-action)
+                            'face face))
+         ('count (propertize (number-to-string (seq-length actions))
+                             'face face))))
+     lsp-modeline-code-actions-segments " ")))
+
+(defun lsp-modeline--build-code-actions-string (actions)
+  "Build the string to be presented on modeline for code ACTIONS."
+  (-let* ((single-action? (= (length actions) 1))
+          (keybinding (concat "("
+                              (-some->> #'lsp-execute-code-action
+                                where-is-internal
+                                (-find (lambda (o)
+                                         (not (member (aref o 0) '(menu-bar normal-state)))))
+                                key-description)
+                              ")"))
+          (built-string (lsp-modeline--build-code-actions-segments actions))
+          (preferred-code-action (-some->> actions
+                                   (-first #'lsp:code-action-is-preferred?)
+                                   lsp-modeline--code-action->string)))
+    (add-text-properties 0 (length built-string)
+                         (list 'help-echo
+                               (concat (format "Apply code actions %s\nmouse-1: " keybinding)
+                                       (if single-action?
+                                           (lsp-modeline--code-action-name actions preferred-code-action)
+                                         "select from multiple code actions"))
+                               'mouse-face 'mode-line-highlight
+                               'local-map (make-mode-line-mouse-map
+                                           'mouse-1 (lambda ()
+                                                      (interactive)
+                                                      (if single-action?
+                                                          (lsp-execute-code-action (lsp-seq-first actions))
+                                                        (lsp-execute-code-action (lsp--select-action actions))))))
+                         built-string)
+    (unless (string= "" built-string)
+      (concat built-string " "))))
+
+(defun lsp--modeline-update-code-actions (actions)
+  "Update modeline with new code ACTIONS."
+  (when lsp-modeline-code-actions-kind-regex
+    (setq actions (seq-filter (-lambda ((&CodeAction :kind?))
+                                (or (not kind?)
+                                    (s-match lsp-modeline-code-actions-kind-regex kind?)))
+                              actions)))
+  (setq lsp-modeline--code-actions-string
+        (if (seq-empty-p actions) ""
+          (lsp-modeline--build-code-actions-string actions)))
+  (force-mode-line-update))
+
+(defun lsp-modeline--check-code-actions (&rest _)
+  "Request code actions to update modeline for given BUFFER."
+  (when (lsp-feature? "textDocument/codeAction")
+    (lsp-request-async
+     "textDocument/codeAction"
+     (lsp--text-document-code-action-params)
+     #'lsp--modeline-update-code-actions
+     :mode 'unchanged
+     :cancel-token :lsp-modeline-code-actions)))
+
+(defun lsp-modeline--enable-code-actions ()
+  "Enable code actions on modeline mode."
+  (when (and lsp-modeline-code-actions-enable
+             (lsp-feature? "textDocument/codeAction"))
+    (lsp-modeline-code-actions-mode 1)))
+
+(defun lsp-modeline--disable-code-actions ()
+  "Disable code actions on modeline mode."
+  (lsp-modeline-code-actions-mode -1))
+
+;;;###autoload
+(define-minor-mode lsp-modeline-code-actions-mode
+  "Toggle code actions on modeline."
+  :group 'lsp-modeline
+  :global nil
+  :lighter ""
+  (cond
+   (lsp-modeline-code-actions-mode
+    (add-to-list 'global-mode-string '(t (:eval lsp-modeline--code-actions-string)))
+
+    (add-hook 'lsp-on-idle-hook 'lsp-modeline--check-code-actions nil t)
+    (add-hook 'lsp-configure-hook #'lsp-modeline--enable-code-actions nil t)
+    (add-hook 'lsp-unconfigure-hook #'lsp-modeline--disable-code-actions nil t))
+   (t
+    (remove-hook 'lsp-on-idle-hook 'lsp-modeline--check-code-actions t)
+    (remove-hook 'lsp-configure-hook #'lsp-modeline--enable-code-actions t)
+    (remove-hook 'lsp-unconfigure-hook #'lsp-modeline--disable-code-actions t)
+    (setq global-mode-string (remove '(t (:eval lsp-modeline--code-actions-string)) global-mode-string)))))
+
+\f
+;; diagnostics
+
+(defvar-local lsp-modeline--diagnostics-string nil
+  "Value of current buffer diagnostics statistics.")
+
+(defvar lsp-modeline--diagnostics-wks->strings nil
+  "Plist of workspaces to their modeline strings.
+The `:global' workspace is global one.")
+
+(defun lsp-modeline-diagnostics-statistics ()
+  "Calculate diagnostics statistics based on `lsp-modeline-diagnostics-scope'."
+  (let ((diagnostics (cond
+                      ((equal :file lsp-modeline-diagnostics-scope)
+                       (list (lsp--get-buffer-diagnostics)))
+                      (t (->> (eq :workspace lsp-modeline-diagnostics-scope)
+                              (lsp-diagnostics)
+                              (ht-values)))))
+        (stats (make-vector lsp/diagnostic-severity-max 0))
+        strs
+        (i 0))
+    (mapc (lambda (buf-diags)
+            (mapc (lambda (diag)
+                    (-let [(&Diagnostic? :severity?) diag]
+                      (when severity?
+                        (cl-incf (aref stats severity?)))))
+                  buf-diags))
+          diagnostics)
+    (while (< i lsp/diagnostic-severity-max)
+      (when (> (aref stats i) 0)
+        (setq strs
+              (nconc strs
+                     `(,(propertize
+                         (format "%s" (aref stats i))
+                         'face
+                         (cond
+                          ((= i lsp/diagnostic-severity-error) 'error)
+                          ((= i lsp/diagnostic-severity-warning) 'warning)
+                          ((= i lsp/diagnostic-severity-information) 'success)
+                          ((= i lsp/diagnostic-severity-hint) 'success)))))))
+      (cl-incf i))
+    (-> (s-join "/" strs)
+        (propertize 'mouse-face 'mode-line-highlight
+                    'help-echo "mouse-1: Show diagnostics"
+                    'local-map (when (require 'lsp-treemacs nil t)
+                                 (make-mode-line-mouse-map
+                                  'mouse-1 #'lsp-treemacs-errors-list))))))
+
+(defun lsp-modeline--diagnostics-reset-modeline-cache ()
+  "Reset the modeline diagnostics cache."
+  (plist-put lsp-modeline--diagnostics-wks->strings (car (lsp-workspaces)) nil)
+  (plist-put lsp-modeline--diagnostics-wks->strings :global nil)
+  (setq lsp-modeline--diagnostics-string nil))
+
+(defun lsp-modeline--diagnostics-update-modeline ()
+  "Update diagnostics modeline string."
+  (cl-labels ((calc-modeline ()
+                             (let ((str (lsp-modeline-diagnostics-statistics)))
+                               (if (string-empty-p str) ""
+                                 (concat str " ")))))
+    (setq lsp-modeline--diagnostics-string
+          (cl-case lsp-modeline-diagnostics-scope
+            (:file (or lsp-modeline--diagnostics-string
+                       (calc-modeline)))
+            (:workspace
+             (let ((wk (car (lsp-workspaces))))
+               (or (plist-get lsp-modeline--diagnostics-wks->strings wk)
+                   (let ((ml (calc-modeline)))
+                     (setq lsp-modeline--diagnostics-wks->strings
+                           (plist-put lsp-modeline--diagnostics-wks->strings wk ml))
+                     ml))))
+            (:global
+             (or (plist-get lsp-modeline--diagnostics-wks->strings :global)
+                 (let ((ml (calc-modeline)))
+                   (setq lsp-modeline--diagnostics-wks->strings
+                         (plist-put lsp-modeline--diagnostics-wks->strings :global ml))
+                   ml)))))))
+
+(defun lsp-modeline--enable-diagnostics ()
+  "Enable diagnostics on modeline mode."
+  (when (and lsp-modeline-diagnostics-enable
+             (lsp-feature? "textDocument/publishDiagnostics"))
+    (lsp-modeline-diagnostics-mode 1)))
+
+(defun lsp-modeline--disable-diagnostics ()
+  "Disable diagnostics on modeline mode."
+  (lsp-modeline-diagnostics-mode -1))
+
+;;;###autoload
+(define-obsolete-function-alias 'lsp-diagnostics-modeline-mode
+  'lsp-modeline-diagnostics-mode "lsp-mode 7.0.1")
+
+;;;###autoload
+(define-minor-mode lsp-modeline-diagnostics-mode
+  "Toggle diagnostics modeline."
+  :group 'lsp-modeline
+  :global nil
+  :lighter ""
+  (cond
+   (lsp-modeline-diagnostics-mode
+    (add-hook 'lsp-configure-hook #'lsp-modeline--enable-diagnostics nil t)
+    (add-hook 'lsp-unconfigure-hook #'lsp-modeline--disable-diagnostics nil t)
+    (add-to-list 'global-mode-string '(t (:eval (lsp-modeline--diagnostics-update-modeline))))
+    (add-hook 'lsp-diagnostics-updated-hook 'lsp-modeline--diagnostics-reset-modeline-cache))
+   (t
+    (remove-hook 'lsp-configure-hook #'lsp-modeline--enable-diagnostics t)
+    (remove-hook 'lsp-unconfigure-hook #'lsp-modeline--disable-diagnostics t)
+    (remove-hook 'lsp-diagnostics-updated-hook 'lsp-modeline--diagnostics-reset-modeline-cache)
+    (setq global-mode-string (remove '(t (:eval (lsp-modeline--diagnostics-update-modeline))) global-mode-string)))))
+
+\f
+;; workspace status
+
+(defun lsp-modeline--workspace-status-string ()
+  "Build the workspace status string."
+  '(t (:eval (-keep #'lsp--workspace-status-string (lsp-workspaces)))))
+
+(defun lsp-modeline--enable-workspace-status ()
+  "Enable workspace status on modeline."
+  (let ((status (lsp-modeline--workspace-status-string)))
+    (setq-local global-mode-string (if (-contains? global-mode-string status)
+                                       global-mode-string
+                                     (cons status global-mode-string)))))
+
+(defun lsp-modeline--disable-workspace-status ()
+  "Disable workspace status on modeline."
+  (let ((status (lsp-modeline--workspace-status-string)))
+    (setq-local global-mode-string (remove status global-mode-string))))
+
+;;;###autoload
+(define-minor-mode lsp-modeline-workspace-status-mode
+  "Toggle workspace status on modeline."
+  :group 'lsp-modeline
+  :global nil
+  :lighter ""
+  (cond
+   (lsp-modeline-workspace-status-mode
+    (add-hook 'lsp-configure-hook #'lsp-modeline--enable-workspace-status nil t)
+    (add-hook 'lsp-unconfigure-hook #'lsp-modeline--disable-workspace-status nil t))
+   (t
+    (remove-hook 'lsp-configure-hook #'lsp-modeline--enable-workspace-status t)
+    (remove-hook 'lsp-unconfigure-hook #'lsp-modeline--disable-workspace-status t))))
+
+(lsp-consistency-check lsp-modeline)
+
+(provide 'lsp-modeline)
+;;; lsp-modeline.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-nginx.el b/elpa/lsp-mode-20220201.852/lsp-nginx.el
new file mode 100644 (file)
index 0000000..b2e184b
--- /dev/null
@@ -0,0 +1,53 @@
+;;; lsp-nginx.el --- Nginx Client settings  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021  Shen, Jen-Chieh
+
+;; Author: Jen-Chieh Shen <jcs090218NOSPAMgmail.com>
+;; Keywords: nginx lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; LSP client for Nginx
+;;
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-nginx nil
+  "LSP support for Nginx."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/pappasam/nginx-language-server")
+  :package-version `(lsp-mode . "8.0.1"))
+
+(defcustom lsp-nginx-server-command '("nginx-language-server")
+  "Command to start Nginx Language Server."
+  :risky t
+  :group 'lsp-nginx
+  :type '(repeat string)
+  :package-version `(lsp-mode . "8.0.1"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda () lsp-nginx-server-command))
+                  :major-modes '(nginx-mode)
+                  :priority -1
+                  :server-id 'nginx-ls))
+
+(lsp-consistency-check lsp-nginx)
+
+(provide 'lsp-nginx)
+;;; lsp-nginx.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-nim.el b/elpa/lsp-mode-20220201.852/lsp-nim.el
new file mode 100644 (file)
index 0000000..5418137
--- /dev/null
@@ -0,0 +1,45 @@
+;;; lsp-nim.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, nim
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Nim Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+;; Nim
+(defgroup lsp-nimlsp nil
+  "LSP support for Nim, using nimlsp."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/PMunch/nimlsp"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection "nimlsp")
+                  :major-modes '(nim-mode)
+                  :priority -1
+                  :server-id 'nimls))
+
+
+(lsp-consistency-check lsp-nim)
+
+(provide 'lsp-nim)
+;;; lsp-nim.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-nix.el b/elpa/lsp-mode-20220201.852/lsp-nix.el
new file mode 100644 (file)
index 0000000..d19151c
--- /dev/null
@@ -0,0 +1,48 @@
+;;; lsp-nix.el --- lsp-mode nix integration    -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 lsp-mode maintainers
+
+;; Author: Seong Yong-ju <sei40krNOSPAMgmail.com>
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Client for the rnix language server.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-nix nil
+  "LSP support for Nix, using rnix-lsp."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/nix-community/rnix-lsp"))
+
+(defcustom lsp-nix-server-path "rnix-lsp"
+  "Executable path for the server."
+  :group 'lsp-nix
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-nix-server-path))
+                  :major-modes '(nix-mode)
+                  :server-id 'rnix-lsp))
+
+(lsp-consistency-check lsp-nix)
+
+(provide 'lsp-nix)
+;;; lsp-nix.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-ocaml.el b/elpa/lsp-mode-20220201.852/lsp-ocaml.el
new file mode 100644 (file)
index 0000000..b1e1003
--- /dev/null
@@ -0,0 +1,84 @@
+;;; lsp-ocaml.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, ocaml
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Ocaml Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-ocaml nil
+  "LSP support for OCaml, using ocaml-language-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/freebroccolo/ocaml-language-server"))
+
+(define-obsolete-variable-alias
+  'lsp-ocaml-ocaml-lang-server-command
+  'lsp-ocaml-lang-server-command
+  "lsp-mode 6.1")
+
+(defcustom lsp-ocaml-lang-server-command
+  '("ocaml-language-server" "--stdio")
+  "Command to start ocaml-language-server."
+  :group 'lsp-ocaml
+  :type '(choice
+          (string :tag "Single string value")
+          (repeat :tag "List of string values"
+                  string)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda () lsp-ocaml-lang-server-command))
+                  :major-modes '(reason-mode caml-mode tuareg-mode)
+                  :priority -1
+                  :server-id 'ocaml-ls))
+
+(defgroup lsp-ocaml-lsp-server nil
+  "LSP support for OCaml, using ocaml-lsp-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/ocaml/ocaml-lsp"))
+
+(define-obsolete-variable-alias 'lsp-merlin 'lsp-ocaml-lsp-server "lsp-mode 6.1")
+(define-obsolete-variable-alias 'lsp-merlin-command 'lsp-ocaml-lsp-server-command "lsp-mode 6.1")
+
+(defcustom lsp-ocaml-lsp-server-command
+  '("ocamllsp")
+  "Command to start ocaml-language-server."
+  :group 'lsp-ocaml
+  :type '(choice
+          (string :tag "Single string value")
+          (repeat :tag "List of string values"
+                  string)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection
+  (lsp-stdio-connection (lambda () lsp-ocaml-lsp-server-command))
+  :major-modes '(reason-mode caml-mode tuareg-mode)
+  :priority 0
+  :server-id 'ocaml-lsp-server))
+
+
+(lsp-consistency-check lsp-ocaml)
+
+(provide 'lsp-ocaml)
+;;; lsp-ocaml.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-perl.el b/elpa/lsp-mode-20220201.852/lsp-perl.el
new file mode 100644 (file)
index 0000000..4126e0d
--- /dev/null
@@ -0,0 +1,117 @@
+;;; lsp-perl.el --- lsp-perl config  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 lsp-mode developers
+
+;; Author: Hiroki Noda <kubo39NOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-perl client
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-perl nil
+  "LSP support for Perl"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/richterger/Perl-LanguageServer")
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-perl-language-server-path "perl"
+  "Path to perl interpreter."
+  :type 'string
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-perl-language-server-port 13603
+  "Choose listen port."
+  :type 'integer
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-perl-language-server-client-version "2.1.0"
+  "Choose client version."
+  :type 'string
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-perl-perl-cmd nil
+  "Path to perl interpreter used in Perl Language Server.
+Defaults to `perl' if nil."
+  :type 'string
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "7.0.1"))
+(defcustom lsp-perl-perl-inc nil
+  "A vector of paths to add to perl library path."
+  :type 'lsp-string-vector
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "7.0.1"))
+(defcustom lsp-perl-file-filter nil
+  "A vector of directories filtering perl file.
+Defaults to `[\".pm\" \".pl\"]' if nil."
+  :type 'lsp-string-vector
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "7.0.1"))
+(defcustom lsp-perl-ignore-dirs nil
+  "A vector of directories to ignore.
+Defaults to `[\".vscode\" \".git\" \".svn\"]' if nil."
+  :type 'lsp-string-vector
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "7.0.1"))
+
+(defcustom lsp-perl-show-local-vars nil
+  "If true, show also local variables in symbol view.
+Defaults to false if nil"
+  :type 'boolean
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-perl-log-level nil
+  "Log level 0-2.
+Defaults to 0."
+  :type 'integer
+  :group 'lsp-perl
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-register-custom-settings
+ '(("perl.perlCmd" lsp-perl-perl-cmd)
+   ("perl.perlInc" lsp-perl-perl-inc)
+   ("perl.fileFilter" lsp-perl-file-filter)
+   ("perl.ignoreDirs" lsp-perl-ignore-dirs)
+   ("perl.showLocalVars" lsp-perl-show-local-vars t)
+   ("perl.logLevel" lsp-perl-log-level)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     (list lsp-perl-language-server-path
+                                           "-MPerl::LanguageServer" "-e" "Perl::LanguageServer::run" "--"
+                                           (format "--port %d --version %s"
+                                                   lsp-perl-language-server-port lsp-perl-language-server-client-version))))
+                  :major-modes '(perl-mode cperl-mode)
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration
+                                       (lsp-configuration-section "perl"))))
+                  :priority -1
+                  :server-id 'perl-language-server))
+
+(lsp-consistency-check lsp-perl)
+
+(provide 'lsp-perl)
+;;; lsp-perl.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-php.el b/elpa/lsp-mode-20220201.852/lsp-php.el
new file mode 100644 (file)
index 0000000..fd8bc21
--- /dev/null
@@ -0,0 +1,450 @@
+;;; lsp-php.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, php
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the PHP Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'lsp-protocol)
+
+;; PHP Language Server
+(defgroup lsp-php nil
+  "LSP support for PHP, using php-language-server."
+  :link '(url-link "https://github.com/felixfbecker/php-language-server")
+  :group 'lsp-mode)
+
+(defun lsp-php-get-composer-dir ()
+  "Get composer home directory if possible."
+  (if (executable-find "composer")
+      (replace-regexp-in-string "\n$" "" (shell-command-to-string "composer config --global home"))
+    "~/.composer"))
+
+(defcustom lsp-php-composer-dir nil
+  "Home directory of composer."
+  :group 'lsp-php
+  :type 'string)
+
+(defcustom lsp-clients-php-server-command nil
+  "Install directory for php-language-server."
+  :group 'lsp-php
+  :type '(repeat string))
+
+(defun lsp-php--create-connection ()
+  "Create lsp connection."
+  (lsp-stdio-connection
+   (lambda ()
+     (unless lsp-php-composer-dir
+       (setq lsp-php-composer-dir (lsp-php-get-composer-dir)))
+     (unless lsp-clients-php-server-command
+       (setq lsp-clients-php-server-command
+             `("php",
+               (expand-file-name
+                (f-join lsp-php-composer-dir "vendor/felixfbecker/language-server/bin/php-language-server.php")))))
+     lsp-clients-php-server-command)
+   (lambda ()
+     (if (and (cdr lsp-clients-php-server-command)
+              (eq (string-match-p "php[0-9.]*\\'" (car lsp-clients-php-server-command)) 0))
+         ;; Start with the php command and the list has more elems. Test the existence of the PHP script.
+         (let ((php-file (nth 1 lsp-clients-php-server-command)))
+           (or (file-exists-p php-file)
+               (progn
+                 (lsp-log "%s is not present." php-file)
+                 nil)))
+       t))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-php--create-connection)
+                  :activation-fn (lsp-activate-on "php")
+                  :priority -3
+                  :server-id 'php-ls))
+
+;;; Intelephense
+(defgroup lsp-intelephense nil
+  "LSP support for PHP, using Intelephense."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/bmewburn/vscode-intelephense")
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-php-version "8.0.1"
+  "Minimum version of PHP to refer to. Affects code actions, diagnostic &
+completions."
+  :type 'string
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-files-max-size 1000000
+  "Maximum file size in bytes."
+  :type 'number
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-files-associations
+  ["*.php" "*.phtml"]
+  "Configure glob patterns to make files available for language
+server features."
+  :type '(repeat string)
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-files-exclude
+  ["**/.git/**" "**/.svn/**" "**/.hg/**" "**/CVS/**" "**/.DS_Store/**"
+   "**/node_modules/**" "**/bower_components/**" "**/vendor/**/{Test,test,Tests,tests}/**"]
+  "Configure glob patterns to exclude certain files and folders
+from all language server features."
+  :type '(repeat string)
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-stubs
+  ["apache" "bcmath" "bz2" "calendar"
+   "com_dotnet" "Core" "ctype" "curl" "date" "dba" "dom" "enchant"
+   "exif" "fileinfo" "filter" "fpm" "ftp" "gd" "hash" "iconv" "imap" "interbase"
+   "intl" "json" "ldap" "libxml" "mbstring" "mcrypt" "meta" "mssql" "mysqli"
+   "oci8" "odbc" "openssl" "pcntl" "pcre" "PDO" "pdo_ibm" "pdo_mysql"
+   "pdo_pgsql" "pdo_sqlite" "pgsql" "Phar" "posix" "pspell" "readline" "recode"
+   "Reflection" "regex" "session" "shmop" "SimpleXML" "snmp" "soap" "sockets"
+   "sodium" "SPL" "sqlite3" "standard" "superglobals" "sybase" "sysvmsg"
+   "sysvsem" "sysvshm" "tidy" "tokenizer" "wddx" "xml" "xmlreader" "xmlrpc"
+   "xmlwriter" "Zend OPcache" "zip" "zlib"]
+  "Configure stub files for built in symbols and common
+extensions. The default setting includes PHP core and all
+bundled extensions."
+  :type '(repeat string)
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-completion-insert-use-declaration t
+  "Use declarations will be automatically inserted for namespaced
+classes, traits, interfaces, functions, and constants."
+  :type 'boolean
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-completion-fully-qualify-global-constants-and-functions nil
+  "Global namespace constants and functions will be fully
+qualified (prefixed with a backslash)."
+  :type 'boolean
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-completion-trigger-parameter-hints t
+  "Method and function completions will include parentheses and
+trigger parameter hints."
+  :type 'boolean
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-intelephense-completion-max-items 100
+  "The maximum number of completion items returned per request."
+  :type 'number
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-intelephense-format-enable t
+  "Enables formatting."
+  :type 'boolean
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-licence-key nil
+  "Enter your intelephense licence key here to access premium
+features."
+  :type 'string
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-intelephense-telemetry-enabled nil
+  "Anonymous usage and crash data will be sent to Azure
+Application Insights."
+  :type 'boolean
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-intelephense-rename-exclude
+  ["**/vendor/**"]
+  "Glob patterns to exclude files and folders from having symbols
+renamed. Rename operation will fail if references and/or
+definitions are found in excluded files/folders."
+  :type '(repeat string)
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-intelephense-trace-server "off"
+  "Traces the communication between VSCode and the intelephense
+language server."
+  :type '(choice (:tag "off" "messages" "verbose"))
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-storage-path
+  (expand-file-name (locate-user-emacs-file "lsp-cache"))
+  "Optional absolute path to storage dir."
+  :type 'directory
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-intelephense-global-storage-path
+  (expand-file-name (locate-user-emacs-file "intelephense"))
+  "Optional absolute path to global storage dir."
+  :type 'directory
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-intelephense-clear-cache nil
+  "Optional flag to clear server state."
+  :type 'boolean
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-intelephense-multi-root t
+  "Flag to control if the server supports multi-root projects."
+  :type 'boolean
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.3"))
+
+(lsp-register-custom-settings
+ '(("intelephense.environment.phpVersion" lsp-intelephense-php-version)
+   ("intelephense.trace.server" lsp-intelephense-trace-server)
+   ("intelephense.rename.exclude" lsp-intelephense-rename-exclude)
+   ("intelephense.telemetry.enabled" lsp-intelephense-telemetry-enabled t)
+   ("intelephense.format.enable" lsp-intelephense-format-enable t)
+   ("intelephense.completion.maxItems" lsp-intelephense-completion-max-items)
+   ("intelephense.completion.triggerParameterHints" lsp-intelephense-completion-trigger-parameter-hints t)
+   ("intelephense.completion.fullyQualifyGlobalConstantsAndFunctions" lsp-intelephense-completion-fully-qualify-global-constants-and-functions t)
+   ("intelephense.completion.insertUseDeclaration" lsp-intelephense-completion-insert-use-declaration t)
+   ("intelephense.stubs" lsp-intelephense-stubs)
+   ("intelephense.files.exclude" lsp-intelephense-files-exclude)
+   ("intelephense.files.associations" lsp-intelephense-files-associations)
+   ("intelephense.files.maxSize" lsp-intelephense-files-max-size)))
+
+(define-obsolete-variable-alias
+  'lsp-clients-php-iph-server-command
+  'lsp-intelephense-server-command
+  "lsp-mode 6.1")
+
+(defcustom lsp-intelephense-server-command
+  `("intelephense" "--stdio")
+  "Command to start Intelephense."
+  :type '(repeat string)
+  :group 'lsp-intelephense
+  :package-version '(lsp-mode . "6.1"))
+
+(lsp-dependency 'intelephense
+                '(:system "intelephense")
+                '(:npm :package "intelephense"
+                       :path "intelephense"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     `(,(or (executable-find
+                                             (cl-first lsp-intelephense-server-command))
+                                            (lsp-package-path 'intelephense))
+                                       ,@(cl-rest lsp-intelephense-server-command))))
+                  :activation-fn (lsp-activate-on "php")
+                  :priority -1
+                  :notification-handlers (ht ("indexingStarted" #'ignore)
+                                             ("indexingEnded" #'ignore))
+                  :initialization-options (lambda ()
+                                            (list :storagePath lsp-intelephense-storage-path
+                                                  :globalStoragePath lsp-intelephense-global-storage-path
+                                                  :licenceKey lsp-intelephense-licence-key
+                                                  :clearCache lsp-intelephense-clear-cache))
+                  :multi-root lsp-intelephense-multi-root
+                  :completion-in-comments? t
+                  :server-id 'iph
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure 'intelephense
+                                                            callback error-callback))))
+
+
+;;; Serenata
+(defgroup lsp-serenata nil
+  "LSP support for the PHP programming language, using serenata."
+  :group 'lsp-mode
+  :link '(url-link "https://gitlab.com/Serenata/Serenata")
+  :package-version '(lsp-mode . "7.0"))
+
+(defcustom lsp-serenata-server-path
+  "serenata.phar"
+  "Path to the Serenata Language Server phar file.
+It can be downloaded from https://gitlab.com/Serenata/Serenata/-/releases."
+  :group 'lsp-serenata
+  :type 'file)
+
+(defcustom lsp-serenata-uris
+  []
+  "A list of folders to index for your project.
+This does not have to include the root of the project itself, in
+case you have need of an exotic configuration where the root of
+the project is at some location but your actual PHP code is
+somewhere else.  Note that if you are running Serenata in a
+container, you will have to ensure that these URI's are mapped
+inside it.  Avoid using file paths containing spaces. This is
+currently broken due to apparent PHP quirks.  By default, the
+value is taken from the lsp workspace location."
+  :group 'lsp-serenata
+  :type 'lsp-string-vector)
+
+(defcustom lsp-serenata-php-version
+  7.3
+  "Allows you to specify the PHP version your project is written in.
+At the moment this directive is still ignored, but it will
+influence functionality such as refactoring in the future, where
+older PHP versions may not support scalar type hints, which may
+then be omitted from places such as getters and setters."
+  :group 'lsp-serenata
+  :type 'number)
+
+(defcustom lsp-serenata-file-extensions
+  ["php"]
+  "List of file extensions (without dot) to process.
+Files that do not match this whitelist will be ignored during
+indexing.  Usually you'll want to set this to at least include
+php, as it is the most common PHP extension.  phpt is not
+included by default as it is often used to contain test code that
+is not directly part of the code.  Note that for existing
+projects, removing extensions will not not automatically prune
+files having them from the index if they are already present.
+Adding new ones will cause the files having them to be picked up
+on the next project initialization."
+  :group 'lsp-serenata
+  :type 'lsp-string-vector)
+
+(defcustom lsp-serenata-index-database-uri (lsp--path-to-uri (f-join  user-emacs-directory "index.sqlite"))
+  "The location to store the index database.
+Note that, as the index database uses SQLite and WAL mode,
+additional files (usually two) may be generated and used in the
+same folder.  Note also that Serenata relies on the Doctrine DBAL
+library as well as the SQLite backends in PHP, which may not
+support non-file URI's, which may prevent you from using these."
+  :group 'lsp-serenata
+  :type 'file)
+
+(defcustom lsp-serenata-exclude-path-expressions ["/.+Test.php$/"]
+  "One or more expressions of paths to ignore.
+This uses Symfony's Finder in the background, so this means you
+can configure anything here that can also be passed to the name
+function, which includes plain strings, globs, as well as regular
+expressions.  Note that for existing projects, modifying these
+will not not automatically prune them from the index if they are
+already present."
+  :group 'lsp-serenata
+  :type 'lsp-string-vector)
+
+(defun lsp-serenata-server-start-fun (port)
+  "Define serenata start function, it requires a PORT."
+  `(,lsp-serenata-server-path
+    "-u" ,(number-to-string port)))
+
+(defun lsp-serenata-init-options ()
+  "Init options for lsp-serenata."
+  `( :configuration ( :uris ,lsp-serenata-uris
+                      :indexDatabaseUri ,lsp-serenata-index-database-uri
+                      :phpVersion ,lsp-serenata-php-version
+                      :excludedPathExpressions ,lsp-serenata-exclude-path-expressions
+                      :fileExtensions ,lsp-serenata-file-extensions)))
+
+
+(lsp-interface (serenata:didProgressIndexing (:sequenceOfIndexedItem :totalItemsToIndex :progressPercentage :folderUri :fileUri :info) nil ))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-tcp-connection 'lsp-serenata-server-start-fun)
+  :activation-fn (lsp-activate-on "php")
+  :priority -2
+  :notification-handlers (ht ("serenata/didProgressIndexing"
+                              (lambda (_server data)
+                                (lsp-log "%s" (lsp:serenata-did-progress-indexing-info data)))))
+
+  :initialization-options #'lsp-serenata-init-options
+  :initialized-fn (lambda (workspace)
+                    (when (equal (length lsp-serenata-uris) 0)
+                      (let* ((lsp-root (lsp--path-to-uri (lsp-workspace-root))))
+                        (setq lsp-serenata-uris (vector lsp-root))))
+                    (with-lsp-workspace workspace
+                      (lsp--set-configuration
+                       (lsp-configuration-section "serenata"))))
+  :server-id 'serenata))
+\f
+;;; phpactor
+
+(defgroup lsp-phpactor nil
+  "LSP support for Phpactor."
+  :link '(url-link "https://github.com/phpactor/phpactor")
+  :group 'lsp-mode)
+
+(defcustom lsp-phpactor-path nil
+  "Path to the `phpactor' command."
+  :group 'lsp-phpactor
+  :type "string")
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection
+                   (lambda ()
+                     (unless lsp-php-composer-dir
+                       (setq lsp-php-composer-dir (lsp-php-get-composer-dir)))
+                     (unless lsp-phpactor-path
+                       (setq lsp-phpactor-path (or (executable-find "phpactor")
+                                                   (f-join lsp-php-composer-dir "vendor/phpactor/phpactor/bin/phpactor"))))
+                     (list lsp-phpactor-path "language-server")))
+  :activation-fn (lsp-activate-on "php")
+  ;; `phpactor' is not really that feature-complete: it doesn't support
+  ;; `textDocument/showOccurence' and sometimes errors (e.g. find references on
+  ;; a global free-standing function).
+  :priority -4
+  ;; Even though `phpactor' itself supports no options, this needs to be
+  ;; serialized as an empty object (otherwise the LS won't even start, due to a
+  ;; type error).
+  :initialization-options (ht)
+  :server-id 'phpactor))
+
+(defcustom lsp-phpactor-extension-alist '(("Phpstan" . "phpactor/language-server-phpstan-extension")
+                                          ("Behat" . "phpactor/behat-extension")
+                                          ("PHPUnit" . "phpactor/phpunit-extension"))
+  "Alist mapping extension names to `composer' packages.
+These extensions can be installed using
+`lsp-phpactor-install-extension'."
+  :type '(alist :key-type "string" :value-type "string")
+  :group 'lsp-phpactor)
+
+(defun lsp-phpactor-install-extension (extension)
+  "Install a `phpactor' EXTENSION.
+See `lsp-phpactor-extension-alist' and
+https://phpactor.readthedocs.io/en/develop/extensions.html."
+  (interactive (list (completing-read "Select extension: "
+                                      lsp-phpactor-extension-alist)))
+  (compilation-start
+   (format "%s extension:install %s"
+           (shell-quote-argument (expand-file-name lsp-phpactor-path))
+           (shell-quote-argument
+            (cdr (assoc extension lsp-phpactor-extension-alist))))
+   nil
+   (lambda (_mode)
+     (format "*Phpactor install %s*" extension))))
+
+(lsp-consistency-check lsp-php)
+
+(provide 'lsp-php)
+;;; lsp-php.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-prolog.el b/elpa/lsp-mode-20220201.852/lsp-prolog.el
new file mode 100644 (file)
index 0000000..084f0ee
--- /dev/null
@@ -0,0 +1,55 @@
+;;; lsp-prolog.el --- Prolog Client settings -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020  James Cash
+
+;; Author: James Cash <james.nvcNOSPAMgmail.com>
+;; Keywords: languages,tools
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-prolog client
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-prolog nil
+  "LSP support for Prolog."
+  :link '(url-link "https://github.com/jamesnvc/lsp_server")
+  :group 'lsp-mode
+  :tag "Lsp Prolog")
+
+(defcustom lsp-prolog-server-command '("swipl"
+                                       "-g" "use_module(library(lsp_server))."
+                                       "-g" "lsp_server:main"
+                                       "-t" "halt"
+                                       "--" "stdio")
+  "The prolog-lsp server command."
+  :group 'lsp-prolog
+  :risky t
+  :type 'list)
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda () lsp-prolog-server-command))
+  :major-modes '(prolog-mode)
+  :multi-root t
+  :server-id 'prolog-lsp))
+
+(lsp-consistency-check lsp-prolog)
+
+(provide 'lsp-prolog)
+;;; lsp-prolog.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-protocol.el b/elpa/lsp-mode-20220201.852/lsp-protocol.el
new file mode 100644 (file)
index 0000000..a3de34c
--- /dev/null
@@ -0,0 +1,766 @@
+;;; lsp-protocol.el --- Language Sever Protocol Bindings  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords: convenience
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Autogenerated bindings from lsp4j using
+;; https://github.com/victools/jsonschema-generator+scrips to generate
+;; scripts/generated.protocol.schema.json and then
+;; scripts/lsp-generate-bindings.el
+
+;;; Code:
+
+(require 'cl-lib)
+(require 'dash)
+(require 'ht)
+(require 's)
+
+(eval-and-compile
+  (defun lsp-keyword->symbol (keyword)
+    "Convert a KEYWORD to symbol."
+    (intern (substring (symbol-name keyword) 1)))
+
+  (defun lsp-keyword->string (keyword)
+    "Convert a KEYWORD to string."
+    (substring (symbol-name keyword) 1))
+
+  (defvar lsp-use-plists (getenv "LSP_USE_PLISTS")))
+
+(defmacro lsp-interface (&rest interfaces)
+  "Generate LSP bindings from INTERFACES triplet.
+
+Example usage with `dash`.
+
+\(-let [(&ApplyWorkspaceEditResponse
+  :failure-reason?) (ht (\"failureReason\" \"...\"))]
+  failure-reason?)
+
+\(fn (INTERFACE-NAME-1 REQUIRED-FIELDS-1 OPTIONAL-FIELDS-1) (INTERFACE-NAME-2 REQUIRED-FIELDS-2 OPTIONAL-FIELDS-2) ...)"
+  (with-case-table ascii-case-table
+    (->> interfaces
+         (-map (-lambda ((interface required optional))
+                 (let ((params (nconc
+                                (-map (lambda (param-name)
+                                        (cons
+                                         (intern (concat ":" (s-dashed-words (symbol-name param-name)) "?"))
+                                         param-name))
+                                      optional)
+                                (-map (lambda (param-name)
+                                        (cons (intern (concat ":" (s-dashed-words (symbol-name param-name))))
+                                              param-name))
+                                      required))))
+                   (cl-list*
+                    `(defun ,(intern (format "dash-expand:&%s" interface)) (key source)
+                       (unless (or (member key ',(-map #'cl-first params))
+                                   (s-starts-with? ":_" (symbol-name key)))
+                         (error "Unknown key: %s.  Available keys: %s" key ',(-map #'cl-first params)))
+                       ,(if lsp-use-plists
+                            ``(plist-get ,source
+                                         ,(if (s-starts-with? ":_" (symbol-name key))
+                                              key
+                                            (cl-rest (assoc key ',params))))
+                          ``(gethash ,(if (s-starts-with? ":_" (symbol-name key))
+                                          (substring (symbol-name key) 1)
+                                        (substring (symbol-name
+                                                    (cl-rest (assoc key ',params)))
+                                                   1))
+                                     ,source)))
+                    `(defun ,(intern (format "dash-expand:&%s?" interface)) (key source)
+                       (unless (member key ',(-map #'cl-first params))
+                         (error "Unknown key: %s.  Available keys: %s" key ',(-map #'cl-first params)))
+                       ,(if lsp-use-plists
+                            ``(plist-get ,source
+                                         ,(if (s-starts-with? ":_" (symbol-name key))
+                                              key
+                                            (cl-rest (assoc key ',params))))
+                          ``(when (ht? ,source)
+                              (gethash ,(substring (symbol-name
+                                                    (cl-rest (assoc key ',params)))
+                                                   1)
+                                       ,source))))
+
+                    `(defun ,(intern (format "lsp-%s?" (s-dashed-words (symbol-name interface)))) (object)
+                       (cond
+                        ((ht? object)
+                         (-all? (let ((keys (ht-keys object)))
+                                  (lambda (prop)
+                                    (member prop keys)))
+                                ',(-map (lambda (field-name)
+                                          (substring (symbol-name field-name) 1))
+                                        required)))
+                        ((listp object) (-all? (lambda (prop)
+                                                 (plist-member object prop))
+                                               ',required))))
+                    `(cl-defun ,(intern (format "lsp-make-%s" (s-dashed-words (symbol-name interface))))
+                         (&rest plist &key ,@(-map (-lambda ((key))
+                                                     (intern (substring (symbol-name key) 1))) params)
+                                &allow-other-keys)
+                       (ignore ,@(-map (-lambda ((key))
+                                         (intern (substring (symbol-name key) 1))) params))
+                       ,(format "Constructs %s from `plist.'
+Allowed params: %s" interface (reverse (-map #'cl-first params)))
+                       ,(if lsp-use-plists
+                            `(-mapcat (-lambda ((key value))
+                                        (list (or (cl-rest (assoc key ',params)) key) value))
+                                      (-partition 2 plist))
+                          `(let (($$result (ht)))
+                             (mapc (-lambda ((key value))
+                                     (puthash (lsp-keyword->string (or (cl-rest (assoc key ',params))
+                                                                       key))
+                                              value
+                                              $$result))
+                                   (-partition 2 plist))
+                             $$result)))
+                    `(pcase-defmacro ,interface (&rest property-bindings)
+                       ,(if lsp-use-plists
+                            ``(and
+                               (pred listp)
+                               ;; Check if all the types required by the
+                               ;; interface exist in the expr-val.
+                               ,@(-map
+                                  (lambda (key)
+                                    `(pred
+                                      (lambda (plist)
+                                        (plist-member plist ,key))))
+                                  ',required)
+                               ;; Recursively generate the bindings.
+                               ,@(let ((current-list property-bindings)
+                                       (output-bindings nil))
+                                   ;; Invariant: while current-list is
+                                   ;; non-nil, the car of current-list is
+                                   ;; always of the form :key, while the
+                                   ;; cadr of current-list is either a)
+                                   ;; nil, b) of the form :key-next or c)
+                                   ;; a pcase pattern that can
+                                   ;; recursively match an expression.
+                                   (while current-list
+                                     (-let* (((curr-binding-as-keyword next-entry . _) current-list)
+                                             (curr-binding-as-camelcased-symbol
+                                              (or (alist-get curr-binding-as-keyword ',params)
+                                                  (error "Unknown key: %s.  Available keys: %s"
+                                                         (symbol-name curr-binding-as-keyword)
+                                                         ',(-map #'cl-first params))))
+                                             (bound-name (lsp-keyword->symbol curr-binding-as-keyword))
+                                             (next-entry-is-key-or-nil
+                                              (and (symbolp next-entry)
+                                                   (or (null next-entry)
+                                                       (s-starts-with? ":" (symbol-name next-entry))))))
+                                       (cond
+                                        ;; If the next-entry is either a
+                                        ;; plist-key or nil, then bind to
+                                        ;; bound-name the value corresponding
+                                        ;; to the camelcased symbol.  Pop
+                                        ;; current-list once.
+                                        (next-entry-is-key-or-nil
+                                         (push `(app (lambda (plist)
+                                                       (plist-get plist ,curr-binding-as-camelcased-symbol))
+                                                     ,bound-name)
+                                               output-bindings)
+                                         (setf current-list (cdr current-list)))
+                                        ;; Otherwise, next-entry is a pcase
+                                        ;; pattern we recursively match to the
+                                        ;; expression. This can in general
+                                        ;; create additional bindings that we
+                                        ;; persist in the top level of
+                                        ;; bindings.  We pop current-list
+                                        ;; twice.
+                                        (t
+                                         (push `(app (lambda (plist)
+                                                       (plist-get plist ,curr-binding-as-camelcased-symbol))
+                                                     ,next-entry)
+                                               output-bindings)
+                                         (setf current-list (cddr current-list))))))
+                                   output-bindings))
+                          ``(and
+                             (pred ht?)
+                             ,@(-map
+                                (lambda (key)
+                                  `(pred
+                                    (lambda (hash-table)
+                                      (ht-contains? hash-table ,(lsp-keyword->string key)))))
+                                ',required)
+                             ,@(let ((current-list property-bindings)
+                                     (output-bindings nil))
+                                 (while current-list
+                                   (-let* (((curr-binding-as-keyword next-entry . _) current-list)
+                                           (curr-binding-as-camelcased-string
+                                            (lsp-keyword->string (or (alist-get curr-binding-as-keyword ',params)
+                                                                     (error "Unknown key: %s.  Available keys: %s"
+                                                                            (symbol-name curr-binding-as-keyword)
+                                                                            ',(-map #'cl-first params)))))
+                                           (bound-name (lsp-keyword->symbol curr-binding-as-keyword))
+                                           (next-entry-is-key-or-nil
+                                            (and (symbolp next-entry)
+                                                 (or (null next-entry)
+                                                     (s-starts-with? ":" (symbol-name next-entry))))))
+                                     (cond
+                                      (next-entry-is-key-or-nil
+                                       (push `(app (lambda (hash-table)
+                                                     (ht-get hash-table ,curr-binding-as-camelcased-string))
+                                                   ,bound-name)
+                                             output-bindings)
+                                       (setf current-list (cdr current-list)))
+                                      (t
+                                       (push `(app (lambda (hash-table)
+                                                     (ht-get hash-table ,curr-binding-as-camelcased-string))
+                                                   ,next-entry)
+                                             output-bindings)
+                                       (setf current-list (cddr current-list))))))
+                                 output-bindings))))
+                    (-mapcat (-lambda ((label . name))
+                               (list
+                                `(defun ,(intern (format "lsp:%s-%s"
+                                                         (s-dashed-words (symbol-name interface))
+                                                         (substring (symbol-name label) 1)))
+                                     (object)
+                                   ,(if lsp-use-plists
+                                        `(plist-get object ,name)
+                                      `(when (ht? object) (gethash ,(lsp-keyword->string name) object))))
+                                `(defun ,(intern (format "lsp:set-%s-%s"
+                                                         (s-dashed-words (symbol-name interface))
+                                                         (substring (symbol-name label) 1)))
+                                     (object value)
+                                   ,@(if lsp-use-plists
+                                         `((plist-put object ,name value))
+                                       `((puthash ,(lsp-keyword->string name) value object)
+                                         object)))))
+                             params)))))
+         (apply #'append)
+         (cl-list* 'progn))))
+
+(if lsp-use-plists
+    (progn
+      (defun lsp-get (from key)
+        (plist-get from key))
+      (defun lsp-put (where key value)
+        (plist-put where key value))
+      (defun lsp-map (fn value)
+        (-map (-lambda ((k v))
+                (funcall fn (lsp-keyword->string k) v))
+              (-partition 2 value )))
+      (defalias 'lsp-merge 'append)
+      (defalias 'lsp-empty? 'null)
+      (defalias 'lsp-copy 'copy-sequence)
+      (defun lsp-member? (from key)
+        (when (listp from)
+          (plist-member from key))))
+  (defun lsp-get (from key)
+    (when from
+      (gethash (lsp-keyword->string key) from)))
+  (defun lsp-put (where key value)
+    (prog1 where
+      (puthash (lsp-keyword->string key) value where)))
+  (defun lsp-map (fn value)
+    (when value
+      (maphash fn value)))
+  (defalias 'lsp-merge 'ht-merge)
+  (defalias 'lsp-empty? 'ht-empty?)
+  (defalias 'lsp-copy 'ht-copy)
+  (defun lsp-member? (from key)
+    (when (hash-table-p from)
+      (not (eq (gethash (lsp-keyword->string key) from :__lsp_default)
+               :__lsp_default)))))
+
+(defmacro lsp-defun (name match-form &rest body)
+  "Define a function named NAME.
+The function destructures its input as MATCH-FORM then executes BODY.
+
+Note that you have to enclose the MATCH-FORM in a pair of parens,
+such that:
+
+  (-defun (x) body)
+  (-defun (x y ...) body)
+
+has the usual semantics of `defun'.  Furthermore, these get
+translated into a normal `defun', so there is no performance
+penalty.
+
+See `-let' for a description of the destructuring mechanism."
+  (declare (doc-string 3) (indent defun)
+           (debug (&define name sexp
+                           [&optional stringp]
+                           [&optional ("declare" &rest sexp)]
+                           [&optional ("interactive" interactive)]
+                           def-body)))
+  (cond
+   ((nlistp match-form)
+    (signal 'wrong-type-argument (list #'listp match-form)))
+   ;; no destructuring, so just return regular defun to make things faster
+   ((-all? #'symbolp match-form)
+    `(defun ,name ,match-form ,@body))
+   (t
+    (-let* ((inputs (--map-indexed (list it (make-symbol (format "input%d" it-index))) match-form))
+            ((body docs) (cond
+                          ;; only docs
+                          ((and (stringp (car body))
+                                (not (cdr body)))
+                           (list body (car body)))
+                          ;; docs + body
+                          ((stringp (car body))
+                           (list (cdr body) (car body)))
+                          ;; no docs
+                          (t (list body))))
+            ((body interactive-form) (cond
+                                      ;; interactive form
+                                      ((and (listp (car body))
+                                            (eq (caar body) 'interactive))
+                                       (list (cdr body) (car body)))
+                                      ;; no interactive form
+                                      (t (list body)))))
+      ;; TODO: because inputs to the defun are evaluated only once,
+      ;; -let* need not to create the extra bindings to ensure that.
+      ;; We should find a way to optimize that.  Not critical however.
+      `(defun ,name ,(-map #'cadr inputs)
+         ,@(when docs (list docs))
+         ,@(when interactive-form (list interactive-form))
+         (-let* ,inputs ,@body))))))
+
+\f
+
+
+;; manually defined interfaces
+(defconst lsp/markup-kind-plain-text "plaintext")
+(defconst lsp/markup-kind-markdown "markdown")
+
+(lsp-interface (JSONResponse (:params :id :method :result) nil)
+               (JSONResponseError (:error) nil)
+               (JSONMessage nil (:params :id :method :result :error))
+               (JSONResult nil (:params :id :method))
+               (JSONNotification (:params :method) nil)
+               (JSONRequest (:params :method) nil)
+               (JSONError (:message :code) (:data))
+               (ProgressParams (:token :value) nil)
+               (Edit (:kind) nil)
+               (WorkDoneProgress (:kind) nil)
+               (WorkDoneProgressBegin  (:kind :title) (:cancellable :message :percentage))
+               (WorkDoneProgressReport  (:kind) (:cancellable :message :percentage))
+               (WorkDoneProgressEnd  (:kind) (:message))
+               (WorkDoneProgressOptions nil (:workDoneProgress))
+               (SemanticTokensOptions (:legend) (:rangeProvider :documentProvider))
+               (SemanticTokensLegend (:tokenTypes :tokenModifiers))
+               (SemanticTokensResult (:resultId) (:data))
+               (SemanticTokensPartialResult nil (:data))
+               (SemanticTokensEdit (:start :deleteCount) (:data))
+               (SemanticTokensDelta (:resultId) (:edits))
+               (SemanticTokensDeltaPartialResult nil (:edits)))
+
+(lsp-interface (v1:ProgressParams (:id :title) (:message :percentage :done)))
+
+(defun dash-expand:&RangeToPoint (key source)
+  "Convert the position KEY from SOURCE into a point."
+  `(lsp--position-to-point
+    (lsp-get ,source ,key)))
+
+(lsp-interface (eslint:StatusParams  (:state) nil)
+               (eslint:OpenESLintDocParams (:url) nil)
+               (eslint:ConfirmExecutionParams (:scope :file :libraryPath) nil))
+
+(lsp-interface (haxe:ProcessStartNotification (:title) nil))
+
+(lsp-interface (pwsh:ScriptRegion (:StartLineNumber :EndLineNumber :StartColumnNumber :EndColumnNumber :Text) nil))
+
+(lsp-interface (omnisharp:ErrorMessage (:Text :FileName :Line :Column))
+               (omnisharp:ProjectInformationRequest (:FileName))
+               (omnisharp:MsBuildProject (:IsUnitProject :IsExe :Platform :Configuration :IntermediateOutputPath :OutputPath :TargetFrameworks :SourceFiles :TargetFramework :TargetPath :AssemblyName :Path :ProjectGuid))
+               (omnisharp:ProjectInformation (:ScriptProject :MsBuildProject))
+               (omnisharp:CodeStructureRequest (:FileName))
+               (omnisharp:CodeStructureResponse (:Elements))
+               (omnisharp:CodeElement (:Kind :Name :DisplayName :Children :Ranges :Properties))
+               (omnisharp:CodeElementProperties () (:static :accessibility :testMethodName :testFramework))
+               (omnisharp:Range (:Start :End))
+               (omnisharp:RangeList () (:attributes :full :name))
+               (omnisharp:Point (:Line :Column))
+               (omnisharp:RunTestsInClassRequest (:MethodNames :RunSettings :TestFrameworkname :TargetFrameworkVersion :NoBuild :Line :Column :Buffer :FileName))
+               (omnisharp:RunTestResponse (:Results :Pass :Failure :ContextHadNoTests))
+               (omnisharp:TestMessageEvent (:MessageLevel :Message))
+               (omnisharp:DotNetTestResult (:MethodName :Outcome :ErrorMessage :ErrorStackTrace :StandardOutput :StandardError)))
+
+(lsp-interface (csharp-ls:CSharpMetadata (:textDocument))
+               (csharp-ls:CSharpMetadataResponse (:source :projectName :assemblyName :symbolName)))
+
+(lsp-interface (rls:Cmd (:args :binary :env :cwd) nil))
+
+(defconst lsp/rust-analyzer-inlay-hint-kind-type-hint "TypeHint")
+(defconst lsp/rust-analyzer-inlay-hint-kind-param-hint "ParameterHint")
+(defconst lsp/rust-analyzer-inlay-hint-kind-chaining-hint "ChainingHint")
+(lsp-interface (rust-analyzer:AnalyzerStatusParams (:textDocument))
+               (rust-analyzer:SyntaxTreeParams (:textDocument) (:range))
+               (rust-analyzer:ExpandMacroParams (:textDocument :position) nil)
+               (rust-analyzer:ExpandedMacro (:name :expansion) nil)
+               (rust-analyzer:MatchingBraceParams (:textDocument :positions) nil)
+               (rust-analyzer:OpenCargoTomlParams (:textDocument) nil)
+               (rust-analyzer:OpenExternalDocsParams (:textDocument :position) nil)
+               (rust-analyzer:ResovedCodeActionParams (:id :codeActionParams) nil)
+               (rust-analyzer:JoinLinesParams (:textDocument :ranges) nil)
+               (rust-analyzer:MoveItemParams (:textDocument :range :direction) nil)
+               (rust-analyzer:RunnablesParams (:textDocument) (:position))
+               (rust-analyzer:Runnable (:label :kind :args) (:location))
+               (rust-analyzer:RunnableArgs (:cargoArgs :executableArgs) (:workspaceRoot))
+               (rust-analyzer:RelatedTestsParams (:textDocument :position) nil)
+               (rust-analyzer:RelatedTests (:runnable) nil)
+               (rust-analyzer:InlayHint (:range :label :kind) nil)
+               (rust-analyzer:InlayHintsParams (:textDocument) nil)
+               (rust-analyzer:SsrParams (:query :parseOnly) nil)
+               (rust-analyzer:CommandLink (:title :command) (:arguments :tooltip))
+               (rust-analyzer:CommandLinkGroup (:commands) (:title)))
+
+(lsp-interface (clojure-lsp:TestTreeParams (:uri :tree) nil)
+               (clojure-lsp:TestTreeNode (:name :range :nameRange :kind) (:children)))
+
+\f
+;; begin autogenerated code
+
+(defvar lsp/completion-item-kind-lookup
+  [nil Text Method Function Constructor Field Variable Class Interface Module Property Unit Value Enum Keyword Snippet Color File Reference Folder EnumMember Constant Struct Event Operator TypeParameter])
+(defconst lsp/completion-item-kind-text 1)
+(defconst lsp/completion-item-kind-method 2)
+(defconst lsp/completion-item-kind-function 3)
+(defconst lsp/completion-item-kind-constructor 4)
+(defconst lsp/completion-item-kind-field 5)
+(defconst lsp/completion-item-kind-variable 6)
+(defconst lsp/completion-item-kind-class 7)
+(defconst lsp/completion-item-kind-interface 8)
+(defconst lsp/completion-item-kind-module 9)
+(defconst lsp/completion-item-kind-property 10)
+(defconst lsp/completion-item-kind-unit 11)
+(defconst lsp/completion-item-kind-value 12)
+(defconst lsp/completion-item-kind-enum 13)
+(defconst lsp/completion-item-kind-keyword 14)
+(defconst lsp/completion-item-kind-snippet 15)
+(defconst lsp/completion-item-kind-color 16)
+(defconst lsp/completion-item-kind-file 17)
+(defconst lsp/completion-item-kind-reference 18)
+(defconst lsp/completion-item-kind-folder 19)
+(defconst lsp/completion-item-kind-enum-member 20)
+(defconst lsp/completion-item-kind-constant 21)
+(defconst lsp/completion-item-kind-struct 22)
+(defconst lsp/completion-item-kind-event 23)
+(defconst lsp/completion-item-kind-operator 24)
+(defconst lsp/completion-item-kind-type-parameter 25)
+(defvar lsp/completion-trigger-kind-lookup
+  [nil Invoked TriggerCharacter TriggerForIncompleteCompletions])
+(defconst lsp/completion-trigger-kind-invoked 1)
+(defconst lsp/completion-trigger-kind-trigger-character 2)
+(defconst lsp/completion-trigger-kind-trigger-for-incomplete-completions 3)
+(defvar lsp/diagnostic-severity-lookup
+  [nil Error Warning Information Hint Max])
+(defconst lsp/diagnostic-severity-error 1)
+(defconst lsp/diagnostic-severity-warning 2)
+(defconst lsp/diagnostic-severity-information 3)
+(defconst lsp/diagnostic-severity-hint 4)
+(defconst lsp/diagnostic-severity-max 5)
+(defvar lsp/diagnostic-tag-lookup
+  [nil Unnecessary Deprecated])
+(defconst lsp/diagnostic-tag-unnecessary 1)
+(defconst lsp/diagnostic-tag-deprecated 2)
+(defvar lsp/completion-item-tag-lookup
+  [nil Deprecated])
+(defconst lsp/completion-item-tag-deprecated 1)
+(defvar lsp/document-highlight-kind-lookup
+  [nil Text Read Write])
+(defconst lsp/document-highlight-kind-text 1)
+(defconst lsp/document-highlight-kind-read 2)
+(defconst lsp/document-highlight-kind-write 3)
+(defvar lsp/file-change-type-lookup
+  [nil Created Changed Deleted])
+(defconst lsp/file-change-type-created 1)
+(defconst lsp/file-change-type-changed 2)
+(defconst lsp/file-change-type-deleted 3)
+(defvar lsp/insert-text-format-lookup
+  [nil PlainText Snippet])
+(defconst lsp/insert-text-format-plain-text 1)
+(defconst lsp/insert-text-format-snippet 2)
+(defvar lsp/insert-text-mode-lookup
+  [nil AsIs AdjustIndentation])
+(defconst lsp/insert-text-mode-as-it 1)
+(defconst lsp/insert-text-mode-adjust-indentation 2)
+(defvar lsp/message-type-lookup
+  [nil Error Warning Info Log])
+(defconst lsp/message-type-error 1)
+(defconst lsp/message-type-warning 2)
+(defconst lsp/message-type-info 3)
+(defconst lsp/message-type-log 4)
+(defvar lsp/signature-help-trigger-kind-lookup
+  [nil Invoked TriggerCharacter ContentChange])
+(defconst lsp/signature-help-trigger-kind-invoked 1)
+(defconst lsp/signature-help-trigger-kind-trigger-character 2)
+(defconst lsp/signature-help-trigger-kind-content-change 3)
+(defvar lsp/symbol-kind-lookup
+  [nil File Module Namespace Package Class Method Property Field Constructor Enum Interface Function Variable Constant String Number Boolean Array Object Key Null EnumMember Struct Event Operator TypeParameter])
+(defconst lsp/symbol-kind-file 1)
+(defconst lsp/symbol-kind-module 2)
+(defconst lsp/symbol-kind-namespace 3)
+(defconst lsp/symbol-kind-package 4)
+(defconst lsp/symbol-kind-class 5)
+(defconst lsp/symbol-kind-method 6)
+(defconst lsp/symbol-kind-property 7)
+(defconst lsp/symbol-kind-field 8)
+(defconst lsp/symbol-kind-constructor 9)
+(defconst lsp/symbol-kind-enum 10)
+(defconst lsp/symbol-kind-interface 11)
+(defconst lsp/symbol-kind-function 12)
+(defconst lsp/symbol-kind-variable 13)
+(defconst lsp/symbol-kind-constant 14)
+(defconst lsp/symbol-kind-string 15)
+(defconst lsp/symbol-kind-number 16)
+(defconst lsp/symbol-kind-boolean 17)
+(defconst lsp/symbol-kind-array 18)
+(defconst lsp/symbol-kind-object 19)
+(defconst lsp/symbol-kind-key 20)
+(defconst lsp/symbol-kind-null 21)
+(defconst lsp/symbol-kind-enum-member 22)
+(defconst lsp/symbol-kind-struct 23)
+(defconst lsp/symbol-kind-event 24)
+(defconst lsp/symbol-kind-operator 25)
+(defconst lsp/symbol-kind-type-parameter 26)
+(defvar lsp/text-document-save-reason-lookup
+  [nil Manual AfterDelay FocusOut])
+(defconst lsp/text-document-save-reason-manual 1)
+(defconst lsp/text-document-save-reason-after-delay 2)
+(defconst lsp/text-document-save-reason-focus-out 3)
+(defvar lsp/text-document-sync-kind-lookup
+  [None Full Incremental])
+(defconst lsp/text-document-sync-kind-none 0)
+(defconst lsp/text-document-sync-kind-full 1)
+(defconst lsp/text-document-sync-kind-incremental 2)
+(defvar lsp/type-hierarchy-direction-lookup
+  [nil Children Parents Both])
+(defconst lsp/type-hierarchy-direction-children 1)
+(defconst lsp/type-hierarchy-direction-parents 2)
+(defconst lsp/type-hierarchy-direction-both 3)
+(defvar lsp/call-hierarchy-direction-lookup
+  [nil CallsFrom CallsTo])
+(defconst lsp/call-hierarchy-direction-calls-from 1)
+(defconst lsp/call-hierarchy-direction-calls-to 2)
+(defvar lsp/response-error-code-lookup
+  [nil ParseError InvalidRequest MethodNotFound InvalidParams InternalError serverErrorStart serverErrorEnd])
+(defconst lsp/response-error-code-parse-error 1)
+(defconst lsp/response-error-code-invalid-request 2)
+(defconst lsp/response-error-code-method-not-found 3)
+(defconst lsp/response-error-code-invalid-params 4)
+(defconst lsp/response-error-code-internal-error 5)
+(defconst lsp/response-error-code-server-error-start 6)
+(defconst lsp/response-error-code-server-error-end 7)
+
+(lsp-interface
+ (CallHierarchyCapabilities nil (:dynamicRegistration))
+ (CallHierarchyItem (:kind :name :range :selectionRange :uri) (:detail :tags))
+ (ClientCapabilities nil (:experimental :textDocument :workspace))
+ (ClientInfo (:name) (:version))
+ (CodeActionCapabilities nil (:codeActionLiteralSupport :dynamicRegistration :isPreferredSupport :dataSupport :resolveSupport))
+ (CodeActionContext (:diagnostics) (:only))
+ (CodeActionKindCapabilities (:valueSet) nil)
+ (CodeActionLiteralSupportCapabilities nil (:codeActionKind))
+ (CodeActionOptions nil (:codeActionKinds :resolveProvider))
+ (CodeLensCapabilities nil (:dynamicRegistration))
+ (CodeLensOptions (:resolveProvider) nil)
+ (Color (:red :green :blue :alpha) nil)
+ (ColorProviderCapabilities nil (:dynamicRegistration))
+ (ColorProviderOptions nil (:documentSelector :id))
+ (ColoringInformation (:range :styles) nil)
+ (Command (:title :command) (:arguments))
+ (CompletionCapabilities nil (:completionItem :completionItemKind :contextSupport :dynamicRegistration))
+ (CompletionContext (:triggerKind) (:triggerCharacter))
+ (CompletionItem (:label) (:additionalTextEdits :command :commitCharacters :data :deprecated :detail :documentation :filterText :insertText :insertTextFormat :insertTextMode :kind :preselect :sortText :tags :textEdit :score))
+ (CompletionItemCapabilities nil (:commitCharactersSupport :deprecatedSupport :documentationFormat :preselectSupport :snippetSupport :tagSupport :insertReplaceSupport :resolveSupport))
+ (CompletionItemKindCapabilities nil (:valueSet))
+ (CompletionItemTagSupportCapabilities (:valueSet) nil)
+ (CompletionOptions nil (:resolveProvider :triggerCharacters :allCommitCharacters))
+ (ConfigurationItem nil (:scopeUri :section))
+ (CreateFileOptions nil (:ignoreIfExists :overwrite))
+ (DeclarationCapabilities nil (:dynamicRegistration :linkSupport))
+ (DefinitionCapabilities nil (:dynamicRegistration :linkSupport))
+ (DeleteFileOptions nil (:ignoreIfNotExists :recursive))
+ (Diagnostic (:range :message) (:code :relatedInformation :severity :source :tags))
+ (DiagnosticRelatedInformation (:location :message) nil)
+ (DiagnosticsTagSupport (:valueSet) nil)
+ (DidChangeConfigurationCapabilities nil (:dynamicRegistration))
+ (DidChangeWatchedFilesCapabilities nil (:dynamicRegistration))
+ (DocumentFilter nil (:language :pattern :scheme))
+ (DocumentHighlightCapabilities nil (:dynamicRegistration))
+ (DocumentLinkCapabilities nil (:dynamicRegistration :tooltipSupport))
+ (DocumentLinkOptions nil (:resolveProvider))
+ (DocumentOnTypeFormattingOptions (:firstTriggerCharacter) (:moreTriggerCharacter))
+ (DocumentSymbol (:kind :name :range :selectionRange) (:children :deprecated :detail))
+ (DocumentSymbolCapabilities nil (:dynamicRegistration :hierarchicalDocumentSymbolSupport :symbolKind))
+ (ExecuteCommandCapabilities nil (:dynamicRegistration))
+ (ExecuteCommandOptions (:commands) nil)
+ (FileEvent (:type :uri) nil)
+ (FileSystemWatcher (:globPattern) (:kind))
+ (FoldingRangeCapabilities nil (:dynamicRegistration :lineFoldingOnly :rangeLimit))
+ (FoldingRangeProviderOptions nil (:documentSelector :id))
+ (FormattingCapabilities nil (:dynamicRegistration))
+ (FormattingOptions (:tabSize :insertSpaces) (:trimTrailingWhitespace :insertFinalNewline :trimFinalNewlines))
+ (HoverCapabilities nil (:contentFormat :dynamicRegistration))
+ (ImplementationCapabilities nil (:dynamicRegistration :linkSupport))
+ (LinkedEditingRanges (:ranges) (:wordPattern))
+ (Location (:range :uri) nil)
+ (MarkedString (:language :value) nil)
+ (MarkupContent (:kind :value) nil)
+ (MessageActionItem (:title) nil)
+ (OnTypeFormattingCapabilities nil (:dynamicRegistration))
+ (ParameterInformation (:label) (:documentation))
+ (ParameterInformationCapabilities nil (:labelOffsetSupport))
+ (Position (:character :line) nil)
+ (PublishDiagnosticsCapabilities nil (:relatedInformation :tagSupport :versionSupport))
+ (Range (:start :end) nil)
+ (RangeFormattingCapabilities nil (:dynamicRegistration))
+ (ReferenceContext (:includeDeclaration) nil)
+ (ReferencesCapabilities nil (:dynamicRegistration))
+ (Registration (:method :id) (:registerOptions))
+ (RenameCapabilities nil (:dynamicRegistration :prepareSupport))
+ (RenameFileOptions nil (:ignoreIfExists :overwrite))
+ (RenameOptions nil (:documentSelector :id :prepareProvider))
+ (ResourceChange nil (:current :newUri))
+ (ResourceOperation (:kind) nil)
+ (SaveOptions nil (:includeText))
+ (SelectionRange (:range) (:parent))
+ (SelectionRangeCapabilities nil (:dynamicRegistration))
+ (SemanticHighlightingCapabilities nil (:semanticHighlighting))
+ (SemanticHighlightingInformation (:line) (:tokens))
+ (SemanticHighlightingServerCapabilities nil (:scopes))
+ (ServerCapabilities nil (:callHierarchyProvider :codeActionProvider :codeLensProvider :colorProvider :completionProvider :declarationProvider :definitionProvider :documentFormattingProvider :documentHighlightProvider :documentLinkProvider :documentOnTypeFormattingProvider :documentRangeFormattingProvider :documentSymbolProvider :executeCommandProvider :experimental :foldingRangeProvider :hoverProvider :implementationProvider :referencesProvider :renameProvider :selectionRangeProvider :semanticHighlighting :signatureHelpProvider :textDocumentSync :typeDefinitionProvider :typeHierarchyProvider :workspace :workspaceSymbolProvider :semanticTokensProvider))
+ (ServerInfo (:name) (:version))
+ (SignatureHelp (:signatures) (:activeParameter :activeSignature))
+ (SignatureHelpCapabilities nil (:contextSupport :dynamicRegistration :signatureInformation))
+ (SignatureHelpContext (:triggerKind :isRetrigger) (:activeSignatureHelp :triggerCharacter))
+ (SignatureHelpOptions nil (:retriggerCharacters :triggerCharacters))
+ (SignatureInformation (:label) (:documentation :parameters))
+ (SignatureInformationCapabilities nil (:documentationFormat :parameterInformation))
+ (StaticRegistrationOptions nil (:documentSelector :id))
+ (SymbolCapabilities nil (:dynamicRegistration :symbolKind))
+ (SymbolKindCapabilities nil (:valueSet))
+ (SynchronizationCapabilities nil (:didSave :dynamicRegistration :willSave :willSaveWaitUntil))
+ (TextDocumentClientCapabilities nil (:callHierarchy :codeAction :codeLens :colorProvider :completion :declaration :definition :documentHighlight :documentLink :documentSymbol :foldingRange :formatting :hover :implementation :onTypeFormatting :publishDiagnostics :rangeFormatting :references :rename :selectionRange :semanticHighlightingCapabilities :signatureHelp :synchronization :typeDefinition :typeHierarchyCapabilities))
+ (TextDocumentContentChangeEvent (:text) (:range :rangeLength))
+ (TextDocumentEdit (:textDocument :edits) nil)
+ (TextDocumentIdentifier (:uri) nil)
+ (TextDocumentItem (:languageId :text :uri :version) nil)
+ (TextDocumentSyncOptions nil (:change :openClose :save :willSave :willSaveWaitUntil))
+ (TextEdit (:newText :range) nil)
+ (InsertReplaceEdit (:newText :insert :replace) nil)
+ (SnippetTextEdit (:newText :range) (:insertTextFormat))
+ (TypeDefinitionCapabilities nil (:dynamicRegistration :linkSupport))
+ (TypeHierarchyCapabilities nil (:dynamicRegistration))
+ (TypeHierarchyItem (:kind :name :range :selectionRange :uri) (:children :data :deprecated :detail :parents))
+ (Unregistration (:method :id) nil)
+ (VersionedTextDocumentIdentifier (:uri) (:version))
+ (WorkspaceClientCapabilities nil (:applyEdit :configuration :didChangeConfiguration :didChangeWatchedFiles :executeCommand :symbol :workspaceEdit :workspaceFolders))
+ (WorkspaceEdit nil (:changes :documentChanges :resourceChanges))
+ (WorkspaceEditCapabilities nil (:documentChanges :failureHandling :resourceChanges :resourceOperations))
+ (WorkspaceFolder (:uri :name) nil)
+ (WorkspaceFoldersChangeEvent (:removed :added) nil)
+ (WorkspaceFoldersOptions nil (:changeNotifications :supported))
+ (WorkspaceServerCapabilities nil (:workspaceFolders))
+ (ApplyWorkspaceEditParams (:edit) (:label))
+ (ApplyWorkspaceEditResponse (:applied) nil)
+ (CallHierarchyIncomingCall (:from :fromRanges) nil)
+ (CallHierarchyIncomingCallsParams (:item) nil)
+ (CallHierarchyOutgoingCall (:to :fromRanges) nil)
+ (CallHierarchyOutgoingCallsParams (:item) nil)
+ (CallHierarchyPrepareParams (:textDocument :position) (:uri))
+ (CodeAction (:title) (:command :diagnostics :edit :isPreferred :kind :data))
+ (CodeActionKind nil nil)
+ (CodeActionParams (:textDocument :context :range) nil)
+ (CodeLens (:range) (:command :data))
+ (CodeLensParams (:textDocument) nil)
+ (CodeLensRegistrationOptions nil (:documentSelector :resolveProvider))
+ (ColorInformation (:color :range) nil)
+ (ColorPresentation (:label) (:additionalTextEdits :textEdit))
+ (ColorPresentationParams (:color :textDocument :range) nil)
+ (ColoringParams (:uri :infos) nil)
+ (ColoringStyle nil nil)
+ (CompletionList (:items :isIncomplete) nil)
+ (CompletionParams (:textDocument :position) (:context :uri))
+ (CompletionRegistrationOptions nil (:documentSelector :resolveProvider :triggerCharacters))
+ (ConfigurationParams (:items) nil)
+ (CreateFile (:kind :uri) (:options))
+ (DeclarationParams (:textDocument :position) (:uri))
+ (DefinitionParams (:textDocument :position) (:uri))
+ (DeleteFile (:kind :uri) (:options))
+ (DidChangeConfigurationParams (:settings) nil)
+ (DidChangeTextDocumentParams (:contentChanges :textDocument) (:uri))
+ (DidChangeWatchedFilesParams (:changes) nil)
+ (DidChangeWatchedFilesRegistrationOptions (:watchers) nil)
+ (DidChangeWorkspaceFoldersParams (:event) nil)
+ (DidCloseTextDocumentParams (:textDocument) nil)
+ (DidOpenTextDocumentParams (:textDocument) (:text))
+ (DidSaveTextDocumentParams (:textDocument) (:text))
+ (DocumentColorParams (:textDocument) nil)
+ (DocumentFormattingParams (:textDocument :options) nil)
+ (DocumentHighlight (:range) (:kind))
+ (DocumentHighlightParams (:textDocument :position) (:uri))
+ (DocumentLink (:range) (:data :target :tooltip))
+ (DocumentLinkParams (:textDocument) nil)
+ (DocumentLinkRegistrationOptions nil (:documentSelector :resolveProvider))
+ (DocumentOnTypeFormattingParams (:ch :textDocument :options :position) nil)
+ (DocumentOnTypeFormattingRegistrationOptions (:firstTriggerCharacter) (:documentSelector :moreTriggerCharacter))
+ (DocumentRangeFormattingParams (:textDocument :options :range) nil)
+ (DocumentSymbolParams (:textDocument) nil)
+ (DynamicRegistrationCapabilities nil (:dynamicRegistration))
+ (ExecuteCommandParams (:command) (:arguments))
+ (ExecuteCommandRegistrationOptions (:commands) nil)
+ (FailureHandlingKind nil nil)
+ (FoldingRange (:endLine :startLine) (:endCharacter :kind :startCharacter))
+ (FoldingRangeKind nil nil)
+ (FoldingRangeRequestParams (:textDocument) nil)
+ (Hover (:contents) (:range))
+ (HoverParams (:textDocument :position) (:uri))
+ (ImplementationParams (:textDocument :position) (:uri))
+ (InitializeError (:retry) nil)
+ (InitializeErrorCode nil nil)
+ (InitializeParams nil (:capabilities :clientInfo :clientName :initializationOptions :processId :rootPath :rootUri :trace :workspaceFolders))
+ (InitializeResult (:capabilities) (:serverInfo))
+ (InitializedParams nil nil)
+ (LocationLink (:targetSelectionRange :targetUri :targetRange) (:originSelectionRange))
+ (MarkupKind nil nil)
+ (MessageParams (:type :message) nil)
+ (PrepareRenameParams (:textDocument :position) (:uri))
+ (PrepareRenameResult (:range :placeholder) nil)
+ (PublishDiagnosticsParams (:diagnostics :uri) (:version))
+ (ReferenceParams (:textDocument :context :position) (:uri))
+ (RegistrationParams (:registrations) nil)
+ (RenameFile (:kind :newUri :oldUri) (:options))
+ (RenameParams (:newName :textDocument :position) (:uri))
+ (ResolveTypeHierarchyItemParams (:item :resolve :direction) nil)
+ (ResourceOperationKind nil nil)
+ (SelectionRangeParams (:textDocument :positions) nil)
+ (SemanticHighlightingParams (:textDocument :lines) nil)
+ (ShowDocumentParams (:uri) (:external :takeFocus :selection))
+ (ShowDocumentResult (:success) nil)
+ (ShowMessageRequestParams (:type :message) (:actions))
+ (SignatureHelpParams (:textDocument :position) (:context :uri))
+ (SignatureHelpRegistrationOptions nil (:documentSelector :triggerCharacters))
+ (SymbolInformation (:kind :name :location) (:containerName :deprecated))
+ (TextDocumentChangeRegistrationOptions (:syncKind) (:documentSelector))
+ (TextDocumentPositionParams (:textDocument :position) (:uri))
+ (TextDocumentRegistrationOptions nil (:documentSelector))
+ (TextDocumentSaveRegistrationOptions nil (:documentSelector :includeText))
+ (TypeDefinitionParams (:textDocument :position) (:uri))
+ (TypeHierarchyParams (:resolve :textDocument :position) (:direction :uri))
+ (UnregistrationParams (:unregisterations) nil)
+ (WatchKind nil nil)
+ (WillSaveTextDocumentParams (:reason :textDocument) nil)
+ (WorkspaceSymbolParams (:query) nil))
+
+\f
+(provide 'lsp-protocol)
+
+;;; lsp-protocol.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-purescript.el b/elpa/lsp-mode-20220201.852/lsp-purescript.el
new file mode 100644 (file)
index 0000000..d6e761a
--- /dev/null
@@ -0,0 +1,72 @@
+;;; lsp-purescript.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, purescript
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the PureScript Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-purescript nil
+  "LSP support for PureScript, using purescript-language-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/nwolverson/purescript-language-server"))
+
+(defcustom lsp-purescript-server-executable nil
+  "Path to server executable."
+  :type 'string
+  :risky t
+  :group 'lsp-purescript)
+
+(defcustom lsp-purescript-server-args
+  '("--stdio")
+  "Arguments to pass to the server."
+  :type '(repeat string)
+  :risky t
+  :group 'lsp-purescript)
+
+(defun lsp-purescript--server-command ()
+  "Generate LSP startup command for purescript-language-server."
+  (cons (or lsp-purescript-server-executable
+            (lsp-package-path 'purescript-language-server))
+        lsp-purescript-server-args))
+
+(lsp-dependency 'purescript-language-server
+                '(:system "purescript-language-server")
+                '(:npm :package "purescript-language-server"
+                       :path "purescript-language-server"))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection
+                   #'lsp-purescript--server-command)
+  :major-modes '(purescript-mode)
+  :priority -1
+  :server-id 'pursls
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'purescript-language-server callback error-callback))))
+
+
+(lsp-consistency-check lsp-purescript)
+
+(provide 'lsp-purescript)
+;;; lsp-purescript.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-pwsh.el b/elpa/lsp-mode-20220201.852/lsp-pwsh.el
new file mode 100644 (file)
index 0000000..7b39bba
--- /dev/null
@@ -0,0 +1,363 @@
+;;; lsp-pwsh.el --- client for PowerShellEditorServices  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Kien Nguyen
+
+;; Author: kien.n.quang at gmail.com
+;; Keywords: lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'f)
+(require 'dash)
+(require 's)
+(require 'ht)
+
+(require 'lsp-protocol)
+(require 'lsp-mode)
+
+(defgroup lsp-pwsh nil
+  "LSP support for PowerShell, using the PowerShellEditorServices."
+  :group 'lsp-mode
+  :package-version '(lsp-mode . "6.2"))
+
+;; PowerShell vscode flags
+(defcustom lsp-pwsh-help-completion "BlockComment"
+  "Controls the comment-based help completion behavior triggered by typing '##'.
+Set the generated help style with 'BlockComment' or 'LineComment'.
+Disable the feature with 'Disabled'."
+  :type
+  '(choice
+    (:tag "Disabled" "BlockComment" "LineComment"))
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-script-analysis-enable t
+  "Enables real-time script analysis from PowerShell Script Analyzer.
+Uses the newest installed version of the PSScriptAnalyzer module or the
+version bundled with this extension, if it is newer."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-script-analysis-settings-path ""
+  "Specifies the path to a PowerShell Script Analyzer settings file.
+To override the default settings for all projects, enter an absolute path,
+or enter a path relative to your workspace."
+  :type 'string
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-folding-enable t
+  "Enables syntax based code folding.
+When disabled, the default indentation based code folding is used."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-folding-show-last-line t
+  "Shows the last line of a folded section.
+Similar to the default VSCode folding style.
+When disabled, the entire folded region is hidden."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-preset "Custom"
+  "Sets the codeformatting options to follow the given indent style.
+Sets in a way that is compatible with PowerShell syntax.
+For more information about the brace styles please refer to https://github.com/PoshCode/PowerShellPracticeAndStyle/issues/81."
+  :type
+  '(choice
+    (:tag "Custom" "Allman" "OTBS" "Stroustrup"))
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-open-brace-on-same-line t
+  "Places open brace on the same line as its associated statement."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-new-line-after-open-brace t
+  "Adds a newline (line break) after an open brace."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-new-line-after-close-brace t
+  "Adds a newline (line break) after a closing brace."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-pipeline-indentation-style "NoIndentation"
+  "Multi-line pipeline style settings."
+  :type
+  '(choice
+    (:tag "IncreaseIndentationForFirstPipeline" "IncreaseIndentationAfterEveryPipeline" "NoIndentation"))
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-whitespace-before-open-brace t
+  "Adds a space between a keyword and its associated scriptblock expression."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-whitespace-before-open-paren t
+  "Adds a space between a keyword (if, elseif, while, switch, etc) and its
+associated conditional expression."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-whitespace-around-operator t
+  "Adds spaces before and after an operator ('=', '+', '-', etc.)."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-whitespace-after-separator t
+  "Adds a space after a separator (',' and ';')."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-whitespace-inside-brace t
+  "Adds a space after an opening brace ('{') and before a closing brace ('}')."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-whitespace-around-pipe t
+  "Adds a space before and after the pipeline operator ('|')."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-ignore-one-line-block t
+  "Does not reformat one-line code blocks, such as \"if (...) {...} else
+{...}\"."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-align-property-value-pairs t
+  "Align assignment statements in a hashtable or a DSC Configuration."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-code-formatting-use-correct-casing nil
+  "Use correct casing for cmdlets."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-developer-editor-services-log-level "Normal"
+  "Sets the log level for the PowerShell Editor Services host executable.
+Valid values are 'Diagnostic', 'Verbose', 'Normal', 'Warning', and 'Error'"
+  :type
+  '(choice
+    (:tag "Diagnostic" "Verbose" "Normal" "Warning" "Error"))
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-developer-editor-services-wait-for-debugger nil
+  "Launches the language service with the /waitForDebugger flag to force it to
+wait for a .NET debugger to attach before proceeding."
+  :type 'boolean
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-developer-feature-flags nil
+  "An array of strings that enable experimental features in the PowerShell
+extension."
+  :type
+  '(repeat string)
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(lsp-register-custom-settings
+ '(("powershell.developer.featureFlags" lsp-pwsh-developer-feature-flags)
+   ("powershell.developer.editorServicesWaitForDebugger" lsp-pwsh-developer-editor-services-wait-for-debugger t)
+   ("powershell.codeFormatting.useCorrectCasing" lsp-pwsh-code-formatting-use-correct-casing t)
+   ("powershell.codeFormatting.alignPropertyValuePairs" lsp-pwsh-code-formatting-align-property-value-pairs t)
+   ("powershell.codeFormatting.ignoreOneLineBlock" lsp-pwsh-code-formatting-ignore-one-line-block t)
+   ("powershell.codeFormatting.whitespaceAroundPipe" lsp-pwsh-code-formatting-whitespace-around-pipe t)
+   ("powershell.codeFormatting.whitespaceInsideBrace" lsp-pwsh-code-formatting-whitespace-inside-brace t)
+   ("powershell.codeFormatting.whitespaceAfterSeparator" lsp-pwsh-code-formatting-whitespace-after-separator t)
+   ("powershell.codeFormatting.whitespaceAroundOperator" lsp-pwsh-code-formatting-whitespace-around-operator t)
+   ("powershell.codeFormatting.whitespaceBeforeOpenParen" lsp-pwsh-code-formatting-whitespace-before-open-paren t)
+   ("powershell.codeFormatting.whitespaceBeforeOpenBrace" lsp-pwsh-code-formatting-whitespace-before-open-brace t)
+   ("powershell.codeFormatting.pipelineIndentationStyle" lsp-pwsh-code-formatting-pipeline-indentation-style)
+   ("powershell.codeFormatting.newLineAfterCloseBrace" lsp-pwsh-code-formatting-new-line-after-close-brace t)
+   ("powershell.codeFormatting.newLineAfterOpenBrace" lsp-pwsh-code-formatting-new-line-after-open-brace t)
+   ("powershell.codeFormatting.openBraceOnSameLine" lsp-pwsh-code-formatting-open-brace-on-same-line t)
+   ("powershell.codeFormatting.preset" lsp-pwsh-code-formatting-preset)
+   ("powershell.codeFolding.showLastLine" lsp-pwsh-code-folding-show-last-line t)
+   ("powershell.codeFolding.enable" lsp-pwsh-code-folding-enable t)
+   ("powershell.scriptAnalysis.settingsPath" lsp-pwsh-script-analysis-settings-path)
+   ("powershell.scriptAnalysis.enable" lsp-pwsh-script-analysis-enable t)
+   ("powershell.helpCompletion" lsp-pwsh-help-completion)))
+
+;; lsp-pwsh custom variables
+(defcustom lsp-pwsh-ext-path (expand-file-name "pwsh" lsp-server-install-dir)
+  "The path to powershell vscode extension."
+  :type 'string
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-exe (or (executable-find "pwsh") (executable-find "powershell"))
+  "PowerShell executable."
+  :type 'string
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pwsh-dir lsp-pwsh-ext-path
+  "Path to PowerShellEditorServices without last slash."
+  :type 'string
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defvar lsp-pwsh-pses-script (expand-file-name "PowerShellEditorServices/Start-EditorServices.ps1"
+                                               lsp-pwsh-dir)
+  "Main script to start PSES.")
+
+(defvar lsp-pwsh-log-path (expand-file-name "logs" lsp-pwsh-ext-path)
+  "Path to directory where server will write log files.
+Must not nil.")
+
+(defvar lsp-pwsh--sess-id (emacs-pid))
+
+(defun lsp-pwsh--command ()
+  "Return the command to start server."
+  `(,lsp-pwsh-exe "-NoProfile" "-NonInteractive" "-NoLogo"
+                  ,@(if (eq system-type 'windows-nt) '("-ExecutionPolicy" "Bypass"))
+                  "-OutputFormat" "Text"
+                  "-File"
+                  ,lsp-pwsh-pses-script
+                  "-HostName" "\"Emacs Host\""
+                  "-HostProfileId" "'Emacs.LSP'"
+                  "-HostVersion" "8.0.1"
+                  "-LogPath" ,(expand-file-name "emacs-powershell.log" lsp-pwsh-log-path)
+                  "-LogLevel" ,lsp-pwsh-developer-editor-services-log-level
+                  "-SessionDetailsPath" ,(expand-file-name (format "PSES-VSCode-%d" lsp-pwsh--sess-id)
+                                                           lsp-pwsh-log-path)
+                  ;; "-AdditionalModules" "@('PowerShellEditorServices.VSCode')"
+                  "-Stdio"
+                  "-BundledModulesPath" ,lsp-pwsh-dir
+                  "-FeatureFlags" "@()"))
+
+(defun lsp-pwsh--extra-init-params ()
+  "Return form describing parameters for language server.")
+
+(lsp-defun lsp-pwsh--apply-code-action-edits ((&Command :command :arguments?))
+  "Handle ACTION for PowerShell.ApplyCodeActionEdits."
+  (-if-let* (((&pwsh:ScriptRegion :start-line-number :end-line-number
+                                  :start-column-number :end-column-number :text)
+              (lsp-seq-first arguments?))
+             (start-position (lsp-make-position :line (1- start-line-number)
+                                                :character (1- start-column-number)))
+             (end-position (lsp-make-position :line (1- end-line-number)
+                                              :character (1- end-column-number)))
+             (edits `[,(lsp-make-text-edit :range (lsp-make-range :start start-position
+                                                                  :end end-position)
+                                           :newText text)]))
+      (lsp--apply-text-edits edits 'code-action)
+    (lsp-send-execute-command command arguments?)))
+
+(lsp-defun lsp-pwsh--show-code-action-document ((&Command :arguments?))
+  "Handle ACTION for PowerShell.ShowCodeActionDocumentation."
+  (-if-let* ((rule-raw (lsp-seq-first arguments?))
+             (rule-id (if (s-prefix-p "PS" rule-raw) (substring rule-raw 2) rule-raw)))
+      (browse-url
+       (concat "https://github.com/PowerShell/PSScriptAnalyzer/blob/master/RuleDocumentation/"
+               rule-id
+               ".md"))
+    (lsp-warn "Cannot show documentation for code action, no ruleName was supplied")))
+
+(defvar lsp-pwsh--major-modes '(powershell-mode))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection #'lsp-pwsh--command
+                                        (lambda ()
+                                          (f-exists? lsp-pwsh-pses-script)))
+  :major-modes lsp-pwsh--major-modes
+  :server-id 'pwsh-ls
+  :priority -1
+  :multi-root t
+  :initialization-options #'lsp-pwsh--extra-init-params
+  :notification-handlers (ht ("powerShell/executionStatusChanged" #'ignore)
+                             ("output" #'ignore))
+  :action-handlers (ht ("PowerShell.ApplyCodeActionEdits"
+                        #'lsp-pwsh--apply-code-action-edits)
+                       ("PowerShell.ShowCodeActionDocumentation"
+                        #'lsp-pwsh--show-code-action-document))
+  :initialized-fn (lambda (w)
+                    (with-lsp-workspace w
+                      (lsp--set-configuration
+                       (lsp-configuration-section "powershell")))
+                    (let ((caps (lsp--workspace-server-capabilities w)))
+                      (lsp:set-server-capabilities-document-range-formatting-provider? caps t)
+                      (lsp:set-server-capabilities-document-formatting-provider? caps t)))
+  :download-server-fn #'lsp-pwsh-setup))
+
+(defcustom lsp-pwsh-github-asset-url
+  "https://github.com/%s/%s/releases/latest/download/%s"
+  "GitHub latest asset template url."
+  :type 'string
+  :group 'lsp-pwsh
+  :package-version '(lsp-mode . "6.2"))
+
+(defun lsp-pwsh-setup (_client callback error-callback update)
+  "Downloads PowerShellEditorServices to `lsp-pwsh-dir'.
+CALLBACK is called when the download finish successfully otherwise
+ERROR-CALLBACK is called.
+UPDATE is non-nil if it is already downloaded.
+FORCED if specified with prefix argument."
+
+  (unless (and lsp-pwsh-exe (file-executable-p lsp-pwsh-exe))
+    (user-error "Use `lsp-pwsh-exe' with the value of `%s' is not a valid powershell binary"
+                lsp-pwsh-exe))
+
+  (let ((url (format lsp-pwsh-github-asset-url "PowerShell"
+                     "PowerShellEditorServices" "PowerShellEditorServices.zip"))
+        (temp-file (make-temp-file "ext" nil ".zip")))
+    (unless (f-exists? lsp-pwsh-log-path)
+      (mkdir lsp-pwsh-log-path 'create-parent))
+    (unless (and (not update) (f-exists? lsp-pwsh-pses-script))
+      ;; since we know it's installed, use powershell to download the file
+      ;; (and avoid url.el bugginess or additional libraries)
+      (when (f-exists? lsp-pwsh-dir) (delete-directory lsp-pwsh-dir 'recursive))
+      (lsp-async-start-process
+       callback
+       error-callback
+       lsp-pwsh-exe "-noprofile" "-noninteractive" "-nologo"
+       "-ex" "bypass" "-command"
+       "Invoke-WebRequest" "-UseBasicParsing" "-uri" url "-outfile" temp-file ";"
+       "Expand-Archive" "-Path" temp-file
+       "-DestinationPath" lsp-pwsh-dir))))
+
+(lsp-consistency-check lsp-pwsh)
+
+(provide 'lsp-pwsh)
+;;; lsp-pwsh.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-pyls.el b/elpa/lsp-mode-20220201.852/lsp-pyls.el
new file mode 100644 (file)
index 0000000..7213749
--- /dev/null
@@ -0,0 +1,504 @@
+;;; lsp-pyls.el --- pyls configuration               -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; PYLS configuration
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-pyls nil
+  "LSP support for Python, using Palantir's Python Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/palantir/python-language-server")
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-clients-python-library-directories '("/usr/")
+  "List of directories which will be considered to be libraries."
+  :risky t
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(define-obsolete-variable-alias
+  'lsp-clients-python-command
+  'lsp-pyls-server-command
+  "6.1")
+
+(defcustom lsp-pyls-disable-warning nil
+  "Disable Palantir python-language-server deprecation warning"
+  :group 'lsp-pyls
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-pyls-server-command '("pyls")
+  "Command to start pyls."
+  :risky t
+  :group 'lsp-pyls
+  :type '(repeat string)
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-configuration-sources ["pycodestyle"]
+  "List of configuration sources to use."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-completion-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-completion-include-params t
+  "Auto-completes methods and classes with tabstops for each
+parameter."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-definition-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-definition-follow-imports t
+  "The goto call will follow imports."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-definition-follow-builtin-imports t
+  "If follow_imports is True will decide if it follow builtin
+imports."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-hover-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-references-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-signature-help-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-symbols-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-jedi-symbols-all-scopes t
+  "If True lists the names of all scopes instead of only the
+module namespace."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-mccabe-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-mccabe-threshold 15
+  "The minimum threshold that triggers warnings about cyclomatic
+complexity."
+  :type 'number
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-preload-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-preload-modules nil
+  "List of modules to import on startup"
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pylint-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pylint-args []
+  "Arguments, passed to pylint"
+  :risky t
+  :type 'lsp-string-vector
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pycodestyle-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pycodestyle-exclude nil
+  "Exclude files or directories which match these patterns."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pycodestyle-filename nil
+  "When parsing directories, only check filenames matching these
+patterns."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pycodestyle-select nil
+  "Select errors and warnings"
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pycodestyle-ignore nil
+  "Ignore errors and warnings"
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pycodestyle-hang-closing nil
+  "Hang closing bracket instead of matching indentation of
+opening bracket's line."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pycodestyle-max-line-length nil
+  "Set maximum allowed line length."
+  :type 'number
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-convention nil
+  "Choose the basic list of checked errors by specifying an
+existing convention."
+  :type '(choice (:tag "pep257" "numpy"))
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-add-ignore nil
+  "Ignore errors and warnings in addition to the specified
+convention."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-add-select nil
+  "Select errors and warnings in addition to the specified
+convention."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-ignore nil
+  "Ignore errors and warnings"
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-select nil
+  "Select errors and warnings"
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-match "(?!test_).*\\.py"
+  "Check only files that exactly match the given regular
+expression; default is to match files that don't start with
+'test_' but end with '.py'."
+  :type 'string
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pydocstyle-match-dir "[^\\.].*"
+  "Search only dirs that exactly match the given regular
+expression; default is to match dirs which do not begin with a
+dot."
+  :type 'string
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-pyflakes-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-rope-completion-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-autopep8-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-yapf-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-rope-extension-modules nil
+  "Builtin and c-extension modules that are allowed to be
+imported and inspected by rope."
+  :type 'string
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-rope-rope-folder nil
+  "The name of the folder in which rope stores project
+configurations and data. Pass `nil` for not using such a folder
+at all."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-pyls-plugins-flake8-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-flake8-exclude nil
+  "List of glob patterns to exclude from checks."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-flake8-filename nil
+  "List of glob patterns to include for checks."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-flake8-hang-closing nil
+  "Toggle whether pycodestyle should enforce matching the indentation of the
+opening bracket’s line. When you specify this, it will prefer that you hang the
+closing bracket rather than match the indentation."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-flake8-ignore nil
+  "A list of codes to ignore."
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-flake8-max-line-length nil
+  "Set the maximum length that any line (with some exceptions) may be.
+Exceptions include lines that are either strings or comments which are
+entirely URLs."
+  :type 'integer
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-flake8-select nil
+  "Specify the list of error codes you wish Flake8 to report. Similarly to
+`lsp-pyls-plugins-flake8-ignore'. You can specify a portion of an error code to
+get all that start with that string. For example, you can use E, E4, E43, and
+E431"
+  :type '(repeat string)
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-pyls-plugins-flake8-config nil
+  "A path to a config file that will be the only config file read and used.
+This will cause Flake8 to ignore all other config files that exist.
+
+NOTE: other parameters as `lsp-pyls-plugins-flake8-max-line-length' take
+precedence over parameters referenced in config."
+  :type 'string
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-pyls-plugins-jedi-use-pyenv-environment nil
+  "If enabled, pass the environment got by pyenv to jedi"
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-pyls-plugins-jedi-environment nil
+  "Specify the environment that jedi runs on where <environment>/bin/python
+should be the python executable. This option will be prioritized over
+`lsp-pyls-plugins-jedi-use-pyenv-environment'."
+  :type 'string
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-pyls-plugins-jedi-completion-fuzzy nil
+  "If enabled, uses fuzzy completion in jedi. Requires pyls >= 0.32.0
+Can hit performance, as well as lsp-mode implements its own fuzzy search on
+completion items."
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "7.0"))
+
+(defcustom lsp-pyls-plugins-jedi-completion-include-class-objects t
+  "If enabled, adds class objects to completion in order to avoid snippet
+with init args.
+
+Has no effect if `lsp-pyls-plugins-jedi-completion-include-params' is disabled.
+Requires pyls >= 0.33.0"
+  :type 'boolean
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "7.0"))
+
+(defcustom lsp-pyls-rename-backend 'jedi
+  "Choose renaming backend.
+
+Jedi is preferred but only works for python >= 3.6 and pyls >= 0.32.0
+Beware that Jedi is lazy and doesn't scan the whole project.
+So it will rename only references it can find."
+  :type '(choice (const :tag "jedi" jedi)
+                 (const :tag "rope" rope))
+  :group 'lsp-pyls
+  :package-version '(lsp-mode . "7.0"))
+
+
+(defun lsp-pyls-get-pyenv-environment ()
+  "Get the pyenv-managed environment for current workspace, where
+<ENV>/bin/python is the corresponding Python executable"
+  (if lsp-pyls-plugins-jedi-environment
+      lsp-pyls-plugins-jedi-environment
+    (when lsp-pyls-plugins-jedi-use-pyenv-environment
+      (let ((pyenv-version (getenv "PYENV_VERSION"))
+            (root (lsp-seq-first (lsp-find-roots-for-workspace lsp--cur-workspace (lsp-session)))))
+        (when root
+          (setenv "PYENV_VERSION" nil)
+          (let* ((pyenv-command-path (executable-find "pyenv"))
+                 (python-env (when pyenv-command-path
+                               (f-parent
+                                (f-parent
+                                 (shell-command-to-string
+                                  (format "PYENV_DIR='%s' %s which python"
+                                          root pyenv-command-path)))))))
+            (if python-env (lsp--info "Configure pyls with environment: %s" python-env)
+              (lsp--warn "Can't find the python environment for
+              %s even if
+              `lsp-pyls-plugins-jedi-use-pyenv-environment` is
+              enabled") root)
+            (setenv "PYENV_VERSION" pyenv-version)
+            python-env))))))
+
+(lsp-register-custom-settings
+ '(("pyls.rope.ropeFolder" lsp-pyls-rope-rope-folder)
+   ("pyls.rope.extensionModules" lsp-pyls-rope-extension-modules)
+   ("pyls.plugins.rope_rename.enabled" (lambda () (eq lsp-pyls-rename-backend 'rope)) t)
+   ("pyls.plugins.autopep8.enabled" lsp-pyls-plugins-autopep8-enabled t)
+   ("pyls.plugins.yapf.enabled" lsp-pyls-plugins-yapf-enabled t)
+   ("pyls.plugins.rope_completion.enabled" lsp-pyls-plugins-rope-completion-enabled t)
+   ("pyls.plugins.pyflakes.enabled" lsp-pyls-plugins-pyflakes-enabled t)
+   ("pyls.plugins.pydocstyle.matchDir" lsp-pyls-plugins-pydocstyle-match-dir)
+   ("pyls.plugins.pydocstyle.match" lsp-pyls-plugins-pydocstyle-match)
+   ("pyls.plugins.pydocstyle.select" lsp-pyls-plugins-pydocstyle-select)
+   ("pyls.plugins.pydocstyle.ignore" lsp-pyls-plugins-pydocstyle-ignore)
+   ("pyls.plugins.pydocstyle.addSelect" lsp-pyls-plugins-pydocstyle-add-select)
+   ("pyls.plugins.pydocstyle.addIgnore" lsp-pyls-plugins-pydocstyle-add-ignore)
+   ("pyls.plugins.pydocstyle.convention" lsp-pyls-plugins-pydocstyle-convention)
+   ("pyls.plugins.pydocstyle.enabled" lsp-pyls-plugins-pydocstyle-enabled t)
+   ("pyls.plugins.pycodestyle.maxLineLength" lsp-pyls-plugins-pycodestyle-max-line-length)
+   ("pyls.plugins.pycodestyle.hangClosing" lsp-pyls-plugins-pycodestyle-hang-closing t)
+   ("pyls.plugins.pycodestyle.ignore" lsp-pyls-plugins-pycodestyle-ignore)
+   ("pyls.plugins.pycodestyle.select" lsp-pyls-plugins-pycodestyle-select)
+   ("pyls.plugins.pycodestyle.filename" lsp-pyls-plugins-pycodestyle-filename)
+   ("pyls.plugins.pycodestyle.exclude" lsp-pyls-plugins-pycodestyle-exclude)
+   ("pyls.plugins.pycodestyle.enabled" lsp-pyls-plugins-pycodestyle-enabled t)
+   ("pyls.plugins.pylint.enabled" lsp-pyls-plugins-pylint-enabled t)
+   ("pyls.plugins.pylint.args" lsp-pyls-plugins-pylint-args)
+   ("pyls.plugins.flake8.enabled" lsp-pyls-plugins-flake8-enabled)
+   ("pyls.plugins.flake8.exclude" lsp-pyls-plugins-flake8-exclude)
+   ("pyls.plugins.flake8.filename" lsp-pyls-plugins-flake8-filename)
+   ("pyls.plugins.flake8.hangClosing" lsp-pyls-plugins-flake8-hang-closing)
+   ("pyls.plugins.flake8.ignore" lsp-pyls-plugins-flake8-ignore)
+   ("pyls.plugins.flake8.maxLineLength" lsp-pyls-plugins-flake8-max-line-length)
+   ("pyls.plugins.flake8.select" lsp-pyls-plugins-flake8-select)
+   ("pyls.plugins.flake8.config" lsp-pyls-plugins-flake8-config)
+   ("pyls.plugins.preload.modules" lsp-pyls-plugins-preload-modules)
+   ("pyls.plugins.preload.enabled" lsp-pyls-plugins-preload-enabled t)
+   ("pyls.plugins.mccabe.threshold" lsp-pyls-plugins-mccabe-threshold)
+   ("pyls.plugins.mccabe.enabled" lsp-pyls-plugins-mccabe-enabled t)
+   ("pyls.plugins.jedi_symbols.all_scopes" lsp-pyls-plugins-jedi-symbols-all-scopes t)
+   ("pyls.plugins.jedi_symbols.enabled" lsp-pyls-plugins-jedi-symbols-enabled t)
+   ("pyls.plugins.jedi_signature_help.enabled" lsp-pyls-plugins-jedi-signature-help-enabled t)
+   ("pyls.plugins.jedi_references.enabled" lsp-pyls-plugins-jedi-references-enabled t)
+   ("pyls.plugins.jedi_hover.enabled" lsp-pyls-plugins-jedi-hover-enabled t)
+   ("pyls.plugins.jedi_definition.follow_builtin_imports" lsp-pyls-plugins-jedi-definition-follow-builtin-imports t)
+   ("pyls.plugins.jedi_definition.follow_imports" lsp-pyls-plugins-jedi-definition-follow-imports t)
+   ("pyls.plugins.jedi_definition.enabled" lsp-pyls-plugins-jedi-definition-enabled t)
+   ("pyls.plugins.jedi_completion.include_params" lsp-pyls-plugins-jedi-completion-include-params t)
+   ("pyls.plugins.jedi_completion.enabled" lsp-pyls-plugins-jedi-completion-enabled t)
+   ("pyls.plugins.jedi_completion.include_class_objects" lsp-pyls-plugins-jedi-completion-include-class-objects t)
+   ("pyls.plugins.jedi.environment" lsp-pyls-get-pyenv-environment)
+   ("pyls.plugins.jedi_completion.fuzzy" lsp-pyls-plugins-jedi-completion-fuzzy t)
+   ("pyls.plugins.jedi_rename.enabled" (lambda () (eq lsp-pyls-rename-backend 'jedi)) t)
+   ("pyls.configurationSources" lsp-pyls-configuration-sources)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda () lsp-clients-python-command))
+                  :major-modes '(python-mode cython-mode)
+                  :priority -2
+                  :server-id 'pyls
+                  :library-folders-fn (lambda (_workspace) lsp-clients-python-library-directories)
+                  :initialized-fn (lambda (workspace)
+                                    (unless lsp-pyls-disable-warning
+                                      (warn (concat "The palantir python-language-server (pyls) is unmaintained; "
+                                                    "a maintained fork is the python-lsp-server (pylsp) project; "
+                                                    "you can install it with pip via: pip install python-lsp-server")))
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration (lsp-configuration-section "pyls"))))))
+
+(lsp-consistency-check lsp-pyls)
+
+(provide 'lsp-pyls)
+;;; lsp-pyls.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-pylsp.el b/elpa/lsp-mode-20220201.852/lsp-pylsp.el
new file mode 100644 (file)
index 0000000..511745f
--- /dev/null
@@ -0,0 +1,434 @@
+;;; lsp-pylsp.el --- python-lsp-server support       -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021  Doug Davis
+
+;; Author: Doug Davis <ddavisNOSPAMddavis.io>
+;; Keywords: language tools
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; pylsp configuration
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-pylsp nil
+  "LSP support for Python, using python-lsp's Python Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/python-lsp/python-lsp-server"))
+
+(defcustom lsp-clients-pylsp-library-directories '("/usr/")
+  "List of directories which will be considered to be libraries."
+  :risky t
+  :type '(repeat string)
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-server-command '("pylsp")
+  "Command to start pylsp."
+  :risky t
+  :group 'lsp-pylsp
+  :type '(repeat string))
+
+(defcustom lsp-pylsp-configuration-sources ["flake8"]
+  "List of configuration sources to use."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-completion-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-completion-include-params t
+  "Auto-completes methods and classes with tabstops for each
+parameter."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-definition-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-definition-follow-imports t
+  "The goto call will follow imports."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-definition-follow-builtin-imports t
+  "If follow_imports is True will decide if it follow builtin
+imports."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-hover-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-references-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-signature-help-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-symbols-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-symbols-all-scopes t
+  "If True lists the names of all scopes instead of only the
+module namespace."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-mccabe-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-mccabe-threshold 15
+  "The minimum threshold that triggers warnings about cyclomatic
+complexity."
+  :type 'number
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-preload-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-preload-modules nil
+  "List of modules to import on startup"
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pylint-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pylint-args []
+  "Arguments, passed to pylint"
+  :risky t
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pycodestyle-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pycodestyle-exclude nil
+  "Exclude files or directories which match these patterns."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pycodestyle-filename nil
+  "When parsing directories, only check filenames matching these
+patterns."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pycodestyle-select nil
+  "Select errors and warnings"
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pycodestyle-ignore nil
+  "Ignore errors and warnings"
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pycodestyle-hang-closing nil
+  "Hang closing bracket instead of matching indentation of
+opening bracket's line."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pycodestyle-max-line-length nil
+  "Set maximum allowed line length."
+  :type 'number
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-convention nil
+  "Choose the basic list of checked errors by specifying an
+existing convention."
+  :type '(choice (:tag "pep257" "numpy"))
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-add-ignore nil
+  "Ignore errors and warnings in addition to the specified
+convention."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-add-select nil
+  "Select errors and warnings in addition to the specified
+convention."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-ignore nil
+  "Ignore errors and warnings"
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-select nil
+  "Select errors and warnings"
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-match "(?!test_).*\\.py"
+  "Check only files that exactly match the given regular
+expression; default is to match files that don't start with
+'test_' but end with '.py'."
+  :type 'string
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pydocstyle-match-dir "[^\\.].*"
+  "Search only dirs that exactly match the given regular
+expression; default is to match dirs which do not begin with a
+dot."
+  :type 'string
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-pyflakes-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-rope-completion-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-autopep8-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-yapf-enabled nil
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-rope-extension-modules nil
+  "Builtin and c-extension modules that are allowed to be
+imported and inspected by rope."
+  :type 'string
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-rope-rope-folder nil
+  "The name of the folder in which rope stores project
+configurations and data. Pass `nil` for not using such a folder
+at all."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-enabled t
+  "Enable or disable the plugin."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-exclude nil
+  "List of glob patterns to exclude from checks."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-filename nil
+  "List of glob patterns to include for checks."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-hang-closing nil
+  "Toggle whether pycodestyle should enforce matching the indentation of the
+opening bracket’s line. When you specify this, it will prefer that you hang the
+closing bracket rather than match the indentation."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-ignore nil
+  "A list of codes to ignore."
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-max-line-length nil
+  "Set the maximum length that any line (with some exceptions) may be.
+Exceptions include lines that are either strings or comments which are
+entirely URLs."
+  :type 'integer
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-select nil
+  "Specify the list of error codes you wish Flake8 to report. Similarly to
+`lsp-pylsp-plugins-flake8-ignore'. You can specify a portion of an error code to
+get all that start with that string. For example, you can use E, E4, E43, and
+E431"
+  :type 'lsp-string-vector
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-flake8-config nil
+  "A path to a config file that will be the only config file read and used.
+This will cause Flake8 to ignore all other config files that exist.
+
+NOTE: other parameters as `lsp-pylsp-plugins-flake8-max-line-length' take
+precedence over parameters referenced in config."
+  :type 'string
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-use-pyenv-environment nil
+  "If enabled, pass the environment got by pyenv to jedi"
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-environment nil
+  "Specify the environment that jedi runs on where <environment>/bin/python
+should be the python executable. This option will be prioritized over
+`lsp-pylsp-plugins-jedi-use-pyenv-environment'."
+  :type 'string
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-completion-fuzzy nil
+  "If enabled, uses fuzzy completion in jedi. Requires pylsp >= 0.32.0
+Can hit performance, as well as lsp-mode implements its own fuzzy search on
+completion items."
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-plugins-jedi-completion-include-class-objects t
+  "If enabled, adds class objects to completion in order to avoid snippet
+with init args.
+
+Has no effect if `lsp-pylsp-plugins-jedi-completion-include-params' is disabled.
+Requires pylsp >= 0.33.0"
+  :type 'boolean
+  :group 'lsp-pylsp)
+
+(defcustom lsp-pylsp-rename-backend 'jedi
+  "Choose renaming backend.
+
+Jedi is preferred but only works for python >= 3.6 and pylsp >= 0.32.0
+Beware that Jedi is lazy and doesn't scan the whole project.
+So it will rename only references it can find."
+  :type '(choice (const :tag "jedi" jedi)
+                 (const :tag "rope" rope))
+  :group 'lsp-pylsp)
+
+(defun lsp-pylsp-get-pyenv-environment ()
+  "Get the pyenv-managed environment for current workspace, where
+<ENV>/bin/python is the corresponding Python executable"
+  (if lsp-pylsp-plugins-jedi-environment
+      lsp-pylsp-plugins-jedi-environment
+    (when lsp-pylsp-plugins-jedi-use-pyenv-environment
+      (let ((pyenv-version (getenv "PYENV_VERSION"))
+            (root (lsp-seq-first (lsp-find-roots-for-workspace lsp--cur-workspace (lsp-session)))))
+        (when root
+          (setenv "PYENV_VERSION" nil)
+          (let* ((pyenv-command-path (executable-find "pyenv"))
+                 (python-env (when pyenv-command-path
+                               (f-parent
+                                (f-parent
+                                 (shell-command-to-string
+                                  (format "PYENV_DIR='%s' %s which python"
+                                          root pyenv-command-path)))))))
+            (if python-env (lsp--info "Configure pylsp with environment: %s" python-env)
+              (lsp--warn "Can't find the python environment for
+              %s even if
+              `lsp-pylsp-plugins-jedi-use-pyenv-environment` is
+              enabled") root)
+            (setenv "PYENV_VERSION" pyenv-version)
+            python-env))))))
+
+(lsp-register-custom-settings
+ '(("pylsp.rope.ropeFolder" lsp-pylsp-rope-rope-folder)
+   ("pylsp.rope.extensionModules" lsp-pylsp-rope-extension-modules)
+   ("pylsp.plugins.rope_rename.enabled" (lambda () (eq lsp-pylsp-rename-backend 'rope)) t)
+   ("pylsp.plugins.autopep8.enabled" lsp-pylsp-plugins-autopep8-enabled t)
+   ("pylsp.plugins.yapf.enabled" lsp-pylsp-plugins-yapf-enabled t)
+   ("pylsp.plugins.rope_completion.enabled" lsp-pylsp-plugins-rope-completion-enabled t)
+   ("pylsp.plugins.pyflakes.enabled" lsp-pylsp-plugins-pyflakes-enabled t)
+   ("pylsp.plugins.pydocstyle.matchDir" lsp-pylsp-plugins-pydocstyle-match-dir)
+   ("pylsp.plugins.pydocstyle.match" lsp-pylsp-plugins-pydocstyle-match)
+   ("pylsp.plugins.pydocstyle.select" lsp-pylsp-plugins-pydocstyle-select)
+   ("pylsp.plugins.pydocstyle.ignore" lsp-pylsp-plugins-pydocstyle-ignore)
+   ("pylsp.plugins.pydocstyle.addSelect" lsp-pylsp-plugins-pydocstyle-add-select)
+   ("pylsp.plugins.pydocstyle.addIgnore" lsp-pylsp-plugins-pydocstyle-add-ignore)
+   ("pylsp.plugins.pydocstyle.convention" lsp-pylsp-plugins-pydocstyle-convention)
+   ("pylsp.plugins.pydocstyle.enabled" lsp-pylsp-plugins-pydocstyle-enabled t)
+   ("pylsp.plugins.pycodestyle.maxLineLength" lsp-pylsp-plugins-pycodestyle-max-line-length)
+   ("pylsp.plugins.pycodestyle.hangClosing" lsp-pylsp-plugins-pycodestyle-hang-closing t)
+   ("pylsp.plugins.pycodestyle.ignore" lsp-pylsp-plugins-pycodestyle-ignore)
+   ("pylsp.plugins.pycodestyle.select" lsp-pylsp-plugins-pycodestyle-select)
+   ("pylsp.plugins.pycodestyle.filename" lsp-pylsp-plugins-pycodestyle-filename)
+   ("pylsp.plugins.pycodestyle.exclude" lsp-pylsp-plugins-pycodestyle-exclude)
+   ("pylsp.plugins.pycodestyle.enabled" lsp-pylsp-plugins-pycodestyle-enabled t)
+   ("pylsp.plugins.pylint.enabled" lsp-pylsp-plugins-pylint-enabled t)
+   ("pylsp.plugins.pylint.args" lsp-pylsp-plugins-pylint-args)
+   ("pylsp.plugins.flake8.enabled" lsp-pylsp-plugins-flake8-enabled)
+   ("pylsp.plugins.flake8.exclude" lsp-pylsp-plugins-flake8-exclude)
+   ("pylsp.plugins.flake8.filename" lsp-pylsp-plugins-flake8-filename)
+   ("pylsp.plugins.flake8.hangClosing" lsp-pylsp-plugins-flake8-hang-closing)
+   ("pylsp.plugins.flake8.ignore" lsp-pylsp-plugins-flake8-ignore)
+   ("pylsp.plugins.flake8.maxLineLength" lsp-pylsp-plugins-flake8-max-line-length)
+   ("pylsp.plugins.flake8.select" lsp-pylsp-plugins-flake8-select)
+   ("pylsp.plugins.flake8.config" lsp-pylsp-plugins-flake8-config)
+   ("pylsp.plugins.preload.modules" lsp-pylsp-plugins-preload-modules)
+   ("pylsp.plugins.preload.enabled" lsp-pylsp-plugins-preload-enabled t)
+   ("pylsp.plugins.mccabe.threshold" lsp-pylsp-plugins-mccabe-threshold)
+   ("pylsp.plugins.mccabe.enabled" lsp-pylsp-plugins-mccabe-enabled t)
+   ("pylsp.plugins.jedi_symbols.all_scopes" lsp-pylsp-plugins-jedi-symbols-all-scopes t)
+   ("pylsp.plugins.jedi_symbols.enabled" lsp-pylsp-plugins-jedi-symbols-enabled t)
+   ("pylsp.plugins.jedi_signature_help.enabled" lsp-pylsp-plugins-jedi-signature-help-enabled t)
+   ("pylsp.plugins.jedi_references.enabled" lsp-pylsp-plugins-jedi-references-enabled t)
+   ("pylsp.plugins.jedi_hover.enabled" lsp-pylsp-plugins-jedi-hover-enabled t)
+   ("pylsp.plugins.jedi_definition.follow_builtin_imports" lsp-pylsp-plugins-jedi-definition-follow-builtin-imports t)
+   ("pylsp.plugins.jedi_definition.follow_imports" lsp-pylsp-plugins-jedi-definition-follow-imports t)
+   ("pylsp.plugins.jedi_definition.enabled" lsp-pylsp-plugins-jedi-definition-enabled t)
+   ("pylsp.plugins.jedi_completion.include_params" lsp-pylsp-plugins-jedi-completion-include-params t)
+   ("pylsp.plugins.jedi_completion.enabled" lsp-pylsp-plugins-jedi-completion-enabled t)
+   ("pylsp.plugins.jedi_completion.include_class_objects" lsp-pylsp-plugins-jedi-completion-include-class-objects t)
+   ("pylsp.plugins.jedi.environment" lsp-pylsp-get-pyenv-environment)
+   ("pylsp.plugins.jedi_completion.fuzzy" lsp-pylsp-plugins-jedi-completion-fuzzy t)
+   ("pylsp.plugins.jedi_rename.enabled" (lambda () (eq lsp-pylsp-rename-backend 'jedi)) t)
+   ("pylsp.configurationSources" lsp-pylsp-configuration-sources)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda () lsp-pylsp-server-command))
+                  :major-modes '(python-mode cython-mode)
+                  :priority -1
+                  :server-id 'pylsp
+                  :library-folders-fn (lambda (_workspace) lsp-clients-pylsp-library-directories)
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration (lsp-configuration-section "pylsp"))))))
+
+(lsp-consistency-check lsp-pylsp)
+
+(provide 'lsp-pylsp)
+;;; lsp-pylsp.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-r.el b/elpa/lsp-mode-20220201.852/lsp-r.el
new file mode 100644 (file)
index 0000000..da54bc3
--- /dev/null
@@ -0,0 +1,49 @@
+;;; lsp-r.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, r
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the R Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-r nil
+  "LSP support for R."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/REditorSupport/languageserver"))
+
+(defcustom lsp-clients-r-server-command '("R" "--slave" "-e" "languageserver::run()")
+  "Command to start the R language server."
+  :group 'lsp-r
+  :risky t
+  :type '(repeat string))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-r-server-command)
+                  :major-modes '(ess-r-mode)
+                  :server-id 'lsp-r))
+
+
+(lsp-consistency-check lsp-r)
+
+(provide 'lsp-r)
+;;; lsp-r.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-racket.el b/elpa/lsp-mode-20220201.852/lsp-racket.el
new file mode 100644 (file)
index 0000000..be00ba9
--- /dev/null
@@ -0,0 +1,77 @@
+;;; lsp-racket.el --- lsp-mode racket integration    -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 lsp-mode maintainers
+
+;; Author: lsp-mode maintainers
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Client for the Racket language server.
+
+;;; Code:
+
+(require 'ht)
+(require 'lsp-mode)
+
+\f
+;; racket-langserver
+
+(defgroup lsp-racket-langserver nil
+  "LSP support for Racket, using racket-langserver"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/jeapostrophe/racket-langserver"))
+
+(defcustom lsp-racket-langserver-command '("racket" "--lib" "racket-langserver")
+  "Command to start the server."
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-racket-langserver-command))
+                  :major-modes '(racket-mode)
+                  :priority 1
+                  :server-id 'racket-langserver))
+
+\f
+;; Theia
+
+(defgroup lsp-racket-language-server nil
+  "LSP support for Racket, using racket-language-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/theia-ide/racket-language-server"))
+
+(defcustom lsp-racket-language-server-path "racket-language-server"
+  "Executable path for the server."
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-racket-language-server-colorize-handler (&rest _args)
+  "Handler for the colorize notification."
+  ;; TODO:
+  nil)
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-racket-language-server-path))
+                  :major-modes '(racket-mode)
+                  :priority -1
+                  :notification-handlers (ht ("racket/colorize" #'lsp-racket-language-server-colorize-handler))
+                  :server-id 'racket-language-server))
+
+(lsp-consistency-check lsp-racket)
+
+(provide 'lsp-racket)
+;;; lsp-racket.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-remark.el b/elpa/lsp-mode-20220201.852/lsp-remark.el
new file mode 100644 (file)
index 0000000..19cdaa7
--- /dev/null
@@ -0,0 +1,69 @@
+;;; lsp-remark.el --- lsp-mode remark integration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 lsp-mode maintainers
+
+;; Author: lsp-mode maintainers
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;  LSP client for remark-language-server
+
+;;; Code:
+
+(require 'lsp-mode)
+
+;;; Markdown
+(defgroup lsp-remark nil
+  "Settings for the markdown language server client."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/remarkjs/remark-language-server")
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-remark-server-command "remark-language-server"
+  "The binary (or full path to binary) which executes the server."
+  :type 'string
+  :group 'lsp-remark
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-remark-server-command-args '("--stdio")
+  "Command-line arguments for the markdown lsp server."
+  :type '(repeat 'string)
+  :group 'lsp-remark
+  :package-version '(lsp-mode . "8.0.1"))
+
+(lsp-dependency 'remark-language-server
+                '(:system "remark-language-server")
+                '(:npm :package "remark-language-server"
+                       :path "remark-language-server"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     (cons (or (executable-find lsp-remark-server-command)
+                                               (lsp-package-path 'remark-language-server))
+                                           lsp-remark-server-command-args)))
+                  :activation-fn (lsp-activate-on "markdown")
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration (lsp-configuration-section "remark-language-server"))))
+                  :priority 0
+                  :server-id 'remark))
+
+(lsp-consistency-check lsp-remark)
+
+(provide 'lsp-remark)
+;;; lsp-remark.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-rf.el b/elpa/lsp-mode-20220201.852/lsp-rf.el
new file mode 100644 (file)
index 0000000..eee0a16
--- /dev/null
@@ -0,0 +1,147 @@
+;;; lsp-rf.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, rf, robot
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Robot Framework.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-rf nil
+  "Settings for Robot Framework Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/tomi/vscode-rf-language-server"))
+
+(defcustom lsp-rf-language-server-start-command '("~/.nvm/versions/node/v9.11.2/bin/node" "~/.vscode/extensions/tomiturtiainen.rf-intellisense-2.8.0/server/server.js")
+  "Path to the server.js file of the rf-intellisense server.
+Accepts a list of strings (path/to/interpreter path/to/server.js)"
+  :type 'list
+  :group 'lsp-rf)
+
+(defcustom lsp-rf-language-server-include-paths []
+  "An array of files that should be included by the parser.
+Glob patterns as strings are accepted (eg. *.robot between double quotes)"
+  :type 'lsp-string-vector
+  :group 'lsp-rf)
+
+(defcustom lsp-rf-language-server-exclude-paths []
+  "An array of files that should be ignored by the parser.
+Glob patterns as strings are accepted (eg. *bad.robot between double quotes)"
+  :type 'lsp-string-vector
+  :group 'lsp-rf)
+
+(defcustom lsp-rf-language-server-dir "~/.vscode/extensions/tomiturtiainen.rf-intellisense-2.8.0/server/library-docs/"
+  "Libraries directory for libraries in `lsp-rf-language-server-libraries'"
+  :type 'string
+  :group 'lsp-rf)
+
+(defcustom lsp-rf-language-server-libraries ["BuiltIn-3.1.1" "Collections-3.0.4"]
+  "Libraries whose keywords are suggested with `auto-complete'."
+  :type '(repeat string)
+  ;; :type 'lsp-string-vector
+  :group 'lsp-rf)
+
+(defcustom lsp-rf-language-server-log-level "debug"
+  "What language server log messages are printed."
+  :type 'string
+  ;; :type '(choice (:tag "off" "errors" "info" "debug"))
+  :group 'lsp-rf)
+
+(defcustom lsp-rf-language-server-trace-server "verbose"
+  "Traces the communication between VSCode and the rfLanguageServer service."
+  :type 'string
+  ;; :type '(choice (:tag "off" "messages" "verbose"))
+  :group 'lsp-rf)
+
+(defun parse-rf-language-server-library-dirs (dirs)
+  (vconcat (mapcar
+   (lambda (x)
+     (concat
+      (expand-file-name
+       lsp-rf-language-server-dir)
+      x
+      ".json"))
+   dirs)))
+
+(defun expand-start-command ()
+  (mapcar 'expand-file-name lsp-rf-language-server-start-command))
+
+(defun parse-rf-language-server-globs-to-regex (vector)
+  "Convert a VECTOR of globs to a regex."
+  (--> (mapcan #'lsp-glob-to-regexps vector)
+       (s-join "\\|" it)
+       (concat "\\(?:" it "\\)")))
+
+(defun parse-rf-language-server-include-path-regex (vector)
+  "Creates regexp to select files from workspace directory."
+  (let ((globs (if (eq vector [])
+                        ["*.robot" "*.resource"]
+                      vector)))
+    (parse-rf-language-server-globs-to-regex globs)))
+
+(defun parse-rf-language-server-exclude-paths (seq)
+  "Creates regexp to select files from workspace directory."
+  (if (eq lsp-rf-language-server-exclude-paths [])
+      seq
+  (cl-delete-if (lambda (x) (string-match-p
+                             (parse-rf-language-server-globs-to-regex
+                              lsp-rf-language-server-exclude-paths)
+                             x))
+                seq)))
+
+(lsp-register-custom-settings
+ '(
+   ("rfLanguageServer.trace.server" lsp-rf-language-server-trace-server)
+   ("rfLanguageServer.logLevel" lsp-rf-language-server-log-level)
+   ("rfLanguageServer.libraries" lsp-rf-language-server-libraries)
+   ("rfLanguageServer.excludePaths" lsp-rf-language-server-exclude-paths)
+   ("rfLanguageServer.includePaths" lsp-rf-language-server-include-paths)))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (expand-start-command))
+                  :major-modes '(robot-mode)
+                  :server-id 'rf-intellisense
+                  ;; :library-folders-fn (lambda (_workspace)
+                  ;;                        lsp-rf-language-server-libraries)
+                  :library-folders-fn (lambda (_workspace)
+                                         (parse-rf-language-server-library-dirs
+                                         lsp-rf-language-server-libraries))
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration
+                                       (lsp-configuration-section "rfLanguageServer"))
+                                      (lsp-request "buildFromFiles"
+                                                   (list :files
+                                                         (vconcat
+                                                          (parse-rf-language-server-exclude-paths
+                                                           (directory-files-recursively
+                                                            (lsp--workspace-root workspace)
+                                                            (parse-rf-language-server-include-path-regex
+                                                             lsp-rf-language-server-include-paths))))))))))
+
+
+
+(lsp-consistency-check lsp-rf)
+
+(provide 'lsp-rf)
+;;; lsp-rf.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-rust.el b/elpa/lsp-mode-20220201.852/lsp-rust.el
new file mode 100644 (file)
index 0000000..8ff4956
--- /dev/null
@@ -0,0 +1,1173 @@
+;;; lsp-rust.el --- Rust Client settings             -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-rust client
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'ht)
+(require 'dash)
+
+(defgroup lsp-rust nil
+  "LSP support for Rust, using Rust Language Server or rust-analyzer."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/rust-lang/rls")
+  :package-version '(lsp-mode . "6.1"))
+
+(defgroup lsp-rust-rls nil
+  "LSP support for Rust, using Rust Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/rust-lang/rls")
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defgroup lsp-rust-analyzer nil
+  "LSP support for Rust, using rust-analyzer."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/rust-analyzer/rust-analyzer")
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-server 'rust-analyzer
+  "Choose LSP server."
+  :type '(choice (const :tag "rls" rls)
+                 (const :tag "rust-analyzer" rust-analyzer))
+  :group 'lsp-rust
+  :package-version '(lsp-mode . "6.2"))
+
+;; RLS
+
+(defcustom lsp-rust-rls-server-command '("rls")
+  "Command to start RLS."
+  :type '(repeat string)
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-library-directories '("~/.cargo/registry/src" "~/.rustup/toolchains")
+  "List of directories which will be considered to be libraries."
+  :risky t
+  :type '(repeat string)
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-sysroot nil
+  "If non-nil, use the given path as the sysroot for all rustc invocations
+instead of trying to detect the sysroot automatically."
+  :type '(choice
+          (const :tag "None" nil)
+          (string :tag "Sysroot"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-target nil
+  "If non-nil, use the given target triple for all rustc invocations."
+  :type '(choice
+          (const :tag "None" nil)
+          (string :tag "Target"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-rustflags nil
+  "Flags added to RUSTFLAGS."
+  :type '(choice
+          (const :tag "None" nil)
+          (string :tag "Flags"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-clear-env-rust-log t
+  "Clear the RUST_LOG environment variable before running rustc or cargo."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-build-lib nil
+  "If non-nil, checks the project as if you passed the `--lib' argument to
+cargo.
+
+Mutually exclusive with, and preferred over, `lsp-rust-build-bin'. (Unstable)"
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-build-bin nil
+  "If non-nil, checks the project as if you passed `-- bin <build_bin>'
+argument to cargo.
+
+Mutually exclusive with `lsp-rust-build-lib'. (Unstable)"
+  :type '(choice
+          (const :tag "None" nil)
+          (string :tag "Binary"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-cfg-test nil
+  "If non-nil, checks the project as if you were running `cargo test' rather
+than cargo build.
+
+I.e., compiles (but does not run) test code."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-unstable-features nil
+  "Enable unstable features."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-wait-to-build nil
+  "Time in milliseconds between receiving a change notification
+and starting build. If not specified, automatically inferred by
+the latest build duration."
+  :type '(choice
+          (const :tag "Auto" nil)
+          (number :tag "Time"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-show-warnings t
+  "Show warnings."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-crate-blacklist  [
+                                      "cocoa"
+                                      "gleam"
+                                      "glium"
+                                      "idna"
+                                      "libc"
+                                      "openssl"
+                                      "rustc_serialize"
+                                      "serde"
+                                      "serde_json"
+                                      "typenum"
+                                      "unicode_normalization"
+                                      "unicode_segmentation"
+                                      "winapi"
+                                      ]
+  "A list of Cargo crates to blacklist."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-build-on-save nil
+  "Only index the project when a file is saved and not on change."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-features []
+  "List of Cargo features to enable."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-all-features nil
+  "Enable all Cargo features."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-analyzer-cargo-target nil
+  "Compilation target (target triple)."
+  :type 'string
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-no-default-features nil
+  "Do not enable default Cargo features."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-racer-completion t
+  "Enables code completion using racer."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-clippy-preference "opt-in"
+  "Controls eagerness of clippy diagnostics when available.
+Valid values are (case-insensitive):
+ - \"off\": Disable clippy lints.
+ - \"opt-in\": Clippy lints are shown when crates specify `#![warn(clippy)]'.
+ - \"on\": Clippy lints enabled for all crates in workspace.
+
+You need to install clippy via rustup if you haven't already."
+  :type '(choice
+          (const "on")
+          (const "opt-in")
+          (const "off"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-jobs nil
+  "Number of Cargo jobs to be run in parallel."
+  :type '(choice
+          (const :tag "Auto" nil)
+          (number :tag "Jobs"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-all-targets t
+  "Checks the project as if you were running cargo check --all-targets.
+I.e., check all targets and integration tests too."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-target-dir nil
+  "When specified, it places the generated analysis files at the
+specified target directory. By default it is placed target/rls
+directory."
+  :type '(choice
+          (const :tag "Default" nil)
+          (string :tag "Directory"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-rustfmt-path nil
+  "When specified, RLS will use the Rustfmt pointed at the path
+instead of the bundled one"
+  :type '(choice
+          (const :tag "Bundled" nil)
+          (string :tag "Path"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-build-command nil
+  "EXPERIMENTAL (requires `rust.unstable_features')
+If set, executes a given program responsible for rebuilding save-analysis to be
+loaded by the RLS. The program given should output a list of resulting .json
+files on stdout.
+
+Implies `rust.build_on_save': true."
+  :type '(choice
+          (const :tag "None" nil)
+          (string :tag "Command"))
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-full-docs nil
+  "Instructs cargo to enable full documentation extraction during
+save-analysis while building the crate."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-rust-show-hover-context t
+  "Show additional context in hover tooltips when available. This
+is often the type local variable declaration."
+  :type 'boolean
+  :group 'lsp-rust-rls
+  :package-version '(lsp-mode . "6.1"))
+
+(lsp-register-custom-settings
+ '(("rust.show_hover_context" lsp-rust-show-hover-context t)
+   ("rust.full_docs" lsp-rust-full-docs t)
+   ("rust.build_command" lsp-rust-build-command)
+   ("rust.rustfmt_path" lsp-rust-rustfmt-path)
+   ("rust.target_dir" lsp-rust-target-dir)
+   ("rust.all_targets" lsp-rust-all-targets t)
+   ("rust.jobs" lsp-rust-jobs)
+   ("rust.clippy_preference" lsp-rust-clippy-preference)
+   ("rust.racer_completion" lsp-rust-racer-completion t)
+   ("rust.no_default_features" lsp-rust-no-default-features t)
+   ("rust.all_features" lsp-rust-all-features t)
+   ("rust.features" lsp-rust-features)
+   ("rust.build_on_save" lsp-rust-build-on-save t)
+   ("rust.crate_blacklist" lsp-rust-crate-blacklist)
+   ("rust.show_warnings" lsp-rust-show-warnings t)
+   ("rust.wait_to_build" lsp-rust-wait-to-build)
+   ("rust.unstable_features" lsp-rust-unstable-features t)
+   ("rust.cfg_test" lsp-rust-cfg-test t)
+   ("rust.build_bin" lsp-rust-build-bin)
+   ("rust.build_lib" lsp-rust-build-lib t)
+   ("rust.clear_env_rust_log" lsp-rust-clear-env-rust-log t)
+   ("rust.rustflags" lsp-rust-rustflags)
+   ("rust.target" lsp-rust-target)
+   ("rust.sysroot" lsp-rust-sysroot)))
+
+(defun lsp-clients--rust-window-progress (workspace params)
+  "Progress report handling.
+PARAMS progress report notification data."
+  (-let [(&v1:ProgressParams :done? :message? :title) params]
+    (if (or done? (s-blank-str? message?))
+        (lsp-workspace-status nil workspace)
+      (lsp-workspace-status (format "%s - %s" title (or message? "")) workspace))))
+
+(lsp-defun lsp-rust--rls-run ((&Command :arguments? params))
+  (-let* (((&rls:Cmd :env :binary :args :cwd) (lsp-seq-first params))
+          (default-directory (or cwd (lsp-workspace-root) default-directory) ))
+    (compile
+     (format "%s %s %s"
+             (s-join " " (ht-amap (format "%s=%s" key value) env))
+             binary
+             (s-join " " args)))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-rust-rls-server-command))
+                  :major-modes '(rust-mode rustic-mode)
+                  :priority (if (eq lsp-rust-server 'rls) 1 -1)
+                  :initialization-options '((omitInitBuild . t)
+                                            (cmdRun . t))
+                  :notification-handlers (ht ("window/progress" 'lsp-clients--rust-window-progress))
+                  :action-handlers (ht ("rls.run" 'lsp-rust--rls-run))
+                  :library-folders-fn (lambda (_workspace) lsp-rust-library-directories)
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration
+                                       (lsp-configuration-section "rust"))))
+                  :server-id 'rls))
+
+
+;; rust-analyzer
+(defcustom lsp-rust-analyzer-server-command '("rust-analyzer")
+  "Command to start rust-analyzer."
+  :type '(repeat string)
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-rust-analyzer-server-display-inlay-hints nil
+  "Show inlay hints."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-rust-analyzer-max-inlay-hint-length nil
+  "Max inlay hint length."
+  :type 'integer
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-display-parameter-hints nil
+  "Whether to show function parameter name inlay hints at the call site."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-display-chaining-hints nil
+  "Whether to show inlay type hints for method chains."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-lru-capacity nil
+  "Number of syntax trees rust-analyzer keeps in memory."
+  :type 'integer
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-cargo-watch-enable t
+  "Enable Cargo watch."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-cargo-watch-command "check"
+  "Cargo watch command."
+  :type 'string
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-cargo-watch-args []
+  "Cargo watch args."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-cargo-override-command []
+  "Advanced option, fully override the command rust-analyzer uses for checking.
+The command should include `--message=format=json` or similar option."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-cargo-all-targets t
+  "Cargo watch all targets or not."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-cargo-unset-test []
+  "force rust-analyzer to unset `#[cfg(test)]` for the specified crates."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-rust-analyzer-use-client-watching t
+  "Use client watching"
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-exclude-globs []
+  "Exclude globs"
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-exclude-dirs []
+  "These directories will be ignored by rust-analyzer."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-macro-expansion-method 'lsp-rust-analyzer-macro-expansion-default
+  "Use a different function if you want formatted macro expansion results and
+syntax highlighting."
+  :type 'function
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.2.2"))
+
+(defcustom lsp-rust-analyzer-diagnostics-enable t
+  "Whether to show native rust-analyzer diagnostics."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-diagnostics-enable-experimental t
+  "Whether to show native rust-analyzer diagnostics that are still experimental
+\(might have more false positives than usual)."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-diagnostics-disabled []
+  "List of native rust-analyzer diagnostics to disable."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-diagnostics-warnings-as-hint []
+  "List of warnings that should be displayed with hint severity."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-diagnostics-warnings-as-info []
+  "List of warnings that should be displayed with info severity."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(define-obsolete-variable-alias
+  'lsp-rust-analyzer-cargo-load-out-dirs-from-check
+  'lsp-rust-analyzer-cargo-run-build-scripts
+  "8.0.0")
+
+(defcustom lsp-rust-analyzer-cargo-run-build-scripts t
+  "Whether to run build scripts (`build.rs`) for more precise code analysis."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-rustfmt-extra-args []
+  "Additional arguments to rustfmt."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-rustfmt-override-command []
+  "Advanced option, fully override the command rust-analyzer uses
+for formatting."
+  :type 'lsp-string-vector
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-completion-add-call-parenthesis t
+  "Whether to add parenthesis when completing functions."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-completion-add-call-argument-snippets t
+  "Whether to add argument snippets when completing functions."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-completion-postfix-enable t
+  "Whether to show postfix snippets like `dbg`, `if`, `not`, etc."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-call-info-full t
+  "Whether to show function name and docs in parameter hints."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-proc-macro-enable nil
+  "Enable Proc macro support.
+Implies `lsp-rust-analyzer-cargo-run-build-scripts'"
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "6.3.2"))
+
+(defcustom lsp-rust-analyzer-import-merge-behaviour "full"
+  "The strategy to use when inserting new imports or merging imports.
+Valid values are:
+ - \"none\": No merging
+ - \"full\": Merge all layers of the import trees
+ - \"last\": Only merge the last layer of the import trees"
+  :type '(choice
+          (const "none")
+          (const "full")
+          (const "last"))
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-import-prefix "plain"
+  "The path structure for newly inserted paths to use.
+Valid values are:
+ - \"plain\": Insert import paths relative to the current module, using up to
+one `super' prefix if the parent module contains the requested item.
+ - \"by_self\": Prefix all import paths with `self' if they don't begin with
+`self', `super', `crate' or a crate name.
+ - \"by_crate\": Force import paths to be absolute by always starting
+them with `crate' or the crate name they refer to."
+  :type '(choice
+          (const "plain")
+          (const "by_self")
+          (const "by_crate"))
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-import-granularity "crate"
+  "How imports should be grouped into use statements."
+  :type '(choice
+          (const "crate" :doc "Merge imports from the same crate into a single use statement. This kind of nesting is only supported in Rust versions later than 1.24.")
+          (const "module" :doc "Merge imports from the same module into a single use statement.")
+          (const "item" :doc "Don’t merge imports at all, creating one import per item.")
+          (const "preserve" :doc "Do not change the granularity of any imports. For auto-import this has the same effect as `\"item\"'"))
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-cargo-auto-reload t
+  "Automatically refresh project info via `cargo metadata' on `Cargo.toml' changes."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-use-rustc-wrapper-for-build-scripts t
+  "Use `RUSTC_WRAPPER=rust-analyzer' when running build scripts to avoid
+compiling unnecessary things."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-completion-auto-import-enable t
+  "Toggles the additional completions that automatically add imports when
+completed. `lsp-completion-enable-additional-text-edit' must be non-nil
+ for this feature to be fully enabled."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-completion-auto-self-enable t
+  "Toggles the additional completions that automatically show method calls
+and field accesses with self prefixed to them when inside a method."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-import-enforce-granularity nil
+  "Whether to enforce the import granularity setting for all files.
+ If set to nil rust-analyzer will try to keep import styles consistent per file."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-import-group t
+  "Group inserted imports by the following order:
+https://rust-analyzer.github.io/manual.html#auto-import.
+ Groups are separated by newlines."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-highlighting-strings t
+  "Use semantic tokens for strings."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-rustc-source nil
+  "Path to the Cargo.toml of the rust compiler workspace."
+  :type 'string
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-experimental-proc-attr-macros nil
+  "Whether to enable experimental support for expanding proc macro attributes."
+  :type 'boolean
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-rust-analyzer--make-init-options ()
+  "Init options for rust-analyzer"
+  `(:diagnostics (:enable ,(lsp-json-bool lsp-rust-analyzer-diagnostics-enable)
+                  :enableExperimental ,(lsp-json-bool lsp-rust-analyzer-diagnostics-enable-experimental)
+                  :disabled ,lsp-rust-analyzer-diagnostics-disabled
+                  :warningsAsHint ,lsp-rust-analyzer-diagnostics-warnings-as-hint
+                  :warningsAsInfo ,lsp-rust-analyzer-diagnostics-warnings-as-info)
+    :assist (:importMergeBehaviour ,lsp-rust-analyzer-import-merge-behaviour
+             :importPrefix ,lsp-rust-analyzer-import-prefix
+             :importGranularity ,lsp-rust-analyzer-import-granularity
+             :importEnforceGranularity ,(lsp-json-bool lsp-rust-analyzer-import-enforce-granularity)
+             :importGroup ,(lsp-json-bool lsp-rust-analyzer-import-group))
+    :lruCapacity ,lsp-rust-analyzer-lru-capacity
+    :checkOnSave (:enable ,(lsp-json-bool lsp-rust-analyzer-cargo-watch-enable)
+                  :command ,lsp-rust-analyzer-cargo-watch-command
+                  :extraArgs ,lsp-rust-analyzer-cargo-watch-args
+                  :allTargets ,(lsp-json-bool lsp-rust-analyzer-cargo-all-targets)
+                  :overrideCommand ,lsp-rust-analyzer-cargo-override-command)
+    :files (:exclude ,lsp-rust-analyzer-exclude-globs
+            :watcher ,(lsp-json-bool (if lsp-rust-analyzer-use-client-watching
+                                         "client"
+                                       "notify"))
+            :excludeDirs ,lsp-rust-analyzer-exclude-dirs)
+    :cargo (:allFeatures ,(lsp-json-bool lsp-rust-all-features)
+            :noDefaultFeatures ,(lsp-json-bool lsp-rust-no-default-features)
+            :features ,lsp-rust-features
+            :target ,lsp-rust-analyzer-cargo-target
+            :runBuildScripts ,(lsp-json-bool lsp-rust-analyzer-cargo-run-build-scripts)
+            ; Obsolete, but used by old Rust-Analyzer versions
+            :loadOutDirsFromCheck ,(lsp-json-bool lsp-rust-analyzer-cargo-run-build-scripts)
+            :autoreload ,(lsp-json-bool lsp-rust-analyzer-cargo-auto-reload)
+            :useRustcWrapperForBuildScripts ,(lsp-json-bool lsp-rust-analyzer-use-rustc-wrapper-for-build-scripts)
+            :unsetTest ,lsp-rust-analyzer-cargo-unset-test)
+    :rustfmt (:extraArgs ,lsp-rust-analyzer-rustfmt-extra-args
+              :overrideCommand ,lsp-rust-analyzer-rustfmt-override-command)
+    :inlayHints (:typeHints ,(lsp-json-bool lsp-rust-analyzer-server-display-inlay-hints)
+                 :chainingHints ,(lsp-json-bool lsp-rust-analyzer-display-chaining-hints)
+                 :parameterHints ,(lsp-json-bool lsp-rust-analyzer-display-parameter-hints)
+                 :maxLength ,lsp-rust-analyzer-max-inlay-hint-length)
+    :completion (:addCallParenthesis ,(lsp-json-bool lsp-rust-analyzer-completion-add-call-parenthesis)
+                 :addCallArgumentSnippets ,(lsp-json-bool lsp-rust-analyzer-completion-add-call-argument-snippets)
+                 :postfix (:enable ,(lsp-json-bool lsp-rust-analyzer-completion-postfix-enable))
+                 :autoimport (:enable ,(lsp-json-bool lsp-rust-analyzer-completion-auto-import-enable))
+                 :autoself (:enable ,(lsp-json-bool lsp-rust-analyzer-completion-auto-self-enable)))
+    :callInfo (:full ,(lsp-json-bool lsp-rust-analyzer-call-info-full))
+    :procMacro (:enable ,(lsp-json-bool lsp-rust-analyzer-proc-macro-enable))
+    :rustcSource ,lsp-rust-analyzer-rustc-source
+    :highlighting (:strings ,(lsp-json-bool lsp-rust-analyzer-highlighting-strings))
+    :experimental (:procAttrMacros ,(lsp-json-bool lsp-rust-analyzer-experimental-proc-attr-macros))))
+
+(defconst lsp-rust-notification-handlers
+  '(("rust-analyzer/publishDecorations" . (lambda (_w _p)))))
+
+(defconst lsp-rust-action-handlers
+  '())
+
+(define-derived-mode lsp-rust-analyzer-syntax-tree-mode special-mode "Rust-Analyzer-Syntax-Tree"
+  "Mode for the rust-analyzer syntax tree buffer.")
+
+(defun lsp-rust-analyzer-syntax-tree ()
+  "Display syntax tree for current buffer."
+  (interactive)
+  (-let* ((root (lsp-workspace-root default-directory))
+          (params (lsp-make-rust-analyzer-syntax-tree-params
+                   :text-document (lsp--text-document-identifier)
+                   :range? (if (use-region-p)
+                               (lsp--region-to-range (region-beginning) (region-end))
+                             (lsp--region-to-range (point-min) (point-max)))))
+          (results (lsp-send-request (lsp-make-request
+                                      "rust-analyzer/syntaxTree"
+                                      params))))
+    (let ((buf (get-buffer-create (format "*rust-analyzer syntax tree %s*" root)))
+          (inhibit-read-only t))
+      (with-current-buffer buf
+        (lsp-rust-analyzer-syntax-tree-mode)
+        (erase-buffer)
+        (insert results)
+        (goto-char (point-min)))
+      (pop-to-buffer buf))))
+
+(define-derived-mode lsp-rust-analyzer-status-mode special-mode "Rust-Analyzer-Status"
+  "Mode for the rust-analyzer status buffer.")
+
+(defun lsp-rust-analyzer-status ()
+  "Displays status information for rust-analyzer."
+  (interactive)
+  (-let* ((root (lsp-workspace-root default-directory))
+          (params (lsp-make-rust-analyzer-analyzer-status-params
+                   :text-document (lsp--text-document-identifier)))
+          (results (lsp-send-request (lsp-make-request
+                                      "rust-analyzer/analyzerStatus"
+                                      params))))
+    (let ((buf (get-buffer-create (format "*rust-analyzer status %s*" root)))
+          (inhibit-read-only t))
+      (with-current-buffer buf
+        (lsp-rust-analyzer-status-mode)
+        (erase-buffer)
+        (insert results)
+        (pop-to-buffer buf)))))
+
+(defun lsp-rust-analyzer-join-lines ()
+  "Join selected lines into one, smartly fixing up whitespace and trailing commas."
+  (interactive)
+  (let* ((params (lsp-make-rust-analyzer-join-lines-params
+                  :text-document (lsp--text-document-identifier)
+                  :ranges (vector (if (use-region-p)
+                                      (lsp--region-to-range (region-beginning) (region-end))
+                                    (lsp--region-to-range (point) (point))))))
+         (result (lsp-send-request (lsp-make-request "experimental/joinLines" params))))
+    (lsp--apply-text-edits result 'code-action)))
+
+(defun lsp-rust-analyzer-reload-workspace ()
+  "Reload workspace, picking up changes from Cargo.toml"
+  (interactive)
+  (lsp--cur-workspace-check)
+  (lsp-send-request (lsp-make-request "rust-analyzer/reloadWorkspace")))
+
+(defcustom lsp-rust-analyzer-download-url
+  (format "https://github.com/rust-analyzer/rust-analyzer/releases/latest/download/%s"
+          (pcase system-type
+            ('gnu/linux "rust-analyzer-x86_64-unknown-linux-gnu.gz")
+            ('darwin "rust-analyzer-x86_64-apple-darwin.gz")
+            ('windows-nt "rust-analyzer-x86_64-pc-windows-msvc.gz")))
+  "Automatic download url for Rust Analyzer"
+  :type 'string
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-store-path (f-join lsp-server-install-dir
+                                                "rust"
+                                                (if (eq system-type 'windows-nt)
+                                                    "rust-analyzer.exe"
+                                                  "rust-analyzer"))
+  "The path to the file in which `rust-analyzer' will be stored."
+  :type 'file
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-dependency
+ 'rust-analyzer
+ `(:download :url lsp-rust-analyzer-download-url
+             :decompress :gzip
+             :store-path lsp-rust-analyzer-store-path
+             :set-executable? t)
+ '(:system "rust-analyzer"))
+
+(lsp-defun lsp-rust--analyzer-run-single ((&Command :arguments?))
+  (lsp-rust-analyzer-run (lsp-seq-first arguments?)))
+
+(lsp-defun lsp-rust--analyzer-show-references
+  ((&Command :title :arguments? [_uri _filepos references]))
+  (lsp-show-xrefs (lsp--locations-to-xref-items references) nil
+                  (s-contains-p "reference" title)))
+
+(declare-function dap-debug "ext:dap-mode" (template) t)
+
+(lsp-defun lsp-rust--analyzer-debug-lens ((&Command :arguments? [args]))
+  (lsp-rust-analyzer-debug args))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection
+                   (lambda ()
+                     `(,(or (executable-find
+                             (cl-first lsp-rust-analyzer-server-command))
+                            (lsp-package-path 'rust-analyzer)
+                            "rust-analyzer")
+                       ,@(cl-rest lsp-rust-analyzer-server-command))))
+  :major-modes '(rust-mode rustic-mode)
+  :priority (if (eq lsp-rust-server 'rust-analyzer) 1 -1)
+  :initialization-options 'lsp-rust-analyzer--make-init-options
+  :notification-handlers (ht<-alist lsp-rust-notification-handlers)
+  :action-handlers (ht ("rust-analyzer.runSingle" #'lsp-rust--analyzer-run-single)
+                       ("rust-analyzer.debugSingle" #'lsp-rust--analyzer-debug-lens)
+                       ("rust-analyzer.showReferences" #'lsp-rust--analyzer-show-references))
+  :library-folders-fn (lambda (_workspace) lsp-rust-library-directories)
+  :after-open-fn (lambda ()
+                   (when lsp-rust-analyzer-server-display-inlay-hints
+                     (lsp-rust-analyzer-inlay-hints-mode)))
+  :ignore-messages nil
+  :server-id 'rust-analyzer
+  :custom-capabilities `((experimental . ((snippetTextEdit . ,(and lsp-enable-snippet (featurep 'yasnippet))))))
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'rust-analyzer callback error-callback))))
+
+(defun lsp-rust-switch-server (&optional lsp-server)
+  "Switch priorities of lsp servers, unless LSP-SERVER is already active."
+  (interactive)
+  (let ((current-server (if (> (lsp--client-priority (gethash 'rls lsp-clients)) 0)
+                            'rls
+                          'rust-analyzer)))
+    (unless (eq lsp-server current-server)
+      (dolist (server '(rls rust-analyzer))
+        (when (natnump (setf (lsp--client-priority (gethash server lsp-clients))
+                             (* (lsp--client-priority (gethash server lsp-clients)) -1)))
+          (message (format "Switched to server %s." server)))))))
+
+;; inlay hints
+
+(defvar-local lsp-rust-analyzer-inlay-hints-timer nil)
+
+(defface lsp-rust-analyzer-inlay-face
+  '((t :inherit font-lock-comment-face))
+  "The face to use for the Rust Analyzer inlays."
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "7.0"))
+
+(defface lsp-rust-analyzer-inlay-type-face
+  '((t :inherit lsp-rust-analyzer-inlay-face))
+  "Face for inlay type hints (e.g. inferred variable types)."
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-inlay-type-space-format "%s"
+  "Format string for spacing around variable inlays
+\(not part of the inlay face)."
+  :type '(string :tag "String")
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-inlay-type-format ": %s"
+  "Format string for variable inlays (part of the inlay face)."
+  :type '(string :tag "String")
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defface lsp-rust-analyzer-inlay-param-face
+  '((t :inherit lsp-rust-analyzer-inlay-face))
+  "Face for inlay parameter hints (e.g. function parameter names at call-site)."
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-inlay-param-space-format "%s "
+  "Format string for spacing around parameter inlays
+\(not part of the inlay face)."
+  :type '(string :tag "String")
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-inlay-param-format "%s:"
+  "Format string for parameter inlays (part of the inlay face)."
+  :type '(string :tag "String")
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defface lsp-rust-analyzer-inlay-chain-face
+  '((t :inherit lsp-rust-analyzer-inlay-face))
+  "Face for inlay chaining hints (e.g. inferred chain intermediate types)."
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-inlay-chain-space-format "%s"
+  "Format string for spacing around chain inlays (not part of the inlay face)."
+  :type '(string :tag "String")
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-inlay-chain-format ": %s"
+  "Format string for chain inlays (part of the inlay face)."
+  :type '(string :tag "String")
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-rust-analyzer-debug-lens-extra-dap-args
+  '(:MIMode "gdb" :miDebuggerPath "gdb" :stopAtEntry t :externalConsole :json-false)
+  "Extra arguments to pass to DAP template when debugging a test from code lens.
+
+As a rule of the thumb, do not add extra keys to this plist unless you exactly
+what you are doing, it might break the \"Debug test\" lens otherwise.
+
+See dap-mode documentation and cpptools documentation for the extra variables
+meaning."
+  :type 'plist
+  :group 'lsp-rust-analyzer
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-rust-analyzer-update-inlay-hints (buffer)
+  (if (and (lsp-rust-analyzer-initialized?)
+           (eq buffer (current-buffer)))
+      (lsp-request-async
+       "rust-analyzer/inlayHints"
+       (lsp-make-rust-analyzer-inlay-hints-params
+        :text-document (lsp--text-document-identifier))
+       (lambda (res)
+         (remove-overlays (point-min) (point-max) 'lsp-rust-analyzer-inlay-hint t)
+         (dolist (hint res)
+           (-let* (((&rust-analyzer:InlayHint :range :label :kind) hint)
+                   ((&RangeToPoint :start :end) range)
+                   (overlay (make-overlay start end nil 'front-advance 'end-advance)))
+             (overlay-put overlay 'lsp-rust-analyzer-inlay-hint t)
+             (overlay-put overlay 'evaporate t)
+             (cond
+              ((equal kind lsp/rust-analyzer-inlay-hint-kind-type-hint)
+               (overlay-put overlay 'after-string
+                            (format lsp-rust-analyzer-inlay-type-space-format
+                                    (propertize (format lsp-rust-analyzer-inlay-type-format label)
+                                                'font-lock-face 'lsp-rust-analyzer-inlay-type-face))))
+
+              ((equal kind lsp/rust-analyzer-inlay-hint-kind-param-hint)
+               (overlay-put overlay 'before-string
+                            (format lsp-rust-analyzer-inlay-param-space-format
+                                    (propertize (format lsp-rust-analyzer-inlay-param-format label)
+                                                'font-lock-face 'lsp-rust-analyzer-inlay-param-face))))
+
+              ((equal kind lsp/rust-analyzer-inlay-hint-kind-chaining-hint)
+               (overlay-put overlay 'after-string
+                            (format lsp-rust-analyzer-inlay-chain-space-format
+                                    (propertize (format lsp-rust-analyzer-inlay-chain-format label)
+                                                'font-lock-face 'lsp-rust-analyzer-inlay-chain-face))))))))
+       :mode 'tick))
+  nil)
+
+(defun lsp-rust-analyzer-initialized? ()
+  (when-let ((workspace (lsp-find-workspace 'rust-analyzer (buffer-file-name))))
+    (eq 'initialized (lsp--workspace-status workspace))))
+
+(defun lsp-rust-analyzer-inlay-hints-change-handler (&rest _rest)
+  (when lsp-rust-analyzer-inlay-hints-timer
+    (cancel-timer lsp-rust-analyzer-inlay-hints-timer))
+  (setq lsp-rust-analyzer-inlay-hints-timer
+        (run-with-idle-timer 0.1 nil #'lsp-rust-analyzer-update-inlay-hints (current-buffer))))
+
+(define-minor-mode lsp-rust-analyzer-inlay-hints-mode
+  "Mode for displaying inlay hints."
+  :lighter nil
+  (cond
+   (lsp-rust-analyzer-inlay-hints-mode
+    (lsp-rust-analyzer-update-inlay-hints (current-buffer))
+    (add-hook 'lsp-on-change-hook #'lsp-rust-analyzer-inlay-hints-change-handler nil t))
+   (t
+    (remove-overlays (point-min) (point-max) 'lsp-rust-analyzer-inlay-hint t)
+    (remove-hook 'lsp-on-change-hook #'lsp-rust-analyzer-inlay-hints-change-handler t))))
+
+(defun lsp-rust-analyzer-expand-macro ()
+  "Expands the macro call at point recursively."
+  (interactive)
+  (-if-let* ((params (lsp-make-rust-analyzer-expand-macro-params
+                      :text-document (lsp--text-document-identifier)
+                      :position (lsp--cur-position)))
+             (response (lsp-request
+                        "rust-analyzer/expandMacro"
+                        params))
+             ((&rust-analyzer:ExpandedMacro :expansion) response))
+      (funcall lsp-rust-analyzer-macro-expansion-method expansion)
+    (lsp--error "No macro found at point, or it could not be expanded.")))
+
+(defun lsp-rust-analyzer-macro-expansion-default (result)
+  "Default method for displaying macro expansion."
+  (let* ((root (lsp-workspace-root default-directory))
+         (buf (get-buffer-create (get-buffer-create (format "*rust-analyzer macro expansion %s*" root)))))
+    (with-current-buffer buf
+      (let ((inhibit-read-only t))
+        (erase-buffer)
+        (insert (lsp--render-string result "rust"))
+        (special-mode)))
+    (pop-to-buffer buf)))
+
+;; runnables
+(defvar lsp-rust-analyzer--last-runnable nil)
+
+(defun lsp-rust-analyzer--runnables ()
+  (lsp-send-request (lsp-make-request
+                     "experimental/runnables"
+                     (lsp-make-rust-analyzer-runnables-params
+                      :text-document (lsp--text-document-identifier)
+                      :position? (lsp--cur-position)))))
+
+(defun lsp-rust-analyzer--select-runnable ()
+  (lsp--completing-read
+   "Select runnable:"
+   (if lsp-rust-analyzer--last-runnable
+       (cons lsp-rust-analyzer--last-runnable
+             (-remove (-lambda ((&rust-analyzer:Runnable :label))
+                        (equal label (lsp-get lsp-rust-analyzer--last-runnable :label)))
+                      (lsp-rust-analyzer--runnables)))
+     (lsp-rust-analyzer--runnables))
+   (-lambda ((&rust-analyzer:Runnable :label)) label)))
+
+
+(defun lsp-rust-analyzer--common-runner (runnable)
+  "Execute a given RUNNABLE.
+
+Extract the arguments, prepare the minor mode (cargo-process-mode if possible)
+and run a compilation"
+  (-let* (((&rust-analyzer:Runnable :kind :label :args) runnable)
+          ((&rust-analyzer:RunnableArgs :cargo-args :executable-args :workspace-root?) args)
+          (default-directory (or workspace-root? default-directory)))
+    (if (not (string-equal kind "cargo"))
+        (lsp--error "'%s' runnable is not supported" kind)
+      (compilation-start
+       (string-join (append (list "cargo") cargo-args (when executable-args '("--")) executable-args '()) " ")
+       ;; cargo-process-mode is nice, but try to work without it...
+       (if (functionp 'cargo-process-mode) 'cargo-process-mode nil)
+       (lambda (_) (concat "*" label "*"))))))
+
+
+(defun lsp-rust-analyzer-run (runnable)
+  "Select and run a RUNNABLE action."
+  (interactive (list (lsp-rust-analyzer--select-runnable)))
+    (when (lsp-rust-analyzer--common-runner runnable)
+      (setq lsp-rust-analyzer--last-runnable runnable)))
+
+(defun lsp-rust-analyzer-debug (runnable)
+  "Select and debug a RUNNABLE action."
+  (interactive (list (lsp-rust-analyzer--select-runnable)))
+  (unless (featurep 'dap-cpptools)
+    (user-error "You must require `dap-cpptools'"))
+  (-let (((&rust-analyzer:Runnable
+           :args (&rust-analyzer:RunnableArgs :cargo-args :workspace-root? :executable-args)
+           :label) runnable))
+    (cl-case (aref cargo-args 0)
+      ("run" (aset cargo-args 0 "build"))
+      ("test" (when (-contains? (append cargo-args ()) "--no-run")
+                (cl-callf append cargo-args (list "--no-run")))))
+    (->> (append (list (executable-find "cargo"))
+                 cargo-args
+                 (list "--message-format=json"))
+         (s-join " ")
+         (shell-command-to-string)
+         (s-lines)
+         (-keep (lambda (s)
+                  (condition-case nil
+                      (-let* ((json-object-type 'plist)
+                              ((msg &as &plist :reason :executable) (json-read-from-string s)))
+                        (when (and executable (string= "compiler-artifact" reason))
+                          executable))
+                    (error))))
+         (funcall
+          (lambda (artifact-spec)
+            (pcase artifact-spec
+              (`() (user-error "No compilation artifacts or obtaining the runnable artifacts failed"))
+              (`(,spec) spec)
+              (_ (user-error "Multiple compilation artifacts are not supported")))))
+         (list :type "cppdbg"
+               :request "launch"
+               :name label
+               :args executable-args
+               :cwd workspace-root?
+               :sourceLanguages ["rust"]
+               :program)
+         (append lsp-rust-analyzer-debug-lens-extra-dap-args)
+         (dap-debug))))
+
+(defun lsp-rust-analyzer-rerun (&optional runnable)
+  (interactive (list (or lsp-rust-analyzer--last-runnable
+                         (lsp-rust-analyzer--select-runnable))))
+  (lsp-rust-analyzer-run (or runnable lsp-rust-analyzer--last-runnable)))
+
+;; goto parent module
+(cl-defun lsp-rust-find-parent-module (&key display-action)
+  "Find parent module of current module."
+  (interactive)
+  (lsp-find-locations "experimental/parentModule" nil :display-action display-action))
+
+(defun lsp-rust-analyzer-open-cargo-toml (&optional new-window)
+  "Open the closest Cargo.toml from the current file.
+
+Rust-Analyzer LSP protocol documented here and added in November 2020
+https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#open-cargotoml
+
+If NEW-WINDOW (interactively the prefix argument) is non-nil,
+open in a new window."
+  (interactive "P")
+  (-if-let (workspace (lsp-find-workspace 'rust-analyzer))
+      (-if-let* ((response (with-lsp-workspace workspace
+                             (lsp-send-request (lsp-make-request
+                                                "experimental/openCargoToml"
+                                                (lsp-make-rust-analyzer-open-cargo-toml-params
+                                                 :text-document (lsp--text-document-identifier))))))
+                 ((&Location :uri :range) response))
+          (funcall (if new-window #'find-file-other-window #'find-file)
+                   (lsp--uri-to-path uri))
+        (lsp--warn "Couldn't find a Cargo.toml file or your version of rust-analyzer doesn't support this extension"))
+    (lsp--error "OpenCargoToml is an extension available only with rust-analyzer")))
+
+(defun lsp-rust-analyzer-open-external-docs ()
+  "Open a URL for documentation related to the current TextDocumentPosition.
+
+Rust-Analyzer LSP protocol documented here
+https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#open-external-documentation"
+  (interactive)
+  (-if-let* ((params (lsp-make-rust-analyzer-open-external-docs-params
+                      :text-document (lsp--text-document-identifier)
+                      :position (lsp--cur-position)))
+             (url (lsp-request "experimental/externalDocs" params)))
+      (browse-url url)
+    (lsp--warn "Couldn't find documentation URL or your version of rust-analyzer doesn't support this extension")))
+
+(defun lsp-rust-analyzer--related-tests ()
+  "Get runnable test items related to the current TextDocumentPosition.
+Calls a rust-analyzer LSP extension endpoint that returns a wrapper over Runnable[]"
+  (lsp-send-request (lsp-make-request
+                     "rust-analyzer/relatedTests"
+                     (lsp--text-document-position-params))))
+
+(defun lsp-rust-analyzer--select-related-test ()
+  "Call the endpoint and ask for user selection.
+
+Cannot reuse `lsp-rust-analyzer--select-runnable' because the runnables endpoint
+responds with Runnable[], while relatedTests responds with TestInfo[], which is a wrapper
+over runnable. Also, this method doesn't set the `lsp-rust-analyzer--last-runnable' variable"
+  (-if-let* ((resp (lsp-rust-analyzer--related-tests))
+             (runnables (seq-map
+                         #'lsp:rust-analyzer-related-tests-runnable
+                         resp)))
+      (lsp--completing-read
+       "Select test: "
+       runnables
+       #'lsp:rust-analyzer-runnable-label)))
+
+(defun lsp-rust-analyzer-related-tests (runnable)
+  "Execute a RUNNABLE test related to the current document position.
+
+Rust-Analyzer LSP protocol extension
+https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#related-tests"
+  (interactive (list (lsp-rust-analyzer--select-related-test)))
+  (if runnable
+      (lsp-rust-analyzer--common-runner runnable)
+    (lsp--info "There are no tests related to the symbol at point")))
+
+(defun lsp-rust-analyzer-move-item (direction)
+  "Move item under cursor or selection in some DIRECTION"
+  (let* ((params (lsp-make-rust-analyzer-move-item-params
+                  :text-document (lsp--text-document-identifier)
+                  :range (if (use-region-p)
+                             (lsp--region-to-range (region-beginning) (region-end))
+                           (lsp--region-to-range (point) (point)))
+                  :direction direction))
+         (edits (lsp-request "experimental/moveItem" params)))
+    (lsp--apply-text-edits edits 'code-action)))
+
+(defun lsp-rust-analyzer-move-item-up ()
+  "Move item under cursor or selection up"
+  (interactive)
+  (lsp-rust-analyzer-move-item "Up"))
+
+(defun lsp-rust-analyzer-move-item-down ()
+  "Move item under cursor or selection down"
+  (interactive)
+  (lsp-rust-analyzer-move-item "Down"))
+
+(lsp-consistency-check lsp-rust)
+
+(provide 'lsp-rust)
+;;; lsp-rust.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-semantic-tokens.el b/elpa/lsp-mode-20220201.852/lsp-semantic-tokens.el
new file mode 100644 (file)
index 0000000..59ba076
--- /dev/null
@@ -0,0 +1,870 @@
+;;; lsp-semantic-tokens.el --- Semantic tokens -*- lexical-binding: t; -*-
+;;
+;; Copyright (C) 2020 emacs-lsp maintainers
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+;;
+;;; Commentary:
+;;
+;;  Semantic tokens
+;;  https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
+;;
+;;; Code:
+
+(require 'lsp-mode)
+(require 'dash)
+
+(defgroup lsp-semantic-tokens nil
+  "LSP support for semantic-tokens."
+  :prefix "lsp-semantic-tokens-"
+  :group 'lsp-mode
+  :tag "LSP Semantic tokens")
+
+(define-obsolete-variable-alias 'lsp-semantic-highlighting-warn-on-missing-face 'lsp-semantic-tokens-warn-on-missing-face "lsp-mode 8.0.0")
+
+(defcustom lsp-semantic-tokens-warn-on-missing-face nil
+  "Warning on missing face for token type/modifier.
+When non-nil, this option will emit a warning any time a token
+or modifier type returned by a language server has no face associated with it."
+  :group 'lsp-semantic-tokens
+  :type 'boolean)
+
+(defcustom lsp-semantic-tokens-apply-modifiers t
+  "Whether semantic tokens should take token modifiers into account."
+  :group 'lsp-semantic-tokens
+  :type 'boolean)
+
+(defcustom lsp-semantic-tokens-allow-ranged-requests t
+  "Whether to use ranged semantic token requests when available.
+
+Note that even when this is set to t, delta requests will
+be preferred whenever possible, unless
+`lsp-semantic-tokens-allow-delta-requests' is false."
+  :group 'lsp-semantic-tokens
+  :type 'boolean)
+
+(defcustom lsp-semantic-tokens-allow-delta-requests t
+  "Whether to use semantic token delta requests when available.
+
+When supported by the language server, delta requests are always
+preferred over both full and ranged token requests."
+  :group 'lsp-semantic-tokens
+  :type 'boolean)
+
+(defcustom lsp-semantic-tokens-honor-refresh-requests nil
+  "Whether to honor semanticTokens/refresh requests.
+
+When set to nil, refresh requests will be silently discarded.
+When set to t, semantic tokens will be re-requested for all buffers
+associated with the requesting language server."
+  :group 'lsp-semantic-tokens
+  :type 'boolean)
+
+(defface lsp-face-semhl-constant
+  '((t :inherit font-lock-constant-face))
+  "Face used for semantic highlighting scopes matching constant scopes."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-variable
+  '((t :inherit font-lock-variable-name-face))
+  "Face used for semantic highlighting scopes matching variable.*.
+Unless overridden by a more specific face association."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-function
+  '((t :inherit font-lock-function-name-face))
+  "Face used for semantic highlighting scopes matching entity.name.function.*.
+Unless overridden by a more specific face association."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-method
+  '((t :inherit lsp-face-semhl-function))
+  "Face used for semantic highlighting scopes matching entity.name.method.*.
+Unless overridden by a more specific face association."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-namespace
+  '((t :inherit font-lock-type-face :weight bold))
+  "Face used for semantic highlighting scopes matching entity.name.namespace.*.
+Unless overridden by a more specific face association."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-comment
+  '((t (:inherit font-lock-comment-face)))
+  "Face used for comments."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-keyword
+  '((t (:inherit font-lock-keyword-face)))
+  "Face used for keywords."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-string
+  '((t (:inherit font-lock-string-face)))
+  "Face used for keywords."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-number
+  '((t (:inherit font-lock-constant-face)))
+  "Face used for numbers."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-regexp
+  '((t (:inherit font-lock-string-face :slant italic)))
+  "Face used for regexps."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-operator
+  '((t (:inherit font-lock-function-name-face)))
+  "Face used for operators."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-namespace
+  '((t (:inherit font-lock-keyword-face)))
+  "Face used for namespaces."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-type
+  '((t (:inherit font-lock-type-face)))
+  "Face used for types."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-struct
+  '((t (:inherit font-lock-type-face)))
+  "Face used for structs."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-class
+  '((t (:inherit font-lock-type-face)))
+  "Face used for classes."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-interface
+  '((t (:inherit font-lock-type-face)))
+  "Face used for interfaces."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-enum
+  '((t (:inherit font-lock-type-face)))
+  "Face used for enums."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-type-parameter
+  '((t (:inherit font-lock-type-face)))
+  "Face used for type parameters."
+  :group 'lsp-semantic-tokens)
+
+;; function face already defined, move here when support
+;; for theia highlighting gets removed
+(defface lsp-face-semhl-member
+  '((t (:inherit font-lock-variable-name-face)))
+  "Face used for members."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-property
+  '((t (:inherit font-lock-variable-name-face)))
+  "Face used for properties."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-event
+  '((t (:inherit font-lock-variable-name-face)))
+  "Face used for event properties."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-macro
+  '((t (:inherit font-lock-preprocessor-face)))
+  "Face used for macros."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-variable
+  '((t (:inherit font-lock-variable-name-face)))
+  "Face used for variables."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-parameter
+  '((t (:inherit font-lock-variable-name-face)))
+  "Face used for parameters."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-label
+  '((t (:inherit font-lock-comment-face)))
+  "Face used for labels."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-deprecated
+  '((t :strike-through t))
+  "Face used for semantic highlighting scopes matching constant scopes."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-definition
+  '((t :inherit font-lock-function-name-face :weight bold))
+  "Face used for definition modifier."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-default-library
+  '((t :inherit font-lock-builtin-face))
+  "Face used for defaultLibrary modifier."
+  :group 'lsp-semantic-tokens)
+
+(defface lsp-face-semhl-static
+  '((t :inherit font-lock-keyword-face))
+  "Face used for static modifier."
+  :group 'lsp-semantic-tokens)
+
+(defvar lsp-semantic-token-faces
+  '(("comment" . lsp-face-semhl-comment)
+    ("keyword" . lsp-face-semhl-keyword)
+    ("string" . lsp-face-semhl-string)
+    ("number" . lsp-face-semhl-number)
+    ("regexp" . lsp-face-semhl-regexp)
+    ("operator" . lsp-face-semhl-operator)
+    ("namespace" . lsp-face-semhl-namespace)
+    ("type" . lsp-face-semhl-type)
+    ("struct" . lsp-face-semhl-struct)
+    ("class" . lsp-face-semhl-class)
+    ("interface" . lsp-face-semhl-interface)
+    ("enum" . lsp-face-semhl-enum)
+    ("typeParameter" . lsp-face-semhl-type-parameter)
+    ("function" . lsp-face-semhl-function)
+    ("method" . lsp-face-semhl-method)
+    ("member" . lsp-face-semhl-member)
+    ("property" . lsp-face-semhl-property)
+    ("event" . lsp-face-semhl-event)
+    ("macro" . lsp-face-semhl-macro)
+    ("variable" . lsp-face-semhl-variable)
+    ("parameter" . lsp-face-semhl-parameter)
+    ("label" . lsp-face-semhl-label)
+    ("enumConstant" . lsp-face-semhl-constant)
+    ("enumMember" . lsp-face-semhl-constant)
+    ("dependent" . lsp-face-semhl-type)
+    ("concept" . lsp-face-semhl-interface))
+  "Faces to use for semantic tokens.")
+
+(defvar lsp-semantic-token-modifier-faces
+  '(("declaration" . lsp-face-semhl-interface)
+    ("definition" . lsp-face-semhl-definition)
+    ("readonly" . lsp-face-semhl-constant)
+    ("static" . lsp-face-semhl-static)
+    ("deprecated" . lsp-face-semhl-deprecated)
+    ("abstract" . lsp-face-semhl-keyword)
+    ("async" . lsp-face-semhl-macro)
+    ("modification" . lsp-face-semhl-operator)
+    ("documentation" . lsp-face-semhl-comment)
+    ("defaultLibrary" . lsp-face-semhl-default-library))
+  "Semantic tokens modifier faces.
+Faces to use for semantic token modifiers if
+`lsp-semantic-tokens-apply-modifiers' is non-nil.")
+
+(defvar lsp-semantic-tokens-capabilities
+  `((semanticTokens
+     . ((dynamicRegistration . t)
+        (requests . ((range . t) (full . t)))
+        (tokenModifiers . ,(if lsp-semantic-tokens-apply-modifiers
+                               (apply 'vector (mapcar #'car lsp-semantic-token-modifier-faces))
+                             []))
+        (tokenTypes . ,(apply 'vector (mapcar #'car lsp-semantic-token-faces)))
+        (formats . ["relative"])))))
+
+(defvar lsp--semantic-tokens-pending-full-token-requests '()
+  "Buffers which should have their semantic tokens refreshed on idle.
+
+This is an alist of the form ((buffer_i . fontify_immediately_i) ...); entries
+with fontify_immediately set to t will immediately refontify once their
+token request is answered.")
+
+;; NOTE: doesn't keep track of outstanding requests, so might still produce large latency outliers
+;; if the language server doesn't process all outstanding token requests within one lsp-idle-delay
+(defcustom lsp-semantic-tokens-max-concurrent-idle-requests 1
+  "Maximum number of on-idle token requests to be dispatched simultaneously."
+  :group 'lsp-semantic-tokens
+  :type 'integer)
+
+(defvar lsp--semantic-tokens-idle-timer nil)
+
+(defun lsp--semantic-tokens-process-pending-requests ()
+  (let ((fuel lsp-semantic-tokens-max-concurrent-idle-requests))
+    (while (and lsp--semantic-tokens-pending-full-token-requests (> fuel 0))
+      (-let (((buffer . fontify-immediately) (pop lsp--semantic-tokens-pending-full-token-requests)))
+        (when (buffer-live-p buffer)
+          (setq fuel (1- fuel))
+          (with-current-buffer buffer
+            (lsp--semantic-tokens-request nil fontify-immediately))))))
+  (unless lsp--semantic-tokens-pending-full-token-requests
+    (cancel-timer lsp--semantic-tokens-idle-timer)
+    (setq lsp--semantic-tokens-idle-timer nil)))
+
+(defun lsp--semantic-tokens-sort-pending-requests (pending-requests)
+  ;; service currently visible buffers first, otherwise prefer immediate-fontification requests
+  (-sort (lambda (entry-a entry-b)
+           (let ((a-hidden (eq nil (get-buffer-window (car entry-a))))
+                 (b-hidden (eq nil (get-buffer-window (car entry-b)))))
+             (cond ((and b-hidden (not a-hidden)) t)   ; sort a before b
+                   ((and a-hidden (not b-hidden)) nil) ; sort b before a
+                   ((and (not (cdr entry-a)) (cdr entry-b)) nil) ; otherwise sort b before a only if b is immediate and a is not
+                   (t t))))
+         (--filter (buffer-live-p (car it)) pending-requests)))
+
+(defun lsp--semantic-tokens-request-full-token-set-when-idle (buffer fontify-immediately)
+  "Request full token set after an idle timeout of `lsp-idle-delay'.
+
+If FONTIFY-IMMEDIATELY is non-nil, fontification will be performed immediately
+ once the corresponding response is received."
+  (let ((do-fontify-immediately (or fontify-immediately
+                                    (cdr (assoc buffer lsp--semantic-tokens-pending-full-token-requests)))))
+    (setq lsp--semantic-tokens-pending-full-token-requests
+          (lsp--semantic-tokens-sort-pending-requests
+           (cons (cons buffer do-fontify-immediately)
+                 (--remove (eq buffer (car it)) lsp--semantic-tokens-pending-full-token-requests)))))
+  (unless lsp--semantic-tokens-idle-timer
+    (setq lsp--semantic-tokens-idle-timer
+          (run-with-idle-timer lsp-idle-delay t #'lsp--semantic-tokens-process-pending-requests))))
+
+(defun lsp--semantic-tokens-refresh-if-enabled (buffer)
+  (when (buffer-local-value 'lsp-semantic-tokens-mode buffer)
+    (lsp--semantic-tokens-request-full-token-set-when-idle buffer t)))
+
+(defvar-local lsp--semantic-tokens-cache nil
+  "Previously returned token set.
+
+When non-nil, `lsp--semantic-tokens-cache' should adhere to the
+following lsp-interface:
+`(_SemanticTokensCache
+  (:_documentVersion)
+  (:response :_region :_truncated))'.")
+
+(defsubst lsp--semantic-tokens-putcache (k v)
+  "Set key K of `lsp--semantic-tokens-cache' to V."
+  (setq lsp--semantic-tokens-cache
+        (plist-put lsp--semantic-tokens-cache k v)))
+
+(defvar-local lsp--semantic-tokens-teardown nil)
+
+(defun lsp--semantic-tokens-ingest-range-response (response)
+  "Handle RESPONSE to semanticTokens/range request."
+  (lsp--semantic-tokens-putcache :response response)
+  (cl-assert (plist-get lsp--semantic-tokens-cache :_region))
+  (lsp--semantic-tokens-request-full-token-set-when-idle (current-buffer) nil))
+
+(defun lsp--semantic-tokens-ingest-full-response (response)
+  "Handle RESPONSE to semanticTokens/full request."
+  (lsp--semantic-tokens-putcache :response response)
+  (cl-assert (not (plist-get lsp--semantic-tokens-cache :_region))))
+
+(defsubst lsp--semantic-tokens-apply-delta-edits (old-data edits)
+  "Apply EDITS obtained from full/delta request to OLD-DATA."
+  (let* ((old-token-count (length old-data))
+         (old-token-index 0)
+         (substrings))
+    (cl-loop
+     for edit across edits
+     do
+     (when (< old-token-index (lsp-get edit :start))
+       (push (substring old-data old-token-index (lsp-get edit :start)) substrings))
+     (push (lsp-get edit :data) substrings)
+     (setq old-token-index (+ (lsp-get edit :start) (lsp-get edit :deleteCount)))
+     finally do (push (substring old-data old-token-index old-token-count) substrings))
+    (apply #'vconcat (nreverse substrings))))
+
+(defun lsp--semantic-tokens-ingest-full/delta-response (response)
+  "Handle RESPONSE to semanticTokens/full/delta request."
+  (if (lsp-get response :edits)
+      (let ((old-data (--> lsp--semantic-tokens-cache (plist-get it :response) (lsp-get it :data))))
+        (cl-assert (not (plist-get lsp--semantic-tokens-cache :_region)))
+        (when old-data
+          (lsp--semantic-tokens-putcache
+           :response (lsp-put response
+                              :data (lsp--semantic-tokens-apply-delta-edits
+                                     old-data (lsp-get response :edits))))))
+    ;; server decided to send full response instead
+    (lsp--semantic-tokens-ingest-full-response response)))
+
+
+(defun lsp--semantic-tokens-request (region fontify-immediately)
+  "Send semantic tokens request to the language server.
+
+A full/delta request will be sent if delta requests are supported by
+the language server, allowed via `lsp-semantic-tokens-allow-delta-requests',
+and if a full set of tokens had previously been received.
+Otherwise, a ranged request will be dispatched if REGION is non-nil,
+ranged requests are supported by the language server, and allowed via
+`lsp-semantic-tokens-allow-delta-requests'. In all other cases, a full
+tokens request will be dispatched.
+
+If FONTIFY-IMMEDIATELY is non-nil, fontification will be performed immediately
+ upon receiving the response."
+  (let ((request-type "textDocument/semanticTokens/full")
+        (request `(:textDocument ,(lsp--text-document-identifier)))
+        (response-handler nil)
+        (final-region nil))
+    (cond
+     ((and lsp-semantic-tokens-allow-delta-requests
+           (lsp-feature? "textDocument/semanticTokensFull/Delta")
+           (--> lsp--semantic-tokens-cache
+                (plist-get it :response)
+                (and (lsp-get it :resultId) (lsp-get it :data)
+                     (not (plist-get lsp--semantic-tokens-cache :_region)))))
+      (setq request-type "textDocument/semanticTokens/full/delta")
+      (setq response-handler #'lsp--semantic-tokens-ingest-full/delta-response)
+      (setq request
+            (plist-put request :previousResultId
+                       (lsp-get (plist-get lsp--semantic-tokens-cache :response) :resultId))))
+     ((and lsp-semantic-tokens-allow-ranged-requests region
+           (lsp-feature? "textDocument/semanticTokensRangeProvider"))
+      (setq request-type "textDocument/semanticTokens/range")
+      (setq final-region region)
+      (setq request
+            (plist-put request :range (lsp--region-to-range (car final-region) (cdr final-region))))
+      (setq response-handler #'lsp--semantic-tokens-ingest-range-response))
+     (t (setq response-handler #'lsp--semantic-tokens-ingest-full-response)))
+    (lsp-request-async
+     request-type request
+     (lambda (response)
+       (lsp--semantic-tokens-putcache :_documentVersion lsp--cur-version)
+       (lsp--semantic-tokens-putcache :_region final-region)
+       (funcall response-handler response)
+       (when (or fontify-immediately (plist-get lsp--semantic-tokens-cache :_truncated)) (font-lock-flush)))
+     :error-handler ;; buffer is not captured in `error-handler', it is in `callback'
+     (let ((buf (current-buffer)))
+       (lambda (&rest _)
+         (when (buffer-live-p buf)
+           (lsp--semantic-tokens-request-full-token-set-when-idle buf t))))
+     :mode 'tick
+     :cancel-token (format "semantic-tokens-%s" (lsp--buffer-uri)))))
+
+
+(defun lsp-semantic-tokens--fontify (old-fontify-region beg-orig end-orig &optional loudly)
+  "Apply fonts to retrieved semantic tokens.
+OLD-FONTIFY-REGION is the underlying region fontification function,
+e.g., `font-lock-fontify-region'.
+BEG-ORIG and END-ORIG deliminate the requested fontification region and maybe
+modified by OLD-FONTIFY-REGION.
+LOUDLY will be forwarded to OLD-FONTIFY-REGION as-is."
+  ;; TODO: support multiple language servers per buffer?
+  (let ((faces (seq-some #'lsp--workspace-semantic-tokens-faces lsp--buffer-workspaces))
+        (modifier-faces
+         (when lsp-semantic-tokens-apply-modifiers
+           (seq-some #'lsp--workspace-semantic-tokens-modifier-faces lsp--buffer-workspaces)))
+        old-bounds
+        beg end)
+    (cond
+     ((or (eq nil faces)
+          (eq nil lsp--semantic-tokens-cache)
+          (eq nil (plist-get lsp--semantic-tokens-cache :response)))
+      ;; default to non-semantic highlighting until first response has arrived
+      (funcall old-fontify-region beg-orig end-orig loudly))
+     ((not (= lsp--cur-version (plist-get lsp--semantic-tokens-cache :_documentVersion)))
+      ;; delay fontification until we have fresh tokens
+      '(jit-lock-bounds 0 . 0))
+     (t
+      (setq old-bounds (funcall old-fontify-region beg-orig end-orig loudly))
+      ;; this is to prevent flickering when semantic token highlighting
+      ;; is layered on top of, e.g., tree-sitter-hl, or clojure-mode's syntax highlighting.
+      (setq beg (min beg-orig (cadr old-bounds))
+            end (max end-orig (cddr old-bounds)))
+      ;; if we're using the response to a ranged request, we'll only be able to fontify within
+      ;; that range (and hence shouldn't clear any highlights outside of that range)
+      (let ((token-region (plist-get lsp--semantic-tokens-cache :_region)))
+        (if token-region
+            (progn
+              (lsp--semantic-tokens-putcache :_truncated (or (< beg (car token-region))
+                                                             (> end (cdr token-region))))
+              (setq beg (max beg (car token-region)))
+              (setq end (min end (cdr token-region))))
+          (lsp--semantic-tokens-putcache :_truncated nil)))
+      (-let* ((inhibit-field-text-motion t)
+              (data (lsp-get (plist-get lsp--semantic-tokens-cache :response) :data))
+              (i0 0)
+              (i-max (1- (length data)))
+              (current-line 1)
+              (line-delta)
+              (column 0)
+              (face)
+              (line-start-pos)
+              (line-min)
+              (line-max-inclusive)
+              (text-property-beg)
+              (text-property-end))
+        (save-mark-and-excursion
+          (save-restriction
+            (widen)
+            (goto-char beg)
+            (goto-char (line-beginning-position))
+            (setq line-min (line-number-at-pos))
+            (with-silent-modifications
+              (goto-char end)
+              (goto-char (line-end-position))
+              (setq line-max-inclusive (line-number-at-pos))
+              (forward-line (- line-min line-max-inclusive))
+              (let ((skip-lines (- line-min current-line)))
+                (while (and (<= i0 i-max) (< (aref data i0) skip-lines))
+                  (setq skip-lines (- skip-lines (aref data i0)))
+                  (setq i0 (+ i0 5)))
+                (setq current-line (- line-min skip-lines)))
+              (forward-line (- current-line line-min))
+              (setq line-start-pos (point))
+              (cl-loop
+               for i from i0 to i-max by 5 do
+               (setq line-delta (aref data i))
+               (unless (= line-delta 0)
+                 (forward-line line-delta)
+                 (setq line-start-pos (point))
+                 (setq column 0)
+                 (setq current-line (+ current-line line-delta)))
+               (setq column (+ column (aref data (1+ i))))
+               (setq face (aref faces (aref data (+ i 3))))
+               (setq text-property-beg (+ line-start-pos column))
+               (setq text-property-end (+ text-property-beg (aref data (+ i 2))))
+               (when face
+                 (put-text-property text-property-beg text-property-end 'face face))
+               (cl-loop for j from 0 to (1- (length modifier-faces)) do
+                        (when (and (aref modifier-faces j)
+                                   (> (logand (aref data (+ i 4)) (lsh 1 j)) 0))
+                          (add-face-text-property text-property-beg text-property-end
+                                                  (aref modifier-faces j))))
+               when (> current-line line-max-inclusive) return nil)))))
+      `(jit-lock-bounds ,beg . ,end)))))
+
+(defun lsp-semantic-tokens--request-update ()
+  "Request semantic-tokens update."
+  ;; when dispatching ranged requests, we'll over-request by several chunks in both directions,
+  ;; which should minimize those occasions where font-lock region extension extends beyond the
+  ;; region covered by our freshly requested tokens (see lsp-mode issue #3154), while still limiting
+  ;; requests to fairly small regions even if the underlying buffer is large
+  (lsp--semantic-tokens-request
+   (cons (max (point-min) (- (window-start) (* 5 jit-lock-chunk-size)))
+         (min (point-max) (+ (window-end) (* 5 jit-lock-chunk-size)))) t))
+
+(defun lsp--semantic-tokens-as-defined-by-workspace (workspace)
+  "Return plist of token-types and token-modifiers defined by WORKSPACE,
+or nil if none are defined."
+  (when-let ((token-capabilities
+              (or
+               (-some->
+                   (lsp--registered-capability "textDocument/semanticTokens")
+                 (lsp--registered-capability-options))
+               (lsp:server-capabilities-semantic-tokens-provider?
+                (lsp--workspace-server-capabilities workspace)))))
+    (-let* (((&SemanticTokensOptions :legend) token-capabilities))
+      `(:token-types ,(lsp:semantic-tokens-legend-token-types legend)
+        :token-modifiers ,(lsp:semantic-tokens-legend-token-modifiers legend)))))
+
+(defun lsp-semantic-tokens-suggest-overrides ()
+  "Suggest face overrides that best match the faces
+chosen by `font-lock-fontify-region'."
+  (interactive)
+  (-when-let* ((token-info (-some #'lsp--semantic-tokens-as-defined-by-workspace lsp--buffer-workspaces))
+               ((&plist :token-types token-types :token-modifiers token-modifiers) token-info))
+    (let* ((tokens (lsp-request
+                    "textDocument/semanticTokens/full"
+                    `(:textDocument, (lsp--text-document-identifier))))
+           (inhibit-field-text-motion t)
+           (data (lsp-get tokens :data))
+           (associated-faces '())
+           (line-delta)
+           ;; KLUDGE: clear cache so our font-lock advice won't apply semantic-token faces
+           (old-cache lsp--semantic-tokens-cache)
+           (face-or-faces))
+      (setq lsp--semantic-tokens-cache nil)
+      (save-restriction
+        (save-excursion
+          (widen)
+          (font-lock-fontify-region (point-min) (point-max) t)
+          (save-mark-and-excursion
+            (save-restriction
+              (widen)
+              (goto-char (point-min))
+              (cl-loop
+               for i from 0 to (1- (length data)) by 5 do
+               (setq line-delta (aref data i))
+               (unless (= line-delta 0) (forward-line line-delta))
+               (forward-char (aref data (+ i 1)))
+               (setq face-or-faces (get-text-property (point) 'face))
+               ;; TODO: consider modifiers?
+               (when face-or-faces
+                 (--each (if (listp face-or-faces) face-or-faces (list face-or-faces))
+                   (cl-pushnew `(,(aref data (+ i 3)) . ,it) associated-faces :test #'equal))))
+              (setq lsp--semantic-tokens-cache old-cache)
+              (font-lock-flush)))))
+      (switch-to-buffer (get-buffer-create "*Suggested Overrides*"))
+      (insert "(")
+      ;; TODO: sort alternatives by frequency
+      (--each-indexed (-group-by #'car associated-faces)
+        (insert (if (= it-index 0) "(" "\n ("))
+        (insert (format "%s . " (aref token-types (car it))))
+        (--each-indexed (mapcar #'cdr (cdr it))
+          (insert (if (= it-index 0) (format "%s)" (prin1-to-string it))
+                    (format " ; Alternative: %s" (prin1-to-string it))))))
+      (insert ")"))))
+
+(declare-function tree-sitter-hl-mode "ext:tree-sitter-hl")
+
+(with-eval-after-load 'tree-sitter-hl
+  (add-hook
+   'tree-sitter-hl-mode-hook
+   (lambda ()
+     (when (and lsp-mode lsp--semantic-tokens-teardown
+                (boundp 'tree-sitter-hl-mode) tree-sitter-hl-mode)
+       (lsp-warn "It seems you have configured tree-sitter-hl to activate after lsp-mode.
+To prevent tree-sitter-hl from overriding lsp-mode's semantic token highlighting, lsp-mode
+will now disable both semantic highlighting and tree-sitter-hl mode and subsequently re-enable both,
+starting with tree-sitter-hl-mode.
+
+Please adapt your config to prevent unnecessary mode reinitialization in the future.")
+       (tree-sitter-hl-mode -1)
+       (funcall lsp--semantic-tokens-teardown)
+       (setq lsp--semantic-tokens-teardown nil)
+       (tree-sitter-hl-mode t)
+       (lsp--semantic-tokens-initialize-buffer)))))
+
+;;;###autoload
+(defun lsp--semantic-tokens-initialize-buffer ()
+  "Initialize the buffer for semantic tokens.
+IS-RANGE-PROVIDER is non-nil when server supports range requests."
+  (let* ((old-extend-region-functions font-lock-extend-region-functions)
+         ;; make sure font-lock always fontifies entire lines (TODO: do we also have
+         ;; to change some jit-lock-...-region functions/variables?)
+         (new-extend-region-functions
+          (if (memq 'font-lock-extend-region-wholelines old-extend-region-functions)
+              old-extend-region-functions
+            (cons 'font-lock-extend-region-wholelines old-extend-region-functions)))
+         (buffer (current-buffer)))
+    (setq lsp--semantic-tokens-cache nil)
+    (setq font-lock-extend-region-functions new-extend-region-functions)
+    (add-function :around (local 'font-lock-fontify-region-function) #'lsp-semantic-tokens--fontify)
+    (add-hook 'lsp-on-change-hook #'lsp-semantic-tokens--request-update nil t)
+    (lsp-semantic-tokens--request-update)
+    (setq lsp--semantic-tokens-teardown
+          (lambda ()
+            (setq lsp--semantic-tokens-pending-full-token-requests
+                  (--remove (eq buffer (car it)) lsp--semantic-tokens-pending-full-token-requests))
+            (setq font-lock-extend-region-functions old-extend-region-functions)
+            (setq lsp--semantic-tokens-cache nil)
+            (remove-function (local 'font-lock-fontify-region-function)
+                             #'lsp-semantic-tokens--fontify)
+            (remove-hook 'lsp-on-change-hook #'lsp-semantic-tokens--request-update t)))))
+
+(defun lsp--semantic-tokens-build-face-map (identifiers faces category varname)
+  "Build map of FACES for IDENTIFIERS using CATEGORY and VARNAME."
+  (apply 'vector
+         (mapcar (lambda (id)
+                   (let ((maybe-face (cdr (assoc id faces))))
+                     (when (and lsp-semantic-tokens-warn-on-missing-face (not maybe-face))
+                       (lsp-warn "No face has been associated to the %s '%s': consider adding a corresponding definition to %s"
+                                 category id varname)) maybe-face)) identifiers)))
+
+(defun lsp-semantic-tokens--replace-alist-values (a b)
+  "Replace alist A values with B ones where available."
+  (-map
+   (-lambda ((ak . av))
+     (cons ak (alist-get ak b av nil #'string=)))
+   a))
+
+(defun lsp-semantic-tokens--type-faces-for (client)
+  "Return the semantic token type faces for CLIENT."
+  (lsp-semantic-tokens--replace-alist-values lsp-semantic-token-faces
+                                             (plist-get (lsp--client-semantic-tokens-faces-overrides client) :types)))
+
+(defun lsp-semantic-tokens--modifier-faces-for (client)
+  "Return the semantic token type faces for CLIENT."
+  (lsp-semantic-tokens--replace-alist-values lsp-semantic-token-modifier-faces
+                                             (plist-get (lsp--client-semantic-tokens-faces-overrides client) :modifiers)))
+
+(defun lsp--semantic-tokens-on-refresh (workspace)
+  "Clear semantic tokens within all buffers of WORKSPACE,
+refresh in currently active buffer."
+  (cl-assert (not (eq nil workspace)))
+  (when lsp-semantic-tokens-honor-refresh-requests
+    (cl-loop
+     for ws-buffer in (lsp--workspace-buffers workspace) do
+     (let ((fontify-immediately (equal (current-buffer) ws-buffer)))
+       (with-current-buffer ws-buffer (lsp--semantic-tokens-request nil fontify-immediately))))))
+
+;;;###autoload
+(defun lsp--semantic-tokens-initialize-workspace (workspace)
+  "Initialize semantic tokens for WORKSPACE."
+  (cl-assert workspace)
+  (-let (((&plist :token-types types :token-modifiers modifiers)
+          (lsp--semantic-tokens-as-defined-by-workspace workspace))
+         (client (lsp--workspace-client workspace)))
+    (setf (lsp--workspace-semantic-tokens-faces workspace)
+          (lsp--semantic-tokens-build-face-map
+           types (lsp-semantic-tokens--type-faces-for client)
+           "semantic token" "lsp-semantic-token-faces"))
+    (setf (lsp--workspace-semantic-tokens-modifier-faces workspace)
+          (lsp--semantic-tokens-build-face-map
+           modifiers (lsp-semantic-tokens--modifier-faces-for client)
+           "semantic token modifier" "lsp-semantic-token-modifier-faces"))))
+
+;;;###autoload
+(defun lsp-semantic-tokens--warn-about-deprecated-setting ()
+  "Warn about deprecated semantic highlighting variable."
+  (when (boundp 'lsp-semantic-highlighting)
+    (pcase lsp-semantic-highlighting
+      (:semantic-tokens
+       (lsp-warn "It seems you wish to use semanticTokens-based
+ highlighting. To do so, please remove any references to the
+ deprecated variable `lsp-semantic-highlighting' from your
+ configuration and set `lsp-semantic-tokens-enable' to `t'
+ instead.")
+       (setq lsp-semantic-tokens-enable t))
+      ((or :immediate :deferred)
+       (lsp-warn "It seems you wish to use Theia-based semantic
+ highlighting. This protocol has been superseded by the
+ semanticTokens protocol specified by LSP v3.16 and is no longer
+ supported by lsp-mode. If your language server provides
+ semanticToken support, please set
+ `lsp-semantic-tokens-enable' to `t' to use it.")))))
+
+;;;###autoload
+(defun lsp-semantic-tokens--enable ()
+  "Enable semantic tokens mode."
+  (when (and lsp-semantic-tokens-enable
+             (lsp-feature? "textDocument/semanticTokens"))
+    (lsp-semantic-tokens--warn-about-deprecated-setting)
+    (lsp-semantic-tokens-mode 1)))
+
+(defun lsp-semantic-tokens--disable ()
+  "Disable semantic tokens mode."
+  (lsp-semantic-tokens-mode -1))
+
+;;;###autoload
+(define-minor-mode lsp-semantic-tokens-mode
+  "Toggle semantic-tokens support."
+  :group 'lsp-semantic-tokens
+  :global nil
+  (cond
+   (lsp-semantic-tokens-mode
+    (add-hook 'lsp-configure-hook #'lsp-semantic-tokens--enable nil t)
+    (add-hook 'lsp-unconfigure-hook #'lsp-semantic-tokens--disable nil t)
+    (mapc #'lsp--semantic-tokens-initialize-workspace
+          (lsp--find-workspaces-for "textDocument/semanticTokens"))
+    (lsp--semantic-tokens-initialize-buffer))
+   (t
+    (remove-hook 'lsp-configure-hook #'lsp-semantic-tokens--enable t)
+    (remove-hook 'lsp-unconfigure-hook #'lsp-semantic-tokens--disable t)
+    (when lsp--semantic-tokens-teardown
+      (funcall lsp--semantic-tokens-teardown))
+    (lsp-semantic-tokens--request-update)
+    (setq lsp--semantic-tokens-cache nil
+          lsp--semantic-tokens-teardown nil))))
+
+;; debugging helpers
+(defun lsp--semantic-tokens-verify ()
+  "Store current token set and compare with the response to a full token request."
+  (interactive)
+  (let ((old-tokens (--> lsp--semantic-tokens-cache (plist-get it :response) (lsp-get it :data)))
+        (old-version (--> lsp--semantic-tokens-cache (plist-get it :_documentVersion))))
+    (if (not (equal lsp--cur-version old-version))
+        (message "Stored documentVersion %d differs from current version %d" old-version lsp--cur-version)
+      (lsp-request-async
+       "textDocument/semanticTokens/full" `(:textDocument ,(lsp--text-document-identifier))
+       (lambda (response)
+         (let ((new-tokens (lsp-get response :data)))
+           (if (equal old-tokens new-tokens)
+               (message "New tokens (total count %d) are identical to previously held token set"
+                        (length new-tokens))
+             (message "Newly returned tokens differ from old token set")
+             (print old-tokens)
+             (print new-tokens))))
+       :mode 'tick
+       :cancel-token (format "semantic-tokens-%s" (lsp--buffer-uri))))))
+
+(defvar-local lsp-semantic-tokens--log '())
+
+(defvar-local lsp-semantic-tokens--prev-response nil)
+
+(defun lsp-semantic-tokens--log-buffer-contents (tag)
+  "Log buffer contents for TAG."
+  (save-restriction
+    (save-excursion
+      (widen) (push `(:tag ,tag
+                      :buffer-contents ,(buffer-substring (point-min) (point-max))
+                      :prev-response ,lsp-semantic-tokens--prev-response)
+                    lsp-semantic-tokens--log))))
+
+(defun lsp-semantic-tokens-enable-log ()
+  "Enable logging of intermediate fontification states.
+
+This is a debugging tool, and may incur significant performance penalties."
+  (setq lsp-semantic-tokens--log '())
+  (defadvice lsp-semantic-tokens--fontify (around advice-tokens-fontify activate)
+    (lsp-semantic-tokens--log-buffer-contents 'before)
+    (let ((result ad-do-it))
+      (lsp-semantic-tokens--log-buffer-contents 'after)
+      result))
+  (defadvice lsp--semantic-tokens-ingest-full/delta-response
+      (before log-delta-response (response) activate)
+    (setq lsp-semantic-tokens--prev-response `(:request-type "delta"
+                                               :response ,response
+                                               :version ,lsp--cur-version)))
+  (defadvice lsp--semantic-tokens-ingest-full-response
+      (before log-full-response (response) activate)
+    (setq lsp-semantic-tokens--prev-response `(:request-type "full"
+                                               :response ,response
+                                               :version ,lsp--cur-version)))
+  (defadvice lsp--semantic-tokens-ingest-range-response
+      (before log-range-response (response) activate)
+    (setq lsp-semantic-tokens--prev-response `(:request-type "range"
+                                               :response ,response
+                                               :version ,lsp--cur-version))))
+
+(defun lsp-semantic-tokens-disable-log ()
+  "Disable logging of intermediate fontification states."
+  (ad-unadvise 'lsp-semantic-tokens--fontify)
+  (ad-unadvise 'lsp--semantic-tokens-ingest-full/delta-response)
+  (ad-unadvise 'lsp--semantic-tokens-ingest-full-response)
+  (ad-unadvise 'lsp--semantic-tokens-ingest-range-response))
+
+(declare-function htmlize-buffer "ext:htmlize")
+
+(defun lsp-semantic-tokens-export-log ()
+  "Write HTML-formatted snapshots of previous fontification results to /tmp."
+  (require 'htmlize)
+  (let* ((outdir (f-join "/tmp" "semantic-token-snapshots"))
+         (progress-reporter
+          (make-progress-reporter
+           (format "Writing buffer snapshots to %s..." outdir)
+           0 (length lsp-semantic-tokens--log))))
+    (f-mkdir outdir)
+    (--each-indexed (reverse lsp-semantic-tokens--log)
+      (-let* (((&plist :tag tag
+                       :buffer-contents buffer-contents
+                       :prev-response prev-response) it)
+              (html-buffer))
+        ;; FIXME: doesn't update properly; sit-for helps... somewhat,
+        ;; but unreliably
+        (when (= (% it-index 5) 0)
+          (progress-reporter-update progress-reporter it-index)
+          (sit-for 0.01))
+        ;; we're emitting 2 snapshots (before & after) per update, so request
+        ;; parameters should only change on every 2nd invocation
+        (when (cl-evenp it-index)
+          (with-temp-buffer
+            (insert (prin1-to-string prev-response))
+            (write-file (f-join outdir (format "parameters_%d.el" (/ it-index 2))))))
+        (with-temp-buffer
+          (insert buffer-contents)
+          (setq html-buffer (htmlize-buffer))
+          (with-current-buffer html-buffer
+            ;; some configs such as emacs-doom may autoformat on save; switch to
+            ;; fundamental-mode to avoid this
+            (fundamental-mode)
+            (write-file (f-join outdir (format "buffer_%d_%s.html" (/ it-index 2) tag)))))
+        (kill-buffer html-buffer)))
+    (progress-reporter-done progress-reporter)))
+
+(lsp-consistency-check lsp-semantic-tokens)
+
+(provide 'lsp-semantic-tokens)
+;;; lsp-semantic-tokens.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-solargraph.el b/elpa/lsp-mode-20220201.852/lsp-solargraph.el
new file mode 100644 (file)
index 0000000..968b32a
--- /dev/null
@@ -0,0 +1,166 @@
+;;; lsp-solargraph.el --- Solargraph server configuration  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-solargraph nil
+  "LSP support for Ruby, using the Solargraph language server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/castwide/solargraph")
+  :package-version '(lsp-mode . "6.1"))
+
+;; (defcustom lsp-solargraph-check-gem-version t
+;;   "Automatically check if a new version of the Solargraph gem is available."
+;;   :type 'boolean)
+
+(defcustom lsp-solargraph-completion t
+  "Enable completion"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-hover t
+  "Enable hover"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-diagnostics t
+  "Enable diagnostics"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-autoformat nil
+  "Enable automatic formatting while typing (WARNING: experimental)"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-formatting t
+  "Enable document formatting"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-symbols t
+  "Enable symbols"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-definitions t
+  "Enable definitions (go to, etc.)"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-rename t
+  "Enable symbol renaming"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-references t
+  "Enable finding references"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-folding t
+  "Enable folding ranges"
+  :type 'boolean
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-log-level "warn"
+  "Level of debug info to log. `warn` is least and `debug` is most."
+  :type '(choice (const :tag "warn" "info" "debug"))
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+;; https://github.com/castwide/solargraph#solargraph-and-bundler
+(defcustom lsp-solargraph-use-bundler nil
+  "Run solargraph under bundler"
+  :type 'boolean
+  :safe #'booleanp
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-solargraph-multi-root t
+  "If non nil, `solargraph' will be started in multi-root mode."
+  :type 'boolean
+  :safe #'booleanp
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-solargraph-library-directories
+  '("~/.rbenv/" "/usr/lib/ruby/" "~/.rvm/" "~/.gem/")
+  "List of directories which will be considered to be libraries."
+  :type '(repeat string)
+  :group 'lsp-solargraph
+  :package-version '(lsp-mode . "7.0.1"))
+
+(defun lsp-solargraph--build-command ()
+  "Build solargraph command"
+  (let ((lsp-command '("solargraph" "stdio")))
+    (if lsp-solargraph-use-bundler
+              (append '("bundle" "exec") lsp-command)
+            lsp-command)))
+
+(lsp-register-custom-settings
+ '(("solargraph.logLevel" lsp-solargraph-log-level)
+   ("solargraph.folding" lsp-solargraph-folding t)
+   ("solargraph.references" lsp-solargraph-references t)
+   ("solargraph.rename" lsp-solargraph-rename t)
+   ("solargraph.definitions" lsp-solargraph-definitions t)
+   ("solargraph.symbols" lsp-solargraph-symbols t)
+   ("solargraph.formatting" lsp-solargraph-formatting t)
+   ("solargraph.autoformat" lsp-solargraph-autoformat t)
+   ("solargraph.diagnostics" lsp-solargraph-diagnostics t)
+   ("solargraph.hover" lsp-solargraph-hover t)
+   ("solargraph.completion" lsp-solargraph-completion t)
+   ("solargraph.useBundler" lsp-solargraph-use-bundler t)))
+
+;; Ruby
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection
+                   #'lsp-solargraph--build-command)
+  :major-modes '(ruby-mode enh-ruby-mode)
+  :priority -1
+  :multi-root lsp-solargraph-multi-root
+  :library-folders-fn (lambda (_workspace) lsp-solargraph-library-directories)
+  :server-id 'ruby-ls
+  :initialized-fn (lambda (workspace)
+                    (with-lsp-workspace workspace
+                      (lsp--set-configuration
+                       (lsp-configuration-section "solargraph"))))))
+
+(lsp-consistency-check lsp-solargraph)
+
+(provide 'lsp-solargraph)
+;;; lsp-solargraph.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-sorbet.el b/elpa/lsp-mode-20220201.852/lsp-sorbet.el
new file mode 100644 (file)
index 0000000..58040a7
--- /dev/null
@@ -0,0 +1,59 @@
+;;; lsp-sorbet.el --- Sorbet server configuration  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020
+
+;; Author: Christopher Wilson <chrisNOSPAMsencjw.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; lsp-sorbet client
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-sorbet nil
+  "LSP support for Ruby, using the Sorbet language server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/sorbet/sorbet")
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-sorbet-use-bundler nil
+  "Run sorbet under bundler"
+  :type 'boolean
+  :group 'lsp-sorbet
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-sorbet--build-command ()
+  "Build sorbet command"
+  (let ((lsp-command '("srb" "typecheck" "--lsp" "--disable-watchman")))
+    (if lsp-sorbet-use-bundler
+              (append '("bundle" "exec") lsp-command)
+            lsp-command)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection
+                   #'lsp-sorbet--build-command)
+  :priority -2
+  :major-modes '(ruby-mode enh-ruby-mode)
+  :server-id 'sorbet-ls))
+
+(lsp-consistency-check lsp-sorbet)
+
+(provide 'lsp-sorbet)
+;;; lsp-sorbet.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-sqls.el b/elpa/lsp-mode-20220201.852/lsp-sqls.el
new file mode 100644 (file)
index 0000000..bd69372
--- /dev/null
@@ -0,0 +1,190 @@
+;;; lsp-sqls.el --- SQL Client settings -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Shunya Ishii
+
+;; Author: Shunya Ishii
+;; Keywords: sql lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP client for SQL
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-sqls nil
+  "LSP support for SQL, using sqls"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/lighttiger2505/sqls")
+  :package-version `(lsp-mode . "7.0"))
+
+(defcustom lsp-sqls-server "sqls"
+  "Path to the `sqls` binary."
+  :group 'lsp-sqls
+  :risky t
+  :type 'file
+  :package-version `(lsp-mode . "7.0"))
+
+(defcustom lsp-sqls-workspace-config-path "workspace"
+  "If non-nil then setup workspace configuration with json file path."
+  :group 'lsp-sqls
+  :risky t
+  :type '(choice (const "workspace")
+                 (const "root"))
+  :package-version `(lsp-mode . "7.0"))
+
+(defun lsp-sqls--make-launch-cmd ()
+  (-let [base `(,lsp-sqls-server)]
+    ;; we can add some options to command. (e.g. "-config")
+    base))
+
+
+(defcustom lsp-sqls-timeout 0.5
+  "Timeout to use for `sqls' requests."
+  :type 'number
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-sqls-connections nil
+  "The connections to the SQL server(s)."
+  :type '(repeat (alist :key-type (choice
+                                   (const :tag "Driver" driver)
+                                   (const :tag "Connection String" dataSourceName))
+                        :value-type string)))
+
+(defun lsp-sqls-setup-workspace-configuration ()
+  "Setup workspace configuration using json file depending on `lsp-sqls-workspace-config-path'."
+
+  (if lsp-sqls-connections
+      (lsp--set-configuration `(:sqls (:connections ,(apply #'vector lsp-sqls-connections))))
+    (when-let ((config-json-path (cond
+                                  ((equal lsp-sqls-workspace-config-path "workspace")
+                                   ".sqls/config.json")
+                                  ((equal lsp-sqls-workspace-config-path "root")
+                                   (-> (lsp-workspace-root)
+                                       (f-join ".sqls/config.json"))))))
+      (when (file-exists-p config-json-path)
+        (lsp--set-configuration (lsp--read-json-file config-json-path))))))
+
+(defun lsp-sqls--show-results (result)
+  (with-current-buffer (get-buffer-create "*sqls results*")
+    (with-help-window (buffer-name)
+      (erase-buffer)
+      (insert result))))
+
+(defun lsp-sql-execute-query (&optional command start end)
+  "Execute COMMAND on buffer text against current database.
+Buffer text is between START and END.  If START and END are nil,
+use the current region if set, otherwise the entire buffer."
+  (interactive)
+  (lsp-sqls--show-results
+   (lsp-request
+    "workspace/executeCommand"
+    (list :command "executeQuery"
+          :arguments (or
+                      (when command
+                        (lsp:command-arguments? command))
+                      (vector (lsp--buffer-uri)))
+          :timeout lsp-sqls-timeout
+          :range (list
+                  :start (lsp--point-to-position
+                          (cond
+                           (start start)
+                           ((use-region-p) (region-beginning))
+                            (t (point-min))))
+                  :end (lsp--point-to-position
+                        (cond
+                         (end end)
+                         ((use-region-p) (region-end))
+                         (t (point-max)))))))))
+
+(defun lsp-sql-execute-paragraph (&optional command)
+  "Execute COMMAND on paragraph against current database."
+  (interactive)
+  (let ((start (save-excursion (backward-paragraph) (point)))
+        (end (save-excursion (forward-paragraph) (point))))
+    (lsp-sql-execute-query command start end)))
+
+(defun lsp-sql-show-databases (&optional _command)
+  "Show databases."
+  (interactive)
+  (lsp-sqls--show-results
+   (lsp-request
+    "workspace/executeCommand"
+    (list :command "showDatabases" :timeout lsp-sqls-timeout))))
+
+(defun lsp-sql-show-schemas (&optional _command)
+  "Show schemas."
+  (interactive)
+  (lsp-sqls--show-results
+   (lsp-request
+    "workspace/executeCommand"
+    (list :command "showSchemas" :timeout lsp-sqls-timeout))))
+
+(defun lsp-sql-show-connections (&optional _command)
+  "Show connections."
+  (interactive)
+  (lsp-sqls--show-results
+   (lsp-request
+    "workspace/executeCommand"
+    (list :command "showConnections" :timeout lsp-sqls-timeout))))
+
+(defun lsp-sql-switch-database (&optional _command)
+  "Switch database."
+  (interactive)
+  (lsp-workspace-command-execute
+   "switchDatabase"
+   (vector (completing-read
+            "Select database: "
+            (s-lines (lsp-workspace-command-execute "showDatabases"))
+            nil
+            t))))
+
+(defun lsp-sql-switch-connection (&optional _command)
+  "Switch connection."
+  (interactive)
+  (lsp-workspace-command-execute
+   "switchConnections"
+   (vector (cl-first
+            (s-match "\\([[:digit:]]*\\)"
+                     (completing-read
+                      "Select connection: "
+                      (s-lines (lsp-workspace-command-execute  "showConnections"))
+                      nil
+                      t))))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection #'lsp-sqls--make-launch-cmd)
+                  :major-modes '(sql-mode)
+                  :priority -1
+                  :action-handlers (ht ("executeQuery" #'lsp-sql-execute-query)
+                                       ("showDatabases" #'lsp-sql-show-databases)
+                                       ("showSchemas" #'lsp-sql-show-schemas)
+                                       ("showConnections" #'lsp-sql-show-connections)
+                                       ("switchDatabase" #'lsp-sql-switch-database)
+                                       ("switchConnections" #'lsp-sql-switch-connection))
+                  :server-id 'sqls
+                  :initialized-fn (lambda (workspace)
+                                    (-> workspace
+                                        (lsp--workspace-server-capabilities)
+                                        (lsp:set-server-capabilities-execute-command-provider? t))
+                                    (with-lsp-workspace workspace
+                                      (lsp-sqls-setup-workspace-configuration)))))
+
+(lsp-consistency-check lsp-sqls)
+
+(provide 'lsp-sqls)
+;;; lsp-sqls.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-steep.el b/elpa/lsp-mode-20220201.852/lsp-steep.el
new file mode 100644 (file)
index 0000000..54d50ef
--- /dev/null
@@ -0,0 +1,73 @@
+;;; lsp-steep.el --- lsp-mode for Steep  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020  Masafumi Koba
+
+;; Author: Masafumi Koba <ybiquitousNOSPAMgmail.com>
+;; Keywords: languages
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP client for Steep which is a Ruby type checker.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-steep nil
+  "LSP support for Steep, using the Steep language server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/soutaro/steep"))
+
+(defcustom lsp-steep-log-level "warn"
+  "Log level of Steep."
+  :type '(choice
+          (const "fatal")
+          (const "error")
+          (const "warn")
+          (const "info")
+          (const "debug"))
+  :group 'lsp-steep)
+
+(defcustom lsp-steep-use-bundler t
+  "Run Steep using Bunder."
+  :type 'boolean
+  :safe #'booleanp
+  :group 'lsp-steep)
+
+(defcustom lsp-steep-server-path nil
+  "Path of the Steep language server executable.
+If specified, `lsp-steep-use-bundler' is ignored."
+  :type 'file
+  :group 'lsp-steep
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defun lsp-steep--build-command ()
+  "Build a command to start the Steep language server."
+  (append
+   (if (and lsp-steep-use-bundler (not lsp-steep-server-path)) '("bundle" "exec"))
+   (list (or lsp-steep-server-path "steep") "langserver" "--log-level" lsp-steep-log-level)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection #'lsp-steep--build-command)
+  :major-modes '(ruby-mode enh-ruby-mode)
+  :priority -3
+  :server-id 'steep-ls))
+
+(lsp-consistency-check lsp-steep)
+
+(provide 'lsp-steep)
+;;; lsp-steep.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-svelte.el b/elpa/lsp-mode-20220201.852/lsp-svelte.el
new file mode 100644 (file)
index 0000000..723b8fc
--- /dev/null
@@ -0,0 +1,307 @@
+;;; lsp-svelte.el --- LSP Svelte integration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Stepan Lusnikov
+
+;; Author: Stepan Lusnikov <endenwerNOSPAMgmail.com>
+;; Keywords: lsp svelte
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP client for Svelte
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-svelte nil
+  "LSP support for Svelte."
+  :group 'lsp-mode
+  :link '(url-link
+          "https://github.com/sveltejs/language-tools"))
+
+(lsp-dependency 'svelte-language-server
+                '(:system "svelteserver")
+                '(:npm :package "svelte-language-server"
+                       :path "svelteserver"))
+
+(defcustom lsp-svelte-plugin-typescript-enable t
+  "Enable the TypeScript plugin"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-diagnostics-enable t
+  "Enable diagnostic messages for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-hover-enable t
+  "Enable hover info for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-document-symbols-enable t
+  "Enable document symbols for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-completions-enable t
+  "Enable completions for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-find-references-enable t
+  "Enable find-references for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-definitions-enable t
+  "Enable go to definition for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-code-actions-enable t
+  "Enable code actions for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-selection-range-enable t
+  "Enable selection range for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-signature-help-enable t
+  "Enable signature help (parameter hints) for TypeScript"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-typescript-rename-enable t
+  "Enable rename functionality for JS/TS variables inside Svelte files"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-enable t
+  "Enable the CSS plugin"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-globals ""
+  "Which css files should be checked for global variables
+(`--global-var: value;`).
+
+These variables are added to the css completions.  String of comma-separated
+file paths or globs relative to workspace root."
+  :type 'string
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-diagnostics-enable t
+  "Enable diagnostic messages for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-hover-enable t
+  "Enable hover info for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-completions-enable t
+  "Enable auto completions for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-completions-emmet t
+  "Enable emmet auto completions for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-document-colors-enable t
+  "Enable document colors for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-color-presentations-enable t
+  "Enable color picker for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-document-symbols-enable t
+  "Enable document symbols for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-css-selection-range-enable t
+  "Enable selection range for CSS"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-html-enable t
+  "Enable the HTML plugin"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-html-hover-enable t
+  "Enable hover info for HTML"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-html-completions-enable t
+  "Enable auto completions for HTML"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-html-completions-emmet t
+  "Enable emmet auto completions for HTML"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-html-tag-complete-enable t
+  "Enable HTML tag auto closing"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-html-document-symbols-enable t
+  "Enable document symbols for HTML"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-enable t
+  "Enable the Svelte plugin"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-diagnostics-enable t
+  "Enable diagnostic messages for Svelte"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-compiler-warnings nil
+  "Svelte compiler warning codes to ignore or to treat as errors.
+Example: '((css-unused-selector . ignore) (unused-export-let . error))"
+  :type '(alist :key-type (symbol :tag "Warning code")
+                :value-type (choice
+                             (const :tag "Ignore" ignore)
+                             (const :tag "Treat as error" error)))
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-format-enable t
+  "Enable formatting for Svelte (includes css & js)"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-completions-enable t
+  "Enable auto completions for Svelte"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-hover-enable t
+  "Enable hover information for Svelte"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-code-actions-enable t
+  "Enable Code Actions for Svelte"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-selection-range-enable t
+  "Enable selection range for Svelte"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-svelte-plugin-svelte-rename-enable t
+  "Enable rename/move Svelte files functionality"
+  :type 'boolean
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-register-custom-settings
+ '(("svelte.plugin.svelte.rename.enable" lsp-svelte-plugin-svelte-rename-enable t)
+   ("svelte.plugin.svelte.selectionRange.enable" lsp-svelte-plugin-svelte-selection-range-enable t)
+   ("svelte.plugin.svelte.codeActions.enable" lsp-svelte-plugin-svelte-code-actions-enable t)
+   ("svelte.plugin.svelte.hover.enable" lsp-svelte-plugin-svelte-hover-enable t)
+   ("svelte.plugin.svelte.completions.enable" lsp-svelte-plugin-svelte-completions-enable t)
+   ("svelte.plugin.svelte.format.enable" lsp-svelte-plugin-svelte-format-enable t)
+   ("svelte.plugin.svelte.compilerWarnings" lsp-svelte-plugin-svelte-compiler-warnings)
+   ("svelte.plugin.svelte.diagnostics.enable" lsp-svelte-plugin-svelte-diagnostics-enable t)
+   ("svelte.plugin.svelte.enable" lsp-svelte-plugin-svelte-enable t)
+   ("svelte.plugin.html.documentSymbols.enable" lsp-svelte-plugin-html-document-symbols-enable t)
+   ("svelte.plugin.html.tagComplete.enable" lsp-svelte-plugin-html-tag-complete-enable t)
+   ("svelte.plugin.html.completions.emmet" lsp-svelte-plugin-html-completions-emmet t)
+   ("svelte.plugin.html.completions.enable" lsp-svelte-plugin-html-completions-enable t)
+   ("svelte.plugin.html.hover.enable" lsp-svelte-plugin-html-hover-enable t)
+   ("svelte.plugin.html.enable" lsp-svelte-plugin-html-enable t)
+   ("svelte.plugin.css.selectionRange.enable" lsp-svelte-plugin-css-selection-range-enable t)
+   ("svelte.plugin.css.documentSymbols.enable" lsp-svelte-plugin-css-document-symbols-enable t)
+   ("svelte.plugin.css.colorPresentations.enable" lsp-svelte-plugin-css-color-presentations-enable t)
+   ("svelte.plugin.css.documentColors.enable" lsp-svelte-plugin-css-document-colors-enable t)
+   ("svelte.plugin.css.completions.emmet" lsp-svelte-plugin-css-completions-emmet t)
+   ("svelte.plugin.css.completions.enable" lsp-svelte-plugin-css-completions-enable t)
+   ("svelte.plugin.css.hover.enable" lsp-svelte-plugin-css-hover-enable t)
+   ("svelte.plugin.css.diagnostics.enable" lsp-svelte-plugin-css-diagnostics-enable t)
+   ("svelte.plugin.css.globals" lsp-svelte-plugin-css-globals)
+   ("svelte.plugin.css.enable" lsp-svelte-plugin-css-enable t)
+   ("svelte.plugin.typescript.rename.enable" lsp-svelte-plugin-typescript-rename-enable t)
+   ("svelte.plugin.typescript.signatureHelp.enable" lsp-svelte-plugin-typescript-signature-help-enable t)
+   ("svelte.plugin.typescript.selectionRange.enable" lsp-svelte-plugin-typescript-selection-range-enable t)
+   ("svelte.plugin.typescript.codeActions.enable" lsp-svelte-plugin-typescript-code-actions-enable t)
+   ("svelte.plugin.typescript.definitions.enable" lsp-svelte-plugin-typescript-definitions-enable t)
+   ("svelte.plugin.typescript.findReferences.enable" lsp-svelte-plugin-typescript-find-references-enable t)
+   ("svelte.plugin.typescript.completions.enable" lsp-svelte-plugin-typescript-completions-enable t)
+   ("svelte.plugin.typescript.documentSymbols.enable" lsp-svelte-plugin-typescript-document-symbols-enable t)
+   ("svelte.plugin.typescript.hover.enable" lsp-svelte-plugin-typescript-hover-enable t)
+   ("svelte.plugin.typescript.diagnostics.enable" lsp-svelte-plugin-typescript-diagnostics-enable t)
+   ("svelte.plugin.typescript.enable" lsp-svelte-plugin-typescript-enable t)))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection
+                   (lambda ()
+                     `(,(lsp-package-path 'svelte-language-server)
+                       "--stdio")))
+  :activation-fn (lambda (file-name _mode)
+                   (string= (f-ext file-name)
+                            "svelte"))
+  :initialization-options
+  (lambda ()
+    (list :config (ht-get* (lsp-configuration-section "svelte.plugin")
+                           "svelte"
+                           "plugin")
+          :prettierConfig (lsp-configuration-section "prettier")
+          :emmetConfig (lsp-configuration-section "emmet")
+          :typescriptConfig: (list :typescript (lsp-configuration-section "typescript")
+                                   :javascript (lsp-configuration-section "javascript"))
+          :dontFilterIncompleteCompletions t))
+  :server-id 'svelte-ls
+  :download-server-fn (lambda (_client callback error-callback _update?)
+                        (lsp-package-ensure 'svelte-language-server callback error-callback))
+  :initialized-fn
+  (lambda (workspace)
+    (with-lsp-workspace workspace
+      (lsp--set-configuration
+       (ht-merge (lsp-configuration-section "svelte")
+                 (lsp-configuration-section "javascript")
+                 (lsp-configuration-section "typescript")))
+      (lsp--server-register-capability
+       (lsp-make-registration
+        :id "js/ts/id"
+        :method "workspace/didChangeWatchedFiles"
+        :register-options? (lsp-make-did-change-watched-files-registration-options
+                            :watchers
+                            (vector (lsp-make-file-system-watcher :glob-pattern "**/*.js")
+                                    (lsp-make-file-system-watcher :glob-pattern "**/*.ts")))))))))
+
+(lsp-consistency-check lsp-svelte)
+
+(provide 'lsp-svelte)
+;;; lsp-svelte.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-terraform.el b/elpa/lsp-mode-20220201.852/lsp-terraform.el
new file mode 100644 (file)
index 0000000..0d7d429
--- /dev/null
@@ -0,0 +1,99 @@
+;;; lsp-terraform.el --- Terraform Client settings         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Ross Donaldson
+
+;; Author: Ross Donaldson
+;; Keywords: terraform lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP client for Terraform
+
+;;; Code:
+
+(require 'lsp-mode)
+
+\f
+;; terraform-lsp
+
+(defgroup lsp-terraform nil
+  "LSP support for Terraform, using terraform-lsp"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/juliosueiras/terraform-lsp")
+  :package-version `(lsp-mode . "6.2"))
+
+(defcustom lsp-terraform-server "terraform-lsp"
+  "Path to the `terraform-lsp' binary."
+  :group 'lsp-terraform
+  :risky t
+  :type '(choice
+          (file :tag "File")
+          (repeat string))
+  :package-version `(lsp-mode . "6.2"))
+
+(defcustom lsp-terraform-enable-logging nil
+  "If non-nil, enable `terraform-ls''s native logging."
+  :group 'lsp-terraform
+  :risky t
+  :type 'boolean
+  :package-version `(lsp-mode . "6.2"))
+
+
+(defun lsp-terraform--make-launch-cmd ()
+  (-let [base (if (stringp lsp-terraform-server)
+                  `(,lsp-terraform-server)
+                lsp-terraform-server)]
+    (when lsp-terraform-enable-logging
+      (push "-enable-log-file" base))
+    base))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection #'lsp-terraform--make-launch-cmd)
+                  :major-modes '(terraform-mode)
+                  :priority -1
+                  :server-id 'tfls))
+
+\f
+;; terraform-ls
+
+(defgroup lsp-terraform-ls nil
+  "LSP support for Terraform, using terraform-ls from Hashicorp."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/hashicorp/terraform-ls")
+  :package-version `(lsp-mode . "8.0.1"))
+
+(defcustom lsp-terraform-ls-server "terraform-ls"
+  "Path to the `terraform-ls' binary."
+  :group 'lsp-terraform-ls
+  :risky t
+  :type '(choice
+          (file :tag "File")
+          (repeat string))
+  :package-version `(lsp-mode . "8.0.1"))
+
+(defun lsp-terraform-ls--make-launch-cmd ()
+  `(,lsp-terraform-ls-server "serve"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection #'lsp-terraform-ls--make-launch-cmd)
+                  :major-modes '(terraform-mode)
+                  :priority 1
+                  :server-id 'tfmls))
+
+(lsp-consistency-check lsp-terraform)
+
+(provide 'lsp-terraform)
+;;; lsp-terraform.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-tex.el b/elpa/lsp-mode-20220201.852/lsp-tex.el
new file mode 100644 (file)
index 0000000..3cd6d08
--- /dev/null
@@ -0,0 +1,68 @@
+;;; lsp-tex.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, tex
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the Tex Typesetting Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-tex nil
+  "LSP support for TeX and friends, using Digestif and texlab."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/astoff/digestif/")
+  :link '(url-link "https://github.com/latex-lsp/texlab"))
+
+(defcustom lsp-tex-server 'texlab
+  "Choose LSP tex server."
+  :type '(choice (const :tag "texlab" texlab)
+                 (const :tag "digestif" digestif))
+  :group 'lsp-tex)
+
+(defcustom lsp-clients-digestif-executable "digestif"
+  "Command to start the Digestif language server."
+  :group 'lsp-tex
+  :risky t
+  :type 'file)
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-digestif-executable)
+                  :major-modes '(plain-tex-mode latex-mode context-mode texinfo-mode)
+                  :priority (if (eq lsp-tex-server 'digestif) 1 -1)
+                  :server-id 'digestif))
+
+(defcustom lsp-clients-texlab-executable "texlab"
+  "Command to start the texlab language server."
+  :group 'lsp-tex
+  :risky t
+  :type 'file)
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-texlab-executable)
+                  :major-modes '(plain-tex-mode latex-mode)
+                  :priority (if (eq lsp-tex-server 'texlab) 1 -1)
+                  :server-id 'texlab))
+
+(lsp-consistency-check lsp-tex)
+
+(provide 'lsp-tex)
+;;; lsp-tex.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-toml.el b/elpa/lsp-mode-20220201.852/lsp-toml.el
new file mode 100644 (file)
index 0000000..cef8813
--- /dev/null
@@ -0,0 +1,258 @@
+;;; lsp-toml.el --- lsp-mode TOML integration  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021  Taiki Sugawara
+
+;; Author: Taiki Sugawara <buzz.taikiNOSPAMgmail.com>
+;; Keywords: lsp, toml
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Client for taplo-lsp.
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'ht)
+(require 'f)
+
+(defgroup lsp-toml nil
+  "LSP support for TOML, using taplo-lsp."
+  :group 'lsp-mode
+  :link '(url-link "https://taplo.tamasfe.dev/lsp/"))
+
+(defcustom lsp-toml-command "taplo-lsp"
+  "Path to taplo-lsp command."
+  :type 'string
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-cache-path (expand-file-name
+                                (locate-user-emacs-file (f-join ".cache" "lsp-toml")))
+  "Path to cache."
+  :type 'string
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+
+(defcustom lsp-toml-taplo-config nil
+  "An absolute, or workspace relative path to the Taplo configuration file."
+  :type 'file
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-taplo-config-enabled t
+  "Whether to enable the usage of a Taplo configuration file."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+
+(defcustom lsp-toml-schema-enabled t
+  "Enable completion and validation based on JSON schemas."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-schema-links nil
+  "Enable editor links."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-schema-repository-enabled t
+  "Whether to use schemas from the provided schema repository."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-schema-repository-url "https://taplo.tamasfe.dev/schema_index.json"
+  "A HTTP(S) URL that points to a schema index."
+  :type 'string
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-schema-associations
+  `((,(make-symbol "^(.*(/|\\\\)\\.?taplo\\.toml|\\.?taplo\\.toml)$") . "taplo://taplo.toml"))
+  "Document and schema associations."
+  :type '(alist :key-type symbol :value-type string)
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+
+(defcustom lsp-toml-formatter-align-entries nil
+  "Align consecutive entries vertically."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-align-comments t
+  "Align comments vertically after entries and array values."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-array-trailing-comma t
+  "Append trailing commas for multi-line arrays."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-array-auto-expand t
+  "Expand arrays to multiple lines that exceed the maximum column width."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-array-auto-collapse t
+  "Collapse arrays that don't exceed the maximum column width and
+don't contain comments."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-compact-arrays t
+  "Omit white space padding from single-line arrays."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-compact-inline-tables nil
+  "Omit white space padding from the start and end of inline tables."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-compact-entries nil
+  "Omit white space padding around `=` for entries."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-column-width 80
+  "Maximum column width in characters, affects array expansion
+and collapse, this doesn't take whitespace into account."
+  :type 'number
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-indent-tables nil
+  "Indent based on tables and arrays of tables and their
+subtables, subtables out of order are not indented."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-indent-entries nil
+  "Indent entries under tables."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-indent-string nil
+  "The substring that is used for indentation, should be tabs or
+spaces, but technically can be anything.  Uses the IDE setting if
+not set."
+  :type '(repeat string)
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-reorder-keys nil
+  "Alphabetically reorder keys that are not separated by empty lines."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-allowed-blank-lines 2
+  "Maximum amount of allowed consecutive blank lines.
+This does not affect the whitespace at the end of the document,
+as it is always stripped."
+  :type 'number
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-trailing-newline t
+  "Add trailing newline at the end of the file if not present."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-toml-formatter-crlf nil
+  "Use CRLF for line endings."
+  :type 'boolean
+  :group 'lsp-toml
+  :package-version '(lsp-mode . "8.0.1"))
+
+
+(lsp-register-custom-settings
+ '(
+   ("evenBetterToml.taploConfig" lsp-toml-taplo-config)
+   ("evenBetterToml.taploConfigEnabled" lsp-toml-taplo-config-enabled t)
+
+   ("evenBetterToml.schema.enabled" lsp-toml-schema-enabled t)
+   ("evenBetterToml.schema.links" lsp-toml-schema-links t)
+   ("evenBetterToml.schema.repositoryEnabled" lsp-toml-schema-repository-enabled t)
+   ("evenBetterToml.schema.repositoryUrl" lsp-toml-schema-repository-url)
+   ("evenBetterToml.schema.associations" lsp-toml-schema-associations)
+
+   ("evenBetterToml.formatter.alignEntries" lsp-toml-formatter-align-entries t)
+   ("evenBetterToml.formatter.alignComments" lsp-toml-formatter-align-comments t)
+   ("evenBetterToml.formatter.arrayTrailingComma" lsp-toml-formatter-array-trailing-comma t)
+   ("evenBetterToml.formatter.arrayAutoExpand" lsp-toml-formatter-array-auto-expand t)
+   ("evenBetterToml.formatter.arrayAutoCollapse" lsp-toml-formatter-array-auto-collapse t)
+   ("evenBetterToml.formatter.compactArrays" lsp-toml-formatter-compact-arrays t)
+   ("evenBetterToml.formatter.compactInlineTables" lsp-toml-formatter-compact-inline-tables t)
+   ("evenBetterToml.formatter.compactEntries" lsp-toml-formatter-compact-entries t)
+   ("evenBetterToml.formatter.columnWidth" lsp-toml-formatter-column-width)
+   ("evenBetterToml.formatter.indentTables" lsp-toml-formatter-indent-tables t)
+   ("evenBetterToml.formatter.indentEntries" lsp-toml-formatter-indent-entries t)
+   ("evenBetterToml.formatter.indentString" lsp-toml-formatter-indent-string)
+   ("evenBetterToml.formatter.reorderKeys" lsp-toml-formatter-reorder-keys t)
+   ("evenBetterToml.formatter.allowedBlankLines" lsp-toml-formatter-allowed-blank-lines)
+   ("evenBetterToml.formatter.trailingNewline" lsp-toml-formatter-trailing-newline t)
+   ("evenBetterToml.formatter.crlf" lsp-toml-formatter-crlf t)))
+
+
+(defun lsp-toml--initialized (workspace)
+  (with-lsp-workspace workspace
+    (lsp--set-configuration (lsp-configuration-section "evenBetterToml"))
+    (lsp-notify "taplo/cachePath" `(:path ,lsp-toml-cache-path))))
+
+(defun lsp-toml--initialization-options ()
+  (list :configuration (ht-get (lsp-configuration-section "evenBetterToml") "evenBetterToml")))
+
+(defun lsp-toml--message-with-output (_workspace params)
+  (funcall (pcase (ht-get params "kind")
+             ("error" 'lsp--error)
+             ("warn" 'lsp--warn)
+             ("info" 'lsp--info)
+             (_ 'lsp--info))
+           "lsp-toml: %s"
+           (ht-get params "message")))
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda () (list lsp-toml-command "run")))
+  :activation-fn (lsp-activate-on "toml")
+  :initialized-fn #'lsp-toml--initialized
+  :initialization-options #'lsp-toml--initialization-options
+  :notification-handlers (ht ("taplo/messageWithOutput" #'lsp-toml--message-with-output))
+  :server-id 'taplo-lsp
+  :priority -1))
+
+(lsp-consistency-check lsp-toml)
+
+(provide 'lsp-toml)
+;;; lsp-toml.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-v.el b/elpa/lsp-mode-20220201.852/lsp-v.el
new file mode 100644 (file)
index 0000000..a809a07
--- /dev/null
@@ -0,0 +1,50 @@
+;;; lsp-v.el --- lsp-mode V integration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 remimimimi
+
+;; Author: remimimimi
+;; Keywords: languages,tools
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;  client for vls, the V language server
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-v nil
+  "LSP support for V via vls."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/vlang/vls/tree/master"))
+
+(defcustom lsp-v-vls-executable "vls"
+  "The vls executable to use.
+Leave as just the executable name to use the default behavior of
+finding the executable with variable `exec-path'."
+  :group 'lsp-v
+  :type 'string)
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda () lsp-v-vls-executable))
+  :activation-fn (lsp-activate-on "V")
+  :server-id 'v-ls))
+
+(lsp-consistency-check lsp-v)
+
+(provide 'lsp-v)
+;;; lsp-v.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-vala.el b/elpa/lsp-mode-20220201.852/lsp-vala.el
new file mode 100644 (file)
index 0000000..479743b
--- /dev/null
@@ -0,0 +1,51 @@
+;;; lsp-vala.el --- Vala Client settings         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 Daniel Svensson
+
+;; Author: Daniel Svensson
+;; Keywords: vala lsp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP client for Vala
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-vala nil
+  "LSP support for Vala, using vala-language-server"
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/benwaffle/vala-language-server")
+  :package-version `(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-vala-ls-executable "vala-language-server"
+  "Path to the `vala-language-server' binary."
+  :group 'lsp-vala
+  :risky t
+  :type 'file
+  :package-version `(lsp-mode . "8.0.0"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-clients-vala-ls-executable))
+                  :major-modes '(vala-mode)
+                  :priority -1
+                  :server-id 'valals))
+
+(lsp-consistency-check lsp-vala)
+
+(provide 'lsp-vala)
+;;; lsp-vala.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-verilog.el b/elpa/lsp-mode-20220201.852/lsp-verilog.el
new file mode 100644 (file)
index 0000000..3f9ba41
--- /dev/null
@@ -0,0 +1,186 @@
+;;; lsp-verilog.el --- Verilog Client settings         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Patrick Grogan
+
+;; Author: Patrick Grogan <pogroganNOSPAMgmail.com>
+;; Created: 7 December 2019
+;; Keywords: languages, lsp, verilog
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; LSP client support for Verilog/SystemVerilog. Two language servers
+;; are available:
+;;   1) HDL Checker. See https://github.com/suoto/hdl_checker
+;;   2) SVLangserver. See https://github.com/imc-trading/svlangserver
+;;
+;; This file is based on the lsp-vhdl.el file.
+;;
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-svlangserver nil
+  "Settings for the SystemVerilog language server client."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/imc-trading/svlangserver")
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-clients-svlangserver-includeIndexing '["**/*.{sv,svh}"]
+  "Files included for indexing (glob pattern)"
+  :group 'lsp-svlangserver
+  :type '(lsp-repeatable-vector string)
+  :safe (lambda (x) (seq-every-p #'stringp x)))
+
+(defcustom lsp-clients-svlangserver-excludeIndexing '["test/**/*.{sv,svh}"]
+  "Files excluded for indexing (glob pattern)"
+  :group 'lsp-svlangserver
+  :type '(lsp-repeatable-vector string)
+  :safe (lambda (x) (seq-every-p #'stringp x)))
+
+(defcustom lsp-clients-svlangserver-defines nil
+  "Defines needed for linting"
+  :group 'lsp-svlangserver
+  :type '(lsp-repeatable-vector string)
+  :safe (lambda (x) (seq-every-p #'stringp x)))
+
+(defcustom lsp-clients-svlangserver-launchConfiguration "verilator -sv --lint-only -Wall"
+  "Verilator command used for linting"
+  :group 'lsp-svlangserver
+  :type 'string
+  :safe (lambda (x) (stringp x)))
+
+(defcustom lsp-clients-svlangserver-lintOnUnsaved t
+  "Enable linting on unsaved files"
+  :group 'lsp-svlangserver
+  :type 'boolean
+  :safe (lambda (x) (booleanp x)))
+
+(defcustom lsp-clients-svlangserver-formatCommand "verible-verilog-format"
+  "Verible verilog format command"
+  :group 'lsp-svlangserver
+  :type 'string
+  :safe (lambda (x) (stringp x)))
+
+(defcustom lsp-clients-svlangserver-disableCompletionProvider nil
+  "Disable auto completion provided by the language server"
+  :group 'lsp-svlangserver
+  :type 'boolean
+  :safe (lambda (x) (booleanp x)))
+
+(defcustom lsp-clients-svlangserver-disableHoverProvider nil
+  "Disable hover over help provided by the language server"
+  :group 'lsp-svlangserver
+  :type 'boolean
+  :safe (lambda (x) (booleanp x)))
+
+(defcustom lsp-clients-svlangserver-disableSignatureHelpProvider nil
+  "Disable signature help provided by the language server"
+  :group 'lsp-svlangserver
+  :type 'boolean
+  :safe (lambda (x) (booleanp x)))
+
+(defcustom lsp-clients-svlangserver-disableLinting nil
+  "Disable verilator linting"
+  :group 'lsp-svlangserver
+  :type 'boolean
+  :safe (lambda (x) (booleanp x)))
+
+(defcustom lsp-clients-svlangserver-workspace-additional-dirs nil
+  "Additional directories to be managed by this instance of svlangserver"
+  :group 'lsp-svlangserver
+  :type '(lsp-repeatable-vector string)
+  :safe (lambda (x) (seq-every-p #'stringp x)))
+
+(defcustom lsp-clients-svlangserver-bin-path "svlangserver"
+  "svlangserver binary path"
+  :group 'lsp-svlangserver
+  :type 'string
+  :safe (lambda (x) (stringp x)))
+
+(defcustom lsp-clients-svlangserver-bin-args nil
+  "command line arguments for svlangserver binary"
+  :group 'lsp-svlangserver
+  :type '(lsp-repeatable-vector string)
+  :safe (lambda (x) (seq-every-p #'stringp x)))
+
+(defcustom lsp-clients-svlangserver-node-command "node"
+  "node binary path"
+  :group 'lsp-svlangserver
+  :type 'string
+  :safe (lambda (x) (stringp x)))
+
+(defcustom lsp-clients-svlangserver-module-path "svlangserver.js"
+  "svlangserver module path"
+  :group 'lsp-svlangserver
+  :type 'string
+  :safe (lambda (x) (stringp x)))
+
+(lsp-dependency 'svlangserver
+                '(:system "svlangserver"))
+
+(defun lsp-clients-svlangserver-get-workspace-additional-dirs (_workspace)
+  lsp-clients-svlangserver-workspace-additional-dirs)
+
+(defun lsp-clients-svlangserver-command ()
+  (let ((svlangserver-bin-path (lsp-package-path 'svlangserver)))
+    (if svlangserver-bin-path
+      (cons svlangserver-bin-path lsp-clients-svlangserver-bin-args)
+      (if (file-exists-p lsp-clients-svlangserver-bin-path)
+        (cons lsp-clients-svlangserver-bin-path lsp-clients-svlangserver-bin-args)
+        (if (file-exists-p lsp-clients-svlangserver-module-path)
+          `(,lsp-clients-svlangserver-node-command ,lsp-clients-svlangserver-module-path ,"--stdio")
+          `(,"svlangserver"))))))
+
+(lsp-register-client
+    (make-lsp-client :new-connection (lsp-stdio-connection 'lsp-clients-svlangserver-command)
+                     :major-modes '(verilog-mode)
+                     :priority -1
+                     :library-folders-fn 'lsp-clients-svlangserver-get-workspace-additional-dirs
+                     :server-id 'svlangserver))
+
+(lsp-register-custom-settings '(("systemverilog.includeIndexing" lsp-clients-svlangserver-includeIndexing)
+                                ("systemverilog.excludeIndexing" lsp-clients-svlangserver-excludeIndexing)
+                                ("systemverilog.defines" lsp-clients-svlangserver-defines)
+                                ("systemverilog.launchConfiguration" lsp-clients-svlangserver-launchConfiguration)
+                                ("systemverilog.lintOnUnsaved" lsp-clients-svlangserver-lintOnUnsaved)
+                                ("systemverilog.formatCommand" lsp-clients-svlangserver-formatCommand)
+                                ("systemverilog.disableCompletionProvider" lsp-clients-svlangserver-disableCompletionProvider)
+                                ("systemverilog.disableHoverProvider" lsp-clients-svlangserver-disableHoverProvider)
+                                ("systemverilog.disableSignatureHelpProvider" lsp-clients-svlangserver-disableSignatureHelpProvider)
+                                ("systemverilog.disableLinting" lsp-clients-svlangserver-disableLinting)))
+
+(defgroup lsp-verilog nil
+  "LSP support for Verilog/SystemVerilog."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/suoto/hdl_checker"))
+
+(defcustom lsp-clients-verilog-executable '("hdl_checker" "--lsp")
+  "Command to start the hdl_checker language server."
+  :group 'lsp-verilog
+  :risky t
+  :type 'file)
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection lsp-clients-verilog-executable)
+                  :major-modes '(verilog-mode)
+                  :language-id "verilog"
+                 :priority -2
+                  :server-id 'lsp-verilog))
+
+(lsp-consistency-check lsp-verilog)
+
+(provide 'lsp-verilog)
+;;; lsp-verilog.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-vetur.el b/elpa/lsp-mode-20220201.852/lsp-vetur.el
new file mode 100644 (file)
index 0000000..8bebfcc
--- /dev/null
@@ -0,0 +1,886 @@
+;;; lsp-vetur.el --- vls configuration                 -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; VLS configuration
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'lsp-html)
+
+(defgroup lsp-vetur nil
+  "LSP support for Vue, using the Vue Language Server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/vuejs/vetur/tree/master/server")
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-ignore-project-warning nil
+  "Ignore projects without jsconfig.json or tsconfig.json warnings."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "8.0.1"))
+
+(defcustom lsp-vetur-use-workspace-dependencies nil
+  "Use dependencies from workspace. Currently only for
+TypeScript."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-completion-auto-import t
+  "Include completion for module export and auto import them"
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-completion-scaffold-snippet-sources
+  '((workspace . "(W)")
+    (user . "(U)")
+    (vetur . "(V)"))
+  "Where Vetur source Scaffold Snippets from and how to indicate them.
+- workspace: <WORKSPACE>/.vscode/vetur/snippets.
+- user: <USER-DATA-DIR>/User/snippets/vetur.
+- vetur: Bundled in Vetur.
+The source value can be a string \"(User)\" or an emoji \"✌\".
+Set a source to \"\" to disable it.
+"
+  :type 'alist
+  :group 'lsp-vetur
+  :link '(url-link "https://vuejs.github.io/vetur/guide/snippet.html")
+  :package-version '(lsp-mode. "8.0.1"))
+
+(defcustom lsp-vetur-completion-tag-casing "kebab"
+  "Casing conversion for tag completion"
+  :type '(choice
+          (const "initial")
+          (const "kebab"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-grammar-custom-blocks '((docs . "md") (i18n . "json"))
+  "Mapping from custom block tag name to language name. Used for
+ generating grammar to support syntax highlighting for custom
+ blocks."
+  :type 'alist
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-validation-template t
+  "Validate vue-html in <template> using eslint-plugin-vue"
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-language-features-code-actions t
+  "Enable/disable code actions."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-vetur-validation-style t
+  "Validate css/scss/less/postcss in <style>"
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-validation-script t
+  "Validate js/ts in <script>"
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-enable t
+  "Enable/disable the Vetur document formatter."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-options-tab-size 2
+  "Number of spaces per indentation level. Inherited by all formatters."
+  :type 'number
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-options-use-tabs nil
+  "Use tabs for indentation. Inherited by all formatters."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-html "prettyhtml"
+  "Default formatter for <template> region"
+  :type '(choice
+          (const "none")
+          (const "prettyhtml")
+          (const "js-beautify-html")
+          (const "prettier"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-css "prettier"
+  "Default formatter for <style> region"
+  :type '(choice
+          (const "none")
+          (const "prettier"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-postcss "prettier"
+  "Default formatter for <style lang='postcss'> region"
+  :type '(choice
+          (const "none")
+          (const "prettier"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-scss "prettier"
+  "Default formatter for <style lang='scss'> region"
+  :type '(choice
+          (const "none")
+          (const "prettier"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-less "prettier"
+  "Default formatter for <style lang='less'> region"
+  :type '(choice
+          (const "none")
+          (const "prettier"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-stylus "stylus-supremacy"
+  "Default formatter for <style lang='stylus'> region"
+  :type '(choice
+          (const "none")
+          (const "stylus-supremacy"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-js "prettier"
+  "Default formatter for <script> region"
+  :type '(choice
+          (const "none")
+          (const "prettier")
+          (const "prettier-eslint")
+          (const "vscode-typescript"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-ts "prettier"
+  "Default formatter for <script> region"
+  :type '(choice
+          (const "none")
+          (const "prettier")
+          (const "vscode-typescript"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-default-formatter-options
+  '((js-beautify-html (wrap_attributes . "force-expand-multiline"))
+    (prettyhtml (printWidth . 100)
+                (singleQuote . :json-false)
+                (wrapAttributes . :json-false)
+                (sortAttributes . :json-false)))
+  "Options for all default formatters"
+  :type 'alist
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-style-initial-indent nil
+  "Whether to have initial indent for <style> region"
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-format-script-initial-indent nil
+  "Whether to have initial indent for <script> region"
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-trace-server "off"
+  "Traces the communication between VS Code and Vue Language Server."
+  :type '(choice
+          (const "off")
+          (const "messages")
+          (const "verbose"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-dev-vls-path ""
+  "The vls path for development"
+  :type 'string
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-vetur-dev-vls-port -1
+  "The vls port for development"
+  :type 'integer
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-vetur-dev-log-level "INFO"
+  "The vls log level for development"
+  :type '(choice
+          (const "INFO")
+          (const "DEBUG"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-vetur-experimental-template-interpolation-service nil
+  "Whether to have template interpolation service"
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.3"))
+
+(defcustom lsp-typescript-tsdk nil
+  "Specifies the folder path containing the tsserver and
+lib*.d.ts files to use."
+  :type '(repeat string)
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-disable-automatic-type-acquisition nil
+  "Disables automatic type acquisition. Automatic type
+acquisition fetches `@types` packages from npm to improve
+IntelliSense for external libraries."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-npm nil
+  "Specifies the path to the NPM executable used for Automatic
+Type Acquisition. Requires using TypeScript 2.3.4 or newer in the
+workspace."
+  :type '(repeat string)
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-check-npm-is-installed t
+  "Check if NPM is installed for Automatic Type Acquisition."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-references-code-lens-enabled nil
+  "Enable/disable references CodeLens in JavaScript files."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-references-code-lens-enabled nil
+  "Enable/disable references CodeLens in TypeScript files."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-implementations-code-lens-enabled nil
+  "Enable/disable implementations CodeLens. This CodeLens shows
+the implementers of an interface."
+  :type 'boolean
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-tsserver-log "off"
+  "Enables logging of the TS server to a file. This log can be
+used to diagnose TS Server issues. The log may contain file
+paths, source code, and other potentially sensitive information
+from your project."
+  :type '(choice
+          (const "off")
+          (const "terse")
+          (const "normal")
+          (const "verbose"))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-tsserver-plugin-paths nil
+  "Additional paths to discover Typescript Language Service
+plugins. Requires using TypeScript 2.3.0 or newer in the
+workspace."
+  :type '(repeat string)
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-tsserver-trace "off"
+  "Enables tracing of messages sent to the TS server. This trace
+can be used to diagnose TS Server issues. The trace may contain
+file paths, source code, and other potentially sensitive
+information from your project."
+  :type '(choice
+          (const "off")
+          (const "messages")
+          (const "verbose"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-suggest-complete-function-calls nil
+  "Complete functions with their parameter signature."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-suggest-complete-function-calls nil
+  "Complete functions with their parameter signature."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-report-style-checks-as-warnings t
+  "Report style checks as warnings."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-validate-enable t
+  "Enable/disable TypeScript validation."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-enable t
+  "Enable/disable default TypeScript formatter."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-comma-delimiter t
+  "Defines space handling after a comma delimiter."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-constructor nil
+  "Defines space handling after the constructor keyword. Requires
+using TypeScript 2.3.0 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-semicolon-in-for-statements t
+  "Defines space handling after a semicolon in a for statement."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-before-and-after-binary-operators t
+  "Defines space handling after a binary operator."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-keywords-in-control-flow-statements t
+  "Defines space handling after keywords in a control flow
+statement."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-function-keyword-for-anonymous-functions t
+  "Defines space handling after function keyword for anonymous
+functions."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-before-function-parenthesis nil
+  "Defines space handling before function argument parentheses."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-parenthesis nil
+  "Defines space handling after opening and before closing
+non-empty parenthesis."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-brackets nil
+  "Defines space handling after opening and before closing
+non-empty brackets."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-braces t
+  "Defines space handling after opening and before closing
+non-empty braces. Requires using TypeScript 2.3.0 or newer in the
+workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-opening-and-before-closing-template-string-braces nil
+  "Defines space handling after opening and before closing
+template string braces."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-opening-and-before-closing-jsx-expression-braces nil
+  "Defines space handling after opening and before closing JSX
+expression braces."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-insert-space-after-type-assertion nil
+  "Defines space handling after type assertions in TypeScript.
+Requires using TypeScript 2.4 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-place-open-brace-on-new-line-for-functions nil
+  "Defines whether an open brace is put onto a new line for
+functions or not."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-format-place-open-brace-on-new-line-for-control-blocks nil
+  "Defines whether an open brace is put onto a new line for
+control blocks or not."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-validate-enable t
+  "Enable/disable JavaScript validation."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-enable t
+  "Enable/disable default JavaScript formatter."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-comma-delimiter t
+  "Defines space handling after a comma delimiter."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-constructor nil
+  "Defines space handling after the constructor keyword. Requires
+using TypeScript 2.3.0 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-semicolon-in-for-statements t
+  "Defines space handling after a semicolon in a for statement."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-before-and-after-binary-operators t
+  "Defines space handling after a binary operator."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-keywords-in-control-flow-statements t
+  "Defines space handling after keywords in a control flow
+statement."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-function-keyword-for-anonymous-functions t
+  "Defines space handling after function keyword for anonymous
+functions."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-before-function-parenthesis nil
+  "Defines space handling before function argument parentheses."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-opening-and-before-closing-nonempty-parenthesis nil
+  "Defines space handling after opening and before closing
+non-empty parenthesis."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-opening-and-before-closing-nonempty-brackets nil
+  "Defines space handling after opening and before closing
+non-empty brackets."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-opening-and-before-closing-nonempty-braces t
+  "Defines space handling after opening and before closing
+non-empty braces. Requires using TypeScript 2.3.0 or newer in the
+workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-opening-and-before-closing-template-string-braces nil
+  "Defines space handling after opening and before closing
+template string braces."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-insert-space-after-opening-and-before-closing-jsx-expression-braces nil
+  "Defines space handling after opening and before closing JSX
+expression braces."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-place-open-brace-on-new-line-for-functions nil
+  "Defines whether an open brace is put onto a new line for
+functions or not."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-format-place-open-brace-on-new-line-for-control-blocks nil
+  "Defines whether an open brace is put onto a new line for
+control blocks or not."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-implicit-project-config-check-js nil
+  "Enable/disable semantic checking of JavaScript files. Existing
+jsconfig.json or tsconfig.json files override this setting.
+Requires using TypeScript 2.3.1 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-implicit-project-config-experimental-decorators nil
+  nil
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-suggest-names t
+  "Enable/disable including unique names from the file in
+JavaScript suggestions."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-tsc-auto-detect "on"
+  "Controls auto detection of tsc tasks."
+  :type '(choice
+          (const "on")
+          (const "off")
+          (const "build")
+          (const "watch"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-suggest-paths t
+  "Enable/disable suggestions for paths in import statements and
+require calls."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-suggest-paths t
+  "Enable/disable suggestions for paths in import statements and
+require calls."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-suggest-auto-imports t
+  "Enable/disable auto import suggestions. Requires using
+TypeScript 2.6.1 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-suggest-auto-imports t
+  "Enable/disable auto import suggestions. Requires using
+TypeScript 2.6.1 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-suggest-complete-js-docs t
+  "Enable/disable suggestion to complete JSDoc comments."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-suggest-complete-js-docs t
+  "Enable/disable suggestion to complete JSDoc comments."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-locale nil
+  nil
+  :type '(choice
+          (const "de")
+          (const "es")
+          (const "en")
+          (const "fr")
+          (const "it")
+          (const "ja")
+          (const "ko")
+          (const "ru")
+          (const "zh-CN")
+          (const "zh-TW")
+          nil)
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-suggestion-actions-enabled t
+  "Enable/disable suggestion diagnostics for JavaScript files in
+the editor. Requires using TypeScript 2.8 or newer in the
+workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-suggestion-actions-enabled t
+  "Enable/disable suggestion diagnostics for TypeScript files in
+the editor. Requires using TypeScript 2.8 or newer in the
+workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-preferences-quote-style "auto" nil
+  :type '(choice
+          (const "auto")
+          (const "single")
+          (const "double"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-preferences-quote-style "auto" nil
+  :type '(choice
+          (const "auto")
+          (const "single")
+          (const "double"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-preferences-import-module-specifier "auto"
+  "Preferred path style for auto imports."
+  :type '(choice
+          (const "auto")
+          (const "relative")
+          (const "non-relative"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-preferences-import-module-specifier "auto"
+  "Infer the shortest path type."
+  :type '(choice
+          (const "auto")
+          (const "relative")
+          (const "non-relative"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-preferences-rename-shorthand-properties t
+  "Enable/disable introducing aliases for object shorthand
+properties during renames. Requires using TypeScript 3.4 or newer
+in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-preferences-rename-shorthand-properties t
+  "Enable/disable introducing aliases for object shorthand
+properties during renames. Requires using TypeScript 3.4 or newer
+in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-update-imports-on-file-move-enabled "prompt"
+  "Enable/disable automatic updating of import paths when you
+rename or move a file in VS Code. Requires using TypeScript 2.9
+or newer in the workspace."
+  :type '(choice
+          (const "prompt")
+          (const "always")
+          (const "never"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-update-imports-on-file-move-enabled "prompt"
+  "Prompt on each rename."
+  :type '(choice
+          (const "prompt")
+          (const "always")
+          (const "never"))
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-auto-closing-tags t
+  "Enable/disable automatic closing of JSX tags. Requires using
+TypeScript 3.0 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-auto-closing-tags t
+  "Enable/disable automatic closing of JSX tags. Requires using
+TypeScript 3.0 or newer in the workspace."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-javascript-suggest-enabled t
+  "Enabled/disable autocomplete suggestions."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-suggest-enabled t
+  "Enabled/disable autocomplete suggestions."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-typescript-surveys-enabled t
+  "Enabled/disable occasional surveys that help us improve VS
+Code's JavaScript and TypeScript support."
+  :type 'boolean
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-vetur-emmet "never"
+  "Controls the Emmet suggestions that show up in the suggestion/completion list."
+  :type  '(choice
+           (const "never")
+           (const "inMarkupAndStylesheetFilesOnly")
+           (const "always" ))
+  :group 'lsp-vetur
+  :package-version '(lsp-mode . "6.1"))
+
+(lsp-register-custom-settings
+ '(("javascript.autoClosingTags" lsp-javascript-auto-closing-tags t)
+   ("javascript.format.enable" lsp-javascript-format-enable t)
+   ("javascript.format.insertSpaceAfterCommaDelimiter" lsp-javascript-format-insert-space-after-comma-delimiter t)
+   ("javascript.format.insertSpaceAfterConstructor" lsp-javascript-format-insert-space-after-constructor t)
+   ("javascript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions" lsp-javascript-format-insert-space-after-function-keyword-for-anonymous-functions t)
+   ("javascript.format.insertSpaceAfterKeywordsInControlFlowStatements" lsp-javascript-format-insert-space-after-keywords-in-control-flow-statements t)
+   ("javascript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces" lsp-javascript-format-insert-space-after-opening-and-before-closing-jsx-expression-braces t)
+   ("javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces" lsp-javascript-format-insert-space-after-opening-and-before-closing-nonempty-braces t)
+   ("javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets" lsp-javascript-format-insert-space-after-opening-and-before-closing-nonempty-brackets t)
+   ("javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis" lsp-javascript-format-insert-space-after-opening-and-before-closing-nonempty-parenthesis t)
+   ("javascript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces" lsp-javascript-format-insert-space-after-opening-and-before-closing-template-string-braces t)
+   ("javascript.format.insertSpaceAfterSemicolonInForStatements" lsp-javascript-format-insert-space-after-semicolon-in-for-statements t)
+   ("javascript.format.insertSpaceBeforeAndAfterBinaryOperators" lsp-javascript-format-insert-space-before-and-after-binary-operators t)
+   ("javascript.format.insertSpaceBeforeFunctionParenthesis" lsp-javascript-format-insert-space-before-function-parenthesis t)
+   ("javascript.format.placeOpenBraceOnNewLineForControlBlocks" lsp-javascript-format-place-open-brace-on-new-line-for-control-blocks t)
+   ("javascript.format.placeOpenBraceOnNewLineForFunctions" lsp-javascript-format-place-open-brace-on-new-line-for-functions t)
+   ("javascript.implicitProjectConfig.checkJs" lsp-javascript-implicit-project-config-check-js t)
+   ("javascript.implicitProjectConfig.experimentalDecorators" lsp-javascript-implicit-project-config-experimental-decorators t)
+   ("javascript.preferences.importModuleSpecifier" lsp-javascript-preferences-import-module-specifier)
+   ("javascript.preferences.quoteStyle" lsp-javascript-preferences-quote-style)
+   ("javascript.preferences.renameShorthandProperties" lsp-javascript-preferences-rename-shorthand-properties t)
+   ("javascript.referencesCodeLens.enabled" lsp-javascript-references-code-lens-enabled t)
+   ("javascript.suggest.autoImports" lsp-javascript-suggest-auto-imports t)
+   ("javascript.suggest.completeFunctionCalls" lsp-javascript-suggest-complete-function-calls t)
+   ("javascript.suggest.completeJSDocs" lsp-javascript-suggest-complete-js-docs t)
+   ("javascript.suggest.enabled" lsp-javascript-suggest-enabled t)
+   ("javascript.suggest.names" lsp-javascript-suggest-names t)
+   ("javascript.suggest.paths" lsp-javascript-suggest-paths t)
+   ("javascript.suggestionActions.enabled" lsp-javascript-suggestion-actions-enabled t)
+   ("javascript.updateImportsOnFileMove.enabled" lsp-javascript-update-imports-on-file-move-enabled)
+   ("javascript.validate.enable" lsp-javascript-validate-enable t)
+   ("typescript.autoClosingTags" lsp-typescript-auto-closing-tags t)
+   ("typescript.check.npmIsInstalled" lsp-typescript-check-npm-is-installed t)
+   ("typescript.disableAutomaticTypeAcquisition" lsp-typescript-disable-automatic-type-acquisition t)
+   ("typescript.format.enable" lsp-typescript-format-enable t)
+   ("typescript.format.insertSpaceAfterCommaDelimiter" lsp-typescript-format-insert-space-after-comma-delimiter t)
+   ("typescript.format.insertSpaceAfterConstructor" lsp-typescript-format-insert-space-after-constructor t)
+   ("typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions" lsp-typescript-format-insert-space-after-function-keyword-for-anonymous-functions t)
+   ("typescript.format.insertSpaceAfterKeywordsInControlFlowStatements" lsp-typescript-format-insert-space-after-keywords-in-control-flow-statements t)
+   ("typescript.format.insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces" lsp-typescript-format-insert-space-after-opening-and-before-closing-jsx-expression-braces t)
+   ("typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces" lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-braces t)
+   ("typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets" lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-brackets t)
+   ("typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis" lsp-typescript-format-insert-space-after-opening-and-before-closing-nonempty-parenthesis t)
+   ("typescript.format.insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces" lsp-typescript-format-insert-space-after-opening-and-before-closing-template-string-braces t)
+   ("typescript.format.insertSpaceAfterSemicolonInForStatements" lsp-typescript-format-insert-space-after-semicolon-in-for-statements t)
+   ("typescript.format.insertSpaceAfterTypeAssertion" lsp-typescript-format-insert-space-after-type-assertion t)
+   ("typescript.format.insertSpaceBeforeAndAfterBinaryOperators" lsp-typescript-format-insert-space-before-and-after-binary-operators t)
+   ("typescript.format.insertSpaceBeforeFunctionParenthesis" lsp-typescript-format-insert-space-before-function-parenthesis t)
+   ("typescript.format.placeOpenBraceOnNewLineForControlBlocks" lsp-typescript-format-place-open-brace-on-new-line-for-control-blocks t)
+   ("typescript.format.placeOpenBraceOnNewLineForFunctions" lsp-typescript-format-place-open-brace-on-new-line-for-functions t)
+   ("typescript.implementationsCodeLens.enabled" lsp-typescript-implementations-code-lens-enabled t)
+   ("typescript.locale" lsp-typescript-locale)
+   ("typescript.npm" lsp-typescript-npm)
+   ("typescript.preferences.importModuleSpecifier" lsp-typescript-preferences-import-module-specifier)
+   ("typescript.preferences.quoteStyle" lsp-typescript-preferences-quote-style)
+   ("typescript.preferences.renameShorthandProperties" lsp-typescript-preferences-rename-shorthand-properties t)
+   ("typescript.referencesCodeLens.enabled" lsp-typescript-references-code-lens-enabled t)
+   ("typescript.reportStyleChecksAsWarnings" lsp-typescript-report-style-checks-as-warnings t)
+   ("typescript.suggest.autoImports" lsp-typescript-suggest-auto-imports t)
+   ("typescript.suggest.completeFunctionCalls" lsp-typescript-suggest-complete-function-calls t)
+   ("typescript.suggest.completeJSDocs" lsp-typescript-suggest-complete-js-docs t)
+   ("typescript.suggest.enabled" lsp-typescript-suggest-enabled t)
+   ("typescript.suggest.paths" lsp-typescript-suggest-paths t)
+   ("typescript.suggestionActions.enabled" lsp-typescript-suggestion-actions-enabled t)
+   ("typescript.surveys.enabled" lsp-typescript-surveys-enabled t)
+   ("typescript.tsc.autoDetect" lsp-typescript-tsc-auto-detect)
+   ("typescript.tsdk" lsp-typescript-tsdk)
+   ("typescript.tsserver.log" lsp-typescript-tsserver-log)
+   ("typescript.tsserver.pluginPaths" lsp-typescript-tsserver-plugin-paths)
+   ("typescript.tsserver.trace" lsp-typescript-tsserver-trace)
+   ("typescript.updateImportsOnFileMove.enabled" lsp-typescript-update-imports-on-file-move-enabled)
+   ("typescript.validate.enable" lsp-typescript-validate-enable t)
+   ("vetur.trace.server" lsp-vetur-trace-server)
+   ("vetur.ignoreProjectWarning" lsp-vetur-ignore-project-warning t)
+   ("vetur.format.scriptInitialIndent" lsp-vetur-format-script-initial-indent t)
+   ("vetur.format.styleInitialIndent" lsp-vetur-format-style-initial-indent t)
+   ("vetur.format.defaultFormatterOptions" lsp-vetur-format-default-formatter-options)
+   ("vetur.format.defaultFormatter.ts" lsp-vetur-format-default-formatter-ts)
+   ("vetur.format.defaultFormatter.js" lsp-vetur-format-default-formatter-js)
+   ("vetur.format.defaultFormatter.stylus" lsp-vetur-format-default-formatter-stylus)
+   ("vetur.format.defaultFormatter.less" lsp-vetur-format-default-formatter-less)
+   ("vetur.format.defaultFormatter.scss" lsp-vetur-format-default-formatter-scss)
+   ("vetur.format.defaultFormatter.postcss" lsp-vetur-format-default-formatter-postcss)
+   ("vetur.format.defaultFormatter.css" lsp-vetur-format-default-formatter-css)
+   ("vetur.format.defaultFormatter.html" lsp-vetur-format-default-formatter-html)
+   ("vetur.format.options.useTabs" lsp-vetur-format-options-use-tabs t)
+   ("vetur.format.options.tabSize" lsp-vetur-format-options-tab-size)
+   ("vetur.format.enable" lsp-vetur-format-enable t)
+   ("vetur.validation.script" lsp-vetur-validation-script t)
+   ("vetur.validation.style" lsp-vetur-validation-style t)
+   ("vetur.validation.template" lsp-vetur-validation-template t)
+   ("vetur.languageFeatures.codeActions" lsp-vetur-language-features-code-actions t)
+   ("vetur.grammar.customBlocks" lsp-vetur-grammar-custom-blocks)
+   ("vetur.completion.tagCasing" lsp-vetur-completion-tag-casing)
+   ("vetur.completion.scaffoldSnippetSources" lsp-vetur-completion-scaffold-snippet-sources)
+   ("vetur.completion.autoImport" lsp-vetur-completion-auto-import t)
+   ("vetur.useWorkspaceDependencies" lsp-vetur-use-workspace-dependencies t)
+   ("vetur.dev.vlsPath" lsp-vetur-dev-vls-path)
+   ("vetur.dev.vlsPort" lsp-vetur-dev-vls-port)
+   ("vetur.dev.logLevel" lsp-vetur-dev-log-level)
+   ("vetur.experimental.templateInterpolationService" lsp-vetur-experimental-template-interpolation-service t)
+   ("emmet.showExpandedAbbreviation" lsp-vetur-emmet)))
+
+(define-obsolete-variable-alias
+  'lsp-vetur-server
+  'lsp-vetur-server-command
+  "lsp-mode 6.1")
+
+(defcustom lsp-vetur-global-snippets-dir (expand-file-name (locate-user-emacs-file ".snippets/vetur"))
+  "Path to snippets dir."
+  :type 'file
+  :risky t
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-vetur-server-command '("vls")
+  "Command to start vetur."
+  :type '(repeat string)
+  :risky t
+  :package-version '(lsp-mode . "6.1"))
+
+(lsp-dependency 'vetur-language-server
+                '(:system "vls")
+                '(:npm :package "vls" :path "vls"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     `(,(or (executable-find (cl-first lsp-vetur-server-command))
+                                            (lsp-package-path 'vetur-language-server))
+                                       ,@(cl-rest lsp-vetur-server-command))))
+                  :activation-fn (lambda (filename _mode)
+                                   (string= (file-name-extension filename) "vue"))
+                  :priority -1
+                  :multi-root t
+                  :ignore-messages '("readFile .*? requested by Vue but content not available")
+                  :server-id 'vls
+                  :initialization-options (lambda () (ht-merge (lsp-configuration-section "vetur")
+                                                               (lsp-configuration-section "html")
+                                                               (lsp-configuration-section "javascript")
+                                                               (lsp-configuration-section "typescript")
+                                                               (lsp-configuration-section "emmet")
+                                                               (ht ("globalSnippetDir" lsp-vetur-global-snippets-dir))))
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration
+                                       (ht-merge (lsp-configuration-section "vetur")
+                                                 (lsp-configuration-section "html")
+                                                 (lsp-configuration-section "javascript")
+                                                 (lsp-configuration-section "emmet")
+                                                 (lsp-configuration-section "typescript")))))
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure 'vetur-language-server
+                                                            callback error-callback))))
+
+(lsp-consistency-check lsp-vetur)
+
+(provide 'lsp-vetur)
+;;; lsp-vetur.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-vhdl.el b/elpa/lsp-mode-20220201.852/lsp-vhdl.el
new file mode 100644 (file)
index 0000000..aa55e0e
--- /dev/null
@@ -0,0 +1,121 @@
+;;; lsp-vhdl.el --- VHDL Client settings         -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Christian Birk Sørensen
+
+;; Author: Christian Birk Sørensen <chrbirks+emacsNOSPAMgmail.com>
+;; Created: 6 October 2019
+;; Keywords: languages, lsp, vhdl
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP support for VHDL using using an external language server. Currently
+;; the supported servers are:
+;;
+;; VHDL-tool. See http://www.vhdltool.com/configuration for setting up the
+;; project file.
+;;
+;; HDL Checker. See https://github.com/suoto/hdl_checker/wiki/setting-up-a-project
+;; for setting up the project file.
+;;
+;; VHDL LS. See https://github.com/kraigher/rust_hdl#configuration for setting
+;; up the project file.
+;;
+;; GHDL LS. See https://github.com/ghdl/ghdl-language-server for setting up the
+;; project file.
+;;
+;; Set the symbol lsp-vhdl-server to select the language server and set
+;; lsp-vhdl-server-path if the binary is not in the user PATH.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defvar vhdl-tool-bin-name "vhdl-tool"
+  "Name of the VHDL Tool binary.")
+
+(defvar hdl-checker-bin-name "hdl_checker"
+  "Name of HDL Checker binary.")
+
+(defvar vhdl-ls-bin-name "vhdl_ls"
+  "Name of the VHDL LS binary.")
+
+(defvar ghdl-ls-bin-name "ghdl-ls"
+  "Name of the GHDL LS binary.")
+
+(defgroup lsp-vhdl nil
+  "LSP support for VHDL. Set lsp-vhdl-server to select server. The default is to use VHDL-tool."
+  :group 'lsp-mode)
+
+(defcustom lsp-vhdl-server 'vhdl-tool
+  "Select which server to use:
+VHDL-tool: A syntax checking, type checking and linting tool (http://vhdltool.com).
+HDL Checker: A wrapper for third party tools such as GHDL, ModelSim, Vivado Simulator (https://github.com/suoto/hdl_checker).
+VHDL LS: A complete VHDL language server protocol implementation with diagnostics, navigate to symbol, find all references etc. (https://github.com/kraigher/rust_hdl)."
+  :type '(choice (const :tag "VHDL-tool" vhdl-tool)
+                (const :tag "HDL Checker" hdl-checker)
+                (const :tag "VHDL LS" vhdl-ls)
+                (const :tag "GHDL LS" ghdl-ls))
+  :group 'lsp-vhdl)
+
+(defcustom lsp-vhdl-server-path nil
+  "Path to binary server file."
+  :group 'lsp-vhdl
+  :risky t
+  :type 'file)
+
+(defvar lsp-vhdl--params nil)
+
+(defun lsp-vhdl--create-connection ()
+  "Returns lsp-stdio-connection based on the selected server"
+  (lsp-vhdl--set-server-path)
+  (lsp-vhdl--set-server-args)
+  (lsp-stdio-connection
+    (lambda () (cons (plist-get lsp-vhdl--params 'server-path) (plist-get lsp-vhdl--params 'server-args)))
+    (lambda () (executable-find (plist-get lsp-vhdl--params 'server-path)))))
+
+(defun lsp-vhdl--set-server-path()
+  "Set path to server binary based on selection in lsp-vhdl-server."
+  (cond ((eq lsp-vhdl-server 'hdl-checker) (if (eq lsp-vhdl-server-path nil)
+                                              (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path hdl-checker-bin-name))
+                                            (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))
+       ((eq lsp-vhdl-server 'vhdl-tool) (if (eq lsp-vhdl-server-path nil)
+                                            (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path vhdl-tool-bin-name))
+                                          (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))
+       ((eq lsp-vhdl-server 'vhdl-ls) (if (eq lsp-vhdl-server-path nil)
+                                          (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path vhdl-ls-bin-name))
+                                        (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))
+       ((eq lsp-vhdl-server 'ghdl-ls) (if (eq lsp-vhdl-server-path nil)
+                                          (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path ghdl-ls-bin-name))
+                                        (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-path lsp-vhdl-server-path))))))
+
+(defun lsp-vhdl--set-server-args()
+  "Set server arguments based on server selection."
+  (cond ((eq lsp-vhdl-server 'hdl-checker) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '("--lsp"))))
+       ((eq lsp-vhdl-server 'vhdl-tool) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '("lsp"))))
+       ((eq lsp-vhdl-server 'vhdl-ls) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '())))
+       ((eq lsp-vhdl-server 'ghdl-ls) (setq lsp-vhdl--params (plist-put lsp-vhdl--params 'server-args '())))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-vhdl--create-connection)
+                  :major-modes '(vhdl-mode)
+                  :language-id "VHDL"
+                  :priority -1
+                  :server-id 'lsp-vhdl))
+
+(lsp-consistency-check lsp-vhdl)
+
+(provide 'lsp-vhdl)
+;;; lsp-vhdl.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-vimscript.el b/elpa/lsp-mode-20220201.852/lsp-vimscript.el
new file mode 100644 (file)
index 0000000..9f1fec2
--- /dev/null
@@ -0,0 +1,75 @@
+;;; lsp-vimscript.el --- description -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2020 emacs-lsp maintainers
+
+;; Author: emacs-lsp maintainers
+;; Keywords: lsp, vim, vimscript
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; LSP Clients for the VimScript Programming Language.
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-vim nil
+  "LSP support for viml using vim-language-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/iamcco/vim-language-server"))
+
+(defcustom lsp-clients-vim-executable '("vim-language-server" "--stdio")
+  "Command to start the vim language server."
+  :group 'lsp-vim
+  :risky t
+  :type 'file)
+
+(defcustom lsp-clients-vim-initialization-options '((iskeyword . "vim iskeyword option")
+                                                    (vimruntime . "/usr/bin/vim")
+                                                    (runtimepath . "/usr/bin/vim")
+                                                    (diagnostic . ((enable . t)))
+                                                    (indexes . ((runtimepath . t)
+                                                                (gap . 100)
+                                                                (count . 3)))
+                                                    (suggest . ((fromVimruntime . t)
+                                                                (fromRuntimepath . :json-false))))
+  "Initialization options for vim language server."
+  :group 'lsp-vim
+  :type 'alist)
+
+(lsp-dependency 'vim-language-server
+                '(:system "vim-language-server")
+                '(:npm :package "vim-language-server"
+                       :path "vim-language-server"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     `(,(or (executable-find (cl-first lsp-clients-vim-executable))
+                                            (lsp-package-path 'vim-language-server))
+                                       ,@(cl-rest lsp-clients-vim-executable))))
+                  :major-modes '(vimrc-mode)
+                  :priority -1
+                  :server-id 'vimls
+                  :initialization-options (lambda () lsp-clients-vim-initialization-options)
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure 'vim-language-server
+                                                            callback error-callback))))
+
+(lsp-consistency-check lsp-vimscript)
+
+(provide 'lsp-vimscript)
+;;; lsp-vimscript.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-xml.el b/elpa/lsp-mode-20220201.852/lsp-xml.el
new file mode 100644 (file)
index 0000000..209fa09
--- /dev/null
@@ -0,0 +1,245 @@
+;;; lsp-xml.el --- LSP XML server integration        -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Ivan Yonchovski
+
+;; Author: Ivan Yonchovski <yyonchoNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-xml nil
+  "Settings for rls."
+  :group 'tools
+  :tag "Language Server"
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-trace-server "off"
+  "Traces the communication between VS Code and the XML language server."
+  :type '(choice
+          (const "off")
+          (const "messages")
+          (const "verbose"))
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-catalogs nil
+  "Array of XML Catalogs"
+  :type '(repeat string)
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-logs-client t
+  "Should the server log to client output"
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-split-attributes nil
+  "Split multiple attributes each onto a new line"
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-join-cdata-lines nil
+  "Join lines in a CDATA tag's content"
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-join-comment-lines nil
+  "Join comment content on format"
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-space-before-empty-close-tag t
+  "Insert space before end of self closing tag.
+Example: <tag/> -> <tag />"
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-join-content-lines nil
+  "Normalize the whitespace of content inside an element.
+Newlines and excess whitespace are removed."
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-preserve-empty-content nil
+  "Preserve empty content/whitespace in a tag."
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-enabled t
+  "Enable/disable ability to format document"
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-format-quotations "doubleQuotes"
+  "Which type of quotes to use for attribute values when
+  formatting."
+  :type '(choice
+          (const "doubleQuotes")
+          (const "singleQuotes"))
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-file-associations nil
+  "Allows XML schemas to be associated to file name patterns.
+  Example: [{ \"systemId\":\"path/to/file.xsd\",\"pattern\":
+  \"file1.xml\" },{ \"systemId\":
+  \"http://www.w3.org/2001/XMLSchema.xsd\",\"pattern\":
+  \"**/*.xsd\" }]"
+  :type '(repeat string)
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-completion-auto-close-tags t
+  "Enable/disable autoclosing of XML tags. IMPORTANT: Turn off
+  editor.autoClosingTags for this to work"
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-server-vmargs ["-noverify" "-Xmx64M" "-XX:+UseG1GC"
+                                  "-XX:+UseStringDeduplication"]
+  "Specifies extra VM arguments used to launch the XML Language
+  Server. Eg. use `-noverify -Xmx1G -XX:+UseG1GC
+  -XX:+UseStringDeduplication` to bypass class verification,
+  increase the heap size to 1GB and enable String deduplication
+  with the G1 Garbage collector"
+  :type 'lsp-string-vector
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-server-work-dir (expand-file-name ".lsp4xml" "~")
+  "Set a custom folder path for cached XML Schemas. An absolute
+  path is expected, although the ~ prefix (for the user home
+  directory) is supported."
+  :type 'string
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-validation-no-grammar "hint"
+  "The message severity when a document has no associated
+  grammar."
+  :type '(choice (:tag "ignore" "hint" "info" "warning" "error"))
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-validation-enabled t
+  "Enable/disable all validation."
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-validation-resolve-external-entities nil
+  "Enable/disable resolution (downloading) of external entities from the internet."
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "8.0.0"))
+
+(defcustom lsp-xml-validation-schema t
+  "Enable/disable schema based validation. Ignored if
+  \"xml.validation.enabled\": false."
+  :type 'boolean
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(lsp-register-custom-settings '
+ (("xml.validation.schema" lsp-xml-validation-schema t)
+  ("xml.validation.resolveExternalEntities" lsp-xml-validation-resolve-external-entities)
+  ("xml.validation.enabled" lsp-xml-validation-enabled t)
+  ("xml.validation.noGrammar" lsp-xml-validation-no-grammar)
+  ("xml.server.workDir" lsp-xml-server-work-dir)
+  ("xml.server.vmargs" lsp-xml-server-vmargs)
+  ("xml.completion.autoCloseTags" lsp-xml-completion-auto-close-tags t)
+  ("xml.fileAssociations" lsp-xml-file-associations)
+  ("xml.format.quotations" lsp-xml-format-quotations)
+  ("xml.format.enabled" lsp-xml-format-enabled t)
+  ("xml.format.preserveEmptyContent" lsp-xml-format-preserve-empty-content t)
+  ("xml.format.joinContentLines" lsp-xml-format-join-content-lines t)
+  ("xml.format.spaceBeforeEmptyCloseTag" lsp-xml-format-space-before-empty-close-tag t)
+  ("xml.format.joinCommentLines" lsp-xml-format-join-comment-lines t)
+  ("xml.format.joinCDATALines" lsp-xml-format-join-cdata-lines t)
+  ("xml.format.splitAttributes" lsp-xml-format-split-attributes t)
+  ("xml.logs.client" lsp-xml-logs-client t)
+  ("xml.catalogs" lsp-xml-catalogs)
+  ("xml.trace.server" lsp-xml-trace-server)))
+
+(defconst lsp-xml-jar-version "0.18.0")
+
+(defconst lsp-xml-jar-name (format "org.eclipse.lemminx-%s-uber.jar" lsp-xml-jar-version))
+
+(defcustom lsp-xml-jar-file (f-join lsp-server-install-dir "xmlls" lsp-xml-jar-name)
+  "Xml server jar command."
+  :type 'string
+  :group 'lsp-xml
+  :type 'file
+  :package-version '(lsp-mode . "6.1"))
+
+(defcustom lsp-xml-jar-download-url
+  (format
+   "https://repo.eclipse.org/content/repositories/lemminx-releases/org/eclipse/lemminx/org.eclipse.lemminx/%s/%s"
+   lsp-xml-jar-version
+   lsp-xml-jar-name)
+  "Automatic download url for lsp-xml."
+  :type 'string
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "8.0.0"))
+
+(lsp-dependency
+ 'xmlls
+ '(:system lsp-xml-jar-file)
+ `(:download :url lsp-xml-jar-download-url
+             :store-path lsp-xml-jar-file))
+
+(defcustom lsp-xml-server-command `("java" "-jar" ,lsp-xml-jar-file)
+  "Xml server command."
+  :type '(repeat string)
+  :group 'lsp-xml
+  :package-version '(lsp-mode . "6.1"))
+
+(defun lsp-xml--create-connection ()
+  (lsp-stdio-connection
+   (lambda () lsp-xml-server-command)
+   (lambda () (f-exists? lsp-xml-jar-file))))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-xml--create-connection)
+                  :activation-fn (lsp-activate-on "xml")
+                  :priority 0
+                  :server-id 'xmlls
+                  :multi-root t
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration (lsp-configuration-section "xml"))))
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure 'xmlls callback error-callback))))
+
+(lsp-consistency-check lsp-xml)
+
+(provide 'lsp-xml)
+;;; lsp-xml.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-yaml.el b/elpa/lsp-mode-20220201.852/lsp-yaml.el
new file mode 100644 (file)
index 0000000..586df6e
--- /dev/null
@@ -0,0 +1,242 @@
+;;; lsp-yaml.el --- LSP YAML server integration        -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019  Aya Igarashi
+
+;; Author: Aya Igarashi <ladiclexxxNOSPAMgmail.com>
+;; Keywords:
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'dash)
+
+(defgroup lsp-yaml nil
+  "LSP support for YAML, using yaml-language-server."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/redhat-developer/yaml-language-server")
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-format-enable t
+  "Enable/disable default YAML formatter."
+  :type 'boolean
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-single-quote nil
+  "Use single quote instead of double quotes."
+  :type 'boolean
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-bracket-spacing t
+  "Print spaces between brackets in objects."
+  :type 'boolean
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-prose-wrap "preserve"
+  "Options for prose-wrap.
+   Always: wrap prose if it exceeds the print width.
+   Never: never wrap the prose.
+   Preserve: wrap prose as-is."
+  :type '(choice
+          (const "always")
+          (const "never")
+          (const "preserve"))
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-print-width 80
+  "Specify the line length that the printer will wrap on."
+  :type 'number
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-validate t
+  "Enable/disable validation feature."
+  :type 'boolean
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-hover t
+  "Enable/disable hover feature."
+  :type 'boolean
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-completion t
+  "Enable/disable completion feature."
+  :type 'boolean
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-schemas '()
+  "Associate schemas to YAML files in a glob pattern."
+  :type '(alist :key-type (symbol :tag "schema") :value-type (lsp-string-vector :tag "files (glob)"))
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-schema-store-enable t
+  "Enable/disable JSON Schema store. When set to true, available YAML
+   schemas will be automatically pulled from the store."
+  :type 'boolean
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-custom-tags nil
+  "Custom tags for the parser to use."
+  :type '(lsp-repeatable-vector string)
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(defcustom lsp-yaml-schema-store-uri "https://www.schemastore.org/api/json/catalog.json"
+  "URL of schema store catalog to use."
+  :type 'string
+  :group 'lsp-yaml)
+
+(defcustom lsp-yaml-schema-store-local-db (expand-file-name
+                                           (locate-user-emacs-file
+                                            (f-join ".cache" "lsp" "lsp-yaml-schemas.json")))
+  "Cached databse of schema store."
+  :type 'file
+  :group 'lsp-yaml)
+
+(defcustom lsp-yaml-max-items-computed 5000
+  "The maximum number of outline symbols and folding regions computed.
+Limited for performance reasons."
+  :type 'number
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "8.0.0"))
+
+
+(defvar lsp-yaml--schema-store-schemas-alist nil
+  "A list of schemas fetched from schema stores.")
+
+(lsp-register-custom-settings
+ '(("yaml.format.enable" lsp-yaml-format-enable t)
+   ("yaml.format.singleQuote" lsp-yaml-single-quote t)
+   ("yaml.format.bracketSpacing" lsp-yaml-bracket-spacing)
+   ("yaml.format.proseWrap" lsp-yaml-prose-wrap)
+   ("yaml.format.printWidth" lsp-yaml-print-width)
+   ("yaml.validate" lsp-yaml-validate t)
+   ("yaml.hover" lsp-yaml-hover t)
+   ("yaml.completion" lsp-yaml-completion t)
+   ("yaml.schemas" lsp-yaml-schemas)
+   ("yaml.schemaStore.enable" lsp-yaml-schema-store-enable t)
+   ("yaml.schemaStore.url" lsp-yaml-schema-store-uri)
+   ("yaml.customTags" lsp-yaml-custom-tags)
+   ("yaml.maxItemsComputed" lsp-yaml-max-items-computed)))
+
+(defcustom lsp-yaml-server-command '("yaml-language-server" "--stdio")
+  "Command to start yaml-languageserver."
+  :type '(repeat string)
+  :group 'lsp-yaml
+  :package-version '(lsp-mode . "6.2"))
+
+(lsp-dependency 'yaml-language-server
+                '(:system "yaml-language-server")
+                '(:npm :package "yaml-language-server"
+                       :path "yaml-language-server"))
+
+(lsp-register-client
+ (make-lsp-client :new-connection (lsp-stdio-connection
+                                   (lambda ()
+                                     `(,(or (executable-find (cl-first lsp-yaml-server-command))
+                                            (lsp-package-path 'yaml-language-server))
+                                       ,@(cl-rest lsp-yaml-server-command))))
+                  :major-modes '(yaml-mode k8s-mode)
+                  :priority 0
+                  :server-id 'yamlls
+                  :initialized-fn (lambda (workspace)
+                                    (with-lsp-workspace workspace
+                                      (lsp--set-configuration
+                                       (lsp-configuration-section "yaml"))))
+                  :download-server-fn (lambda (_client callback error-callback _update?)
+                                        (lsp-package-ensure 'yaml-language-server
+                                                            callback error-callback))))
+
+(defconst lsp-yaml--built-in-kubernetes-schema
+  '((name . "Kubernetes")
+    (description . "Built-in kubernetes manifest schema definition")
+    (url . "kubernetes")
+    (fileMatch . ["*-k8s.yaml" "*-k8s.yml"])))
+
+(defun lsp-yaml-download-schema-store-db (&optional force-downloading)
+  "Download the remote schema store at `lsp-yaml-schema-store-uri' into local cache.
+Set FORCE-DOWNLOADING to non-nil to force re-download the database."
+  (interactive "P")
+  (when (or force-downloading (not (file-exists-p lsp-yaml-schema-store-local-db)))
+    (unless (file-directory-p (file-name-directory lsp-yaml-schema-store-local-db))
+      (mkdir (file-name-directory lsp-yaml-schema-store-local-db)))
+    (url-copy-file lsp-yaml-schema-store-uri lsp-yaml-schema-store-local-db force-downloading)))
+
+(defun lsp-yaml--get-supported-schemas ()
+  "Get out the list of supported schemas."
+  (when (and lsp-yaml-schema-store-enable
+             (not lsp-yaml--schema-store-schemas-alist))
+    (lsp-yaml-download-schema-store-db)
+    (setq lsp-yaml--schema-store-schemas-alist
+          (alist-get 'schemas (json-read-file lsp-yaml-schema-store-local-db))))
+  (seq-concatenate 'list (list lsp-yaml--built-in-kubernetes-schema) lsp-yaml--schema-store-schemas-alist))
+
+(defun lsp-yaml-set-buffer-schema (uri-string)
+  "Set yaml schema for the current buffer to URI-STRING."
+  (interactive "MURI: ")
+  (let* ((uri (intern uri-string))
+         (workspace-path (file-relative-name
+                          (lsp--uri-to-path (lsp--buffer-uri))
+                          (lsp-workspace-root (lsp--buffer-uri))))
+         (glob (concat "/" workspace-path))
+         (current-config (assoc uri lsp-yaml-schemas))
+         (current-patterns (and current-config (cdr current-config))))
+    (if current-config
+        (or (member glob (append current-patterns nil))
+            (setq lsp-yaml-schemas
+                  (cl-acons uri
+                            (vconcat (vector glob) current-patterns)
+                            (assq-delete-all uri
+                                             (mapcar (lambda (x) (lsp-yaml--remove-glob x glob))
+                                                     lsp-yaml-schemas)))))
+      (setq lsp-yaml-schemas
+            (cl-acons uri (vector glob) (mapcar (lambda (x) (lsp-yaml--remove-glob x glob))
+                                                lsp-yaml-schemas))))
+    (lsp--set-configuration (lsp-configuration-section "yaml"))))
+
+(defun lsp-yaml-select-buffer-schema ()
+  "Select schema for the current buffer based on the list of supported schemas."
+  (interactive)
+  (let* ((schema (lsp--completing-read "Select buffer schema: "
+                                       (lsp-yaml--get-supported-schemas)
+                                       (lambda (schema)
+                                         (format "%s: %s" (alist-get 'name schema)(alist-get 'description schema)))
+                                       nil t))
+         (uri (alist-get 'url schema)))
+    (lsp-yaml-set-buffer-schema uri)))
+
+(defun lsp-yaml--remove-glob (mapping glob)
+  (let ((patterns (cdr mapping)))
+    (cons (car mapping)
+          (vconcat (-filter (lambda (p) (not (equal p glob)))
+                            (append patterns nil)) nil))))
+
+(lsp-consistency-check lsp-yaml)
+
+(provide 'lsp-yaml)
+;;; lsp-yaml.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp-zig.el b/elpa/lsp-mode-20220201.852/lsp-zig.el
new file mode 100644 (file)
index 0000000..0d19acd
--- /dev/null
@@ -0,0 +1,50 @@
+;;; lsp-zig.el --- lsp-mode Zig integration -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2021 Riccardo Binetti
+
+;; Author: Riccardo Binetti <rbinoNOSPAMgmx.com>
+;; Keywords: languages,tools
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;  client for zls, the Zig language server
+
+;;; Code:
+
+(require 'lsp-mode)
+
+(defgroup lsp-zig nil
+  "LSP support for Zig via zls."
+  :group 'lsp-mode
+  :link '(url-link "https://github.com/zigtools/zls"))
+
+(defcustom lsp-zig-zls-executable "zls"
+  "The zls executable to use.
+Leave as just the executable name to use the default behavior of
+finding the executable with variable `exec-path'."
+  :group 'lsp-zig
+  :type 'string)
+
+(lsp-register-client
+ (make-lsp-client
+  :new-connection (lsp-stdio-connection (lambda () lsp-zig-zls-executable))
+  :activation-fn (lsp-activate-on "zig")
+  :server-id 'zls))
+
+(lsp-consistency-check lsp-zig)
+
+(provide 'lsp-zig)
+;;; lsp-zig.el ends here
diff --git a/elpa/lsp-mode-20220201.852/lsp.el b/elpa/lsp-mode-20220201.852/lsp.el
new file mode 100644 (file)
index 0000000..e4f4b5d
--- /dev/null
@@ -0,0 +1,8 @@
+;; The code was moved into lsp-mode.el. This file is kept only for backward compatibility.
+(require 'lsp-mode)
+
+;; (warn "Replace (require 'lsp) with (require 'lsp-mode)")
+
+(provide 'lsp)
+
+;;; lsp.el ends here
diff --git a/elpa/lsp-mode-readme.txt b/elpa/lsp-mode-readme.txt
new file mode 100644 (file)
index 0000000..1a86cf7
--- /dev/null
@@ -0,0 +1 @@
+Emacs client/library for the Language Server Protocol
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-autoloads.el b/elpa/lsp-ui-20220104.1635/lsp-ui-autoloads.el
new file mode 100644 (file)
index 0000000..bf3c8cc
--- /dev/null
@@ -0,0 +1,80 @@
+;;; lsp-ui-autoloads.el --- automatically extracted autoloads
+;;
+;;; Code:
+
+(add-to-list 'load-path (directory-file-name
+                         (or (file-name-directory #$) (car load-path))))
+
+\f
+;;;### (autoloads nil "lsp-ui" "lsp-ui.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ui.el
+
+(autoload 'lsp-ui-mode "lsp-ui" "\
+Toggle language server UI mode on or off.
+‘lsp-ui-mode’ is a minor mode that contains a series of useful UI
+integrations for ‘lsp-mode’.  With a prefix argument ARG, enable
+language server UI mode if ARG is positive, and disable it
+otherwise.  If called from Lisp, enable the mode if ARG is
+omitted or nil, and toggle it if ARG is ‘toggle’.
+
+\(fn &optional ARG)" t nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ui" '("lsp-ui-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ui-doc" "lsp-ui-doc.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ui-doc.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ui-doc" '("lsp-ui-doc-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ui-flycheck" "lsp-ui-flycheck.el" (0 0
+;;;;;;  0 0))
+;;; Generated autoloads from lsp-ui-flycheck.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ui-flycheck" '("lsp-ui-flycheck-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ui-imenu" "lsp-ui-imenu.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ui-imenu.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ui-imenu" '("lsp-ui-imenu")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ui-peek" "lsp-ui-peek.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ui-peek.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ui-peek" '("lsp-")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ui-sideline" "lsp-ui-sideline.el" (0 0
+;;;;;;  0 0))
+;;; Generated autoloads from lsp-ui-sideline.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ui-sideline" '("lsp-ui-sideline")))
+
+;;;***
+\f
+;;;### (autoloads nil "lsp-ui-util" "lsp-ui-util.el" (0 0 0 0))
+;;; Generated autoloads from lsp-ui-util.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "lsp-ui-util" '("lsp-ui-util-")))
+
+;;;***
+\f
+;;;### (autoloads nil nil ("lsp-ui-pkg.el") (0 0 0 0))
+
+;;;***
+\f
+;; Local Variables:
+;; version-control: never
+;; no-byte-compile: t
+;; no-update-autoloads: t
+;; coding: utf-8
+;; End:
+;;; lsp-ui-autoloads.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-doc.el b/elpa/lsp-ui-20220104.1635/lsp-ui-doc.el
new file mode 100644 (file)
index 0000000..34a017b
--- /dev/null
@@ -0,0 +1,1213 @@
+;;; lsp-ui-doc.el --- Lsp-Ui-Doc  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2017 Sebastien Chapuis
+
+;; Author: Sebastien Chapuis <sebastienNOSPAMchapu.is>
+;; URL: https://github.com/emacs-lsp/lsp-ui
+;; Keywords: languagues, tools
+;; Version: 6.2
+
+;;; License
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; Show documentation of the symbol at point in a child frame
+
+;;; Code:
+
+(require 'lsp-ui-util)
+
+(require 'lsp-protocol)
+(require 'lsp-mode)
+(require 'dash)
+(require 'goto-addr)
+(require 'markdown-mode)
+
+(require 'cl-lib)
+(require 'face-remap)
+(require 'subr-x)
+
+(when (featurep 'xwidget-internal)
+  (require 'xwidget))
+
+(declare-function make-xwidget "ext:xwidget" (type title width height arguments &optional buffer))
+(declare-function set-xwidget-query-on-exit-flag "ext:xwidget")
+(declare-function xwidget-webkit-mode "ext:xwidget")
+(declare-function xwidget-webkit-goto-uri "ext:xwidget" (xwidget uri))
+(declare-function xwidget-at "ext:xwidget" (pos))
+(declare-function xwidget-webkit-execute-script "ext:xwidget" (xwidget script &optional callback))
+(declare-function xwidget-webkit-execute-script-rv "ext:xwidget" (xwidget script &optional default))
+(declare-function xwidget-resize "ext:xwidget" (xwidget new-width new-height))
+
+(defgroup lsp-ui-doc nil
+  "Display informations of the current line."
+  :group 'tools
+  :group 'convenience
+  :group 'lsp-ui
+  :link '(custom-manual "(lsp-ui-doc) Top")
+  :link '(info-link "(lsp-ui-doc) Customizing"))
+
+(defcustom lsp-ui-doc-enable t
+  "Whether or not to enable lsp-ui-doc."
+  :type 'boolean
+  :group 'lsp-ui)
+
+(defcustom lsp-ui-doc-show-with-mouse t
+  "Move the mouse pointer over a symbol to show its documentation."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-show-with-cursor nil
+  "Move the cursor over a symbol to show its documentation."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-header nil
+  "Whether or not to enable the header which display the symbol string."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-include-signature nil
+  "Whether or not to include the object signature/type in the frame."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-position 'top
+  "Where to display the doc when moving the point cursor.
+This affect the position of the documentation when `lsp-ui-doc-show-with-cursor'
+is non-nil."
+  :type '(choice (const :tag "Top" top)
+                 (const :tag "Bottom" bottom)
+                 (const :tag "At point" at-point))
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-alignment 'frame
+  "How to align the doc.
+This only takes effect when `lsp-ui-doc-position' is 'top or 'bottom."
+  :type '(choice (const :tag "Frame" frame)
+                 (const :tag "Window" window))
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-border "white"
+  "Border color of the frame."
+  :type 'color
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-max-width 150
+  "Maximum number of columns of the frame."
+  :type 'integer
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-webkit-max-width-px 600
+  "Maximum width in pixels for the webkit frame."
+  :type 'integer
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-max-height 13
+  "Maximum number of lines in the frame."
+  :type 'integer
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-use-childframe t
+  "Whether to display documentation in a child-frame or the current frame.
+Child frames requires GNU/Emacs version >= 26 and graphical frames."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-use-webkit nil
+  "Whether to display documentation in a WebKit widget in a child-frame.
+This requires GNU/Emacs version >= 26 and built with the `--with-xwidgets`
+option."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-delay 0.2
+  "Number of seconds before showing the doc."
+  :type 'number
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-winum-ignore t
+  "Whether to ignore lsp-ui-doc buffers in winum."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-enhanced-markdown t
+  "Lsp-ui-doc will attempt to better format the markdown documentation."
+  :type 'boolean
+  :group 'lsp-ui-doc)
+
+(defcustom lsp-ui-doc-text-scale-level 0
+  "Text scale amount for doc buffer."
+  :type 'integer
+  :group 'lsp-ui-doc)
+
+(defface lsp-ui-doc-background
+  '((((background light)) :background "#b3b3b3")
+    (t :background "#272A36"))
+  "Background color of the documentation.
+Only the `background' is used in this face."
+  :group 'lsp-ui-doc)
+
+(defface lsp-ui-doc-header
+  '((t :foreground "black"
+       :background "deep sky blue"))
+  "Face used on the header."
+  :group 'lsp-ui-doc)
+
+(defface lsp-ui-doc-highlight-hover
+  '((t :inherit region))
+  "Face used to highlight the hover symbol/region when using mouse."
+  :group 'lsp-ui-doc)
+
+(defface lsp-ui-doc-url
+  '((t :inherit link))
+  "Face used on links."
+  :group 'lsp-ui-doc)
+
+(defvar lsp-ui-doc-frame-parameters
+  '((left . -1)
+    (no-focus-on-map . t)
+    (min-width  . 0)
+    (width  . 0)
+    (min-height  . 0)
+    (height  . 0)
+    (internal-border-width . 1)
+    (vertical-scroll-bars . nil)
+    (horizontal-scroll-bars . nil)
+    (right-fringe . 0)
+    (menu-bar-lines . 0)
+    (tool-bar-lines . 0)
+    (line-spacing . 0)
+    (unsplittable . t)
+    (undecorated . t)
+    (top . -1)
+    (visibility . nil)
+    (mouse-wheel-frame . nil)
+    (no-other-frame . t)
+    (inhibit-double-buffering . t)
+    (drag-internal-border . t)
+    (no-special-glyphs . t)
+    (desktop-dont-save . t))
+  "Frame parameters used to create the frame.")
+
+(defvar lsp-ui-doc-render-function nil
+  "Function called to format the documentation.
+The function takes a string as parameter and should return a string.
+If this variable is nil (the default), the documentation will be rendered
+as markdown.")
+
+(defvar lsp-ui-doc-frame-hook nil
+  "Hooks run on child-frame creation.
+The functions receive 2 parameters: the frame and its window.")
+
+(defvar lsp-ui-doc-webkit-client-path
+  (concat "file://"
+          (file-name-directory (or load-file-name buffer-file-name))
+          "lsp-ui-doc.html")
+  "Path to the page loaded when a WebKit widget is created.")
+
+;; Avoid warning with emacs < 26
+(declare-function display-buffer-in-child-frame "window.el")
+
+(defvar-local lsp-ui-doc--parent-vars nil
+  "Variables from the parents frame that we want to access in the child.
+Because some variables are buffer local.")
+
+(defvar-local lsp-ui-doc--inline-ov nil
+  "Overlay used to display the documentation in the buffer.")
+
+(defvar-local lsp-ui-doc--highlight-ov nil
+  "Overlay used to highlight the hover symbol.")
+
+(defvar-local lsp-ui-doc--bounds nil)
+(defvar-local lsp-ui-doc--timer nil)
+(defvar-local lsp-ui-doc--from-mouse nil
+  "Non nil when the doc was triggered by a mouse event.")
+(defvar-local lsp-ui-doc--from-mouse-current nil
+  "Non nil when the current call is triggered by a mouse event")
+
+(defconst lsp-ui-doc--buffer-prefix " *lsp-ui-doc-")
+
+(defmacro lsp-ui-doc--with-buffer (&rest body)
+  "Execute BODY in the lsp-ui-doc buffer."
+  (declare (indent 0) (debug t))
+  `(let ((parent-vars (list :buffer (current-buffer)
+                            :window (get-buffer-window)))
+         (buffer-list-update-hook nil))
+     (with-current-buffer (get-buffer-create (lsp-ui-doc--make-buffer-name))
+       (setq lsp-ui-doc--parent-vars parent-vars)
+       (prog1 (let ((buffer-read-only nil)
+                    (inhibit-modification-hooks t)
+                    (inhibit-point-motion-hooks t)
+                    (inhibit-redisplay t))
+                ,@body)
+         (setq buffer-read-only t)
+         (let ((text-scale-mode-step 1.1))
+           (text-scale-set lsp-ui-doc-text-scale-level))))))
+
+(defmacro lsp-ui-doc--get-parent (var)
+  "Return VAR in `lsp-ui-doc--parent-vars'."
+  `(plist-get lsp-ui-doc--parent-vars ,var))
+
+(defmacro lsp-ui-doc--set-frame (frame)
+  "Set the frame parameter ‘lsp-ui-doc-frame’ to FRAME."
+  `(set-frame-parameter nil 'lsp-ui-doc-frame ,frame))
+
+(defun lsp-ui-doc--get-frame (&optional _)
+  "Return the child frame."
+  (let ((frame (frame-parameter nil 'lsp-ui-doc-frame)))
+    (and (frame-live-p frame) frame)))
+
+(defsubst lsp-ui-doc--frame-visible-p ()
+  "Return child frame visibility."
+  (let ((frame (lsp-ui-doc--get-frame)))
+    (and frame (frame-visible-p frame))))
+
+(defun lsp-ui-doc--make-buffer-name ()
+  "Construct the buffer name, it should be unique for each frame."
+  (concat lsp-ui-doc--buffer-prefix
+          (or (frame-parameter nil 'window-id)
+              (frame-parameter nil 'name))
+          "*"))
+
+;; ‘markdown-fontify-code-block-default-mode’ isn’t yet available in
+;; Markdown 2.3.
+(defvar markdown-fontify-code-block-default-mode)
+
+(defun lsp-ui-doc--inline-wrapped-line (string)
+  "Wraps a line of text (STRING) for inline display."
+  (cond ((string-empty-p string) "")
+        (t string)))
+
+(defun lsp-ui-doc--inline-formatted-string (string)
+  "Formats STRING for inline rendering."
+  (mapconcat (lambda (line)
+               (lsp-ui-doc--inline-wrapped-line (string-trim-right line)))
+             (split-string string "[\n\v\f\r]")
+             "\n"))
+
+(defun lsp-ui-doc--extract-marked-string (marked-string &optional language)
+  "Render the MARKED-STRING with LANGUAGE."
+  (string-trim-right
+   (let* ((string (if (stringp marked-string)
+                      marked-string
+                    (lsp:markup-content-value marked-string)))
+          (with-lang (lsp-marked-string? marked-string))
+          (language (or (and with-lang
+                             (or (lsp:marked-string-language marked-string)
+                                 (lsp:markup-content-kind marked-string)))
+                        language))
+          (markdown-hr-display-char nil))
+     (cond
+      (lsp-ui-doc-use-webkit
+       (if (and language
+                (not (string= "text" language))
+                (not (string= lsp/markup-kind-markdown language)))
+           (format "```%s\n%s\n```" language string)
+         string))
+      ;; For other programming languages
+      (language (lsp--render-string (lsp-ui-doc--inline-formatted-string string) language))
+      ;; For default element content
+      (t (lsp--render-element (lsp-ui-doc--inline-formatted-string string)))))))
+
+(defun lsp-ui-doc--filter-marked-string (list-marked-string)
+  "Filter the LIST-MARKED-STRING."
+  (let ((groups (--separate (and (lsp-marked-string? it)
+                                 (lsp-get-renderer (lsp:marked-string-language it)))
+                            (append list-marked-string nil))))
+    (if lsp-ui-doc-include-signature
+        list-marked-string
+      (cadr groups))))
+
+(defun lsp-ui-doc--extract (contents)
+  "Extract the documentation from CONTENTS.
+CONTENTS can be differents type of values:
+MarkedString | MarkedString[] | MarkupContent (as defined in the LSP).
+We don't extract the string that `lps-line' is already displaying."
+  (cond
+   ((vectorp contents) ;; MarkedString[]
+    (mapconcat 'lsp-ui-doc--extract-marked-string
+               (lsp-ui-doc--filter-marked-string (seq-filter #'identity contents))
+               "\n\n"
+               ;;(propertize "\n\n" 'face '(:height 0.4))
+               ))
+   ;; when we get markdown contents, render using emacs gfm-view-mode / markdown-mode
+   ((and (lsp-marked-string? contents)
+         (lsp:marked-string-language contents))
+    (lsp-ui-doc--extract-marked-string (lsp:marked-string-value contents)
+                                       (lsp:marked-string-language contents)))
+   ;; The specification for MarkedString also includes raw strings of
+   ;; markdown, which is not reflected by `lsp-marked-string?'
+   ((stringp contents)
+    (lsp-ui-doc--extract-marked-string contents lsp/markup-kind-markdown))
+   ((lsp-marked-string? contents) (lsp-ui-doc--extract-marked-string contents))
+   ((and (lsp-markup-content? contents)
+         (string= (lsp:markup-content-kind contents) lsp/markup-kind-markdown))
+    (lsp-ui-doc--extract-marked-string (lsp:markup-content-value contents) lsp/markup-kind-markdown))
+   ((and (lsp-markup-content? contents)
+         (string= (lsp:markup-content-kind contents) lsp/markup-kind-plain-text))
+    (lsp:markup-content-value contents))))
+
+(defun lsp-ui-doc--webkit-run-xwidget ()
+  "Launch embedded WebKit instance."
+  (lsp-ui-doc--with-buffer
+    (let ((inhibit-read-only t))
+      (insert " ")
+      (goto-char 1)
+      (let ((id (make-xwidget 'webkit nil 1 1 nil (buffer-name))))
+        (set-xwidget-query-on-exit-flag id nil)
+        (put-text-property (point) (+ 1 (point))
+                           'display (list 'xwidget ':xwidget id))
+        (xwidget-webkit-mode)
+        (xwidget-webkit-goto-uri (xwidget-at 1)
+                                 lsp-ui-doc-webkit-client-path)
+        (lsp-ui-doc--webkit-set-width)
+        (lsp-ui-doc--webkit-set-background)
+        (lsp-ui-doc--webkit-set-foreground)))))
+
+(defun lsp-ui-doc--webkit-set-width ()
+  "Set webkit document max-width CSS property."
+  (lsp-ui-doc--webkit-execute-script
+   (format "document.documentElement.style.setProperty('--webkit-max-width-px', %d + 'px');"
+           lsp-ui-doc-webkit-max-width-px)))
+
+(defun lsp-ui-doc--webkit-set-background ()
+  "Set background color of the WebKit widget."
+  (lsp-ui-doc--webkit-execute-script
+   (format "document.body.style.background = '%s';"
+           "#fdfdfd"
+           ;; (face-attribute 'lsp-ui-doc-background :background)
+           )))
+
+(defun lsp-ui-doc--webkit-set-foreground ()
+  "Set foreground color of the WebKit widget."
+  (lsp-ui-doc--webkit-execute-script
+   (format "document.body.style.color = '%s';"
+           (face-attribute 'default :foreground))))
+
+(defun lsp-ui-doc--webkit-get-xwidget ()
+  "Return Xwidget instance."
+  (lsp-ui-doc--with-buffer
+    (xwidget-at 1)))
+
+(defun lsp-ui-doc--webkit-execute-script (script &optional fn)
+  "Execute SCRIPT in embedded Xwidget and run optional callback FN."
+  (-when-let* ((xw (lsp-ui-doc--webkit-get-xwidget)))
+    (xwidget-webkit-execute-script xw script fn)))
+
+(defun lsp-ui-doc--webkit-execute-script-rv (script)
+  "Execute SCRIPT in embedded Xwidget synchronously."
+  (-when-let* ((xw (lsp-ui-doc--webkit-get-xwidget)))
+    (xwidget-webkit-execute-script-rv xw script)))
+
+(defun lsp-ui-doc--hide-frame (&optional _win)
+  "Hide the frame."
+  (setq lsp-ui-doc--bounds nil
+        lsp-ui-doc--from-mouse nil)
+  (lsp-ui-util-safe-delete-overlay lsp-ui-doc--inline-ov)
+  (lsp-ui-util-safe-delete-overlay lsp-ui-doc--highlight-ov)
+  (when-let ((frame (lsp-ui-doc--get-frame)))
+    (when (frame-visible-p frame)
+      (make-frame-invisible frame))))
+
+(defun lsp-ui-doc--buffer-width ()
+  "Calcul the max width of the buffer."
+  (lsp-ui-doc--with-buffer
+    (save-excursion
+      (let ((max 0))
+        (goto-char (point-min))
+        (while (not (eobp))
+          (let* ((len (- (line-end-position) (line-beginning-position))))
+            (when (> len max)
+              (setq max len)))
+          (forward-line 1))
+        max))))
+
+(defun lsp-ui-doc--line-height (&optional line)
+  "Return the pos-y of the LINE on screen, in pixel."
+  (or
+   (nth 2 (or (window-line-height line)
+              (and (redisplay t)
+                   (window-line-height line))))
+   0))
+
+(defun lsp-ui-doc--sideline-pos-y ()
+  "Mark as unused function."
+  (-> (when (bound-and-true-p lsp-ui-sideline--occupied-lines)
+        (-min lsp-ui-sideline--occupied-lines))
+      (line-number-at-pos)
+      (lsp-ui-doc--line-height)))
+
+(defun lsp-ui-doc--webkit-resize-callback (size)
+  "Callback when resizing using webkit depends on the SIZE."
+  (let ((offset-width (round (aref size 0)))
+        (offset-height (round (aref size 1))))
+    (xwidget-resize (lsp-ui-doc--webkit-get-xwidget) offset-width offset-height))
+  (lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))
+
+(defun lsp-ui-doc--resize-buffer ()
+  "If the buffer's width is larger than the current frame, resize it."
+  (if lsp-ui-doc-use-webkit
+      (lsp-ui-doc--webkit-execute-script
+       "[document.querySelector('#lsp-ui-webkit').offsetWidth, document.querySelector('#lsp-ui-webkit').offsetHeight];"
+       'lsp-ui-doc--webkit-resize-callback)
+
+    (let* ((frame-width (frame-width))
+           (fill-column (min lsp-ui-doc-max-width (- frame-width 5))))
+      (when (> (lsp-ui-doc--buffer-width) (min lsp-ui-doc-max-width frame-width))
+        (lsp-ui-doc--with-buffer
+          (fill-region (point-min) (point-max)))))))
+
+(defun lsp-ui-doc--mv-at-point (width height start-x start-y)
+  "Return position of FRAME to be where the point is.
+WIDTH is the child frame width.
+HEIGHT is the child frame height.
+START-X is the position x of the current window.
+START-Y is the position y of the current window.
+The algorithm prefers to position FRAME just above the
+symbol at point, to not obstruct the view of the code that follows.
+If there's no space above in the current window, it places
+FRAME just below the symbol at point."
+  (-let* (((x . y) (--> (or lsp-ui-doc--bounds (bounds-of-thing-at-point 'symbol))
+                        (or (posn-x-y (posn-at-point (car it)))
+                            (if (< (car it) (window-start))
+                                (cons 0 0)
+                              (posn-x-y (posn-at-point (1- (window-end))))))))
+          (frame-relative-symbol-x (+ start-x x (* (frame-char-width) 2)))
+          (frame-relative-symbol-y (+ start-y y))
+          (char-height (frame-char-height))
+          ;; Make sure the frame is positioned horizontally such that
+          ;; it does not go beyond the frame boundaries.
+          (frame-x (or (and (<= (frame-outer-width) (+ frame-relative-symbol-x width))
+                            (- x (- (+ frame-relative-symbol-x width)
+                                    (frame-outer-width))))
+                       x))
+          (frame-y (+ (or (and (<= height frame-relative-symbol-y)
+                               (- y height))
+                          (+ y char-height))
+                      (if (fboundp 'window-tab-line-height) (window-tab-line-height) 0))))
+    (cons (+ start-x frame-x) (+ start-y frame-y))))
+
+(defun lsp-ui-doc--size-and-pos-changed (frame left top width height)
+  (-let (((prev-left . prev-top) (frame-position frame)))
+    (not (and (= left prev-left)
+              (= top prev-top)
+              (= height (frame-text-height frame))
+              (= width (frame-text-width frame))))))
+
+(defun lsp-ui-doc--move-frame (frame)
+  "Place our FRAME on screen."
+  (-let* (((left top right _bottom) (window-edges nil t nil t))
+          (window (frame-root-window frame))
+          (char-h (frame-char-height frame))
+          (char-w (frame-char-width frame))
+          ((width . height) (window-text-pixel-size window nil nil 10000 10000 t))
+          (width (+ width (* char-w 1))) ;; margins
+          (height (min (- (* lsp-ui-doc-max-height char-h) (/ char-h 2)) height))
+          (width (min width (* lsp-ui-doc-max-width char-w)))
+          (frame-right (pcase lsp-ui-doc-alignment
+                         ('frame (frame-pixel-width))
+                         ('window right)))
+          ((left . top) (if (eq lsp-ui-doc-position 'at-point)
+                            (lsp-ui-doc--mv-at-point width height left top)
+                          (cons (max (- frame-right width char-w) 10)
+                                (pcase lsp-ui-doc-position
+                                  ('top (+ top char-w))
+                                  ('bottom (- (lsp-ui-doc--line-height 'mode-line)
+                                              height
+                                              10))))))
+          (frame-resize-pixelwise t)
+          (move-frame-functions nil)
+          (window-size-change-functions nil)
+          (window-state-change-hook nil)
+          (window-state-change-functions nil)
+          (window-configuration-change-hook nil)
+          (inhibit-redisplay t))
+    ;; Dirty way to fix unused variable in emacs 26
+    (and window-state-change-functions
+         window-state-change-hook)
+    ;; Make frame invisible before moving/resizing it to avoid flickering:
+    ;; We set the position and size in 1 call, modify-frame-parameters, but
+    ;; internally emacs makes 2 different calls, which can be visible
+    ;; to the user
+    (and (frame-visible-p frame)
+         (lsp-ui-doc--size-and-pos-changed frame left top width height)
+         (make-frame-invisible frame))
+    (modify-frame-parameters
+     frame
+     `((width . (text-pixels . ,width))
+       (height . (text-pixels . ,height))
+       (user-size . t)
+       (left . (+ ,left))
+       (top . (+ ,top))
+       (user-position . t)
+       (lsp-ui-doc--window-origin . ,(selected-window))
+       (lsp-ui-doc--buffer-origin . ,(current-buffer))
+       (lsp-ui-doc--no-focus . t)
+       (right-fringe . 0)
+       (left-fringe . 0)))
+    ;; Insert hr lines after width is computed
+    (lsp-ui-doc--fix-hr-props)
+    (unless (frame-visible-p frame)
+      (make-frame-visible frame))))
+
+(defun lsp-ui-doc--visit-file (filename)
+  "Visit FILENAME in the parent frame."
+  (-some->> (find-file-noselect filename)
+    (set-window-buffer (lsp-ui-doc--get-parent :window))))
+
+(defun lsp-ui-doc--put-click (start end fn)
+  "Add text properties on text to make it clickable.
+The text delimiters bound from START to END.
+FN is the function to call on click."
+  (let ((map (make-sparse-keymap)))
+    (define-key map [down-mouse-1] fn)
+    (put-text-property start end 'keymap map)
+    (put-text-property start end 'mouse-face
+                       (list :inherit 'lsp-ui-doc-url
+                             :box (list :line-width -1
+                                        :color (face-foreground 'lsp-ui-doc-url))))
+    (add-face-text-property start end 'lsp-ui-doc-url)))
+
+(defun lsp-ui-doc--open-markdown-link (&rest _)
+  (interactive "P")
+  (let ((buffer-list-update-hook nil))
+    (-let [(buffer point) (if-let* ((valid (and (listp last-input-event)
+                                                (eq (car last-input-event) 'mouse-2)))
+                                    (event (cadr last-input-event))
+                                    (win (posn-window event))
+                                    (buffer (window-buffer win)))
+                              `(,buffer ,(posn-point event))
+                            `(,(current-buffer) ,(point)))]
+      (with-current-buffer buffer
+        ;; Markdown-mode puts the url in 'help-echo
+        (-some--> (get-text-property point 'help-echo)
+          (and (string-match-p goto-address-url-regexp it)
+               (browse-url it)))))))
+
+(defun lsp-ui-doc--make-clickable-link ()
+  "Find paths and urls in the buffer and make them clickable."
+  (goto-char (point-min))
+  (save-excursion
+    (goto-char (point-min))
+    (let (case-fold-search)
+      (while (re-search-forward goto-address-url-regexp nil t)
+        (goto-char (1+ (match-end 0)))
+        (lsp-ui-doc--put-click (match-beginning 0) (match-end 0)
+                               'browse-url-at-mouse)))))
+
+(defun lsp-ui-doc--buffer-pre-command (&rest _)
+  (and (not (eq this-command 'mwheel-scroll))
+       (frame-parameter nil 'lsp-ui-doc--no-focus)
+       (select-frame (frame-parent) t)))
+
+(defun lsp-ui-doc--fill-document ()
+  "Better wrap the document so it fits the doc window."
+  (let ((fill-column (- lsp-ui-doc-max-width 5))
+        start        ; record start for `fill-region'
+        first-line)  ; first line in paragraph
+    (save-excursion
+      (goto-char (point-min))
+      (setq start (point)
+            first-line (thing-at-point 'line))
+      (while (re-search-forward "^[ \t]*\n" nil t)
+        (setq first-line (thing-at-point 'line))
+        (when (< fill-column (length first-line))
+          (fill-region start (point)))
+        (setq start (point)))
+      ;; Fill the last paragraph
+      (when (< fill-column (length first-line))
+        (fill-region start (point-max))))))
+
+(defun lsp-ui-doc--make-smaller-empty-lines nil
+  "Make empty lines half normal lines."
+  (progn  ; Customize line before header
+    (goto-char 1)
+    (insert (propertize "\n" 'face '(:height 0.3))))
+  (progn  ; Customize line after header
+    (forward-line 1)
+    (insert (propertize " " 'face '(:height 0.1))))
+  (while (not (eobp))
+    (when (and (eolp) (not (bobp)))
+      (save-excursion
+        (delete-region (point) (progn (forward-visible-line 1) (point))))
+      (when (or (and (not (get-text-property (point) 'markdown-heading))
+                     (not (get-text-property (max (- (point) 2) 1) 'markdown-heading)))
+                (get-text-property (point) 'markdown-hr))
+        (insert (propertize " " 'face `(:height 0.2))
+                (propertize "\n" 'face '(:height 0.4)))))
+    (forward-line))
+  (insert (propertize "\n\n" 'face '(:height 0.3))))
+
+(defun lsp-ui-doc--fix-hr-props nil
+  ;; We insert the right display prop after window-text-pixel-size
+  (lsp-ui-doc--with-buffer
+    (let (next)
+      (while (setq next (next-single-property-change (or next 1) 'lsp-ui-doc--replace-hr))
+        (when (get-text-property next 'lsp-ui-doc--replace-hr)
+          (put-text-property next (1+ next) 'display
+                             '(space :align-to (- right-fringe 1) :height (1)))
+          (put-text-property (1+ next) (+ next 2) 'display
+                             '(space :align-to right-fringe :height (1))))))))
+
+(defun lsp-ui-doc--handle-hr-lines nil
+  (let (bolp next before after)
+    (goto-char 1)
+    (while (setq next (next-single-property-change (or next 1) 'markdown-hr))
+      (when (get-text-property next 'markdown-hr)
+        (goto-char next)
+        (setq bolp (bolp)
+              before (char-before))
+        (delete-region (point) (save-excursion (forward-visible-line 1) (point)))
+        (setq after (char-after (1+ (point))))
+        (insert
+         (concat
+          (and bolp (not (equal before ?\n)) (propertize "\n" 'face '(:height 0.5)))
+          (propertize " "
+                      ;; :align-to is added with lsp-ui-doc--fix-hr-props
+                      'display '(space :height (1))
+                      'lsp-ui-doc--replace-hr t
+                      'face '(:background "dark grey"))
+          ;; :align-to is added here too
+          (propertize " " 'display '(space :height (1)))
+          (and (not (equal after ?\n)) (propertize " \n" 'face '(:height 0.2)))))))))
+
+(defun lsp-ui-doc--render-buffer (string symbol)
+  "Set the buffer with STRING and SYMBOL."
+  (lsp-ui-doc--with-buffer
+    (if lsp-ui-doc-use-webkit
+        (progn
+          (lsp-ui-doc--webkit-execute-script
+           (format "renderMarkdown('%s', '%s');"
+                   symbol
+                   (url-hexify-string string))
+           'lsp-ui-doc--webkit-resize-callback))
+      (erase-buffer)
+      (insert (s-trim string))
+      (unless (or (lsp-ui-doc--inline-p) (not lsp-ui-doc-enhanced-markdown))
+        (lsp-ui-doc--fill-document)
+        (lsp-ui-doc--make-smaller-empty-lines)
+        (lsp-ui-doc--handle-hr-lines))
+      (add-text-properties 1 (point) '(line-height 1))
+      (lsp-ui-doc--make-clickable-link)
+      (add-text-properties 1 (point-max) '(pointer arrow)))
+    (lsp-ui-doc-frame-mode 1)
+    (setq wrap-prefix '(space :height (1) :width 1)
+          line-prefix '(space :height (1) :width 1))
+    (setq-local face-remapping-alist `((header-line lsp-ui-doc-header)))
+    (setq-local window-min-height 1)
+    (setq-local show-trailing-whitespace nil)
+    (setq-local window-configuration-change-hook nil)
+    (add-hook 'pre-command-hook 'lsp-ui-doc--buffer-pre-command nil t)
+    (when (boundp 'window-state-change-functions)
+      (setq-local window-state-change-functions nil))
+    (when (boundp 'window-state-change-hook)
+      (setq-local window-state-change-hook nil))
+    (setq-local window-size-change-functions nil)
+    (setq header-line-format (when lsp-ui-doc-header (concat " " symbol))
+          mode-line-format nil
+          cursor-type nil)))
+
+(defun lsp-ui-doc--inline-height ()
+  (lsp-ui-doc--with-buffer
+    (length (split-string (buffer-string) "\n"))))
+
+(defun lsp-ui-doc--remove-invisibles (string)
+  "Remove invisible characters in STRING."
+  (let* ((start (text-property-not-all 0 (length string) 'invisible nil string)))
+    (while start
+      (setq string (concat (substring string 0 start)
+                           (-some->> (next-single-property-change start 'invisible string)
+                             (substring string))))
+      (setq start (text-property-not-all 0 (length string) 'invisible nil string)))
+    string))
+
+(defvar-local lsp-ui-doc--inline-width nil)
+
+(defun lsp-ui-doc--inline-window-width nil
+  (- (min (window-text-width) (window-body-width))
+     (if (bound-and-true-p display-line-numbers-mode)
+         (+ 2 (line-number-display-width))
+       0)
+     1))
+
+(defun lsp-ui-doc--inline-zip (s1 s2)
+  (let* ((width (lsp-ui-doc--inline-window-width))
+         (max-s1 (- width lsp-ui-doc--inline-width 2)))
+    (truncate-string-to-width
+     (concat (truncate-string-to-width s1 max-s1 nil ?\s) s2)
+     width nil ?\s)))
+
+(defun lsp-ui-doc--inline-padding (string len)
+  (let ((string (concat " " string (make-string (- len (string-width string)) ?\s) " ")))
+    (add-face-text-property 0 (length string) (list :background (face-background 'lsp-ui-doc-background nil t)) t string)
+    string))
+
+(defun lsp-ui-doc--inline-faking-frame (doc-strings)
+  (let* ((len-max (-max-by '> (-map 'string-width doc-strings))))
+    (setq lsp-ui-doc--inline-width len-max)
+    (--map (lsp-ui-doc--inline-padding it len-max) doc-strings)))
+
+(defun lsp-ui-doc--inline-untab (string)
+  (replace-regexp-in-string "\t" (make-string tab-width ?\s) string nil t))
+
+(defun lsp-ui-doc--inline-merge (strings)
+  (let* ((buffer-strings (-> (lsp-ui-doc--inline-untab strings)
+                             (lsp-ui-doc--remove-invisibles)
+                             (split-string "\n")))
+         (doc-strings (-> (lsp-ui-doc--with-buffer (buffer-string))
+                          (lsp-ui-doc--inline-untab)
+                          (lsp-ui-doc--remove-invisibles)
+                          (split-string "\n")))
+         (merged (--> (lsp-ui-doc--inline-faking-frame doc-strings)
+                      (-zip-with 'lsp-ui-doc--inline-zip buffer-strings it)
+                      (string-join it "\n")
+                      (concat it "\n"))))
+    merged))
+
+(defun lsp-ui-doc--inline-pos-at (start lines)
+  "Calcul the position at START + forward n LINES."
+  (save-excursion (goto-char start) (forward-line lines) (point)))
+
+(defun lsp-ui-doc--inline-pos (height)
+  "Return a cons of positions where to place the doc.
+HEIGHT is the documentation number of lines."
+  (let* ((w-start (window-start))
+         (w-end (lsp-ui-doc--inline-pos-at w-start (window-body-height)))
+         (ov-end (lsp-ui-doc--inline-pos-at w-start height)))
+    (cond
+     ;; Display on top ?
+     ((< (lsp-ui-doc--inline-pos-at ov-end 1) (point))
+      (cons w-start ov-end))
+     ;; Display at the bottom ?
+     ((>= (lsp-ui-doc--inline-pos-at w-end (- height))
+          (lsp-ui-doc--inline-pos-at (point) 2))
+      (cons (lsp-ui-doc--inline-pos-at w-end (- height))
+            w-end))
+     ;; The doc is too long to display it fixed to the bottom ?
+     ;; Then display 2 lines after `point'
+     ;; The end of the documentation won't be visible in the window
+     (t (cons (lsp-ui-doc--inline-pos-at (point) 2)
+              (lsp-ui-doc--inline-pos-at (point) (+ height 2)))))))
+
+(defun lsp-ui-doc--inline ()
+  "Display the doc in the buffer."
+  (-let* ((height (lsp-ui-doc--inline-height))
+          ((start . end) (lsp-ui-doc--inline-pos height))
+          (buffer-string (buffer-substring start end))
+          (ov (if (overlayp lsp-ui-doc--inline-ov) lsp-ui-doc--inline-ov
+                (setq lsp-ui-doc--inline-ov (make-overlay start end)))))
+    (move-overlay ov start end)
+    (overlay-put ov 'face 'default)
+    (overlay-put ov 'display (lsp-ui-doc--inline-merge buffer-string))
+    (overlay-put ov 'lsp-ui-doc-inline t)
+    (overlay-put ov 'window (selected-window))))
+
+(defun lsp-ui-doc--inline-p ()
+  "Return non-nil when the documentation should be display without a child frame."
+  (or (not lsp-ui-doc-use-childframe)
+      (not (display-graphic-p))
+      (not (fboundp 'display-buffer-in-child-frame))))
+
+(defun lsp-ui-doc--highlight-hover nil
+  (when lsp-ui-doc--from-mouse-current
+    (-let* (((start . end) lsp-ui-doc--bounds)
+            (ov (if (overlayp lsp-ui-doc--highlight-ov) lsp-ui-doc--highlight-ov
+                  (setq lsp-ui-doc--highlight-ov (make-overlay start end)))))
+      (move-overlay ov start end)
+      (overlay-put ov 'face 'lsp-ui-doc-highlight-hover)
+      (overlay-put ov 'window (selected-window)))))
+
+(defun lsp-ui-doc--display (symbol string)
+  "Display the documentation."
+  (when (and lsp-ui-doc-use-webkit (not (featurep 'xwidget-internal)))
+    (setq lsp-ui-doc-use-webkit nil))
+  (if (or (null string) (string-empty-p string))
+      (lsp-ui-doc--hide-frame)
+    (lsp-ui-doc--highlight-hover)
+    (lsp-ui-doc--render-buffer string symbol)
+    (if (lsp-ui-doc--inline-p)
+        (lsp-ui-doc--inline)
+      (unless (lsp-ui-doc--get-frame)
+        (lsp-ui-doc--set-frame (lsp-ui-doc--make-frame)))
+      (unless lsp-ui-doc-use-webkit
+        (lsp-ui-doc--resize-buffer)
+        (lsp-ui-doc--move-frame (lsp-ui-doc--get-frame))))
+    (setq lsp-ui-doc--from-mouse lsp-ui-doc--from-mouse-current)))
+
+(defun lsp-ui-doc--make-frame ()
+  "Create the child frame and return it."
+  (lsp-ui-doc--delete-frame)
+  (let* ((after-make-frame-functions nil)
+         (before-make-frame-hook nil)
+         (name-buffer (lsp-ui-doc--make-buffer-name))
+         (buffer (get-buffer name-buffer))
+         (params (append lsp-ui-doc-frame-parameters
+                         `((name . "")
+                           (default-minibuffer-frame . ,(selected-frame))
+                           (minibuffer . ,(minibuffer-window))
+                           (left-fringe . 0)
+                           (right-fringe . 0)
+                           (cursor-type . nil)
+                           (lsp-ui-doc--no-focus . t)
+                           (background-color . ,(face-background 'lsp-ui-doc-background nil t)))))
+         (window (display-buffer-in-child-frame
+                  buffer
+                  `((child-frame-parameters . ,params))))
+         (frame (window-frame window)))
+    (with-current-buffer buffer
+      (lsp-ui-doc-frame-mode 1))
+    (set-frame-parameter nil 'lsp-ui-doc-buffer buffer)
+    (set-window-dedicated-p window t)
+    ;;(redirect-frame-focus frame (frame-parent frame))
+    (set-face-background 'internal-border lsp-ui-doc-border frame)
+    (when (facep 'child-frame-border)
+      (set-face-background 'child-frame-border lsp-ui-doc-border frame))
+    (set-face-background 'fringe nil frame)
+    (run-hook-with-args 'lsp-ui-doc-frame-hook frame window)
+    (when lsp-ui-doc-use-webkit
+      (define-key (current-global-map) [xwidget-event]
+        (lambda ()
+          (interactive)
+          (let ((xwidget-event-type (nth 1 last-input-event)))
+            ;; (when (eq xwidget-event-type 'load-changed)
+            ;;   (lsp-ui-doc--move-frame (lsp-ui-doc--get-frame)))
+            (when (eq xwidget-event-type 'javascript-callback)
+              (let ((proc (nth 3 last-input-event))
+                    (arg (nth 4 last-input-event)))
+                (funcall proc arg))))))
+      (lsp-ui-doc--webkit-run-xwidget))
+    frame))
+
+(defconst lsp-ui-doc--ignore-commands
+  '(lsp-ui-doc-hide
+    lsp-ui-doc--handle-mouse-movement
+    keyboard-quit
+    ignore
+    handle-switch-frame
+    mwheel-scroll))
+
+(defun lsp-ui-doc--make-request nil
+  "Request the documentation to the LS."
+  (and (not track-mouse) lsp-ui-doc-show-with-mouse (setq-local track-mouse t))
+  (when (and lsp-ui-doc-show-with-cursor
+             (not (memq this-command lsp-ui-doc--ignore-commands))
+             (not (bound-and-true-p lsp-ui-peek-mode))
+             (lsp--capability "hoverProvider"))
+    (-if-let (bounds (or (and (symbol-at-point) (bounds-of-thing-at-point 'symbol))
+                         (and (looking-at "[[:graph:]]") (cons (point) (1+ (point))))))
+        (unless (equal lsp-ui-doc--bounds bounds)
+          (lsp-ui-doc--hide-frame)
+          (lsp-ui-util-safe-kill-timer lsp-ui-doc--timer)
+          (setq lsp-ui-doc--timer
+                (run-with-idle-timer
+                 lsp-ui-doc-delay nil
+                 (let ((buf (current-buffer)))
+                   (lambda nil
+                     (when (equal buf (current-buffer))
+                       (lsp-request-async
+                        "textDocument/hover"
+                        (lsp--text-document-position-params)
+                        (lambda (hover)
+                          (when (equal buf (current-buffer))
+                            (lsp-ui-doc--callback hover bounds (current-buffer))))
+                        :mode 'tick
+                        :cancel-token :lsp-ui-doc-hover)))))))
+      (lsp-ui-doc--hide-frame))))
+
+(defun lsp-ui-doc--extract-bounds (hover)
+  (-when-let* ((hover hover)
+               (data (lsp-get hover :range))
+               (start (-some-> (lsp:range-start data) lsp--position-to-point))
+               (end (-some-> (lsp:range-end data) lsp--position-to-point)))
+    (cons start end)))
+
+(lsp-defun lsp-ui-doc--callback ((hover &as &Hover? :contents) bounds buffer)
+  "Process the received documentation.
+HOVER is the doc returned by the LS.
+BOUNDS are points of the symbol that have been requested.
+BUFFER is the buffer where the request has been made."
+  (let ((bounds (or (lsp-ui-doc--extract-bounds hover) bounds)))
+    (if (and hover
+             (>= (point) (car bounds))
+             (<= (point) (cdr bounds))
+             (eq buffer (current-buffer)))
+        (progn
+          (setq lsp-ui-doc--bounds bounds)
+          (lsp-ui-doc--display
+           (thing-at-point 'symbol t)
+           (-some->> contents
+             lsp-ui-doc--extract
+             (replace-regexp-in-string "\r" "")
+             (replace-regexp-in-string " " " "))))
+      (lsp-ui-doc--hide-frame))))
+
+(defun lsp-ui-doc--delete-frame ()
+  "Delete the child frame if it exists."
+  (-when-let (frame (lsp-ui-doc--get-frame))
+    (delete-frame frame)
+    (lsp-ui-doc--set-frame nil)))
+
+(defun lsp-ui-doc--visible-p ()
+  "Return whether the LSP UI doc is visible"
+  (or (overlayp lsp-ui-doc--inline-ov)
+      (and (lsp-ui-doc--get-frame)
+           (frame-visible-p (lsp-ui-doc--get-frame)))))
+
+(defun lsp-ui-doc-hide-frame-on-window-change (fun window &optional no-record)
+  "Delete the child frame if currently selected window changes.
+Does nothing if the newly-selected window is the same window as
+before, or if the new window is the minibuffer."
+  (let ((initial-window (selected-window)))
+    (prog1 (funcall fun window no-record)
+      (unless no-record
+        (when (lsp-ui-doc--visible-p)
+          (let* ((current-window (selected-window))
+                 (doc-buffer (get-buffer (lsp-ui-doc--make-buffer-name))))
+            (unless (or (window-minibuffer-p current-window)
+                        (equal current-window initial-window)
+                        (and doc-buffer
+                             (equal (window-buffer initial-window) doc-buffer)))
+              (lsp-ui-doc--hide-frame))))))))
+
+(unless (boundp 'window-state-change-functions)
+  (advice-add #'select-window :around #'lsp-ui-doc-hide-frame-on-window-change)
+  (add-hook 'window-configuration-change-hook #'lsp-ui-doc--hide-frame))
+
+(defvar-local lsp-ui-doc--timer-on-changes nil)
+
+(defun lsp-ui-doc--on-state-changed (_frame &optional on-idle)
+  (-when-let* ((frame (lsp-ui-doc--get-frame)))
+    (and (frame-live-p frame)
+         (frame-visible-p frame)
+         (not (minibufferp (window-buffer)))
+         (or (not (eq (selected-window) (frame-parameter frame 'lsp-ui-doc--window-origin)))
+             (not (eq (window-buffer) (frame-parameter frame 'lsp-ui-doc--buffer-origin))))
+         (if on-idle (lsp-ui-doc--hide-frame)
+           (and (timerp lsp-ui-doc--timer-on-changes)
+                (cancel-timer lsp-ui-doc--timer-on-changes))
+           (setq lsp-ui-doc--timer-on-changes
+                 (run-with-idle-timer 0 nil (lambda nil (lsp-ui-doc--on-state-changed frame t))))))))
+
+(advice-add 'load-theme :before (lambda (&rest _) (lsp-ui-doc--delete-frame)))
+
+(advice-add #'keyboard-quit :before #'lsp-ui-doc--hide-frame)
+
+(defun lsp-ui-doc--on-delete (frame)
+  "Function called when a FRAME is deleted."
+  (-some--> (frame-parameter frame 'lsp-ui-doc-buffer)
+    (get-buffer it)
+    (and (buffer-live-p it) it)
+    (kill-buffer it)))
+
+(defun lsp-ui-doc--handle-scroll (win _new-start)
+  "Handle scrolling to the document frame.
+
+This function is apply to hook `window-scroll-functions'.
+
+Argument WIN is current applying window."
+  (let ((frame (lsp-ui-doc--get-frame)))
+    (if (minibufferp (window-buffer))
+        (lsp-ui-doc--hide-frame)
+      (when (and frame
+                 (eq lsp-ui-doc-position 'at-point)
+                 (frame-visible-p frame)
+                 (eq win (selected-window)))  ; This resolved #524
+        (if (and lsp-ui-doc--bounds
+                 (eq (window-buffer) (frame-parameter frame 'lsp-ui-doc--buffer-origin))
+                 (>= (point) (car lsp-ui-doc--bounds))
+                 (<= (point) (cdr lsp-ui-doc--bounds)))
+            (lsp-ui-doc--move-frame frame)
+          ;; The point might have changed if the window was scrolled
+          ;; too far
+          (lsp-ui-doc--hide-frame))))))
+
+(defvar-local lsp-ui-doc--timer-mouse-movement nil)
+(defvar-local lsp-ui-doc--last-event nil)
+
+(defun lsp-ui-doc--mouse-display nil
+  (when (and lsp-ui-doc--last-event
+             (lsp-feature? "textDocument/hover"))
+    (save-excursion
+      (goto-char lsp-ui-doc--last-event)
+      (-when-let* ((valid (not (eolp)))
+                   (bounds (or (and (symbol-at-point) (bounds-of-thing-at-point 'symbol))
+                               (and (looking-at "[[:graph:]]") (cons (point) (1+ (point)))))))
+        (unless (equal bounds lsp-ui-doc--bounds)
+          (lsp-request-async
+           "textDocument/hover"
+           (lsp--text-document-position-params)
+           (lambda (hover)
+             (save-excursion
+               (goto-char lsp-ui-doc--last-event)
+               (let ((lsp-ui-doc-position 'at-point)
+                     (lsp-ui-doc--from-mouse-current t))
+                 (lsp-ui-doc--callback hover bounds (current-buffer)))))
+           :mode 'tick
+           :cancel-token :lsp-ui-doc-hover))))))
+
+(defun lsp-ui-doc--handle-mouse-movement (event)
+  "Show the documentation corresponding to the text under EVENT."
+  (interactive "e")
+  (when lsp-ui-doc-show-with-mouse
+    (and (timerp lsp-ui-doc--timer-mouse-movement)
+         (cancel-timer lsp-ui-doc--timer-mouse-movement))
+    (let* ((e (cadr event))
+           (point (posn-point e))
+           (same-win (eq (selected-window) (posn-window e))))
+      (and lsp-ui-doc--from-mouse
+           lsp-ui-doc--bounds
+           point
+           (or (< point (car lsp-ui-doc--bounds))
+               (> point (cdr lsp-ui-doc--bounds))
+               (not same-win)
+               (equal (char-after point) ?\n))
+           (lsp-ui-doc--hide-frame))
+      (when same-win
+        (setq lsp-ui-doc--last-event point
+              lsp-ui-doc--timer-mouse-movement
+              (run-with-idle-timer lsp-ui-doc-delay nil 'lsp-ui-doc--mouse-display))))))
+
+(defun lsp-ui-doc--disable-mouse-on-prefix nil
+  (and (bound-and-true-p lsp-ui-doc-mode)
+       (bound-and-true-p lsp-ui-doc--mouse-tracked-by-us)
+       track-mouse
+       (> (length (this-single-command-keys)) 0)
+       (setq-local track-mouse nil)))
+
+(defvar lsp-ui-doc--timer-mouse-idle nil)
+
+(defvar-local lsp-ui-doc--mouse-tracked-by-us nil
+  "Nil if `track-mouse' was set by another package.
+If nil, do not prevent mouse on prefix keys.")
+
+(defun lsp-ui-doc--setup-mouse nil
+  (when lsp-ui-doc-show-with-mouse
+    (setq lsp-ui-doc--mouse-tracked-by-us (not track-mouse))
+    (setq-local track-mouse t)
+    (unless lsp-ui-doc--timer-mouse-idle
+      ;; Set only 1 timer for all buffers
+      (setq lsp-ui-doc--timer-mouse-idle
+            (run-with-idle-timer 0 t 'lsp-ui-doc--disable-mouse-on-prefix)))))
+
+(defun lsp-ui-doc--prevent-focus-doc (e)
+  (not (frame-parameter (cadr e) 'lsp-ui-doc--no-focus)))
+
+(define-minor-mode lsp-ui-doc-mode
+  "Minor mode for showing hover information in child frame."
+  :init-value nil
+  :keymap `((,(kbd "<mouse-movement>") . lsp-ui-doc--handle-mouse-movement))
+  :group lsp-ui-doc
+  (cond
+   (lsp-ui-doc-mode
+    (with-eval-after-load 'frameset
+      ;; The documentation frame can’t be properly restored.  Especially
+      ;; ‘desktop-save’ will misbehave and save a bogus string "Unprintable
+      ;; entity" in the desktop file.  Therefore we have to prevent
+      ;; ‘frameset-save’ from saving the parameter.
+      (unless (assq 'lsp-ui-doc-frame frameset-filter-alist)
+        ;; Copy the variable first.  See the documentation of
+        ;; ‘frameset-filter-alist’ for explanation.
+        (cl-callf copy-tree frameset-filter-alist)
+        (push '(lsp-ui-doc-frame . :never) frameset-filter-alist)))
+    (when (boundp 'window-state-change-functions)
+      (add-hook 'window-state-change-functions 'lsp-ui-doc--on-state-changed))
+    (lsp-ui-doc--setup-mouse)
+    (advice-add 'handle-switch-frame :before-while 'lsp-ui-doc--prevent-focus-doc)
+    (add-hook 'post-command-hook 'lsp-ui-doc--make-request nil t)
+    (add-hook 'window-scroll-functions 'lsp-ui-doc--handle-scroll nil t)
+    (add-hook 'delete-frame-functions 'lsp-ui-doc--on-delete nil t))
+   (t
+    (lsp-ui-doc-hide)
+    (when (boundp 'window-state-change-functions)
+      (remove-hook 'window-state-change-functions 'lsp-ui-doc--on-state-changed))
+    (remove-hook 'window-scroll-functions 'lsp-ui-doc--handle-scroll t)
+    (remove-hook 'post-command-hook 'lsp-ui-doc--make-request t)
+    (remove-hook 'delete-frame-functions 'lsp-ui-doc--on-delete t))))
+
+(defun lsp-ui-doc-enable (enable)
+  "Enable/disable ‘lsp-ui-doc-mode’.
+It is supposed to be called from `lsp-ui--toggle'"
+  (lsp-ui-doc-mode (if enable 1 -1)))
+
+(defun lsp-ui-doc-show ()
+  "Trigger display hover information popup."
+  (interactive)
+  (lsp-ui-doc--callback (lsp-request "textDocument/hover" (lsp--text-document-position-params))
+                        (or (bounds-of-thing-at-point 'symbol) (cons (point) (1+ (point))))
+                        (current-buffer)))
+
+(defun lsp-ui-doc-hide ()
+  "Hide hover information popup."
+  (interactive)
+  (lsp-ui-doc--hide-frame))
+
+(defvar-local lsp-ui-doc--unfocus-frame-timer nil)
+(defun lsp-ui-doc--glance-hide-frame ()
+  "Hook to hide hover information popup for `lsp-ui-doc-glance'."
+  (when (or (overlayp lsp-ui-doc--inline-ov)
+            (lsp-ui-doc--frame-visible-p))
+    (lsp-ui-doc--hide-frame)
+    (remove-hook 'post-command-hook 'lsp-ui-doc--glance-hide-frame)
+    ;; make sure child frame is unfocused
+    (setq lsp-ui-doc--unfocus-frame-timer
+          (run-at-time 1 nil #'lsp-ui-doc-unfocus-frame))))
+
+(defun lsp-ui-doc-glance ()
+  "Trigger display hover information popup and hide it on next typing."
+  (interactive)
+  (let ((lsp-ui-doc-show-with-cursor t))
+    (lsp-ui-doc--make-request))
+  (when lsp-ui-doc--unfocus-frame-timer
+    (cancel-timer lsp-ui-doc--unfocus-frame-timer))
+  (add-hook 'post-command-hook 'lsp-ui-doc--glance-hide-frame))
+
+(define-minor-mode lsp-ui-doc-frame-mode
+  "Marker mode to add additional key bind for lsp-ui-doc-frame."
+  :init-value nil
+  :lighter ""
+  :group lsp-ui-doc
+  :keymap `(([?q] . lsp-ui-doc-unfocus-frame)
+            ([remap markdown-follow-thing-at-point] . lsp-ui-doc--open-markdown-link)
+            ([remap mouse-drag-region] . ignore)))
+
+(defun lsp-ui-doc-focus-frame ()
+  "Focus into lsp-ui-doc-frame."
+  (interactive)
+  (when-let* ((frame (lsp-ui-doc--get-frame))
+              (visible (lsp-ui-doc--frame-visible-p)))
+    (set-frame-parameter frame 'lsp-ui-doc--no-focus nil)
+    (set-frame-parameter frame 'cursor-type t)
+    (lsp-ui-doc--with-buffer
+      (setq cursor-type 'box))
+    (select-frame-set-input-focus frame)))
+
+(defun lsp-ui-doc-unfocus-frame ()
+  "Unfocus from lsp-ui-doc-frame."
+  (interactive)
+  (-some-> (frame-parent) select-frame-set-input-focus)
+  (when-let* ((frame (lsp-ui-doc--get-frame)))
+    (set-frame-parameter frame 'lsp-ui-doc--no-focus t)
+    (set-frame-parameter frame 'cursor-type nil)
+    (lsp-ui-doc--with-buffer
+      (setq cursor-type nil))
+    (when lsp-ui-doc--from-mouse
+      (make-frame-invisible frame))))
+
+(provide 'lsp-ui-doc)
+;;; lsp-ui-doc.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-doc.html b/elpa/lsp-ui-20220104.1635/lsp-ui-doc.html
new file mode 100644 (file)
index 0000000..4c39adf
--- /dev/null
@@ -0,0 +1,52 @@
+<html>
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.0/showdown.min.js"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/highlight.min.js"></script>
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/2.10.0/github-markdown.css">
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/default.min.css">
+    <style>
+
+     :root {
+       --webkit-max-width-px: 600px;
+     }
+
+     .markdown-body {
+       box-sizing: border-box;
+       min-width: var(--webkit-max-width-px);
+       max-width: var(--webkit-max-width-px);
+       margin: 0 auto;
+       padding: 10px;
+     }
+
+     .markdown-body pre code {
+       white-space: pre-wrap;
+     }
+    </style>
+  </head>
+  <body>
+    <div id="lsp-ui-webkit" class="markdown-body">
+    </div>
+    <script>
+     var converter = new showdown.Converter({simpleLineBreaks: true});
+     var lastSymbol = "";
+     var elem = document.getElementById('lsp-ui-webkit');
+
+     function renderMarkdown(symbol, markedString) {
+       if (symbol == lastSymbol) return [elem.offsetWidth, elem.offsetHeight];
+       decodedString = decodeURIComponent(markedString);
+       html = converter.makeHtml(decodedString);
+       elem.innerHTML = html;
+       lastSymbol = symbol;
+
+       document.querySelectorAll('pre code').forEach(function(codeBlock) {
+         hljs.highlightBlock(codeBlock);
+       });
+
+       return [elem.offsetWidth, elem.offsetHeight];
+     }
+
+    </script>
+  </body>
+</html>
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-flycheck.el b/elpa/lsp-ui-20220104.1635/lsp-ui-flycheck.el
new file mode 100644 (file)
index 0000000..e3ac831
--- /dev/null
@@ -0,0 +1,171 @@
+;;; lsp-ui-flycheck.el --- Flycheck support for lsp-mode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017  fmdkdd
+;; URL: https://github.com/emacs-lsp/lsp-ui
+;; Keywords: languagues, tools
+;; Version: 6.2
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Flycheck integration for lsp-mode.
+
+;;; Code:
+
+(require 'flycheck nil 'noerror)  ; Temporary solution, see #514
+(require 'pcase)
+(require 'dash)
+
+(require 'lsp-protocol)
+(require 'lsp-mode)
+
+(defgroup lsp-ui-flycheck nil
+  "The LSP extension to display syntax checking."
+  :group 'tools
+  :group 'convenience
+  :group 'lsp-ui
+  :link '(custom-manual "(lsp-ui-flycheck) Top")
+  :link '(info-link "(lsp-ui-flycheck) Customizing"))
+
+(defcustom lsp-ui-flycheck-list-position 'bottom
+  "Position where `lsp-ui-flycheck-list' will show diagnostics for the
+whole workspace."
+  :type '(choice (const :tag "Bottom" bottom)
+                 (const :tag "Right" right))
+  :group 'lsp-ui-flycheck)
+
+(defvar-local lsp-ui-flycheck-list--buffer nil)
+(defvar-local lsp-ui-flycheck--save-mode nil)
+
+(defun lsp-ui-flycheck-list--post-command ()
+  (when (eobp)
+    (forward-line -1)))
+
+(defun lsp-ui-flycheck-list--update (window workspace)
+  "Update flycheck buffer in WINDOW belonging to WORKSPACE.
+Use `lsp-diagnostics' to receive diagnostics from your LSP server."
+  (let ((buffer-read-only nil)
+        (lsp--cur-workspace workspace))
+    (erase-buffer)
+    (remove-overlays)
+    (maphash (lambda (file diagnostic)
+               (when diagnostic
+                 (overlay-put
+                  (make-overlay (point) (point))
+                  'after-string
+                  (concat (propertize "\n" 'face '(:height 0.2))
+                          (propertize (lsp-ui--workspace-path file)
+                                      'face 'dired-directory)
+                          (propertize "\n" 'face '(:height 0.2)))))
+               (dolist (diag diagnostic)
+                 (-let* (((&Diagnostic :message :severity? :source?
+                                       :range (&Range :start (&Position :line start-line))) diag)
+                         (formatted-message (or (if source? (format "%s: %s" source? message) message) "???"))
+                         (severity (or severity? 1))
+                         (line (1+ start-line))
+                         (face (cond ((= severity 1) 'error)
+                                     ((= severity 2) 'warning)
+                                     (t 'success)))
+                         (text (concat (propertize (number-to-string line) 'face face)
+                                       ": "
+                                       (car (split-string formatted-message "\n")))))
+                   (add-text-properties 0 (length text) `(diag ,diag file ,file window ,window) text)
+                   (insert (concat text "\n")))))
+             (lsp-diagnostics)))
+  (if (= (point) 1)
+      (overlay-put (make-overlay 1 1)
+                   'after-string "No diagnostic available\n")
+    (goto-char 1))
+  (lsp-ui-flycheck-list-mode))
+
+(defun lsp-ui-flycheck-list ()
+  "List all the diagnostics in the whole workspace."
+  (interactive)
+  (let ((buffer (get-buffer-create "*lsp-diagnostics*"))
+        (workspace lsp--cur-workspace)
+        (window (selected-window)))
+    (with-current-buffer buffer
+      (lsp-ui-flycheck-list--update window workspace))
+    (add-hook 'lsp-diagnostics-updated-hook 'lsp-ui-flycheck-list--refresh nil t)
+    (setq lsp-ui-flycheck-list--buffer buffer)
+    (let ((win (display-buffer-in-side-window
+                buffer `((side . ,lsp-ui-flycheck-list-position) (slot . 5) (window-width . 0.20)))))
+      (set-window-dedicated-p win t)
+      (select-window win)
+      (fit-window-to-buffer nil nil 10))))
+
+(defun lsp-ui-flycheck-list--refresh ()
+  (let ((workspace lsp--cur-workspace)
+        (current-window (selected-window)))
+    (when (and (buffer-live-p lsp-ui-flycheck-list--buffer)
+               (get-buffer-window lsp-ui-flycheck-list--buffer)
+               workspace)
+      (with-selected-window (get-buffer-window lsp-ui-flycheck-list--buffer)
+        (lsp-ui-flycheck-list--update current-window workspace)
+        (fit-window-to-buffer nil nil 10)))))
+
+(defun lsp-ui-flycheck-list--open ()
+  (-when-let* ((diag (get-text-property (point) 'diag))
+               ((&Diagnostic :range (&Range :start (&Position :line start-line
+                                                              :character start-column))) diag)
+               (file (get-text-property (point) 'file))
+               (window (get-text-property (point) 'window))
+               (marker (with-current-buffer
+                           (or (get-file-buffer file)
+                               (find-file-noselect file))
+                         (save-restriction
+                           (widen)
+                           (save-excursion
+                             (goto-char 1)
+                             (forward-line start-line)
+                             (forward-char start-column)
+                             (point-marker))))))
+    (set-window-buffer window (marker-buffer marker) t)
+    (with-selected-window window
+      (goto-char marker)
+      (recenter)
+      (pulse-momentary-highlight-one-line (marker-position marker) 'next-error))
+    window))
+
+(defun lsp-ui-flycheck-list--view ()
+  (interactive)
+  (lsp-ui-flycheck-list--open))
+
+(defun lsp-ui-flycheck-list--visit ()
+  (interactive)
+  (select-window (lsp-ui-flycheck-list--open)))
+
+(defun lsp-ui-flycheck-list--quit ()
+  (interactive)
+  (kill-buffer))
+
+(defvar lsp-ui-flycheck-list-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "q") 'lsp-ui-flycheck-list--quit)
+    (define-key map (kbd "<return>") 'lsp-ui-flycheck-list--view)
+    (define-key map (kbd "<M-return>") 'lsp-ui-flycheck-list--visit)
+    map)
+  "Keymap for ‘lsp-ui-flycheck-list-mode’.")
+
+(define-derived-mode lsp-ui-flycheck-list-mode special-mode "lsp-ui-flycheck-list"
+  "Mode showing flycheck diagnostics for the whole workspace."
+  (setq truncate-lines t)
+  (setq mode-line-format nil)
+  (add-hook 'post-command-hook 'lsp-ui-flycheck-list--post-command nil t))
+
+(declare-function lsp-ui--workspace-path "lsp-ui" (path))
+
+(provide 'lsp-ui-flycheck)
+;;; lsp-ui-flycheck.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-imenu.el b/elpa/lsp-ui-20220104.1635/lsp-ui-imenu.el
new file mode 100644 (file)
index 0000000..3c628da
--- /dev/null
@@ -0,0 +1,412 @@
+;;; lsp-ui-imenu.el --- Lsp-Ui-Imenu  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2018 Sebastien Chapuis
+
+;; Author: Sebastien Chapuis <sebastienNOSPAMchapu.is>
+;; URL: https://github.com/emacs-lsp/lsp-ui
+;; Keywords: languages, tools
+;; Version: 6.3
+
+;;; License
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; Show imenu entries
+;; Call the function `lsp-ui-imenu'
+;;
+;; (define-key lsp-ui-mode-map (kbd "C-c l") 'lsp-ui-imenu)
+
+;;; Code:
+
+(require 'lsp-mode)
+(require 'dash)
+(require 'lsp-ui-util)
+
+(defgroup lsp-ui-imenu nil
+  "Display imenu entries."
+  :group 'tools
+  :group 'convenience
+  :group 'lsp-ui
+  :link '(custom-manual "(lsp-ui-imenu) Top")
+  :link '(info-link "(lsp-ui-imenu) Customizing"))
+
+(defcustom lsp-ui-imenu-enable t
+  "Whether or not to enable ‘lsp-ui-imenu’."
+  :type 'boolean
+  :group 'lsp-ui)
+
+(defcustom lsp-ui-imenu-kind-position 'top
+  "Where to show the entries kind."
+  :type '(choice (const :tag "Top" top)
+                 (const :tag "Left" left))
+  :group 'lsp-ui-imenu)
+
+(defcustom lsp-ui-imenu-colors '("deep sky blue" "green3")
+  "Color list to cycle through for entry groups."
+  :type '(repeat color)
+  :group 'lsp-ui-imenu)
+
+(defcustom lsp-ui-imenu-window-width 0
+  "When not 0, don't fit window to buffer and use value as window-width."
+  :type 'number
+  :group 'lsp-ui-imenu)
+
+(defcustom lsp-ui-imenu-auto-refresh nil
+  "Automatically refresh imenu when certain conditions meet."
+  :type '(choice (const :tag "Enable" t)
+                 (const :tag "Active only when after save" after-save)
+                 (const :tag "Disable" nil))
+  :group 'lsp-ui-imenu)
+
+(defcustom lsp-ui-imenu-auto-refresh-delay 1.0
+  "Delay time to refresh imenu."
+  :type 'float
+  :group 'lsp-ui-imenu)
+
+(defcustom lsp-ui-imenu--custom-mode-line-format nil
+  "Custom mode line format to be used in `lsp-ui-menu-mode'."
+  :type 'sexp
+  :group 'lsp-ui-menu)
+
+(defconst lsp-ui-imenu--max-bars 8)
+
+(declare-function imenu--make-index-alist 'imenu)
+(declare-function imenu--subalist-p 'imenu)
+(defvar imenu--index-alist)
+
+(defvar-local lsp-ui-imenu--refresh-timer nil
+  "Auto refresh timer for imenu.")
+
+(defun lsp-ui-imenu--pad (s len bars depth color-index for-title is-last)
+  (let ((n (- len (length s))))
+    (apply #'concat
+           (make-string n ?\s)
+           (propertize s 'face `(:foreground ,(lsp-ui-imenu--get-color color-index)))
+           (let (bar-strings)
+             (dotimes (i depth)
+               (push
+                (propertize (lsp-ui-imenu--get-bar bars i depth for-title is-last)
+                            'face `(:foreground
+                                    ,(lsp-ui-imenu--get-color (+ color-index i))))
+                bar-strings))
+             (reverse bar-strings)))))
+
+(defun lsp-ui-imenu--get-bar (bars index depth for-title is-last)
+  (cond
+   ;; Exceeding maximum bars
+   ((>= index lsp-ui-imenu--max-bars) "   ")
+   ;; No bar for this level
+   ((not (aref bars index)) "   ")
+   ;; For the first level, the title is rendered differently, so leaf items are
+   ;; decorated with the full height bar regardless if it's the last item or
+   ;; not.
+   ((and (= depth 1) (not for-title)) " ┃ ")
+   ;; Full height bar for levels other than the rightmost one.
+   ((< (1+ index) depth) " ┃ ")
+   ;; The rightmost bar for the last item.
+   (is-last " ┗ " )
+   ;; The rightmost bar for the title items other than the last one.
+   (for-title " ┣ ")
+   ;; The rightmost bar for the leaf items other than the last one.
+   (t " ┃ ")))
+
+(defun lsp-ui-imenu--get-color (index)
+  (nth (mod index (length lsp-ui-imenu-colors)) lsp-ui-imenu-colors))
+
+(defun lsp-ui-imenu--make-line (title index entry padding bars depth color-index is-last)
+  (let* ((prefix (if (and (= index 0) (eq lsp-ui-imenu-kind-position 'left)) title " "))
+         (text (concat (lsp-ui-imenu--pad prefix padding bars depth color-index nil is-last)
+                       (propertize (car entry) 'face 'default)
+                       "\n"))
+         (len (length text)))
+    (add-text-properties 0 len `(index ,index title ,title marker ,(cdr entry)
+                                       padding ,padding depth, depth)
+                         text)
+    text))
+
+(defvar-local lsp-ui-imenu-ov nil
+  "Variable that holds overlay for imenu.")
+
+(defun lsp-ui-imenu--make-ov nil
+  "Make imenu overlay."
+  (or (and (overlayp lsp-ui-imenu-ov) lsp-ui-imenu-ov)
+      (setq lsp-ui-imenu-ov (make-overlay 1 1))))
+
+(defun lsp-ui-imenu--post-command nil
+  "Post command hook for imenu."
+  (when (eobp) (forward-line -1))
+  (lsp-ui-imenu--move-to-name-beginning)
+  (when (eq lsp-ui-imenu-kind-position 'left)
+    (save-excursion
+      (when (overlayp lsp-ui-imenu-ov)
+        (overlay-put lsp-ui-imenu-ov 'display nil))
+      (redisplay)
+      (goto-char (window-start))
+      (if (= (get-text-property (point) 'index) 0)
+          (when (overlayp lsp-ui-imenu-ov) (delete-overlay lsp-ui-imenu-ov))
+        (let* ((ov (lsp-ui-imenu--make-ov))
+               (padding (get-text-property (point) 'padding))
+               (title (get-text-property (point) 'title))
+               (text (buffer-substring (+ (line-beginning-position) padding) (line-end-position))))
+          (move-overlay ov (line-beginning-position) (line-end-position))
+          (overlay-put ov 'display `(string ,(concat (let ((n (- padding (length title))))
+                                                       (propertize (concat (make-string n ?\s) title)))
+                                                     text))))))))
+
+(defun lsp-ui-imenu--move-to-name-beginning ()
+  (-when-let* ((padding (get-char-property (point) 'padding))
+               (depth (get-char-property (point) 'depth)))
+    (goto-char (+ (* depth 3) (line-beginning-position) padding))))
+
+(defvar lsp-ui-imenu--origin nil)
+
+(defun lsp-ui-imenu--put-separator nil
+  (let ((ov (make-overlay (point) (point))))
+    (overlay-put ov 'after-string (propertize "\n" 'face '(:height 0.6)))))
+
+(defun lsp-ui-imenu--put-toplevel-title (title color-index)
+  (if (eq lsp-ui-imenu-kind-position 'top)
+      (let ((ov (make-overlay (point) (point)))
+            (color (lsp-ui-imenu--get-color color-index)))
+        (overlay-put
+         ov 'after-string
+         (concat (propertize "\n" 'face '(:height 0.6))
+                 (propertize title 'face `(:foreground ,color))
+                 "\n"
+                 (propertize "\n" 'face '(:height 0.6)))))
+    ;; Left placement, title is put with the first sub item. Only put a separator here.
+    (lsp-ui-imenu--put-separator)))
+
+(defun lsp-ui-imenu--put-subtitle (title padding bars depth color-index is-last)
+  (let ((ov (make-overlay (point) (point)))
+        (title-color (lsp-ui-imenu--get-color (+ color-index depth))))
+    (overlay-put
+     ov 'after-string
+     (concat (lsp-ui-imenu--pad " " padding bars depth color-index t is-last)
+             (propertize title 'face `(:foreground ,title-color))
+             (propertize "\n" 'face '(:height 1))))))
+
+(defun lsp-ui-imenu--insert-items (title items padding bars depth color-index)
+  "Insert ITEMS for TITLE.
+
+PADDING is the length of whitespaces to the left of the first bar.
+
+BARS is a bool vector of length `lsp-ui-imenu--max-bars'. The ith
+value indicates whether the ith bar from the left is visible.
+
+DEPTH is the depth of the items in the index tree, starting from 0.
+
+COLOR-INDEX is the index of the color of the leftmost bar.
+
+Return the updated COLOR-INDEX."
+  (let ((len (length items)))
+    (--each-indexed items
+      (let ((is-last (= (1+ it-index) len)))
+        (if (imenu--subalist-p it)
+            (-let* (((sub-title . entries) it))
+              (if (= depth 0)
+                  (lsp-ui-imenu--put-toplevel-title sub-title color-index)
+                (lsp-ui-imenu--put-subtitle sub-title padding bars depth color-index is-last))
+              (when (and is-last (> depth 0))
+                (aset bars (1- depth) nil))
+              (let ((lsp-ui-imenu-kind-position (if (> depth 0) 'top
+                                                  lsp-ui-imenu-kind-position)))
+                (lsp-ui-imenu--insert-items sub-title
+                                            entries
+                                            padding
+                                            bars
+                                            (1+ depth)
+                                            color-index))
+              (when (and is-last (> depth 0))
+                (aset bars (1- depth) t))
+              (when (= depth 0)
+                (setq color-index (1+ color-index))))
+          (insert (lsp-ui-imenu--make-line title it-index it
+                                           padding bars depth color-index
+                                           is-last))))))
+  color-index)
+
+(defun lsp-ui-imenu--get-padding (items)
+  "Get imenu padding determined by `lsp-ui-imenu-kind-position'.
+ITEMS are used when the kind position is 'left."
+  (cl-case lsp-ui-imenu-kind-position
+    (top 1)
+    (left (--> (-filter 'imenu--subalist-p items)
+               (--map (length (car it)) it)
+               (-max (or it '(1)))))
+    (t (user-error "Invalid value for imenu's kind position: %s" lsp-ui-imenu-kind-position))))
+
+(defun lsp-ui-imenu--put-bit (bits offset)
+  (logior bits (lsh 1 offset)))
+
+(defun lsp-ui-imenu--clear-bit (bits offset)
+  (logand bits (lognot (lsh 1 offset))))
+
+(defvar lsp-ui-imenu-buffer-name "*lsp-ui-imenu*"
+  "Buffer name for imenu buffers.")
+
+(defun lsp-ui-imenu--refresh-content ()
+  "Refresh imenu content menu"
+  (let ((imenu-auto-rescan t))
+    (setq lsp-ui-imenu--origin (current-buffer))
+    (imenu--make-index-alist)
+    (let ((imenu-buffer (get-buffer-create lsp-ui-imenu-buffer-name))
+          (list imenu--index-alist))
+      (with-current-buffer imenu-buffer
+        (let* ((padding (lsp-ui-imenu--get-padding list))
+               (grouped-by-subs (-partition-by 'imenu--subalist-p list))
+               (color-index 0)
+               (bars (make-bool-vector lsp-ui-imenu--max-bars t))
+               (inhibit-read-only t))
+          (remove-overlays)
+          (erase-buffer)
+          (dolist (group grouped-by-subs)
+            (if (imenu--subalist-p (car group))
+                (setq color-index (lsp-ui-imenu--insert-items "" group padding bars 0 color-index))
+              (lsp-ui-imenu--put-separator)
+              (lsp-ui-imenu--insert-items "" group padding bars 1 color-index)
+              (setq color-index (1+ color-index))))
+          (lsp-ui-imenu-mode)
+          (when lsp-ui-imenu--custom-mode-line-format
+            (setq mode-line-format lsp-ui-imenu--custom-mode-line-format))
+          (goto-char (point-min))
+          (add-hook 'post-command-hook 'lsp-ui-imenu--post-command nil t))))))
+
+(defun lsp-ui-imenu nil
+  "Open ui-imenu in side window."
+  (interactive)
+  (lsp-ui-imenu-buffer-mode 1)
+  (setq lsp-ui-imenu--origin (current-buffer))
+  (imenu--make-index-alist)
+  (let ((imenu-buffer (get-buffer-create lsp-ui-imenu-buffer-name)))
+    (lsp-ui-imenu--refresh-content)
+    (let ((win (display-buffer-in-side-window imenu-buffer '((side . right)))))
+      (set-window-margins win 1)
+      (select-window win)
+      (set-window-start win 1)
+      (lsp-ui-imenu--move-to-name-beginning)
+      (set-window-dedicated-p win t)
+      ;; when `lsp-ui-imenu-window-width' is 0, fit window to buffer
+      (if (= lsp-ui-imenu-window-width 0)
+          (let ((fit-window-to-buffer-horizontally 'only))
+            (fit-window-to-buffer win)
+            (window-resize win 3 t))
+        (let ((x (- lsp-ui-imenu-window-width (window-width))))
+          (window-resize (selected-window) x t))))))
+
+(defun lsp-ui-imenu--kill nil
+  "Kill imenu window."
+  (interactive)
+  (lsp-ui-imenu-buffer-mode -1)
+  (kill-buffer-and-window))
+
+(defun lsp-ui-imenu--jump (direction)
+  (let ((current (get-text-property (point) 'title)))
+    (forward-line direction)
+    (while (and current
+                (not (= (line-number-at-pos) 1))
+                (equal current (get-text-property (point) 'title)))
+      (forward-line direction))))
+
+(defun lsp-ui-imenu--next-kind nil
+  "Jump to next kind of imenu."
+  (interactive)
+  (lsp-ui-imenu--jump 1))
+
+(defun lsp-ui-imenu--prev-kind nil
+  "Jump to previous kind of imenu."
+  (interactive)
+  (lsp-ui-imenu--jump -1)
+  (while (not (= (get-text-property (point) 'index) 0))
+    (forward-line -1)))
+
+(defun lsp-ui-imenu--visit nil
+  (interactive)
+  (let ((marker (get-text-property (point) 'marker)))
+    (select-window (get-buffer-window lsp-ui-imenu--origin))
+    (goto-char marker)
+    (pulse-momentary-highlight-one-line (point) 'next-error)))
+
+(defun lsp-ui-imenu--view nil
+  (interactive)
+  (let ((marker (get-text-property (point) 'marker)))
+    (with-selected-window (get-buffer-window lsp-ui-imenu--origin)
+      (goto-char marker)
+      (recenter)
+      (pulse-momentary-highlight-one-line (point) 'next-error))))
+
+(defvar lsp-ui-imenu-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map (kbd "q") 'lsp-ui-imenu--kill)
+    (define-key map (kbd "r") 'lsp-ui-imenu--refresh)
+    (define-key map (kbd "<right>") 'lsp-ui-imenu--next-kind)
+    (define-key map (kbd "<left>") 'lsp-ui-imenu--prev-kind)
+    (define-key map (kbd "<return>") 'lsp-ui-imenu--view)
+    (define-key map (kbd "<M-return>") 'lsp-ui-imenu--visit)
+    (define-key map (kbd "RET") 'lsp-ui-imenu--view)
+    (define-key map (kbd "M-RET") 'lsp-ui-imenu--visit)
+    map)
+  "Keymap for ‘lsp-ui-peek-mode’.")
+
+(define-derived-mode lsp-ui-imenu-mode special-mode "lsp-ui-imenu"
+  "Mode showing imenu entries.")
+
+(defun lsp-ui-imenu--refresh ()
+  "Safe refresh imenu content."
+  (interactive)
+  (let ((imenu-buffer (get-buffer lsp-ui-imenu-buffer-name)))
+    (when imenu-buffer
+      (save-selected-window
+        (if (equal (current-buffer) imenu-buffer)
+            (select-window (get-buffer-window lsp-ui-imenu--origin))
+          (setq lsp-ui-imenu--origin (current-buffer)))
+        (lsp-ui-imenu--refresh-content)))))
+
+(defun lsp-ui-imenu--start-refresh (&rest _)
+  "Starts the auto refresh timer."
+  (lsp-ui-util-safe-kill-timer lsp-ui-imenu--refresh-timer)
+  (setq lsp-ui-imenu--refresh-timer
+        (run-with-idle-timer lsp-ui-imenu-auto-refresh-delay nil #'lsp-ui-imenu--refresh)))
+
+(defun lsp-ui-imenu-buffer--enable ()
+  "Enable `lsp-ui-imenu-buffer'."
+  (when lsp-ui-imenu-auto-refresh
+    (cl-case lsp-ui-imenu-auto-refresh
+      (after-save
+       (add-hook 'after-save-hook #'lsp-ui-imenu--start-refresh nil t))
+      (t
+       (add-hook 'after-change-functions #'lsp-ui-imenu--start-refresh nil t)
+       (add-hook 'after-save-hook #'lsp-ui-imenu--start-refresh nil t)))))
+
+(defun lsp-ui-imenu-buffer--disable ()
+  "Disable `lsp-ui-imenu-buffer'."
+  (when lsp-ui-imenu-auto-refresh
+    (cl-case lsp-ui-imenu-auto-refresh
+      (after-save
+       (remove-hook 'after-save-hook #'lsp-ui-imenu--start-refresh t))
+      (t
+       (remove-hook 'after-change-functions #'lsp-ui-imenu--start-refresh t)
+       (remove-hook 'after-save-hook #'lsp-ui-imenu--start-refresh t)))))
+
+(define-minor-mode lsp-ui-imenu-buffer-mode
+  "Minor mode 'lsp-ui-imenu-buffer-mode'."
+  :group lsp-ui-imenu
+  (if lsp-ui-imenu-buffer-mode (lsp-ui-imenu-buffer--enable) (lsp-ui-imenu-buffer--disable)))
+
+(provide 'lsp-ui-imenu)
+;;; lsp-ui-imenu.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-peek.el b/elpa/lsp-ui-20220104.1635/lsp-ui-peek.el
new file mode 100644 (file)
index 0000000..5e1c195
--- /dev/null
@@ -0,0 +1,759 @@
+;;; lsp-ui-peek.el --- Lsp-Ui-Peek  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2017 Sebastien Chapuis
+
+;; Author: Sebastien Chapuis <sebastienNOSPAMchapu.is>
+;; URL: https://github.com/emacs-lsp/lsp-ui
+;; Keywords: languagues, tools
+;; Version: 0.0.1
+
+;;; License
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; Load this file and execute `lsp-ui-peek-find-references'
+;; on a symbol to find its references
+;; or `lsp-ui-peek-find-definitions'.
+;; Type 'q' to close the window.
+;;
+
+;;; Code:
+
+(require 'lsp-protocol)
+(require 'lsp-mode)
+(require 'xref)
+(require 'dash)
+
+(defgroup lsp-ui-peek nil
+  "Improve version of xref with peek feature."
+  :group 'tools
+  :group 'convenience
+  :group 'lsp-ui
+  :link '(custom-manual "(lsp-ui-peek) Top")
+  :link '(info-link "(lsp-ui-peek) Customizing"))
+
+(defcustom lsp-ui-peek-enable t
+  "Whether or not to enable ‘lsp-ui-peek’."
+  :type 'boolean
+  :group 'lsp-ui)
+
+(defcustom lsp-ui-peek-show-directory t
+  "Whether or not to show the directory of files."
+  :type 'boolean
+  :safe t
+  :group 'lsp-ui-peek)
+
+(defcustom lsp-ui-peek-peek-height 20
+  "Height of the peek code."
+  :type 'integer
+  :group 'lsp-ui-peek)
+
+(defcustom lsp-ui-peek-list-width 50
+  "Width of the right panel."
+  :type 'integer
+  :group 'lsp-ui-peek)
+
+(defcustom lsp-ui-peek-fontify 'on-demand
+  "Whether to fontify chunks of code (use semantics colors).
+WARNING: 'always can heavily slow the processing when
+`lsp-ui-peek-expand-function' expands more than 1 file.
+It is recommended to keep the default value of `lsp-ui-peek-expand-function'
+when this variable is set to 'always."
+  :type '(choice (const :tag "Never" never)
+                 (const :tag "On demand" on-demand)
+                 (const :tag "Always" always))
+  :group 'lsp-ui-peek)
+
+(defcustom lsp-ui-peek-always-show nil
+  "Show the peek view even if there is only 1 cross reference.
+By default, the peek view isn't shown if there is 1 xref."
+  :type 'boolean
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-peek
+  '((((background light)) :background "light gray")
+    (t :background "#031A25"))
+  "Face used for the peek."
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-list
+  '((((background light)) :background "light gray")
+    (t :background "#181818"))
+  "Face used to list references."
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-filename
+  '((((background light)) :foreground "red")
+    (t :foreground "dark orange"))
+  "Face used for the filename's reference in the list."
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-line-number
+  '((t :foreground "grey25"))
+  "Line number face."
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-highlight
+  '((((background light)) :background "yellow"
+     :box (:line-width -1 :color "red"))
+    (t :background "white"
+       :foreground "black"
+       :distant-foreground "white"
+       :box (:line-width -1 :color "red")))
+  "Face used to highlight the reference/definition.
+Do not use box, underline or overline prop.  If you want to use
+box, use a negative value for its width.  Those properties deform
+the whole overlay."
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-header
+  '((((background light)) :background "grey30" :foreground "white")
+    (t :background "white" :foreground "black"))
+  "Face used for the headers."
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-footer
+  '((t :inherit lsp-ui-peek-header))
+  "Face used for the footers.  Only the background of this face is used."
+  :group 'lsp-ui-peek)
+
+(defface lsp-ui-peek-selection
+  '((((background light)) :background "grey30" :foreground "white")
+    (t :background "white" :foreground "black"))
+  "Face used for the current selection.
+Do not use box, underline or overline prop.  If you want to use
+box, use a negative value for its width.  Those properties
+deform the whole overlay."
+  :group 'lsp-ui-peek)
+
+(defvar lsp-ui-peek-expand-function 'lsp-ui-peek--expand-buffer
+  "A function used to determinate which file(s) to expand in the list of xrefs.
+The function takes one parameter: a list of cons where the car is the
+filename and the cdr is the number of references in that file.
+It should returns a list of filenames to expand.
+WARNING: If you change this variable and expand more than 1 file, it is
+recommended to set `lsp-ui-peek-fontify' to 'never or 'on-demand, otherwise it
+will cause performances issues.")
+
+(defvar-local lsp-ui-peek--overlay nil)
+(defvar-local lsp-ui-peek--list nil)
+(defvar-local lsp-ui-peek--last-xref nil)
+(defvar-local lsp-ui-peek--selection 0)
+(defvar-local lsp-ui-peek--offset 0)
+(defvar-local lsp-ui-peek--size-list 0)
+(defvar-local lsp-ui-peek--win-start nil)
+(defvar-local lsp-ui-peek--method nil)
+(defvar-local lsp-ui-peek--deactivate-keymap-fn nil)
+
+(defvar lsp--peek-save-major-mode nil
+  "Stores the major mode for lsp ui peek.")
+
+(defvar lsp-ui-peek--jumps (make-hash-table)
+  "Hashtable which stores all jumps on a per window basis.")
+
+(defvar evil--jumps-window-jumps)  ; defined in evil-jumps.el
+
+(defmacro lsp-ui-peek--with-evil-jumps (&rest body)
+  "Make `evil-jumps.el' commands work on `lsp-ui-peek--jumps'."
+  (declare (indent 1))
+  `(let ((evil--jumps-window-jumps lsp-ui-peek--jumps))
+     ,@body))
+
+(with-eval-after-load 'evil-jumps
+  ;; We need to jump through some hoops to prevent the byte-compiler from
+  ;; compiling this code.  We can’t compile the code without requiring
+  ;; ‘evil-macros’.
+  (eval '(progn
+           (evil-define-motion lsp-ui-peek-jump-backward (count)
+                               (lsp-ui-peek--with-evil-jumps
+                                (evil--jump-backward count)
+                                (run-hooks 'xref-after-return-hook)))
+           (evil-define-motion lsp-ui-peek-jump-forward (count)
+                               (lsp-ui-peek--with-evil-jumps
+                                (evil--jump-forward count)
+                                (run-hooks 'xref-after-return-hook))))
+        t))
+
+(defmacro lsp-ui-peek--prop (prop &optional string)
+  `(get-text-property 0 ,prop (or ,string (lsp-ui-peek--get-text-selection) "")))
+
+(defmacro lsp-ui-peek--add-prop (prop &optional string)
+  `(let ((obj (or ,string (lsp-ui-peek--get-text-selection))))
+     (add-text-properties 0 (length obj) ,prop obj)
+     obj))
+
+(defun lsp-ui-peek--truncate (len s)
+  (if (> (string-width s) len)
+      (concat (truncate-string-to-width s (max (- len 2) 0)) "..")
+    s))
+
+(defun lsp-ui-peek--get-text-selection (&optional n)
+  (nth (or n lsp-ui-peek--selection)
+       (--remove (get-text-property 0 'lsp-ui-peek-hidden it) lsp-ui-peek--list)))
+
+(defun lsp-ui-peek--get-selection ()
+  (get-text-property 0 'lsp-ui-peek (or (lsp-ui-peek--get-text-selection) "")))
+
+(defun lsp-ui-peek--visual-index ()
+  (- lsp-ui-peek--selection lsp-ui-peek--offset))
+
+(defun lsp-ui-peek--make-line (index src)
+  (-let* (((s1 . s2) src)
+          (len-s1 (length s1))
+          (len-s2 (length s2))
+          (on-selection (= (1+ (lsp-ui-peek--visual-index)) index))
+          (face-left (if (= index 0) 'lsp-ui-peek-header 'lsp-ui-peek-peek))
+          (face-right (cond (on-selection 'lsp-ui-peek-selection)
+                            ((= index 0) 'lsp-ui-peek-header)
+                            (t 'lsp-ui-peek-list))))
+    (when on-selection
+      (setq s2 (copy-sequence s2))
+      (add-face-text-property 0 len-s2 face-right nil s2))
+    (unless (get-text-property 0 'lsp-ui-peek-faced s2)
+      (add-face-text-property 0 len-s2 face-right t s2)
+      (add-text-properties 0 len-s2 '(lsp-ui-peek-faced t) s2)
+      (add-face-text-property 0 len-s2 'default t s2))
+    (add-face-text-property 0 len-s1 face-left t s1)
+    (add-face-text-property 0 len-s1 'default t s1)
+    (concat
+     s1
+     (propertize "_" 'face face-left 'display `(space :align-to (- right-fringe ,(1+ lsp-ui-peek-list-width))))
+     " "
+     s2
+     (propertize "_" 'face face-right 'display `(space :align-to (- right-fringe 1)))
+     (propertize "\n" 'face face-right))))
+
+(defun lsp-ui-peek--adjust (width strings)
+  (-let* (((s1 . s2) strings))
+    (cons (lsp-ui-peek--truncate (- width (1+ lsp-ui-peek-list-width)) s1)
+          (lsp-ui-peek--truncate (- lsp-ui-peek-list-width 2) s2))))
+
+(defun lsp-ui-peek--make-footer ()
+  ;; Character-only terminals don't support characters of different height
+  (when (display-graphic-p)
+    (list
+     (concat
+      (propertize " "
+                  'face `(:background ,(face-background 'lsp-ui-peek-footer nil t) :height 1)
+                  'display `(space :align-to (- right-fringe ,(1+ lsp-ui-peek-list-width))))
+      (propertize " " 'face '(:height 1)
+                  'display `(space :align-to (- right-fringe ,lsp-ui-peek-list-width)))
+      (propertize " "
+                  'face `(:background ,(face-background 'lsp-ui-peek-footer nil t) :height 1)
+                  'display `(space :align-to (- right-fringe 0)))
+      (propertize "\n" 'face '(:height 1))
+      (propertize "\n" 'face '(:height 0.5))))))
+
+(defun lsp-ui-peek--peek-new (src1 src2)
+  (-let* ((win-width (- (window-text-width)
+                        (if (bound-and-true-p display-line-numbers-mode)
+                            (+ 2 (line-number-display-width))
+                          0)))
+          (string (-some--> (-zip-fill "" src1 src2)
+                    (--map (lsp-ui-peek--adjust win-width it) it)
+                    (-map-indexed 'lsp-ui-peek--make-line it)
+                    (-concat it (lsp-ui-peek--make-footer))))
+          (next-line (line-beginning-position 2))
+          (ov (or (when (overlayp lsp-ui-peek--overlay) lsp-ui-peek--overlay)
+                  (make-overlay next-line next-line))))
+    (setq lsp-ui-peek--overlay ov)
+    (overlay-put ov 'after-string (mapconcat 'identity string ""))
+    (overlay-put ov 'display-line-numbers-disable t)
+    (overlay-put ov 'window (get-buffer-window))))
+
+(defun lsp-ui-peek--expand-buffer (files)
+  (if (--any? (equal (car it) buffer-file-name) files)
+      (list buffer-file-name)
+    (list (caar files))))
+
+(defun lsp-ui-peek--expand (xrefs)
+  (let* ((to-expand (->> (--map (cons (plist-get it :file) (plist-get it :count)) xrefs)
+                         (funcall lsp-ui-peek-expand-function)))
+         first)
+    (while (nth lsp-ui-peek--selection lsp-ui-peek--list)
+      (when (and (lsp-ui-peek--prop 'xrefs)
+                 (member (lsp-ui-peek--prop 'file) to-expand))
+        (unless first
+          (setq first (1+ lsp-ui-peek--selection)))
+        (lsp-ui-peek--toggle-file t))
+      (setq lsp-ui-peek--selection (1+ lsp-ui-peek--selection)))
+    (setq lsp-ui-peek--selection (or first 0))
+    (lsp-ui-peek--recenter)))
+
+(defun lsp-ui-peek--show (xrefs)
+  "Create a window to list references/defintions.
+XREFS is a list of references/definitions."
+  (setq lsp-ui-peek--win-start (window-start)
+        lsp-ui-peek--selection 0
+        lsp-ui-peek--offset 0
+        lsp-ui-peek--size-list 0
+        lsp-ui-peek--list nil)
+  (when (eq (logand lsp-ui-peek-peek-height 1) 1)
+    (setq lsp-ui-peek-peek-height (1+ lsp-ui-peek-peek-height)))
+  (when (< (- (line-number-at-pos (window-end)) (line-number-at-pos))
+           (+ lsp-ui-peek-peek-height 3))
+    (recenter 15))
+  (setq xrefs (--sort (string< (plist-get it :file) (plist-get other :file)) xrefs))
+  (--each xrefs
+    (-let* (((&plist :file filename :xrefs xrefs :count count) it)
+            (len-str (number-to-string count)))
+      (setq lsp-ui-peek--size-list (+ lsp-ui-peek--size-list count))
+      (push (concat (propertize (if lsp-ui-peek-show-directory
+                                    (lsp-ui--workspace-path filename)
+                                  (file-name-nondirectory filename))
+                                'face 'lsp-ui-peek-filename
+                                'file filename
+                                'xrefs xrefs)
+                    (propertize " " 'display `(space :align-to (- right-fringe
+                                                                  ;; Account for Emacs TTY's window divider
+                                                                  ;; Without this leeway, the reference count
+                                                                  ;; string goes to next line - impairs readability
+                                                                  ,(if (display-graphic-p) 0 1)
+                                                                  ,(1+ (length len-str)))))
+                    (propertize len-str 'face 'lsp-ui-peek-filename))
+            lsp-ui-peek--list)))
+  (setq lsp-ui-peek--list (nreverse lsp-ui-peek--list))
+  (lsp-ui-peek--expand xrefs)
+  (lsp-ui-peek--peek))
+
+(defun lsp-ui-peek--recenter ()
+  (let ((half-height (/ lsp-ui-peek-peek-height 2)))
+    (when (> lsp-ui-peek--selection half-height)
+      (setq lsp-ui-peek--offset (- lsp-ui-peek--selection (1- half-height))))))
+
+(defun lsp-ui-peek--fill (min-len list)
+  (let ((len (length list)))
+    (if (< len min-len)
+        (append list (-repeat (- min-len len) ""))
+      list)))
+
+(defun lsp-ui-peek--render (major string)
+  (with-temp-buffer
+    (insert string)
+    (delay-mode-hooks
+      (let ((inhibit-message t))
+        (funcall major))
+      (ignore-errors
+        (font-lock-ensure)))
+    (buffer-string)))
+
+(defun lsp-ui-peek--peek ()
+  "Show reference's chunk of code."
+  (-let* ((xref (lsp-ui-peek--get-selection))
+          ((&plist :file file :chunk chunk) (or xref lsp-ui-peek--last-xref))
+          (header (concat " " (lsp-ui--workspace-path file) "\n"))
+          (header2 (format " %s %s" lsp-ui-peek--size-list
+                           (string-remove-prefix "workspace/" (string-remove-prefix "textDocument/" lsp-ui-peek--method))))
+          (ref-view (--> chunk
+                         (subst-char-in-string ?\t ?\s it)
+                         (concat header it)
+                         (split-string it "\n")))
+          (list-refs (->> lsp-ui-peek--list
+                          (--remove (lsp-ui-peek--prop 'lsp-ui-peek-hidden it))
+                          (-drop lsp-ui-peek--offset)
+                          (-take (1- lsp-ui-peek-peek-height))
+                          (lsp-ui-peek--fill (1- lsp-ui-peek-peek-height))
+                          (-concat (list header2)))))
+    (setq lsp-ui-peek--last-xref (or xref lsp-ui-peek--last-xref))
+    (lsp-ui-peek--peek-new ref-view list-refs)
+    (and (fboundp 'lsp-ui-doc--hide-frame)
+         (lsp-ui-doc--hide-frame))))
+
+(defun lsp-ui-peek--toggle-text-prop (s)
+  (let ((state (lsp-ui-peek--prop 'lsp-ui-peek-hidden s)))
+    (lsp-ui-peek--add-prop `(lsp-ui-peek-hidden ,(not state)) s)))
+
+(defun lsp-ui-peek--toggle-hidden (file)
+  (setq lsp-ui-peek--list
+        (--map-when (string= (plist-get (lsp-ui-peek--prop 'lsp-ui-peek it) :file) file)
+                    (prog1 it (lsp-ui-peek--toggle-text-prop it))
+                    lsp-ui-peek--list)))
+
+(defun lsp-ui-peek--remove-hidden (file)
+  (setq lsp-ui-peek--list
+        (--map-when (string= (plist-get (lsp-ui-peek--prop 'lsp-ui-peek it) :file) file)
+                    (prog1 it (lsp-ui-peek--add-prop '(lsp-ui-peek-hidden nil) it))
+                    lsp-ui-peek--list)))
+
+(defun lsp-ui-peek--make-ref-line (xref)
+  (-let* (((&plist :summary summary :line line :file file) xref)
+          (string (format "%-3s %s"
+                          (propertize (number-to-string (1+ line))
+                                      'face 'lsp-ui-peek-line-number)
+                          (string-trim summary))))
+    (lsp-ui-peek--add-prop `(lsp-ui-peek ,xref file ,file) string)))
+
+(defun lsp-ui-peek--insert-xrefs (xrefs filename index)
+  (setq lsp-ui-peek--list (--> (lsp-ui-peek--get-xrefs-in-file (cons filename xrefs))
+                               (-map 'lsp-ui-peek--make-ref-line it)
+                               (-insert-at (1+ index) it lsp-ui-peek--list)
+                               (-flatten it)))
+  (lsp-ui-peek--add-prop '(xrefs nil)))
+
+(defun lsp-ui-peek--toggle-file (&optional no-update)
+  (interactive)
+  (-if-let* ((xrefs (lsp-ui-peek--prop 'xrefs))
+             (filename (lsp-ui-peek--prop 'file))
+             (index (--find-index (equal (lsp-ui-peek--prop 'file it) filename)
+                                  lsp-ui-peek--list)))
+      (lsp-ui-peek--insert-xrefs xrefs filename index)
+    (let ((file (lsp-ui-peek--prop 'file)))
+      (lsp-ui-peek--toggle-hidden file)
+      (while (not (equal file (lsp-ui-peek--prop 'file)))
+        (lsp-ui-peek--select-prev t))))
+  (unless no-update
+    (lsp-ui-peek--peek)))
+
+(defun lsp-ui-peek--select (index)
+  (setq lsp-ui-peek--selection (+ lsp-ui-peek--selection index)))
+
+(defun lsp-ui-peek--select-next (&optional no-update)
+  (interactive)
+  (when (lsp-ui-peek--get-text-selection (1+ lsp-ui-peek--selection))
+    (lsp-ui-peek--select 1)
+    (while (> (lsp-ui-peek--visual-index) (- lsp-ui-peek-peek-height 2))
+      (setq lsp-ui-peek--offset (1+ lsp-ui-peek--offset)))
+    (unless no-update
+      (lsp-ui-peek--peek))))
+
+(defun lsp-ui-peek--select-prev (&optional no-update)
+  (interactive)
+  (when (> lsp-ui-peek--selection 0)
+    (lsp-ui-peek--select -1)
+    (while (< (lsp-ui-peek--visual-index) 0)
+      (setq lsp-ui-peek--offset (1- lsp-ui-peek--offset))))
+  (unless no-update
+    (lsp-ui-peek--peek)))
+
+(defun lsp-ui-peek--skip-refs (fn)
+  (let ((last-file (lsp-ui-peek--prop 'file))
+        last-selection)
+    (when (lsp-ui-peek--get-selection)
+      (while (and (equal (lsp-ui-peek--prop 'file) last-file)
+                  (not (equal last-selection lsp-ui-peek--selection)))
+        (setq last-selection lsp-ui-peek--selection)
+        (funcall fn t)))))
+
+(defun lsp-ui-peek--select-prev-file ()
+  (interactive)
+  (if (not (lsp-ui-peek--get-selection))
+      (lsp-ui-peek--select-prev)
+    (lsp-ui-peek--skip-refs 'lsp-ui-peek--select-prev)
+    (when (lsp-ui-peek--get-selection)
+      (lsp-ui-peek--skip-refs 'lsp-ui-peek--select-prev)
+      (unless (= lsp-ui-peek--selection 0)
+        (lsp-ui-peek--select-next t))))
+  (if (lsp-ui-peek--prop 'xrefs)
+      (lsp-ui-peek--toggle-file)
+    (lsp-ui-peek--remove-hidden (lsp-ui-peek--prop 'file)))
+  (lsp-ui-peek--select-next t)
+  (lsp-ui-peek--recenter)
+  (lsp-ui-peek--peek))
+
+(defun lsp-ui-peek--select-next-file ()
+  (interactive)
+  (lsp-ui-peek--skip-refs 'lsp-ui-peek--select-next)
+  (if (lsp-ui-peek--prop 'xrefs)
+      (lsp-ui-peek--toggle-file)
+    (lsp-ui-peek--remove-hidden (lsp-ui-peek--prop 'file)))
+  (lsp-ui-peek--select-next t)
+  (lsp-ui-peek--recenter)
+  (lsp-ui-peek--peek))
+
+(defun lsp-ui-peek--peek-hide ()
+  "Hide the chunk of code and restore previous state."
+  (when (overlayp lsp-ui-peek--overlay)
+    (delete-overlay lsp-ui-peek--overlay))
+  (setq lsp-ui-peek--overlay nil
+        lsp-ui-peek--last-xref nil)
+  (when lsp-ui-peek--win-start
+    (set-window-start (get-buffer-window) lsp-ui-peek--win-start)))
+
+(defun lsp-ui-peek--deactivate-keymap ()
+  "Deactivate keymap."
+  (-when-let (fn lsp-ui-peek--deactivate-keymap-fn)
+    (setq lsp-ui-peek--deactivate-keymap-fn nil)
+    (funcall fn)))
+
+(defun lsp-ui-peek--goto-xref (&optional x other-window)
+  "Go to a reference/definition."
+  (interactive)
+  (-if-let (xref (or x (lsp-ui-peek--get-selection)))
+      (-let (((&plist :file file :line line :column column) xref)
+             (buffer (current-buffer)))
+        (if (not (file-readable-p file))
+            (user-error "File not readable: %s" file)
+          (setq lsp-ui-peek--win-start nil)
+          (lsp-ui-peek--abort)
+          (let ((marker (with-current-buffer
+                            (or (get-file-buffer file)
+                                (find-file-noselect file))
+                          (save-restriction
+                            (widen)
+                            (save-excursion
+                              ;; When we jump to a file with line/column unspecified,
+                              ;; we do not want to move the point if the buffer exists.
+                              ;; We interpret line=column=0 differently here.
+                              (when (> (+ line column) 0)
+                                (goto-char 1)
+                                (forward-line line)
+                                (forward-char column))
+                              (point-marker)))))
+                (cur-buffer-workspaces (and (boundp 'lsp--buffer-workspaces) lsp--buffer-workspaces)))
+            (if other-window
+                (pop-to-buffer (marker-buffer marker) t)
+              (switch-to-buffer (marker-buffer marker)))
+            (with-current-buffer buffer
+              (lsp-ui-peek-mode -1))
+            (unless lsp--buffer-workspaces
+              (setq lsp--buffer-workspaces cur-buffer-workspaces)
+              (lsp-mode 1)
+              (dolist (workspace cur-buffer-workspaces)
+                (lsp--open-in-workspace workspace)))
+            (goto-char marker)
+            (run-hooks 'xref-after-jump-hook))))
+    (lsp-ui-peek--toggle-file)))
+
+(defun lsp-ui-peek--goto-xref-other-window ()
+  (interactive)
+  (lsp-ui-peek--goto-xref nil t))
+
+(defvar lsp-ui-peek-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map t)
+    (define-key map "\e\e\e" 'lsp-ui-peek--abort)
+    (define-key map "\C-g" 'lsp-ui-peek--abort)
+    (define-key map (kbd "M-n") 'lsp-ui-peek--select-next-file)
+    (define-key map (kbd "<right>") 'lsp-ui-peek--select-next-file)
+    (define-key map (kbd "M-p") 'lsp-ui-peek--select-prev-file)
+    (define-key map (kbd "<left>") 'lsp-ui-peek--select-prev-file)
+    (define-key map (kbd "C-n") 'lsp-ui-peek--select-next)
+    (define-key map (kbd "n") 'lsp-ui-peek--select-next)
+    (define-key map (kbd "<down>") 'lsp-ui-peek--select-next)
+    (define-key map (kbd "C-p") 'lsp-ui-peek--select-prev)
+    (define-key map (kbd "p") 'lsp-ui-peek--select-prev)
+    (define-key map (kbd "<up>") 'lsp-ui-peek--select-prev)
+    (define-key map (kbd "TAB") 'lsp-ui-peek--toggle-file)
+    (define-key map (kbd "q") 'lsp-ui-peek--abort)
+    (define-key map (kbd "RET") 'lsp-ui-peek--goto-xref)
+    (define-key map (kbd "M-RET") 'lsp-ui-peek--goto-xref-other-window)
+    map)
+  "Keymap for ‘lsp-ui-peek-mode’.")
+
+(defun lsp-ui-peek--disable ()
+  "Do not call this function, call `lsp-ui-peek--abort' instead."
+  (when (bound-and-true-p lsp-ui-peek-mode)
+    (lsp-ui-peek-mode -1)
+    (lsp-ui-peek--peek-hide)))
+
+(defun lsp-ui-peek--abort ()
+  "Abort peek."
+  (interactive)
+  ;; The timer fixes https://github.com/emacs-lsp/lsp-ui/issues/33
+  (run-with-idle-timer 0 nil 'lsp-ui-peek--disable))
+
+(define-minor-mode lsp-ui-peek-mode
+  "Mode for lsp-ui-peek."
+  :init-value nil
+  (if lsp-ui-peek-mode
+      (setq lsp-ui-peek--deactivate-keymap-fn (set-transient-map lsp-ui-peek-mode-map t 'lsp-ui-peek--abort))
+    (lsp-ui-peek--deactivate-keymap)
+    (lsp-ui-peek--peek-hide)))
+
+(defun lsp-ui-peek--find-xrefs (input method param)
+  "Find INPUT references.
+METHOD is ‘references’, ‘definitions’, `implementation` or a custom kind.
+PARAM is the request params."
+  (setq lsp-ui-peek--method method)
+  (let ((xrefs (lsp-ui-peek--get-references method param)))
+    (unless xrefs
+      (user-error "Not found for: %s"  input))
+    (xref-push-marker-stack)
+    (when (featurep 'evil-jumps)
+      (lsp-ui-peek--with-evil-jumps (evil-set-jump)))
+    (if (and (not lsp-ui-peek-always-show)
+             (not (cdr xrefs))
+             (= (length (plist-get (car xrefs) :xrefs)) 1))
+        (let ((x (car (plist-get (car xrefs) :xrefs))))
+          (-if-let (uri (lsp:location-uri x))
+              (-let (((&Range :start (&Position :line :character)) (lsp:location-range x)))
+                (lsp-ui-peek--goto-xref `(:file ,(lsp--uri-to-path uri) :line ,line :column ,character)))
+            (-let (((&Range :start (&Position :line :character)) (or (lsp:location-link-target-selection-range x)
+                                                                     (lsp:location-link-target-range x))))
+              (lsp-ui-peek--goto-xref `(:file ,(lsp--uri-to-path (lsp:location-link-target-uri x)) :line ,line :column ,character)))))
+      (lsp-ui-peek-mode)
+      (lsp-ui-peek--show xrefs))))
+
+(defun lsp-ui-peek-find-references (&optional include-declaration extra)
+  "Find references to the IDENTIFIER at point."
+  (interactive)
+  (lsp-ui-peek--find-xrefs (symbol-at-point) "textDocument/references"
+                           (append extra (lsp--make-reference-params nil include-declaration))))
+
+(defun lsp-ui-peek-find-definitions (&optional extra)
+  "Find definitions to the IDENTIFIER at point."
+  (interactive)
+  (lsp-ui-peek--find-xrefs (symbol-at-point) "textDocument/definition"
+                           (append extra (lsp--text-document-position-params))))
+
+(defun lsp-ui-peek-find-implementation (&optional extra)
+  "Find implementation locations of the symbol at point."
+  (interactive)
+  (lsp-ui-peek--find-xrefs (symbol-at-point) "textDocument/implementation"
+                           (append extra (lsp--text-document-position-params))))
+
+(defun lsp-ui-peek-find-workspace-symbol (pattern &optional extra)
+  "Find symbols in the worskpace.
+The symbols are found matching PATTERN."
+  (interactive (list (read-string "workspace/symbol: "
+                                  nil 'xref--read-pattern-history)))
+  (lsp-ui-peek--find-xrefs pattern "workspace/symbol"
+                           (append extra (lsp-make-workspace-symbol-params :query pattern))))
+
+(defun lsp-ui-peek-find-custom (method &optional extra)
+  "Find custom references.
+KIND is a symbol to name the references (definition, reference, ..).
+REQUEST is the method string to send the the language server.
+EXTRA is a plist of extra parameters."
+  (lsp-ui-peek--find-xrefs (symbol-at-point) method
+                           (append extra (lsp--text-document-position-params))))
+
+(defun lsp-ui-peek--extract-chunk-from-buffer (pos start end)
+  "Return the chunk of code pointed to by POS (a Position object) in the current buffer.
+START and END are delimiters."
+  (let* ((point (lsp--position-to-point pos))
+         (inhibit-field-text-motion t)
+         (line-start (1+ (- 1 (/ lsp-ui-peek-peek-height 2))))
+         (line-end (/ lsp-ui-peek-peek-height 2)))
+    (save-excursion
+      (goto-char point)
+      (let* ((before (buffer-substring (line-beginning-position line-start) (line-beginning-position)))
+             (line (buffer-substring (line-beginning-position) (line-end-position)))
+             (after (buffer-substring (line-end-position) (line-end-position line-end)))
+             (len (length line))
+             (chunk (concat before line after))
+             (start-in-chunk (length before)))
+
+        (when (eq lsp-ui-peek-fontify 'on-demand)
+          (setq chunk (lsp-ui-peek--render lsp--peek-save-major-mode chunk)))
+
+        (remove-text-properties (+ (min start len) start-in-chunk)
+                                (+ (if (null end) len (min end len)) start-in-chunk) '(face nil)
+                                chunk)
+
+        (add-face-text-property (+ (min start len) start-in-chunk)
+                                (+ (if (null end) len (min end len)) start-in-chunk)
+                                'lsp-ui-peek-highlight t chunk)
+
+        `(,(substring chunk start-in-chunk (+ start-in-chunk len)) . ,chunk)))))
+
+(defun lsp-ui-peek--xref-make-item (filename loc)
+  "Return an item from FILENAME given a LOC.
+LOCATION can be either a LSP Location or SymbolInformation."
+  ;; TODO: Read more informations from SymbolInformation.
+  ;;       For now, only the location is used.
+  (-let* ((loc (or (lsp:symbol-information-location loc) loc))
+          (range (or (lsp:location-range loc)
+                     (lsp:location-link-target-selection-range loc)
+                     (lsp:location-link-target-range loc)))
+          ((&Range :start pos-start :end pos-end) range)
+          ((&Position :line start-line :character start-col) pos-start)
+          ((&Position :line end-line :character end-col) pos-end)
+          ((line . chunk) (lsp-ui-peek--extract-chunk-from-buffer pos-start start-col
+                                                                  (when (= start-line end-line) end-col))))
+    (list :summary (or line filename)
+          :chunk (or chunk filename)
+          :file filename
+          :line start-line
+          :column start-col)))
+
+(defun lsp-ui-peek--fontify-buffer (filename)
+  (when (eq lsp-ui-peek-fontify 'always)
+    (unless buffer-file-name
+      (make-local-variable 'delay-mode-hooks)
+      (let ((buffer-file-name filename)
+            (enable-local-variables nil)
+            (inhibit-message t)
+            (delay-mode-hooks t))
+        (set-auto-mode)))
+    (font-lock-ensure)))
+
+(defun lsp-ui-peek--get-xrefs-in-file (file)
+  "Return all references that contain a file.
+FILE is a cons where its car is the filename and the cdr is a list of Locations
+within the file.  We open and/or create the file/buffer only once for all
+references.  The function returns a list of `ls-xref-item'."
+  (let* ((filename (car file))
+         (visiting (find-buffer-visiting filename))
+         (fn (lambda (loc) (lsp-ui-peek--xref-make-item filename loc))))
+    (setq lsp--peek-save-major-mode major-mode)
+    (cond
+     (visiting
+      (with-temp-buffer
+        (insert-buffer-substring-no-properties visiting)
+        (lsp-ui-peek--fontify-buffer filename)
+        (mapcar fn (cdr file))))
+     ((file-readable-p filename)
+      (with-temp-buffer
+        (insert-file-contents-literally filename)
+        (lsp-ui-peek--fontify-buffer filename)
+        (mapcar fn (cdr file))))
+     (t (user-error "Cannot read %s" filename)))))
+
+(defun lsp-ui-peek--get-xrefs-list (file)
+  "Return a list of xrefs in FILE."
+  (-let* (((filename . xrefs) file))
+    `(:file ,filename :xrefs ,xrefs :count ,(length xrefs))))
+
+(defun lsp-ui-peek--get-references (method params)
+  "Get all references/definitions for the symbol under point.
+Returns item(s)."
+  (-when-let* ((locs (lsp-request method params))
+               (locs (if (listp locs)
+                         locs
+                       (if (vectorp locs)
+                           (append locs nil)
+                         (list locs)))))
+    (-filter
+     (-lambda ((&plist :file))
+       (or (f-file? file)
+           (ignore
+            (lsp-log "The following file %s is missing, ignoring from the results."
+                     file))))
+     (mapcar #'lsp-ui-peek--get-xrefs-list
+             (if (lsp:location-uri (car locs))
+                 ;; Location[]
+                 (--group-by (lsp--uri-to-path (lsp:location-uri it)) locs)
+               ;; LocationLink[]
+               (--group-by (lsp--uri-to-path (lsp:location-link-target-uri it)) locs))))))
+
+(defvar lsp-ui-mode-map)
+
+(defun lsp-ui-peek-enable (_enable)
+  (interactive)
+  (unless (bound-and-true-p lsp-ui-mode-map)
+    (user-error "Please load lsp-ui before trying to enable lsp-ui-peek")))
+
+;; lsp-ui.el loads lsp-ui-peek.el, so we can’t ‘require’ lsp-ui.
+;; FIXME: Remove this cyclic dependency.
+(declare-function lsp-ui--workspace-path "lsp-ui" (path))
+
+(declare-function evil-set-jump "ext:evil-jumps.el" (&optional pos))
+
+(provide 'lsp-ui-peek)
+;;; lsp-ui-peek.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-pkg.el b/elpa/lsp-ui-20220104.1635/lsp-ui-pkg.el
new file mode 100644 (file)
index 0000000..8be3286
--- /dev/null
@@ -0,0 +1,15 @@
+(define-package "lsp-ui" "20220104.1635" "UI modules for lsp-mode"
+  '((emacs "26.1")
+    (dash "2.18.0")
+    (lsp-mode "6.0")
+    (markdown-mode "2.3"))
+  :commit "21ce926eedd41ef305c2d89412506ce59b1a7eac" :authors
+  '(("Sebastien Chapuis <sebastienNOSPAMchapu.is>, Fangrui Song" . "iNOSPAMmaskray.me"))
+  :maintainer
+  '("Sebastien Chapuis <sebastienNOSPAMchapu.is>, Fangrui Song" . "iNOSPAMmaskray.me")
+  :keywords
+  '("languages" "tools")
+  :url "https://github.com/emacs-lsp/lsp-ui")
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-sideline.el b/elpa/lsp-ui-20220104.1635/lsp-ui-sideline.el
new file mode 100644 (file)
index 0000000..f627a6a
--- /dev/null
@@ -0,0 +1,768 @@
+;;; lsp-ui-sideline.el --- Lsp-Ui-Sideline  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2017 Sebastien Chapuis
+
+;; Author: Sebastien Chapuis <sebastienNOSPAMchapu.is>
+;; URL: https://github.com/emacs-lsp/lsp-ui
+;; Keywords: languages, tools
+;; Version: 6.2
+
+;;; License
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; Utility to show information for the current line
+
+;;; Code:
+
+(require 'lsp-ui-util)
+(require 'lsp-protocol)
+(require 'lsp-mode)
+(require 'flycheck nil 'noerror)
+(require 'dash)
+(require 'seq)
+(require 'subr-x)
+(require 'face-remap)
+
+(defvar flycheck-display-errors-function)
+(declare-function flycheck-overlay-errors-in "ext:flycheck.el")
+(declare-function flycheck-error-format-message-and-id "ext:flycheck.el")
+(declare-function flycheck-error-level "ext:flycheck.el")
+
+(defgroup lsp-ui-sideline nil
+  "Display information for the current line."
+  :group 'tools
+  :group 'convenience
+  :group 'lsp-ui
+  :link '(custom-manual "(lsp-ui-sideline) Top")
+  :link '(info-link "(lsp-ui-sideline) Customizing"))
+
+(defcustom lsp-ui-sideline-enable t
+  "Whether or not to enable ‘lsp-ui-sideline’."
+  :type 'boolean
+  :group 'lsp-ui)
+
+(defcustom lsp-ui-sideline-ignore-duplicate nil
+  "Ignore duplicates when there is a same symbol with the same contents."
+  :type 'boolean
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-show-symbol t
+  "When t, show the symbol name on the right of the information."
+  :type 'boolean
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-show-hover nil
+  "Whether to show hover messages in sideline."
+  :type 'boolean
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-show-diagnostics t
+  "Whether to show diagnostics messages in sideline."
+  :type 'boolean
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-show-code-actions nil
+  "Whether to show code actions in sideline."
+  :type 'boolean
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-update-mode 'point
+  "Define the mode for updating sideline actions.
+
+When set to `line' the actions will be updated when user
+changes current line otherwise the actions will be updated
+when user changes current point."
+  :type '(choice (const line)
+                 (const point))
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-delay 0.2
+  "Number of seconds to wait before showing sideline."
+  :type 'number
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-diagnostic-max-lines 1
+  "Maximum number of lines to show of diagnostics in sideline."
+  :type 'integer
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-diagnostic-max-line-length 100
+  "Maximum line length of diagnostics in sideline."
+  :type 'integer
+  :group 'lsp-ui-sideline)
+
+(defconst lsp-ui-sideline-actions-icon-default
+  (and (bound-and-true-p lsp-ui-resources-dir)
+       (image-type-available-p 'png)
+       (expand-file-name "lightbulb.png" lsp-ui-resources-dir)))
+
+;; TODO: Set the default actions to `nil' temporarily due to image
+;; scale issue on Emacs version 26.3 or below.
+;;
+;; See #573
+(defcustom lsp-ui-sideline-actions-icon nil
+  "Image file for actions.  It must be a png file."
+  :type '(choice file (const :tag "Disable" nil))
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-wait-for-all-symbols t
+  "Wait for all symbols before displaying info in sideline."
+  :type 'boolean
+  :group 'lsp-ui-sideline)
+
+(defcustom lsp-ui-sideline-actions-kind-regex "quickfix.*\\|refactor.*"
+  "Regex for the code actions kinds to show in the sideline."
+  :type 'string
+  :group 'lsp-ui-sideline)
+
+(defvar lsp-ui-sideline-code-actions-prefix ""
+  "Prefix to insert before the code action title.
+This can be used to insert, for example, an unicode character: 💡")
+
+(defvar-local lsp-ui-sideline--ovs nil
+  "Overlays used by `lsp-ui-sideline'.")
+
+(defvar-local lsp-ui-sideline--occupied-lines nil
+  "List of lines occupied by an overlay of `lsp-ui-sideline'.")
+
+(defvar-local lsp-ui-sideline--first-line-pushed nil
+  "Record weather if we display sideline in the first line.
+
+If we do, then sideline will always look downward instead of the upward
+direction.
+
+This prevent sideline displays below than the first line, which it will cause
+weird looking user interface.")
+
+(defvar-local lsp-ui-sideline--tag nil
+  "Tag marking where the last operation was based.
+It is used to know when the cursor has changed its line or point.")
+
+(defvar-local lsp-ui-sideline--last-width nil
+  "Value of window's width on the last operation.
+It is used to know when the window has changed of width.")
+
+(defvar-local lsp-ui-sideline--last-line-number nil
+  "Line number on the last operation.
+Used to avoid calling `line-number-at-pos' when we're on the same line.")
+
+(defvar-local lsp-ui-sideline--timer nil)
+
+(defvar-local lsp-ui-sideline--code-actions nil
+  "Holds the latest code actions.")
+
+(defvar-local lsp-ui-sideline--cached-infos nil
+  "Cache of rendered line when `lsp-ui-sideline-wait-for-all-symbols'
+is nil. Used to not re-render the same line multiple times.")
+
+(defface lsp-ui-sideline-symbol
+  '((t :foreground "grey"
+       :box (:line-width -1 :color "grey")
+       :height 0.99))
+  "Face used to highlight symbols."
+  :group 'lsp-ui-sideline)
+
+(defface lsp-ui-sideline-current-symbol
+  '((((background light))
+     :foreground "black"
+     :weight ultra-bold
+     :box (:line-width -1 :color "black")
+     :height 0.99)
+    (t :foreground "white"
+       :weight ultra-bold
+       :box (:line-width -1 :color "white")
+       :height 0.99))
+  "Face used to highlight the symbol on point."
+  :group 'lsp-ui-sideline)
+
+(defface lsp-ui-sideline-code-action
+  '((((background light)) :foreground "DarkOrange")
+    (t :foreground "yellow"))
+  "Face used to highlight code action text."
+  :group 'lsp-ui-sideline)
+
+(defface lsp-ui-sideline-symbol-info
+  '((t :slant italic :height 0.99))
+  "Face used to highlight the symbols informations (LSP hover)."
+  :group 'lsp-ui-sideline)
+
+(defface lsp-ui-sideline-global
+  '((t))
+  "Face which apply to all overlays.
+This face have a low priority over the others."
+  :group 'lsp-ui-sideline)
+
+(defun lsp-ui-sideline--first-line-p (pos)
+  "Return non-nil if POS is on the first line."
+  (when (integerp pos)
+    (save-excursion (goto-char 1) (forward-line 1) (> (point) pos))))
+
+(defun lsp-ui-sideline--calc-space (win-width str-len index)
+  "Calculate whether there is enough space on line.
+If there is enough space, it returns the point of the last
+character on the line.
+
+WIN-WIDTH is the window width.
+STR-LEN is the string size.
+INDEX is the line number (relative to the current line)."
+  (let ((eol (line-end-position index)))
+    (unless (member eol lsp-ui-sideline--occupied-lines)
+      (save-excursion
+        (goto-char eol)
+        (end-of-line)
+        (when (>= (- win-width (current-column)) str-len)
+          eol)))))
+
+(defun lsp-ui-sideline--find-line (str-len bol eol &optional up offset)
+  "Find a line where the string can be inserted.
+
+It loops on the nexts lines to find enough space.  Returns the point
+of the last character on the line.
+
+Argument STR-LEN is the string size.
+Argument BOL and EOL are beginning and ending of the user point line.
+If optional argument UP is non-nil, it loops on the previous lines.
+If optional argument OFFSET is non-nil, it starts search OFFSET lines
+from user point line."
+  (let ((win-width (lsp-ui-sideline--window-width))
+        (inhibit-field-text-motion t)
+        (index (if (null offset) 1 offset))
+        pos)
+    (while (and (null pos) (<= (abs index) 30))
+      (setq index (if up (1- index) (1+ index)))
+      (setq pos (lsp-ui-sideline--calc-space win-width str-len index)))
+    (if (and up (or (null pos) (and (<= pos 1) lsp-ui-sideline--first-line-pushed)))
+        (lsp-ui-sideline--find-line str-len bol eol nil offset)
+      (when (and (null lsp-ui-sideline--first-line-pushed)
+                 (lsp-ui-sideline--first-line-p pos))
+        (setq lsp-ui-sideline--first-line-pushed t))  ; mark first line push
+      (and pos (or (> pos eol) (< pos bol))
+           (push pos lsp-ui-sideline--occupied-lines)
+           (list pos (1- index))))))
+
+(defun lsp-ui-sideline--delete-ov ()
+  "Delete overlays."
+  (seq-do 'delete-overlay lsp-ui-sideline--ovs)
+  (setq lsp-ui-sideline--tag nil
+        lsp-ui-sideline--cached-infos nil
+        lsp-ui-sideline--occupied-lines nil
+        lsp-ui-sideline--first-line-pushed (lsp-ui-sideline--first-line-p (point))
+        lsp-ui-sideline--ovs nil))
+
+(defun lsp-ui-sideline--extract-info (contents)
+  "Extract the line to print from CONTENTS.
+CONTENTS can be differents type of values:
+MarkedString | MarkedString[] | MarkupContent (as defined in the LSP).
+We prioritize string with a language (which is probably a type or a
+function signature)."
+  (when contents
+    (cond
+     ((lsp-marked-string? contents) contents)
+     ((vectorp contents)
+      (seq-find (lambda (it) (and (lsp-marked-string? it)
+                                  (lsp-get-renderer (lsp:marked-string-language it))))
+                contents))
+     ((lsp-markup-content? contents) contents))))
+
+(defun lsp-ui-sideline--format-info (marked-string win-width)
+  "Format MARKED-STRING.
+If the string has a language, we fontify it with the function provided
+by `lsp-mode'.
+MARKED-STRING is the string returned by `lsp-ui-sideline--extract-info'."
+  (when (and marked-string (or (lsp-marked-string? marked-string) (lsp-markup-content? marked-string)))
+    (setq marked-string (lsp--render-element marked-string))
+    (add-face-text-property 0 (length marked-string) 'lsp-ui-sideline-symbol-info nil marked-string)
+    (add-face-text-property 0 (length marked-string) 'default t marked-string)
+    (->> (if (> (length marked-string) (/ win-width 2))
+             (car (split-string (string-trim-left marked-string) "[\r\n]+"))
+           marked-string)
+         (replace-regexp-in-string "[\n\r\t ]+" " "))))
+
+(defun lsp-ui-sideline--align (&rest lengths)
+  "Align sideline string by LENGTHS from the right of the window."
+  (+ (apply '+ lengths)
+     (if (display-graphic-p) 1 2)))
+
+(defun lsp-ui-sideline--compute-height nil
+  "Return a fixed size for text in sideline."
+  (if (null text-scale-mode-remapping)
+      '(height 1)
+    ;; Readjust height when text-scale-mode is used
+    (list 'height
+          (/ 1 (or (plist-get (cdr text-scale-mode-remapping) :height)
+                   1)))))
+
+(defun lsp-ui-sideline--make-display-string (info symbol current)
+  "Make final string to display in buffer.
+INFO is the information to display.
+SYMBOL is the symbol associated with the info.
+CURRENT is non-nil when the point is on the symbol."
+  (let* ((face (if current 'lsp-ui-sideline-current-symbol 'lsp-ui-sideline-symbol))
+         (str (if lsp-ui-sideline-show-symbol
+                  (concat info " " (propertize (concat " " symbol " ") 'face face))
+                info))
+         (len (length str))
+         (margin (lsp-ui-sideline--margin-width)))
+    (add-face-text-property 0 len 'lsp-ui-sideline-global nil str)
+    (concat
+     (propertize " " 'display `(space :align-to (- right-fringe ,(lsp-ui-sideline--align len margin))))
+     (propertize str 'display (lsp-ui-sideline--compute-height)))))
+
+(defun lsp-ui-sideline--check-duplicate (symbol info)
+  "Check if there's already a SYMBOL containing INFO, unless `lsp-ui-sideline-ignore-duplicate'
+is set to t."
+  (not (when lsp-ui-sideline-ignore-duplicate
+         (--any (and (string= (overlay-get it 'symbol) symbol)
+                     (string= (overlay-get it 'info) info))
+                lsp-ui-sideline--ovs))))
+
+(defun lsp-ui-sideline--margin-width ()
+  (+ (if fringes-outside-margins right-margin-width 0)
+     (or (and (boundp 'fringe-mode)
+              (consp fringe-mode)
+              (or (equal (car fringe-mode) 0)
+                  (equal (cdr fringe-mode) 0))
+              1)
+         (and (boundp 'fringe-mode) (equal fringe-mode 0) 1)
+         0)
+     (let ((win-fringes (window-fringes)))
+       (if (or (equal (car win-fringes) 0)
+               (equal (cadr win-fringes) 0))
+           2
+         0))
+     (if (< emacs-major-version 27)
+         ;; This was necessary with emacs < 27, recent versions take
+         ;; into account the display-line width with :align-to
+         (lsp-ui-util-line-number-display-width)
+       0)
+     (if (or
+          (bound-and-true-p whitespace-mode)
+          (bound-and-true-p global-whitespace-mode))
+         1
+       0)))
+
+(defun lsp-ui-sideline--window-width ()
+  (- (min (window-text-width) (window-body-width))
+     (lsp-ui-sideline--margin-width)
+     (or (and (>= emacs-major-version 27)
+              ;; We still need this number when calculating available space
+              ;; even with emacs >= 27
+              (lsp-ui-util-line-number-display-width))
+         0)))
+
+(defun lsp-ui-sideline--valid-tag-p (tag mode)
+  (when tag
+    (-let ((inhibit-field-text-motion t)
+           ((p bol _eol buffer) tag))
+      (when (and (= bol (line-beginning-position))
+                 (eq buffer (current-buffer)))
+        (pcase mode
+          ('point (eq p (point)))
+          ('line t) ;; For 'line only bol is relevant
+          (_ (error "Wrong tag mode")))))))
+
+(defun lsp-ui-sideline--display-all-info (list-infos tag bol eol)
+  (when (and (lsp-ui-sideline--valid-tag-p tag 'line)
+             (not (lsp-ui-sideline--stop-p)))
+    (let ((inhibit-modification-hooks t)
+          (win-width (window-body-width))
+          ;; sort by bounds
+          (list-infos (--sort (< (caadr it) (caadr other)) list-infos)))
+      (lsp-ui-sideline--delete-kind 'info)
+      (--each list-infos
+        (-let (((symbol bounds info) it))
+          (lsp-ui-sideline--push-info win-width symbol bounds info bol eol))))))
+
+(defun lsp-ui-sideline--push-info (win-width symbol bounds info bol eol)
+  (let* ((markdown-hr-display-char nil)
+         (info (or (alist-get info lsp-ui-sideline--cached-infos)
+                   (-some--> (lsp:hover-contents info)
+                     (lsp-ui-sideline--extract-info it)
+                     (lsp-ui-sideline--format-info it win-width)
+                     (progn (push (cons info it) lsp-ui-sideline--cached-infos) it))))
+         (current (and (>= (point) (car bounds)) (<= (point) (cdr bounds)))))
+    (when (and (> (length info) 0)
+               (lsp-ui-sideline--check-duplicate symbol info))
+      (let* ((final-string (lsp-ui-sideline--make-display-string info symbol current))
+             (pos-ov (lsp-ui-sideline--find-line (length final-string) bol eol))
+             (ov (when pos-ov (make-overlay (car pos-ov) (car pos-ov)))))
+        (when pos-ov
+          (overlay-put ov 'info info)
+          (overlay-put ov 'symbol symbol)
+          (overlay-put ov 'bounds bounds)
+          (overlay-put ov 'current current)
+          (overlay-put ov 'after-string final-string)
+          (overlay-put ov 'before-string " ")
+          (overlay-put ov 'window (get-buffer-window))
+          (overlay-put ov 'kind 'info)
+          (overlay-put ov 'position (car pos-ov))
+          (push ov lsp-ui-sideline--ovs))))))
+
+(defun lsp-ui-sideline--toggle-current (ov current)
+  "Toggle the OV face according to CURRENT."
+  (let* ((info (overlay-get ov 'info))
+         (symbol (overlay-get ov 'symbol))
+         (string (lsp-ui-sideline--make-display-string info symbol current)))
+    (overlay-put ov 'current current)
+    (overlay-put ov 'after-string string)))
+
+(defun lsp-ui-sideline--highlight-current (point)
+  "Update the symbol's face according to POINT."
+  (dolist (ov lsp-ui-sideline--ovs)
+    (let* ((bounds (overlay-get ov 'bounds))
+           (start (car bounds))
+           (end (cdr bounds)))
+      (if (and bounds (>= point start) (<= point end))
+          (unless (overlay-get ov 'current)
+            (lsp-ui-sideline--toggle-current ov t))
+        (when (overlay-get ov 'current)
+          (lsp-ui-sideline--toggle-current ov nil))))))
+
+(defun lsp-ui-sideline--split-long-lines (lines)
+  "Fill LINES so that they are not longer than `lsp-ui-sideline-diagnostic-max-line-length' characters."
+  (cl-mapcan (lambda (line)
+               (if (< (length line) lsp-ui-sideline-diagnostic-max-line-length)
+                   (list line)
+                 (with-temp-buffer
+                   (let ((fill-column lsp-ui-sideline-diagnostic-max-line-length))
+                     (insert line)
+                     (fill-region (point-min) (point-max))
+                     (split-string (buffer-string) "\n")))))
+             lines))
+
+(defun lsp-ui-sideline--diagnostics (buffer bol eol)
+  "Show diagnostics belonging to the current line.
+Loop over flycheck errors with `flycheck-overlay-errors-in'.
+Find appropriate position for sideline overlays with `lsp-ui-sideline--find-line'.
+Push sideline overlays on `lsp-ui-sideline--ovs'."
+  (when (and (bound-and-true-p flycheck-mode)
+             (bound-and-true-p lsp-ui-sideline-mode)
+             lsp-ui-sideline-show-diagnostics
+             (eq (current-buffer) buffer))
+    (lsp-ui-sideline--delete-kind 'diagnostics)
+    (dolist (e (flycheck-overlay-errors-in bol (1+ eol)))
+      (let* ((lines (--> (flycheck-error-format-message-and-id e)
+                         (split-string it "\n")
+                         (lsp-ui-sideline--split-long-lines it)))
+             (display-lines (butlast lines (- (length lines) lsp-ui-sideline-diagnostic-max-lines)))
+             (offset 1))
+        (dolist (line (nreverse display-lines))
+          (let* ((msg (string-trim (replace-regexp-in-string "[\t ]+" " " line)))
+                 (msg (replace-regexp-in-string " " " " msg))
+                 (len (length msg))
+                 (level (flycheck-error-level e))
+                 (face (if (eq level 'info) 'success level))
+                 (margin (lsp-ui-sideline--margin-width))
+                 (msg (progn (add-face-text-property 0 len 'lsp-ui-sideline-global nil msg)
+                             (add-face-text-property 0 len face nil msg)
+                             msg))
+                 (string (concat (propertize " " 'display `(space :align-to (- right-fringe ,(lsp-ui-sideline--align len margin))))
+                                 (propertize msg 'display (lsp-ui-sideline--compute-height))))
+                 (pos-ov (lsp-ui-sideline--find-line len bol eol t offset))
+                 (ov (and pos-ov (make-overlay (car pos-ov) (car pos-ov)))))
+            (when pos-ov
+              (setq offset (1+ (car (cdr pos-ov))))
+              (overlay-put ov 'after-string string)
+              (overlay-put ov 'kind 'diagnostics)
+              (overlay-put ov 'before-string " ")
+              (overlay-put ov 'position (car pos-ov))
+              (push ov lsp-ui-sideline--ovs))))))))
+
+(defun lsp-ui-sideline-apply-code-actions nil
+  "Choose and apply code action(s) on the current line."
+  (interactive)
+  (unless lsp-ui-sideline--code-actions
+    (user-error "No code actions on the current line"))
+  (lsp-execute-code-action (lsp--select-action lsp-ui-sideline--code-actions)))
+
+(defun lsp-ui-sideline-set-default-icon ()
+  "Set default icon for sideline actions."
+  (setq lsp-ui-sideline-actions-icon lsp-ui-sideline-actions-icon-default))
+
+(defun lsp-ui-sideline--scale-lightbulb (height)
+  "Scale the lightbulb image to character height.
+
+Argument HEIGHT is an actual image height in pixel."
+  (--> (- (frame-char-height) 1)
+       (/ (float it) height)))
+
+(defun lsp-ui-sideline--code-actions-make-image nil
+  (let ((is-default (equal lsp-ui-sideline-actions-icon lsp-ui-sideline-actions-icon-default)))
+    (--> `(image :type png :file ,lsp-ui-sideline-actions-icon :ascent center)
+         (append it `(:scale ,(->> (cond (is-default 128)
+                                         ((fboundp 'image-size) (cdr (image-size it t)))
+                                         (t (error "Function image-size undefined.  Use default icon")))
+                                   (lsp-ui-sideline--scale-lightbulb)))))))
+
+(defun lsp-ui-sideline--code-actions-image nil
+  (when lsp-ui-sideline-actions-icon
+    (with-demoted-errors "[lsp-ui-sideline]: Error with actions icon: %s"
+      (concat
+       (propertize " " 'display (lsp-ui-sideline--code-actions-make-image))
+       (propertize " " 'display '(space :width 0.3))))))
+
+(defun lsp-ui-sideline--code-actions (actions bol eol)
+  "Show code ACTIONS."
+  (let ((inhibit-modification-hooks t))
+    (when lsp-ui-sideline-actions-kind-regex
+      (setq actions (seq-filter (-lambda ((&CodeAction :kind?))
+                                  (or (not kind?)
+                                      (s-match lsp-ui-sideline-actions-kind-regex kind?)))
+                                actions)))
+    (setq lsp-ui-sideline--code-actions actions)
+    (lsp-ui-sideline--delete-kind 'actions)
+    (seq-doseq (action actions)
+      (-let* ((title (->> (lsp:code-action-title action)
+                          (replace-regexp-in-string "[\n\t ]+" " ")
+                          (replace-regexp-in-string " " " ")
+                          (concat (unless lsp-ui-sideline-actions-icon
+                                    lsp-ui-sideline-code-actions-prefix))))
+              (image (lsp-ui-sideline--code-actions-image))
+              (margin (lsp-ui-sideline--margin-width))
+              (keymap (let ((map (make-sparse-keymap)))
+                        (define-key map [down-mouse-1] (lambda () (interactive)
+                                                         (save-excursion
+                                                           (lsp-execute-code-action action))))
+                        map))
+              (len (length title))
+              (title (progn (add-face-text-property 0 len 'lsp-ui-sideline-global nil title)
+                            (add-face-text-property 0 len 'lsp-ui-sideline-code-action nil title)
+                            (add-text-properties 0 len `(keymap ,keymap mouse-face highlight) title)
+                            title))
+              (string (concat (propertize " " 'display `(space :align-to (- right-fringe ,(lsp-ui-sideline--align (+ len (length image)) margin))))
+                              image
+                              (propertize title 'display (lsp-ui-sideline--compute-height))))
+              (pos-ov (lsp-ui-sideline--find-line (+ 1 (length title) (length image)) bol eol t))
+              (ov (and pos-ov (make-overlay (car pos-ov) (car pos-ov)))))
+        (when pos-ov
+          (overlay-put ov 'after-string string)
+          (overlay-put ov 'before-string " ")
+          (overlay-put ov 'kind 'actions)
+          (overlay-put ov 'position (car pos-ov))
+          (push ov lsp-ui-sideline--ovs))))))
+
+(defun lsp-ui-sideline--calculate-tag nil
+  "Calculate the tag used to determine whether to update sideline information."
+  (let ((inhibit-field-text-motion t))
+    (list (point) (line-beginning-position) (line-end-position) (current-buffer))))
+
+(defun lsp-ui-sideline--delete-kind (kind)
+  (->> (--remove
+        (when (eq (overlay-get it 'kind) kind)
+          (--> (overlay-get it 'position)
+               (remq it lsp-ui-sideline--occupied-lines)
+               (setq lsp-ui-sideline--occupied-lines it))
+          (delete-overlay it)
+          t)
+        lsp-ui-sideline--ovs)
+       (setq lsp-ui-sideline--ovs)))
+
+(defvar-local lsp-ui-sideline--last-tick-info nil)
+(defvar-local lsp-ui-sideline--previous-line nil)
+
+(defun lsp-ui-sideline--get-line (bol eol)
+  (buffer-substring-no-properties bol eol))
+
+(defun lsp-ui-sideline--line-diags (line)
+  (->> (--filter
+        (let ((range (lsp-get it :range)))
+          (or (-some-> range (lsp-get :start) (lsp-get :line) (= line))
+              (-some-> range (lsp-get :end) (lsp-get :line) (= line))))
+        (lsp--get-buffer-diagnostics))
+       (apply 'vector)))
+
+(defun lsp-ui-sideline--run (&optional buffer bol eol this-line)
+  "Show information (flycheck + lsp).
+It loops on the symbols of the current line and requests information
+from the language server."
+  (when buffer-file-name
+    (let* ((inhibit-field-text-motion t)
+           (tag (lsp-ui-sideline--calculate-tag))
+           (eol (or eol (nth 2 tag)))
+           (bol (or bol (nth 1 tag)))
+           (this-tick (buffer-modified-tick))
+           (line-changed (not (lsp-ui-sideline--valid-tag-p lsp-ui-sideline--tag 'line)))
+           (line-widen (or (and (not line-changed) lsp-ui-sideline--last-line-number)
+                           (and (buffer-narrowed-p) (save-restriction (widen) (line-number-at-pos)))
+                           (line-number-at-pos)))
+           (new-tick (unless line-changed (not (equal this-tick lsp-ui-sideline--last-tick-info))))
+           (this-line (or this-line (lsp-ui-sideline--get-line bol eol)))
+           (line-modified (and new-tick (not (equal this-line lsp-ui-sideline--previous-line))))
+           (doc-id (lsp--text-document-identifier))
+           (inhibit-modification-hooks t)
+           symbols)
+      (setq lsp-ui-sideline--tag tag
+            lsp-ui-sideline--last-line-number line-widen
+            lsp-ui-sideline--last-width (window-text-width))
+      (when (and line-changed lsp-ui-sideline-show-diagnostics)
+        (lsp-ui-sideline--diagnostics buffer bol eol))
+      (when (and lsp-ui-sideline-show-code-actions
+                 (or (lsp--capability "codeActionProvider")
+                     (lsp--registered-capability "textDocument/codeAction")))
+        (lsp-request-async
+         "textDocument/codeAction"
+         (-let (((start . end) (if (eq lsp-ui-sideline-update-mode 'line)
+                                   (cons 0 (- eol bol))
+                                 (--> (- (point) bol) (cons it it)))))
+           (list :textDocument doc-id
+                 :range (list :start (list :line (1- line-widen) :character start)
+                              :end (list :line (1- line-widen) :character end))
+                 :context (list :diagnostics (lsp-ui-sideline--line-diags (1- line-widen)))))
+         (lambda (actions)
+           (when (eq (current-buffer) buffer)
+             (lsp-ui-sideline--code-actions actions bol eol)))
+         :mode 'tick
+         :error-handler
+         (lambda (&rest _)
+           (lsp-ui-sideline--delete-kind 'actions))
+         :cancel-token :lsp-ui-code-actions))
+      ;; Go through all symbols and request hover information.  Note that the symbols are
+      ;; traversed backwards as `forward-symbol' with a positive argument will jump just past the
+      ;; current symbol.  By going from the end of the line towards the front, point will be placed
+      ;; at the beginning of each symbol.  As the requests are first collected in a list before
+      ;; being processed they are still sent in order from left to right.
+      (when (and lsp-ui-sideline-show-hover (or line-changed line-modified) (lsp--capability "hoverProvider"))
+        (setq lsp-ui-sideline--last-tick-info this-tick
+              lsp-ui-sideline--previous-line this-line)
+        (save-excursion
+          (goto-char eol)
+          (while (and (> (point) bol)
+                      (progn (forward-symbol -1)
+                             (>= (point) bol)))
+            (let* ((symbol (thing-at-point 'symbol t))
+                   (bounds (bounds-of-thing-at-point 'symbol))
+                   (parsing-state (syntax-ppss))
+                   (in-string (nth 3 parsing-state))
+                   (outside-comment (eq (nth 4 parsing-state) nil)))
+              ;; Skip strings and comments
+              (when (and symbol (not in-string) outside-comment)
+                (push (list symbol bounds (list :line (1- line-widen) :character (- (point) bol))) symbols))))
+          (if (null symbols)
+              (lsp-ui-sideline--delete-kind 'info)
+            (let ((length-symbols (length symbols))
+                  (current-index 0)
+                  list-infos)
+              (--each symbols
+                (-let (((symbol bounds position) it))
+                  (lsp-request-async
+                   "textDocument/hover"
+                   (lsp-make-hover-params :text-document doc-id :position position)
+                   (lambda (info)
+                     (cl-incf current-index)
+                     (and info (push (list symbol bounds info) list-infos))
+                     (when (or (= current-index length-symbols) (not lsp-ui-sideline-wait-for-all-symbols))
+                       (lsp-ui-sideline--display-all-info list-infos tag bol eol)))
+                   :error-handler
+                   (lambda (&rest _)
+                     (cl-incf current-index)
+                     (when (or (= current-index length-symbols) (not lsp-ui-sideline-wait-for-all-symbols))
+                       (lsp-ui-sideline--display-all-info list-infos tag bol eol)))
+                   :mode 'tick))))))))))
+
+(defun lsp-ui-sideline--stop-p ()
+  "Return non-nil if the sideline should not be display."
+  (or (region-active-p)
+      (bound-and-true-p company-pseudo-tooltip-overlay)
+      (bound-and-true-p lsp-ui-peek--overlay)))
+
+(defun lsp-ui-sideline--hide-before-company (command)
+  "Disable the sideline before company's overlay appears.
+COMMAND is `company-pseudo-tooltip-frontend' parameter."
+  (when (memq command '(post-command update))
+    (lsp-ui-sideline--delete-ov)))
+
+(defun lsp-ui-sideline ()
+  "Show information for the current line."
+  (if (lsp-ui-sideline--stop-p)
+      (lsp-ui-sideline--delete-ov)
+    (let* ((inhibit-field-text-motion t)
+           (same-line (lsp-ui-sideline--valid-tag-p lsp-ui-sideline--tag 'line))
+           (same-width (equal (window-text-width) lsp-ui-sideline--last-width))
+           (new-tick (and same-line (not (equal (buffer-modified-tick) lsp-ui-sideline--last-tick-info))))
+           (bol (and new-tick (line-beginning-position)))
+           (eol (and new-tick (line-end-position)))
+           (this-line (and new-tick (lsp-ui-sideline--get-line bol eol)))
+           (unmodified (if new-tick (equal this-line lsp-ui-sideline--previous-line) t))
+           (buffer (current-buffer))
+           (point (point)))
+      (cond ((and unmodified same-line same-width)
+             (lsp-ui-sideline--highlight-current (point)))
+            ((not (and same-line same-width))
+             (lsp-ui-sideline--delete-ov)))
+      (when lsp-ui-sideline--timer
+        (cancel-timer lsp-ui-sideline--timer))
+      (setq lsp-ui-sideline--timer
+            (run-with-idle-timer
+             lsp-ui-sideline-delay nil
+             (lambda nil
+               ;; run lsp-ui only if current-buffer is the same.
+               (and (eq buffer (current-buffer))
+                    (= point (point))
+                    (lsp-ui-sideline--run buffer bol eol this-line))))))))
+
+(defun lsp-ui-sideline-toggle-symbols-info ()
+  "Toggle display of symbols information.
+This does not toggle display of flycheck diagnostics or code actions."
+  (interactive)
+  (when (bound-and-true-p lsp-ui-sideline-mode)
+    (setq lsp-ui-sideline-show-hover (not lsp-ui-sideline-show-hover))
+    (lsp-ui-sideline--run (current-buffer))))
+
+(defun lsp-ui-sideline--diagnostics-changed ()
+  "Handler for flycheck notifications."
+  (when lsp-ui-sideline-show-diagnostics
+    (let* ((buffer (current-buffer))
+           (inhibit-field-text-motion t)
+           (eol (line-end-position))
+           (bol (line-beginning-position)))
+      (lsp-ui-sideline--diagnostics buffer bol eol))))
+
+(defun lsp-ui-sideline--erase (&rest _)
+  "Remove all sideline overlays and delete last tag."
+  (when (bound-and-true-p lsp-ui-sideline-mode)
+    (ignore-errors (lsp-ui-sideline--delete-ov))))
+
+(define-minor-mode lsp-ui-sideline-mode
+  "Minor mode for showing information for current line."
+  :init-value nil
+  :group lsp-ui-sideline
+  (cond
+   (lsp-ui-sideline-mode
+    (add-hook 'post-command-hook 'lsp-ui-sideline nil t)
+    (advice-add 'company-pseudo-tooltip-frontend :before 'lsp-ui-sideline--hide-before-company)
+    (add-hook 'flycheck-after-syntax-check-hook 'lsp-ui-sideline--diagnostics-changed nil t)
+    (when lsp-ui-sideline-show-diagnostics
+      (setq-local flycheck-display-errors-function nil)))
+   (t
+    (advice-remove 'company-pseudo-tooltip-frontend 'lsp-ui-sideline--hide-before-company)
+    (lsp-ui-sideline--delete-ov)
+    (remove-hook 'flycheck-after-syntax-check-hook  'lsp-ui-sideline--diagnostics-changed t)
+    (remove-hook 'post-command-hook 'lsp-ui-sideline t)
+    (when lsp-ui-sideline-show-diagnostics
+      (kill-local-variable 'flycheck-display-errors-function)))))
+
+(defun lsp-ui-sideline-enable (enable)
+  "Enable/disable `lsp-ui-sideline-mode'."
+  (lsp-ui-sideline-mode (if enable 1 -1))
+  (if enable
+      (add-hook 'before-revert-hook 'lsp-ui-sideline--delete-ov nil t)
+    (remove-hook 'before-revert-hook 'lsp-ui-sideline--delete-ov t)))
+
+(provide 'lsp-ui-sideline)
+;;; lsp-ui-sideline.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui-util.el b/elpa/lsp-ui-20220104.1635/lsp-ui-util.el
new file mode 100644 (file)
index 0000000..a5d92f2
--- /dev/null
@@ -0,0 +1,71 @@
+;;; lsp-ui-util.el --- Utility module for Lsp-Ui  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2020 Shen, Jen-Chieh
+
+;; Author: Jen-Chieh Shen <jcs090218NOSPAMgmail.com>
+;; URL: https://github.com/emacs-lsp/lsp-ui
+;; Keywords: languages, tools
+;; Version: 6.2
+
+;;; License
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;;
+;; Utility module for Lsp-Ui.
+;;
+
+;;; Code:
+
+(require 'face-remap)
+
+(defun lsp-ui-util-safe-kill-timer (timer)
+  "Safely kill the TIMER."
+  (when (timerp timer) (cancel-timer timer)))
+
+(defun lsp-ui-util-safe-delete-overlay (overlay)
+  "Safely delete the OVERLAY."
+  (when (overlayp overlay) (delete-overlay overlay)))
+
+(defun lsp-ui-util-line-number-display-width ()
+  "Safe way to get value from function `line-number-display-width'."
+  (if (bound-and-true-p display-line-numbers-mode)
+      ;; For some reason, function `line-number-display-width' gave
+      ;; us error `args-out-of-range' even we do not pass anything towards
+      ;; to it function. See the following links,
+      ;;
+      ;; - https://github.com/emacs-lsp/lsp-ui/issues/294
+      ;; - https://github.com/emacs-lsp/lsp-ui/issues/533 (duplicate)
+      (+ (or (ignore-errors (line-number-display-width)) 0) 2)
+    0))
+
+(defun lsp-ui-util-line-string (pos)
+  "Return string at POS."
+  (when (integerp pos) (save-excursion (goto-char pos) (thing-at-point 'line))))
+
+(defun lsp-ui-util-column (&optional pos)
+  "Return column at POS."
+  (setq pos (or pos (point)))
+  (save-excursion (goto-char pos) (current-column)))
+
+(defun lsp-ui-util-text-scale-factor ()
+  "Return the factor effect by `text-scale-mode'."
+  (or (plist-get (cdr text-scale-mode-remapping) :height) 1))
+
+(provide 'lsp-ui-util)
+;;; lsp-ui-util.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/lsp-ui.el b/elpa/lsp-ui-20220104.1635/lsp-ui.el
new file mode 100644 (file)
index 0000000..bed2de7
--- /dev/null
@@ -0,0 +1,177 @@
+;;; lsp-ui.el --- UI modules for lsp-mode -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017 Tobias Pisani
+;; Copyright (C) 2018 Sebastien Chapuis, Fangrui Song
+
+;; Author: Sebastien Chapuis <sebastienNOSPAMchapu.is>, Fangrui Song <iNOSPAMmaskray.me>
+;; Keywords: languages, tools
+;; URL: https://github.com/emacs-lsp/lsp-ui
+;; Package-Requires: ((emacs "26.1") (dash "2.18.0") (lsp-mode "6.0") (markdown-mode "2.3"))
+;; Version: 8.0.0
+
+;;; License
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 3, or (at your option)
+;; any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+;; Floor, Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+
+;; lsp-ui contains a series of useful UI integrations for lsp-mode, like
+;; flycheck support and code lenses.
+
+;;; Code:
+
+(require 'dash)
+(require 'lsp-protocol)
+(require 'find-func)
+
+(defconst lsp-ui-resources-dir
+  (--> (or load-file-name (buffer-file-name))
+       (file-name-directory it)
+       (expand-file-name "resources" it)
+       (file-name-as-directory it)
+       (and (file-directory-p it) it))
+  "Resource folder for package `lsp-ui'.")
+
+(require 'lsp-ui-sideline)
+(require 'lsp-ui-peek)
+(require 'lsp-ui-imenu)
+(require 'lsp-ui-doc)
+
+(defgroup lsp-ui nil
+  "‘lsp-ui’ contains a series of useful UI integrations for ‘lsp-mode’."
+  :group 'tools
+  :group 'convenience
+  :link '(custom-manual "(lsp-ui) Top")
+  :link '(info-link "(lsp-ui) Customizing"))
+
+(with-eval-after-load 'flycheck
+  (require 'lsp-ui-flycheck))
+
+(with-eval-after-load 'winum
+  (when (and (boundp 'winum-ignored-buffers-regexp) lsp-ui-doc-winum-ignore)
+    (add-to-list 'winum-ignored-buffers-regexp lsp-ui-doc--buffer-prefix)))
+
+(defun lsp-ui-peek--render (major string)
+  (with-temp-buffer
+    (insert string)
+    (delay-mode-hooks
+      (let ((inhibit-message t)) (funcall major))
+      (ignore-errors (font-lock-ensure)))
+    (buffer-string)))
+
+(defun lsp-ui--workspace-path (path)
+  "Return the PATH relative to the workspace.
+If the PATH is not in the workspace, it returns the original PATH."
+  (let* ((path (file-truename path))
+         (root (lsp-workspace-root path))
+         (in-workspace (and root (string-prefix-p root path))))
+    (if in-workspace
+        (substring path (length root))
+      path)))
+
+(defun lsp-ui--toggle (enable)
+  (dolist (feature '(lsp-ui-peek lsp-ui-sideline lsp-ui-doc lsp-ui-imenu))
+    (let* ((sym (--> (intern-soft (concat (symbol-name feature) "-enable"))
+                     (and (boundp it) it)))
+           (value (symbol-value sym))
+           (fn (symbol-function sym)))
+      (and (or value (not enable))
+           (functionp fn)
+           (funcall fn enable)))))
+
+(defvar lsp-ui-mode-map (make-sparse-keymap))
+
+;;;###autoload
+(define-minor-mode lsp-ui-mode
+  "Toggle language server UI mode on or off.
+‘lsp-ui-mode’ is a minor mode that contains a series of useful UI
+integrations for ‘lsp-mode’.  With a prefix argument ARG, enable
+language server UI mode if ARG is positive, and disable it
+otherwise.  If called from Lisp, enable the mode if ARG is
+omitted or nil, and toggle it if ARG is ‘toggle’."
+  :init-value nil
+  :group lsp-ui
+  :keymap lsp-ui-mode-map
+  (lsp-ui--toggle lsp-ui-mode))
+
+;; The request is delegated to xref-backend-apropos defined in lsp-mode.
+;; xref-find-apropos does similar job but is less appealing because it splits and
+;; regex quotes the pattern. The language server likely knows more about how
+;; to do fuzzy matching.
+(defun lsp-ui-find-workspace-symbol (pattern)
+  "List project-wide symbols matching the query string PATTERN."
+  (interactive (list (read-string
+                      "workspace/symbol: "
+                      nil 'xref--read-pattern-history)))
+  (xref--find-xrefs pattern 'apropos pattern nil))
+
+(defun lsp-ui--location< (x y)
+  "Compares two triples X and Y.
+Both should have the form (FILENAME LINE COLUMN)."
+  (if (not (string= (car x) (car y)))
+      (string< (car x) (car y))
+    (if (not (= (cadr x) (cadr y)))
+        (< (cadr x) (cadr y))
+      (< (caddr x) (caddr y)))))
+
+(defun lsp-ui--reference-triples (include-declaration)
+  "Return references as a list of (FILENAME LINE COLUMN) triples given EXTRA."
+  (let ((refs (lsp-request "textDocument/references"
+                           (lsp--make-reference-params nil include-declaration))))
+    (sort
+     (mapcar
+      (-lambda ((&Location :uri :range (&Range :start (&Position :line :character))))
+        (list (lsp--uri-to-path uri) line character))
+      refs)
+     #'lsp-ui--location<)))
+
+;; TODO Make it efficient
+(defun lsp-ui-find-next-reference (&optional include-declaration)
+  "Find next reference of the symbol at point."
+  (interactive)
+  (let* ((cur (list buffer-file-name (1- (line-number-at-pos)) (- (point) (line-beginning-position))))
+         (refs (lsp-ui--reference-triples include-declaration))
+         (idx -1)
+         (res (-first (lambda (ref) (cl-incf idx) (lsp-ui--location< cur ref)) refs)))
+    (if res
+        (progn
+          (find-file (car res))
+          (goto-char 1)
+          (forward-line (cadr res))
+          (forward-char (caddr res))
+          (cons idx (length refs)))
+      (cons 0 0))))
+
+;; TODO Make it efficient
+(defun lsp-ui-find-prev-reference (&optional include-declaration)
+  "Find previous reference of the symbol at point."
+  (interactive)
+  (let* ((cur (list buffer-file-name (1- (line-number-at-pos)) (- (point) (line-beginning-position))))
+         (refs (lsp-ui--reference-triples include-declaration))
+         (idx -1)
+         (res (-last (lambda (ref) (and (lsp-ui--location< ref cur) (cl-incf idx))) refs)))
+    (if res
+        (progn
+          (find-file (car res))
+          (goto-char 1)
+          (forward-line (cadr res))
+          (forward-char (caddr res))
+          (cons idx (length refs)))
+      (cons 0 0))))
+
+
+(provide 'lsp-ui)
+;;; lsp-ui.el ends here
diff --git a/elpa/lsp-ui-20220104.1635/resources/lightbulb.png b/elpa/lsp-ui-20220104.1635/resources/lightbulb.png
new file mode 100644 (file)
index 0000000..7c1ad08
Binary files /dev/null and b/elpa/lsp-ui-20220104.1635/resources/lightbulb.png differ
diff --git a/elpa/lsp-ui-readme.txt b/elpa/lsp-ui-readme.txt
new file mode 100644 (file)
index 0000000..2faf014
--- /dev/null
@@ -0,0 +1,2 @@
+lsp-ui contains a series of useful UI integrations for lsp-mode, like
+flycheck support and code lenses.