Compare commits

..

2 Commits

Author SHA1 Message Date
0257340cd8 adding rust and go support to dev settings 2025-11-25 20:02:54 -05:00
b506b0c404 buncha keymaps 2025-11-25 12:08:33 -05:00
3 changed files with 136 additions and 161 deletions

View File

@@ -4,93 +4,68 @@
(use-package csharp-mode
:defer t
:hook (csharp-mode . lsp-deferred)
:hook (csharp-mode . eglot-ensure)
:config
;; C# LSP server configuration
;; Install via: dotnet tool install --global csharp-ls
;; Or use omnisharp-roslyn: choco install omnisharp
(setq lsp-csharp-server-path "csharp-ls") ; or "omnisharp" or nil to use from PATH
(add-to-list 'eglot-server-programs
'(csharp-mode . ("csharp-ls")))
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode)))
;; DAP for .NET debugging
(with-eval-after-load 'dap-mode
(require 'dap-netcore)
(setq dap-netcore-install-dir (expand-file-name "~/.emacs.d/.extension/vscode/ms-dotnettools.csharp"))
;; This uses the netcoredbg that comes with VS Code C# extension
;; You may need to adjust the path based on your VS Code installation
)
(setq dap-netcore-install-dir (expand-file-name "~/.emacs.d/.extension/vscode/ms-dotnettools.csharp")))
;;; Python Configuration
(use-package python-mode
:defer t
:hook (python-mode . lsp-deferred)
(use-package python-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode "\\.py\\'"
:hook (python-ts-mode . eglot-ensure)
:config
(setq python-shell-interpreter "python3"))
;; Python LSP server (install: pip install python-lsp-server)
(use-package lsp-pyright
:defer t
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred))))
;; Python debugging configuration
(with-eval-after-load 'dap-mode
(require 'dap-python)
;; Assumes debugpy is installed: pip install debugpy
(setq dap-python-debugger 'debugpy))
;; Python virtual environment support
(use-package pyvenv
:defer t
:config
(pyvenv-mode 1))
:commands (pyvenv-activate pyvenv-workon))
;;; JavaScript/TypeScript Configuration
(use-package js2-mode
:defer t
;; Use built-in js-mode with eglot (no js2-mode needed)
(use-package js-mode
:ensure nil ; Built-in
:mode "\\.js\\'"
:hook (js2-mode . lsp-deferred)
:hook (js-mode . eglot-ensure)
:config
(setq js2-basic-offset 2
js2-bounce-indent-p nil))
(setq js-indent-level 2))
(use-package typescript-mode
:defer t
:mode ("\\.ts\\'" "\\.tsx\\'")
:hook (typescript-mode . lsp-deferred)
;; TypeScript with tree-sitter
(use-package typescript-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode (("\\.ts\\'" . typescript-ts-mode)
("\\.tsx\\'" . tsx-ts-mode))
:hook ((typescript-ts-mode . eglot-ensure)
(tsx-ts-mode . eglot-ensure))
:config
(setq typescript-indent-level 2))
;; Enhanced JavaScript/TypeScript editing
(use-package tide
:defer t
:after (typescript-mode company flycheck)
:hook ((typescript-mode . tide-setup)
(typescript-mode . tide-hl-identifier-mode)
(js2-mode . tide-setup)
(js2-mode . tide-hl-identifier-mode)))
(setq typescript-ts-mode-indent-offset 2))
;;; Node.js Configuration
;; NPM package management
(use-package npm-mode
:defer t
:hook (js2-mode typescript-mode))
;; Node.js REPL
(use-package nodejs-repl
:defer t
:bind (:map js2-mode-map
("C-c C-z" . nodejs-repl)
:map typescript-mode-map
("C-c C-z" . nodejs-repl)))
:commands nodejs-repl)
;; JSON support (common in Node.js projects)
(use-package json-mode
:defer t
;; JSON support
(use-package json-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode "\\.json\\'")
;;; Additional Web Development Tools
@@ -99,36 +74,23 @@
(use-package web-mode
:defer t
:mode ("\\.html\\'"
"\\.jsx\\'"
"\\.vue\\'")
:config
(setq web-mode-markup-indent-offset 2
web-mode-css-indent-offset 2
web-mode-code-indent-offset 2))
;; CSS/SCSS
(use-package css-mode
:ensure nil
:defer t
;; CSS with tree-sitter
(use-package css-ts-mode
:ensure nil ; Built-in with tree-sitter
:mode "\\.css\\'"
:config
(setq css-indent-offset 2))
(use-package scss-mode
:defer t
:mode "\\.scss\\'"
:config
(setq scss-compile-at-save nil))
;; REST client for API testing
(use-package restclient
:defer t
:mode ("\\.http\\'" . restclient-mode))
;;; LSP Configuration for Windows paths
(when (eq system-type 'windows-nt)
(setq lsp-javascript-typescript-server "typescript-language-server"
lsp-clients-typescript-server-args '("--stdio")))
(provide 'dev-settings-work)
;;; dev-settings-work.el ends here

View File

@@ -4,7 +4,6 @@
(setq byte-compile-warnings '(not free-vars unresolved noruntime lexical make-local))
;;; Package Management
;; Package initialization already done in init.el
(require 'use-package)
(setq use-package-always-ensure t)
@@ -20,76 +19,95 @@
company-show-numbers t
company-tooltip-align-annotations t))
;; Flycheck - syntax checking
(use-package flycheck
:defer 2
:config
(global-flycheck-mode)
;; Disable for emacs lisp in config directories
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc)))
;; LSP Mode - language server protocol
(use-package lsp-mode
;; Eglot - Built-in LSP client (Emacs 29+)
(use-package eglot
:ensure nil ; Built-in to Emacs 29+
:defer t
:commands (lsp lsp-deferred)
:init
(setq lsp-keymap-prefix "C-c l")
:commands (eglot eglot-ensure)
:config
(setq lsp-enable-snippet t
lsp-enable-symbol-highlighting t
lsp-enable-on-type-formatting nil
lsp-signature-auto-activate t
lsp-signature-render-documentation t
lsp-completion-provider :capf
lsp-headerline-breadcrumb-enable t))
;; Disable intrusive features
(setq eglot-autoshutdown t
eglot-send-changes-idle-time 0.5)
;; Disable eldoc signature help and documentation on hover
(setq eldoc-echo-area-use-multiline-p nil)
(add-to-list 'eglot-stay-out-of 'eldoc))
(use-package lsp-ui
:defer t
:commands lsp-ui-mode
:config
(setq lsp-ui-doc-enable t
lsp-ui-doc-show-with-cursor t
lsp-ui-doc-position 'at-point
lsp-ui-sideline-enable t
lsp-ui-sideline-show-hover t))
;; Company integration with LSP
(use-package company-capf
:ensure nil
:after company)
;; Debugging with DAP
;; DAP Mode - Debug Adapter Protocol
(use-package dap-mode
:defer t
:after lsp-mode
:commands dap-mode
:commands (dap-mode dap-debug)
:config
(dap-auto-configure-mode)
(require 'dap-gdb-lldb))
(require 'dap-gdb-lldb) ; C/C++
(require 'dap-cpptools))
;; Project management - already in init.el, just configure for dev
;; Projectile configuration merged with init.el settings
;;; Tree-sitter Configuration (Emacs 29+)
;; Tree-sitter is built-in to Emacs 29+
;; Language grammars need to be installed separately
;; Git integration - already in init.el
;; Automatically install tree-sitter grammars
(use-package treesit-auto
:custom
(treesit-auto-install t) ; Auto-install without prompting
:config
(treesit-auto-add-to-auto-mode-alist 'all)
(global-treesit-auto-mode))
;;; C/C++ Configuration
(use-package cc-mode
:ensure nil
:hook ((c-mode . lsp-deferred)
(c++-mode . lsp-deferred))
(use-package c-ts-mode
:ensure nil ; Built-in
:mode (("\\.c\\'" . c-ts-mode)
("\\.h\\'" . c-ts-mode)
("\\.cpp\\'" . c++-ts-mode)
("\\.hpp\\'" . c++-ts-mode)
("\\.cc\\'" . c++-ts-mode)
("\\.cxx\\'" . c++-ts-mode))
:hook ((c-ts-mode . eglot-ensure)
(c++-ts-mode . eglot-ensure))
:config
(setq c-basic-offset 4
c-default-style "linux"))
(setq c-ts-mode-indent-offset 4))
;; Install clangd for C/C++ LSP support
;; You'll need to install clangd separately:
;; - Windows: Download from LLVM releases
;; - Linux: sudo apt install clangd
;; Arch: sudo pacman -S clang
;; Windows: Download from LLVM releases
;; Modern C++ font-lock
(use-package modern-cpp-font-lock
:hook (c++-mode . modern-c++-font-lock-mode))
;;; Go Configuration
(use-package go-ts-mode
:ensure nil ; Built-in to Emacs 29+
:mode "\\.go\\'"
:hook (go-ts-mode . eglot-ensure)
:config
(setq go-ts-mode-indent-offset 4))
;; Install gopls for Go LSP support
;; Arch: sudo pacman -S go gopls
;; Debug adapter: go install github.com/go-delve/delve/cmd/dlv@latest
(with-eval-after-load 'dap-mode
(require 'dap-dlv-go))
;;; Rust Configuration
(use-package rust-ts-mode
:ensure nil ; Built-in to Emacs 29+
:mode "\\.rs\\'"
:hook (rust-ts-mode . eglot-ensure)
:config
(setq rust-ts-mode-indent-offset 4))
;; Install rust-analyzer for Rust LSP support
;; Arch: sudo pacman -S rust rust-analyzer
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(rust-ts-mode . ("rust-analyzer"))))
(with-eval-after-load 'dap-mode
(require 'dap-gdb-lldb))
;; Note: Rust debugging uses the same gdb-lldb adapter as C/C++
;; configured in the DAP Mode section above
;;; Common Lisp Configuration
@@ -97,7 +115,7 @@
:defer t
:commands slime
:config
(setq inferior-lisp-program "sbcl") ; or "ccl", "clisp", etc.
(setq inferior-lisp-program "sbcl")
(setq slime-contribs '(slime-fancy slime-company))
(setq slime-lisp-implementations
'((sbcl ("sbcl") :coding-system utf-8-unix)
@@ -114,26 +132,15 @@
(use-package elisp-mode
:ensure nil
:hook ((emacs-lisp-mode . eldoc-mode)
(emacs-lisp-mode . company-mode))
:config
;; Disable checkdoc warnings in config files
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(when (or (string-match-p "\\.emacs\\.d" (or buffer-file-name ""))
(string-match-p "init\\.el" (or buffer-file-name ""))
(string-match-p "dev-settings" (or buffer-file-name "")))
(setq-local flycheck-disabled-checkers '(emacs-lisp-checkdoc))))))
(emacs-lisp-mode . company-mode)))
;; Better elisp docs
(use-package helpful
:bind (("C-h f" . helpful-callable)
("C-h v" . helpful-variable)
("C-h k" . helpful-key)))
:defer t
:commands (helpful-callable helpful-variable helpful-key))
;;; Additional Useful Packages
;; Parentheses management - rainbow-delimiters already in init.el
(use-package smartparens
:defer 1
:hook (prog-mode . smartparens-mode)
@@ -150,21 +157,33 @@
:defer t
:after yasnippet)
;; Better search
(use-package ag
:defer t
:commands ag
:if (executable-find "ag"))
;;; LSP Keybindings
(with-eval-after-load 'general
(rh/leader-keys
"g" '(:ignore t :which-key "lsp/go-to")
"gd" '(xref-find-definitions :which-key "go to definition")
"gr" '(xref-find-references :which-key "find references")
"gi" '(eglot-find-implementation :which-key "go to implementation")
"gt" '(eglot-find-typeDefinition :which-key "go to type definition")
"gh" '(eldoc-doc-buffer :which-key "show documentation")
"gs" '(eldoc :which-key "signature help")
"ga" '(eglot-code-actions :which-key "code actions")
"gn" '(eglot-rename :which-key "rename symbol")
"ge" '(flymake-show-buffer-diagnostics :which-key "show diagnostics")
"gf" '(eglot-format-buffer :which-key "format buffer")
;; Treemacs for project navigation
(use-package treemacs
:defer t
:commands treemacs
:bind (("C-c t" . treemacs)))
(use-package treemacs-projectile
:defer t
:after (treemacs projectile))
"d" '(:ignore t :which-key "debug")
"dd" '(dap-debug :which-key "start debugging")
"db" '(dap-breakpoint-toggle :which-key "toggle breakpoint")
"dc" '(dap-continue :which-key "continue")
"dn" '(dap-next :which-key "step over")
"di" '(dap-step-in :which-key "step into")
"do" '(dap-step-out :which-key "step out")
"dr" '(dap-restart-frame :which-key "restart")
"dq" '(dap-disconnect :which-key "quit/disconnect")
"de" '(dap-eval :which-key "eval expression")
"dl" '(dap-ui-locals :which-key "show locals")
"ds" '(dap-ui-sessions :which-key "show sessions")))
;;; Conditional loading of work-specific settings (Windows only)
(when (eq system-type 'windows-nt)

10
init.el
View File

@@ -209,13 +209,7 @@
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages
'(ag all-the-icons company consult-projectile dap-mode doom-modeline
embark-consult evil-collection flycheck general gruvbox-theme
helpful hydra lsp-mode lsp-ui magit marginalia
modern-cpp-font-lock orderless org-bullets org-modern
rainbow-delimiters slime slime-company smartparens treemacs
treemacs-projectile vertico yasnippet yasnippet-snippets)))
'(package-selected-packages nil))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
@@ -234,5 +228,5 @@
:config
(setq org-agenda-files (directory-files-recursively "~/org" "\\.org$")))
;; Development Environment ------------------------------------------------------
;; Development Environment -----------------------------------------------------
(load (expand-file-name "dev-settings.el" user-emacs-directory))