summaryrefslogtreecommitdiff
path: root/fnl/config/lsp/lsp-installer.fnl
blob: af9a4e8cda6a3fc0b306280c7d7ad0b97b5eda42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
;; Loads default handlers and specific language settings.
(module config.lsp.lsp-installer {autoload {util util}})

(def handler-opts (let [handlers (require :config.lsp.handlers)]
                    {:on_attach handlers.on-attach
                     :capabilities (handlers.capabilities)}))

(defn- jsonls-opts []
       (let [jsonls-opts (require :config.lsp.settings.jsonls)]
         (vim.tbl_deep_extend :force jsonls-opts handler-opts)))

(defn- sumneko-lua-opts []
       (let [sumneko-lua (require :config.lsp.settings.sumneko-lua)]
         (vim.tbl_deep_extend :force sumneko-lua.opts handler-opts)))

(defn- pyright-opts []
       (let [pyright (require :config.lsp.settings.pyright)]
         (vim.tbl_deep_extend :force pyright.opts handler-opts)))

(defn- get-server-opts [server]
       (match server.name
         :jsonls (jsonls-opts)
         :pyright (pyright-opts)
         :sumneko_lua (sumneko-lua-opts)
         _ handler-opts))

(let [lsp-installer (util.load-plugin :nvim-lsp-installer)]
  (lsp-installer.on_server_ready (fn [server]
                                   (let [opts (get-server-opts server)]
                                     (server:setup opts)))))