Configure LSP for Shell Development
This commit is contained in:
@@ -1 +1 @@
|
|||||||
#s(lsp-session ("/var/home/fscotto/Projects/toyforth") nil #s(hash-table test equal) #s(hash-table test equal) #s(hash-table test equal))
|
#s(lsp-session ("/var/home/fscotto/.dotfiles/emacs/.emacs.d/scripts" "/var/home/fscotto/Projects/toyforth") nil #s(hash-table test equal) #s(hash-table test equal) #s(hash-table test equal))
|
||||||
@@ -156,6 +156,9 @@
|
|||||||
(require 'magit)
|
(require 'magit)
|
||||||
(call-interactively #'magit-dispatch))
|
(call-interactively #'magit-dispatch))
|
||||||
|
|
||||||
|
(defun fscotto/disable-c-formatting ()
|
||||||
|
(setq-local lsp-enable-on-type-formatting nil))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; PACKAGES ;;
|
;; PACKAGES ;;
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -582,11 +585,17 @@
|
|||||||
(company-idle-delay 0.1)
|
(company-idle-delay 0.1)
|
||||||
:hook (prog-mode . company-mode))
|
:hook (prog-mode . company-mode))
|
||||||
|
|
||||||
|
(with-eval-after-load 'company
|
||||||
|
(add-hook 'bash-ts-mode-hook 'company-mode))
|
||||||
|
|
||||||
;; Static analysis for code base
|
;; Static analysis for code base
|
||||||
(use-package flycheck
|
(use-package flycheck
|
||||||
:ensure t
|
:ensure t
|
||||||
:hook (prog-mode . flycheck-mode))
|
:hook (prog-mode . flycheck-mode))
|
||||||
|
|
||||||
|
(with-eval-after-load 'flycheck
|
||||||
|
(add-hook 'bash-ts-mode-hook 'flycheck-mode))
|
||||||
|
|
||||||
(use-package treesit
|
(use-package treesit
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:config
|
:config
|
||||||
@@ -596,7 +605,7 @@
|
|||||||
'((c-mode . c-ts-mode)
|
'((c-mode . c-ts-mode)
|
||||||
(c++-mode . c++-ts-mode)
|
(c++-mode . c++-ts-mode)
|
||||||
(python-mode . python-ts-mode)
|
(python-mode . python-ts-mode)
|
||||||
(bash-mode . bash-ts-mode)))
|
(sh-mode . bash-ts-mode)))
|
||||||
(setq treesit-language-source-alist
|
(setq treesit-language-source-alist
|
||||||
'((c "https://github.com/tree-sitter/tree-sitter-c")
|
'((c "https://github.com/tree-sitter/tree-sitter-c")
|
||||||
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
|
(cpp "https://github.com/tree-sitter/tree-sitter-cpp")
|
||||||
@@ -619,7 +628,7 @@
|
|||||||
python-ts-mode
|
python-ts-mode
|
||||||
go-mode
|
go-mode
|
||||||
go-ts-mode
|
go-ts-mode
|
||||||
bash-mode
|
sh-mode
|
||||||
bash-ts-mode) . lsp-deferred)
|
bash-ts-mode) . lsp-deferred)
|
||||||
:config
|
:config
|
||||||
;; Performance
|
;; Performance
|
||||||
@@ -649,8 +658,7 @@
|
|||||||
"--ranking-model=heuristics"
|
"--ranking-model=heuristics"
|
||||||
"--malloc-trim"
|
"--malloc-trim"
|
||||||
"--limit-results=500"
|
"--limit-results=500"
|
||||||
"--limit-references=2000"))
|
"--limit-references=2000")))
|
||||||
)
|
|
||||||
|
|
||||||
(use-package lsp-ui
|
(use-package lsp-ui
|
||||||
:ensure t
|
:ensure t
|
||||||
@@ -668,6 +676,9 @@
|
|||||||
consult-lsp-diagnostics))
|
consult-lsp-diagnostics))
|
||||||
|
|
||||||
(with-eval-after-load 'lsp-mode
|
(with-eval-after-load 'lsp-mode
|
||||||
|
;; Attach bash-language-server when open a shell scripts
|
||||||
|
(add-hook 'sh-mode-hook #'lsp)
|
||||||
|
|
||||||
;; Symbols
|
;; Symbols
|
||||||
(global-set-key (kbd "C-c l s") #'consult-lsp-symbols)
|
(global-set-key (kbd "C-c l s") #'consult-lsp-symbols)
|
||||||
|
|
||||||
@@ -730,4 +741,20 @@
|
|||||||
(global-set-key (kbd "C-c d r") #'dap-restart-frame)
|
(global-set-key (kbd "C-c d r") #'dap-restart-frame)
|
||||||
(global-set-key (kbd "C-c d q") #'dap-disconnect))
|
(global-set-key (kbd "C-c d q") #'dap-disconnect))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;;;;;;;;;;;;;; Formatters ;;;;;;;;;;;;;;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;; GOTCHA review this region
|
||||||
|
(use-package reformatter
|
||||||
|
:ensure t
|
||||||
|
:config
|
||||||
|
(reformatter-define shfmt-format
|
||||||
|
:program "shfmt"
|
||||||
|
:args '("-i" "2" "-ci")))
|
||||||
|
|
||||||
|
(add-hook 'bash-ts-mode-hook #'shfmt-format-on-save-mode)
|
||||||
|
(add-hook 'c-ts-mode-hook #'fscotto/disable-c-formatting)
|
||||||
|
(add-hook 'c-mode-hook #'fscotto/disable-c-formatting)
|
||||||
|
|
||||||
(message "...user configuration loaded")
|
(message "...user configuration loaded")
|
||||||
|
|||||||
Reference in New Issue
Block a user