Add lsp support to sh-mode.

This commit is contained in:
Dinko 2020-01-07 14:50:13 +02:00
parent b5a279311c
commit 3530f19ef5
2 changed files with 8 additions and 0 deletions

View file

@ -9,6 +9,7 @@ This module adds support for shell scripting languages.
* Table of Contents :TOC: * Table of Contents :TOC:
- [[#install][Install]] - [[#install][Install]]
- [[#dependencies][Dependencies]] - [[#dependencies][Dependencies]]
- [[#module-flags][Module Flags]]
* Install * Install
** Dependencies ** Dependencies
@ -17,3 +18,6 @@ This module has several soft dependencies:
+ ~shellcheck~ Enables shell script linting. + ~shellcheck~ Enables shell script linting.
+ ~bashdb~ Enables debugging for bash scripts. + ~bashdb~ Enables debugging for bash scripts.
+ ~zshdb~ Enables debugging for zsh scripts. + ~zshdb~ Enables debugging for zsh scripts.
+ ~bash-language-server~ Enables LSP support.
** Module Flags
+ ~+lsp~ to add support Language server protocol.

View file

@ -17,6 +17,9 @@
(set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;")) (set-electric! 'sh-mode :words '("else" "elif" "fi" "done" "then" "do" "esac" ";;"))
(set-repl-handler! 'sh-mode #'+sh/open-repl) (set-repl-handler! 'sh-mode #'+sh/open-repl)
(when (featurep! +lsp)
(add-hook 'sh-mode-hook #'lsp!))
(setq sh-indent-after-continuation 'always) (setq sh-indent-after-continuation 'always)
;; [pedantry intensifies] ;; [pedantry intensifies]
@ -52,6 +55,7 @@
(use-package! company-shell (use-package! company-shell
:when (featurep! :completion company) :when (featurep! :completion company)
:unless (featurep! +lsp)
:after sh-script :after sh-script
:config :config
(set-company-backend! 'sh-mode '(company-shell company-files)) (set-company-backend! 'sh-mode '(company-shell company-files))