;; Projects ;; :PROPERTIES: ;; :header-args: :tangle modules/projects.el ;; :END: ;; An IDE like experience (or better) can be achieved in Emacs using two *Microsoft* open source initiatives. ;; + [[https://microsoft.github.io/language-server-protocol/][Language Server Protocol]] ;; + [[https://microsoft.github.io/debug-adapter-protocol/][Debug Adapter Protocol]] ;; Add support for language servers with [[https://emacs-lsp.github.io/lsp-mode/][lsp-mode]]. (use-package lsp-mode :commands (lsp lsp-deferred) :custom (lsp-idle-delay (* 5 dotfiles/idle))) ;; [[https://emacs-lsp.github.io/lsp-ui/][lsp-ui]] provides UI improvements for =lsp-mode=. (use-package lsp-ui :after lsp :custom (lsp-ui-doc-position 'at-point) (lsp-ui-doc-delay 0.500)) ;; [[https://emacs-lsp.github.io/dap-mode/][Dap-mode]] adds support for the debug adapter protocol to Emacs. (use-package dap-mode :commands (dap-debug)) ;; Containers ;; Use ~docker~ for running containers. Download and install https://github.com/Silex/docker.el, allowing us to manage containers within Emacs. (use-package docker :commands (docker)) ;; Open the management screen with =SPC k=. (dotfiles/leader "k" '(docker :which-key "Docker")) ;; Management ;; Configure [[https://projectile.mx][projectile]], a project interaction library for Emacs. It provides a nice set of features for operating on a project level without introducing external dependencies. (use-package projectile :custom (projectile-project-search-path '("~/.local/source")) :config (projectile-mode)) ;; Completion ;; Text completion framework via =company= aka *Complete Anything*. ;; http://company-mode.github.io/ ;; + Integrate with =lsp-mode= (use-package company :after lsp) (use-package company-lsp :after (lsp company) :custom (company-backend 'company-lsp)) ;; Passwords ;; Pass makes managing passwords extremely easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. =password-store.el= provides a wrapper for the functionality within Emacs. (use-package password-store :custom (password-store-dir dotfiles/passwords)) ;; Configure keybindings behind =SPC p=. ;; + Copy with =p= ;; + Rename with =r= ;; + Generate with =g= (dotfiles/leader "p" '(:ignore t :which-key "Passwords") "pp" '(password-store-copy :which-key "Copy") "pr" '(password-store-rename :which-key "Rename") "pg" '(password-store-generate :which-key "Generate")) ;; Set the ~GOPATH~ environment variable prior to loading, this allows us to change the default value of ~$HOME/go~ to ~$HOME/.go~. (setenv "GOPATH" (concat (getenv "HOME") "/.go/")) ;; Additionally, include the =bin= subdirectory of the ~$GOPATH~ in the ~$PATH~ variable, adding compiled golang programs. (setenv "PATH" (concat (getenv "GOPATH") "bin:" (getenv "PATH"))) ;; Finally we can include the =go-mode= package, integrating it with =lsp=. (use-package go-mode :hook (go-mode . lsp) :custom (lsp-go-gopls-server-path "~/.go/bin/gopls")) ;; Apply some custom behaviour before saving: ;; + Format buffer ;; + Organize imports (defun dotfiles/go-hook () (add-hook 'before-save-hook #'lsp-format-buffer t t) (add-hook 'before-save-hook #'lsp-organize-imports t t)) (add-hook 'go-mode-hook #'dotfiles/go-hook) ;; Add a golang source code block structure template with ~