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 ;; lsp toggle
(defcustom thwap-comp-enable-lsp nil (defcustom thwap-dev-enable-lsp nil
"Whether or not to enable lsp." "Whether or not to enable lsp."
:type 'boolean :type 'boolean
:group 'thwap-config-group) :group 'thwap-config-group)
;;
;; development assistance packages
;;
;; projectile toggle ;; projectile toggle
(defcustom thwap-dev-enable-projectile nil (defcustom thwap-dev-enable-projectile nil
"Whether or not to enable projectile." "Whether or not to enable projectile."
@ -123,6 +118,29 @@
:type 'boolean :type 'boolean
:group 'thwap-config-group) :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 ;; Org mode settings

View File

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

View File

@ -1,14 +1,15 @@
(straight-use-package 'go-mode) (when thwap-dev-enable-go
(straight-use-package 'go-mode)
(setq lsp-go-analyses '((shadow . t) (straight-use-package 'eglot)
(setq lsp-go-analyses '((shadow . t)
(simplifycompositelit . :json-false))) (simplifycompositelit . :json-false)))
(when (executable-find "gopls")
(when (executable-find "gopls")
(setq gofmt-command "goimports")
(add-hook 'go-mode-hook #'lsp-deferred) (add-hook 'go-mode-hook #'lsp-deferred)
(add-hook 'before-save-hook 'gofmt-before-save)
(add-hook 'go-mode-hook 'eglot-ensure)) (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) (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-mode)
(straight-use-package 'lsp-ui) (straight-use-package 'lsp-ui)
(straight-use-package 'lsp-treemacs) (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))) (setq-local tab-width 2)))
(add-hook 'python-mode-hook #'lsp-deferred)
(add-hook 'python-mode-hook #'lsp-deferred) (when (executable-find "pylsp")
(when (executable-find "pylsp")
(add-hook 'python-mode-hook 'eglot-ensure)) (add-hook 'python-mode-hook 'eglot-ensure))
(use-package python-black
(use-package python-black
:demand t :demand t
:straight t :straight t
:after python :after python
:hook (python-mode . python-black-on-save-mode)) :hook (python-mode . python-black-on-save-mode)))
(provide 'thwap-py) (provide 'thwap-py)

View File

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