adding dev environment stuff

This commit is contained in:
2025-11-25 11:22:55 -05:00
parent 69aeca9282
commit 7ea4b2fe8b
3 changed files with 319 additions and 1 deletions

133
dev-settings-work.el Normal file
View File

@@ -0,0 +1,133 @@
;;; dev-settings-work.el --- Work-specific development configuration (Windows)
;;; C# Configuration
(use-package csharp-mode
:hook (csharp-mode . lsp-deferred)
:config
(setq lsp-csharp-server-path nil) ; Use omnisharp from PATH
;; Configure for .NET development
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode)))
;; OmniSharp for C# LSP
;; Install via: dotnet tool install --global csharp-ls
;; Or use omnisharp-roslyn: choco install omnisharp
(use-package lsp-mode
:config
(setq lsp-csharp-server-path "csharp-ls")) ; or "omnisharp"
;; DAP for .NET debugging (uses vsdbg from VS Code)
(use-package dap-mode
:config
(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
)
;;; Python Configuration
(use-package python-mode
:hook (python-mode . lsp-deferred)
:config
(setq python-shell-interpreter "python3"))
;; Python LSP server (install: pip install python-lsp-server)
(use-package lsp-pyright
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred))))
;; Python debugging
(use-package dap-mode
:config
(require 'dap-python)
;; Assumes debugpy is installed: pip install debugpy
(setq dap-python-debugger 'debugpy))
;; Python virtual environment support
(use-package pyvenv
:config
(pyvenv-mode 1))
;;; JavaScript/TypeScript Configuration
(use-package js2-mode
:mode "\\.js\\'"
:hook (js2-mode . lsp-deferred)
:config
(setq js2-basic-offset 2
js2-bounce-indent-p nil))
(use-package typescript-mode
:mode "\\.ts\\'"
:hook (typescript-mode . lsp-deferred)
:config
(setq typescript-indent-level 2))
;; TSX support
(use-package typescript-mode
:mode "\\.tsx\\'"
:config
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-mode)))
;; Enhanced JavaScript/TypeScript editing
(use-package tide
: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)))
;;; Node.js Configuration
;; NPM package management
(use-package npm-mode
:hook (js2-mode typescript-mode))
;; Node.js REPL
(use-package nodejs-repl
:bind (:map js2-mode-map
("C-c C-z" . nodejs-repl)
:map typescript-mode-map
("C-c C-z" . nodejs-repl)))
;; JSON support (common in Node.js projects)
(use-package json-mode
:mode "\\.json\\'")
;;; Additional Web Development Tools
;; Web mode for HTML/JSX/template files
(use-package web-mode
: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
:mode "\\.css\\'"
:config
(setq css-indent-offset 2))
(use-package scss-mode
:mode "\\.scss\\'"
:config
(setq scss-compile-at-save nil))
;; REST client for API testing
(use-package restclient
: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

176
dev-settings.el Normal file
View File

@@ -0,0 +1,176 @@
;;; dev-settings.el --- Development environment configuration
;; Disable warnings for config files
(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)
;;; Core Development Packages
;; Company - autocomplete
(use-package company
:defer 1
:config
(global-company-mode)
(setq company-idle-delay 0.2
company-minimum-prefix-length 2
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
:defer t
:commands (lsp lsp-deferred)
:init
(setq lsp-keymap-prefix "C-c l")
: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))
(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
(use-package dap-mode
:defer t
:after lsp-mode
:commands dap-mode
:config
(dap-auto-configure-mode)
(require 'dap-gdb-lldb))
;; Project management - already in init.el, just configure for dev
;; Projectile configuration merged with init.el settings
;; Git integration - already in init.el
;;; C/C++ Configuration
(use-package cc-mode
:ensure nil
:hook ((c-mode . lsp-deferred)
(c++-mode . lsp-deferred))
:config
(setq c-basic-offset 4
c-default-style "linux"))
;; Install clangd for C/C++ LSP support
;; You'll need to install clangd separately:
;; - Windows: Download from LLVM releases
;; - Linux: sudo apt install clangd
;; Modern C++ font-lock
(use-package modern-cpp-font-lock
:hook (c++-mode . modern-c++-font-lock-mode))
;;; Common Lisp Configuration
(use-package slime
:defer t
:commands slime
:config
(setq inferior-lisp-program "sbcl") ; or "ccl", "clisp", etc.
(setq slime-contribs '(slime-fancy slime-company))
(setq slime-lisp-implementations
'((sbcl ("sbcl") :coding-system utf-8-unix)
(ccl ("ccl") :coding-system utf-8-unix))))
(use-package slime-company
:defer t
:after (slime company)
:config
(setq slime-company-completion 'fuzzy))
;;; Emacs Lisp Configuration
(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))))))
;; Better elisp docs
(use-package helpful
:bind (("C-h f" . helpful-callable)
("C-h v" . helpful-variable)
("C-h k" . helpful-key)))
;;; Additional Useful Packages
;; Parentheses management - rainbow-delimiters already in init.el
(use-package smartparens
:defer 1
:hook (prog-mode . smartparens-mode)
:config
(require 'smartparens-config))
;; Snippets
(use-package yasnippet
:defer 2
:config
(yas-global-mode 1))
(use-package yasnippet-snippets
:defer t
:after yasnippet)
;; Better search
(use-package ag
:defer t
:commands ag
:if (executable-find "ag"))
;; 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))
;;; Conditional loading of work-specific settings (Windows only)
(when (eq system-type 'windows-nt)
(let ((work-settings (expand-file-name "dev-settings-work.el" user-emacs-directory)))
(when (file-exists-p work-settings)
(load work-settings))))
(provide 'dev-settings)
;;; dev-settings.el ends here

11
init.el
View File

@@ -209,7 +209,13 @@
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; If there is more than one, they won't work right.
'(package-selected-packages nil)) '(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)))
(custom-set-faces (custom-set-faces
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.
@@ -227,3 +233,6 @@
:hook (org-mode . rh/org-mode-setup) :hook (org-mode . rh/org-mode-setup)
:config :config
(setq org-agenda-files (directory-files-recursively "~/org" "\\.org$"))) (setq org-agenda-files (directory-files-recursively "~/org" "\\.org$")))
;; Development Environment ------------------------------------------------------
(load (expand-file-name "dev-settings.el" user-emacs-directory))