From 7f2ba97d3cfae5099260aa4bb80fbbd16b13f956 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Mon, 7 Oct 2024 20:16:33 -0700 Subject: [PATCH] lsp --- .config/nvim/fnl/lsp.fnl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.config/nvim/fnl/lsp.fnl b/.config/nvim/fnl/lsp.fnl index 1fd060e..1866301 100644 --- a/.config/nvim/fnl/lsp.fnl +++ b/.config/nvim/fnl/lsp.fnl @@ -3,7 +3,7 @@ ;; .envrc: ;; use vim ;; -;; $ rake init:local-nvim +;; $ rake init:local-nvim[DIR] (local lspconfig (require :lspconfig)) (local {: lsp} vim) @@ -35,18 +35,8 @@ (let [bufopts {:noremap true :silent true :buffer bufnr}] (vim.keymap.set :n :gD lsp.buf.declaration bufopts) (vim.keymap.set :n :gd lsp.buf.definition bufopts) - (vim.keymap.set :n :K lsp.buf.hover bufopts) (vim.keymap.set :n :gi lsp.buf.implementation bufopts) - (vim.keymap.set :n : lsp.buf.signature_help bufopts) - (vim.keymap.set :n :wa lsp.buf.add_workspace_folder bufopts) - (vim.keymap.set :n :wr lsp.buf.remove_workspace_folder bufopts) - (vim.keymap.set :n :wl - #(print (vim.inspect (lsp.buf.list_workspace_folders))) - bufopts) (vim.keymap.set :n :D lsp.buf.type_definition bufopts) - (vim.keymap.set :n :rn lsp.buf.rename bufopts) - (vim.keymap.set :n :ca lsp.buf.code_action bufopts) - (vim.keymap.set :n :gr lsp.buf.references bufopts) (vim.keymap.set :n :lf #(lsp.buf.format {:async true}) bufopts))) (fn on-attach-do [...] @@ -66,8 +56,10 @@ (let [{: setup} (. lspconfig lsp)] (setup (or config {:on_attach on-attach})))) +;; efm-langserver things (local fmt #{:formatCommand $1 :formatStdin true}) (local lint #{:lintCommand $1 :lintFormats $2 :lintStdin true}) + (local fennel-lint "fennel --globals vim,hs,spoon --raw-errors $(realpath --relative-to . ${INPUT}) 2>&1") @@ -80,8 +72,12 @@ (local prettier (fmt "prettier --stdin-filepath ${INPUT}")) (local javascript [eslint prettier]) - (local yamlfmt (fmt "yamlfmt -in")) +(local shellcheck {:lintCommand "shellcheck -f gcc -x" + :lintSource :shellcheck + :lintFormats ["%f:%l:%c: %trror: %m" + "%f:%l:%c: %tarning: %m" + "%f:%l:%c: %tote: %m"]}) (setup-lsp :efm {:on_attach on-attach :init_options {:documentFormatting true @@ -91,12 +87,14 @@ :completion true} :settings {:languages {: fennel : javascript + :sh [shellcheck] :typescript javascript :typescriptreact javascript :vue [prettier] :yaml [yamlfmt]}} :filetypes [:fennel :javascript + :sh :typescript :typescriptreact :vue @@ -108,7 +106,9 @@ (setup-lsp :pyright {:on_attach on-attach :settings {:python {:analysis {:autoImportCompletions true}}}}) -(setup-lsp :ruff_lsp) + +(setup-lsp :ruff) +(setup-lsp :ruby_lsp) (setup-lsp :rust_analyzer {:on_attach on-attach :cmd [:rustup :run :stable :rust-analyzer]