summaryrefslogtreecommitdiff
path: root/dot_config/emacs/lisp/lsp-mode-config.el
diff options
context:
space:
mode:
Diffstat (limited to 'dot_config/emacs/lisp/lsp-mode-config.el')
-rw-r--r--dot_config/emacs/lisp/lsp-mode-config.el169
1 files changed, 169 insertions, 0 deletions
diff --git a/dot_config/emacs/lisp/lsp-mode-config.el b/dot_config/emacs/lisp/lsp-mode-config.el
new file mode 100644
index 0000000..cc26d9c
--- /dev/null
+++ b/dot_config/emacs/lisp/lsp-mode-config.el
@@ -0,0 +1,169 @@
+;; (use-package lsp-mode
+;; :init
+;; ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
+;; (setq lsp-keymap-prefix "C-c l")
+;; :hook
+;; ((lsp-mode . lsp-enable-which-key-integration)
+;; (prog-mode . lsp-deferred))
+;; :commands lsp
+;; :custom
+;; (lsp-keymap-prefix "C-c l") ;; Set the prefix for LSP commands.
+;; (lsp-inlay-hint-enable t) ;; Usage of inlay hints.
+;; (lsp-session-file (locate-user-emacs-file ".lsp-session")) ;; Specify session file location.
+;; (lsp-log-io nil) ;; Disable IO logging for speed.
+;; (lsp-idle-delay 0.5) ;; Set the delay for LSP to 0 (debouncing).
+;; (lsp-keep-workspace-alive nil) ;; Disable keeping the workspace alive.
+;; ;; Core settings
+;; (lsp-enable-xref t) ;; Enable cross-references.
+;; (lsp-auto-configure t) ;; Automatically configure LSP.
+;; (lsp-enable-links nil) ;; Disable links.
+;; (lsp-eldoc-enable-hover t) ;; Enable ElDoc hover.
+;; (lsp-enable-file-watchers nil) ;; Disable file watchers.
+;; (lsp-enable-folding nil) ;; Disable folding.
+;; (lsp-enable-imenu t) ;; Enable Imenu support.
+;; (lsp-enable-indentation nil) ;; Disable indentation.
+;; (lsp-enable-on-type-formatting nil) ;; Disable on-type formatting.
+;; (lsp-enable-suggest-server-download t) ;; Enable server download suggestion.
+;; (lsp-enable-symbol-highlighting t) ;; Enable symbol highlighting.
+;; (lsp-enable-text-document-color t) ;; Enable text document color.
+;; (lsp-warn-no-matched-clients nil) ;; Disable warning when there are no supported clients.
+;; ;; Modeline settings
+;; (lsp-modeline-code-actions-enable nil) ;; Keep modeline clean.
+;; (lsp-modeline-diagnostics-enable nil) ;; Use `flymake' instead.
+;; (lsp-modeline-workspace-status-enable t) ;; Display "LSP" in the modeline when enabled.
+;; (lsp-signature-doc-lines 1) ;; Limit echo area to one line.
+;; (lsp-eldoc-render-all t) ;; Render all ElDoc messages.
+;; ;; Completion settings
+;; (lsp-completion-enable t) ;; Enable completion.
+;; (lsp-completion-enable-additional-text-edit t) ;; Enable additional text edits for completions.
+;; (lsp-enable-snippet t) ;; Disable snippets
+;; (lsp-completion-show-kind t) ;; Show kind in completions.
+;; ;; Lens settings
+;; (lsp-lens-enable t) ;; Enable lens support.
+;; ;; Headerline settings
+;; (lsp-headerline-breadcrumb-enable-symbol-numbers t) ;; Enable symbol numbers in the headerline.
+;; (lsp-headerline-arrow "▶") ;; Set arrow for headerline.
+;; (lsp-headerline-breadcrumb-enable-diagnostics nil) ;; Disable diagnostics in headerline.
+;; (lsp-headerline-breadcrumb-icons-enable nil) ;; Disable icons in breadcrumb.
+;; ;; Semantic settings
+;; (lsp-semantic-tokens-enable nil)
+;; :config
+;; (define-key lsp-mode-map (kbd "C-c l") lsp-command-map)
+;; )
+
+(use-package eldoc-box)
+
+(use-package eglot
+ :hook
+ ;; Automatically start Eglot for specific programming modes
+ ((prog-mode . eglot-ensure))
+ :bind
+ ("C-c l a" . eglot-code-actions)
+ ("C-c l r" . eglot-rename)
+ ("C-c l h" . eldoc-box-help-at-point)
+ ("C-c l f" . eglot-format)
+ ("C-c l F" . eglot-format-buffer)
+ ("C-c l d" . xref-find-definitions)
+ ("C-c l R" . xref-find-references)
+ ("C-c l i" . eglot-find-implementation)
+ :custom
+ (eglot-autoshutdown t)
+ :config
+ ;; Configure rust-analyzer to use Clippy instead of Cargo Check
+ (setq-default eglot-workspace-configuration
+ '(:rust-analyzer
+ (:check
+ (:command "clippy")))))
+
+(use-package corfu
+ :ensure t
+ :defer t
+ :custom
+ (corfu-auto nil) ;; Only completes when hitting TAB
+ (corfu-auto-delay 0) ;; Delay before popup (enable if corfu-auto is t)
+ (corfu-auto-prefix 1) ;; Trigger completion after typing 1 character
+ (corfu-quit-no-match t) ;; Quit popup if no match
+ (corfu-scroll-margin 5) ;; Margin when scrolling completions
+ (corfu-max-width 50) ;; Maximum width of completion popup
+ (corfu-min-width 50) ;; Minimum width of completion popup
+ (corfu-popupinfo-delay 0.5) ;; Delay before showing documentation popup
+ :init
+ (global-corfu-mode)
+ (corfu-popupinfo-mode t))
+
+
+(use-package yasnippet
+ :ensure t)
+ ;; :hook ((text-mode
+ ;; prog-mode
+ ;; conf-mode
+;; snippet-mode) . yas-minor-mode))
+
+(use-package yasnippet-capf
+ :after cape
+ :config
+ (add-to-list 'completion-at-point-functions #'yasnippet-capf)
+ (defun mi/eglot-capf-with-yasnippet ()
+ (setq-local completion-at-point-functions
+ (list
+ (cape-capf-super
+ #'eglot-completion-at-point
+ #'yasnippet-capf))))
+(with-eval-after-load 'eglot
+ (add-hook 'eglot-managed-mode-hook #'mi/eglot-capf-with-yasnippet)))
+
+(use-package yasnippet-snippets)
+
+;; (use-package flycheck
+;; :ensure t
+;; :custom
+;; (flycheck-display-errors-delay 0))
+
+;; (use-package flycheck-inline
+;; :hook
+;; (flycheck-mode . flycheck-inline-mode))
+
+(use-package rustic
+ :ensure t
+ :defer t
+ :init (setq rust-mode-treesitter-derive t)
+ :config
+ (setq rustic-lsp-client 'eglot)
+ (setq rustic-format-on-save t)
+ (setq rustic-rustfmt-args "--edition 2024") ;; should be a temporary fix
+ :custom
+ (rustic-cargo-use-last-stored-arguments t)
+ (rustic-babel-display-error-popup nil)
+ (rustic-lsp-setup-p nil)
+ (lsp-rust-analyzer-cargo-watch-command "clippy"))
+
+(use-package cape
+ :demand t
+ :init
+ ;; Add `completion-at-point-functions', used by `completion-at-point'.
+ (setq-default completion-at-point-functions
+ (append (default-value 'completion-at-point-functions)
+ (list #'cape-dabbrev #'cape-file #'cape-abbrev #'cape-emoji #'cape-history #'cape-tex))))
+
+(use-package fennel-mode
+ :config
+ (with-eval-after-load 'org
+ (require 'ob-fennel)))
+
+;; DAP Mode
+;; (use-package exec-path-from-shell
+;; :ensure
+;; :init (exec-path-from-shell-initialize))
+
+;; (use-package dap-mode
+;; :defer t
+;; :ensure
+;; :config
+;; (dap-ui-mode)
+;; (dap-ui-controls-mode 1)
+
+;; (require 'dap-lldb)
+;; (require 'dap-gdb-lldb)
+;; (dap-gdb-lldb-setup))
+
+(provide 'lsp-mode-config)