Ensure *NEARLY EVERYTHING* is optional

This commit is contained in:
Mike 'Fuzzy' Partin 2024-07-06 10:49:17 -07:00
parent 1a4cd272bf
commit a7c4775960
6 changed files with 75 additions and 59 deletions

View File

@ -97,20 +97,15 @@
;;
;; Language server packages
;; development assistance packages
;;
;; lsp toggle
(defcustom thwap-comp-enable-lsp nil
(defcustom thwap-dev-enable-lsp nil
"Whether or not to enable lsp."
:type 'boolean
:group 'thwap-config-group)
;;
;; development assistance packages
;;
;; projectile toggle
(defcustom thwap-dev-enable-projectile nil
"Whether or not to enable projectile."
@ -123,6 +118,29 @@
:type 'boolean
:group 'thwap-config-group)
;; Copilot toggle
(defcustom thwap-dev-enable-copilot nil
"Whether or not to enable copilot."
:type 'boolean
:group 'thwap-config-group)
;; Go toggle
(defcustom thwap-dev-enable-go nil
"Whether or not to setup Go development modes."
:type 'boolean
:group 'thwap-config-group)
;; Python toggle
(defcustom thwap-dev-enable-python nil
"Whether or not to setup Python development modes."
:type 'boolean
:group 'thwap-config-group)
;; Terraform toggle
(defcustom thwap-dev-enable-terraform nil
"Whether or not to setup Terraform development modes."
:type 'boolean
:group 'thwap-config-group)
;;
;; Org mode settings

View File

@ -1,14 +1,13 @@
(straight-use-package 'dash)
(straight-use-package 'editorconfig)
(use-package copilot
(when thwap-dev-enable-copilot
(straight-use-package 'dash)
(straight-use-package 'editorconfig)
(use-package copilot
:straight (:host github :repo "zerolfx/copilot.el" :files ("dist" "*.el"))
:ensure t)
;; you can utilize :map :hook and :config to customize copilot
(add-hook 'prog-mode-hook 'copilot-mode)
(define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
;; you can utilize :map :hook and :config to customize copilot
(add-hook 'prog-mode-hook 'copilot-mode)
(define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion))
(provide 'thwap-copilot)

View File

@ -1,14 +1,15 @@
(straight-use-package 'go-mode)
(setq lsp-go-analyses '((shadow . t)
(when thwap-dev-enable-go
(straight-use-package 'go-mode)
(straight-use-package 'eglot)
(setq lsp-go-analyses '((shadow . t)
(simplifycompositelit . :json-false)))
(when (executable-find "gopls")
(setq gofmt-command "goimports")
(when (executable-find "gopls")
(add-hook 'go-mode-hook #'lsp-deferred)
(add-hook 'before-save-hook 'gofmt-before-save)
(add-hook 'go-mode-hook 'eglot-ensure))
(when (executable-find "goimports")
(setq gofmt-command "goimports"))
(add-hook 'before-save-hook 'gofmt-before-save))
(provide 'thwap-go)

View File

@ -1,5 +1,5 @@
(when thwap-comp-enable-lsp
(when thwap-dev-enable-lsp
(straight-use-package 'lsp-mode)
(straight-use-package 'lsp-ui)
(straight-use-package 'lsp-treemacs)

View File

@ -1,15 +1,13 @@
(add-hook 'python-mode-hook (lambda ()
(when thwap-dev-enable-python
(add-hook 'python-mode-hook (lambda ()
(setq-local tab-width 2)))
(add-hook 'python-mode-hook #'lsp-deferred)
(when (executable-find "pylsp")
(add-hook 'python-mode-hook #'lsp-deferred)
(when (executable-find "pylsp")
(add-hook 'python-mode-hook 'eglot-ensure))
(use-package python-black
(use-package python-black
:demand t
:straight t
:after python
:hook (python-mode . python-black-on-save-mode))
:hook (python-mode . python-black-on-save-mode)))
(provide 'thwap-py)

View File

@ -1,18 +1,18 @@
(use-package terraform-mode
(when thwap-dev-enable-terraform
(use-package terraform-mode
:straight t
:demand t
:init
(custom-set-variables
'(terraform-indent-level 2)
'(terraform-format-on-save t))
(when (executable-find "terraform-ls")
(add-hook 'terraform-mode-hook 'eglot-ensure))
:config
(straight-use-package 'eglot)
(require 'eglot)
(add-to-list 'eglot-server-programs
`(terraform-mode . ("terraform-ls" "serve"))))
(add-hook 'terraform-mode-hook #'lsp-deferred)
(add-hook 'terraform-mode-hook #'lsp-deferred))
(provide 'thwap-tf)