I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

5.9 KiB

Development

Support for individual programming languages, has a hard dependency on the Projects module for integration with LSP1 / DAP2

Go

First class language support for Golang3.

  • Full support of LSP1

  • Full support of DAP1

Installing requirements

Get started by installing the gopls4 language server.

GO111MODULE=on go get golang.org/x/tools/gopls@latest

Setup the environment

Make some modifications to the environment.

Overriding the $GOPATH

Set the $GOPATH environment variable prior to loading the module, allowing modification of the default value.

(setenv "GOPATH" (concat (getenv "HOME") "/.go/"))

Adding $GOBIN to the $PATH

Include the bin subdirectory of the $GOPATH in the $PATH variable, adding compiled Golang applications to the system path.

(setenv "PATH" (concat (getenv "GOPATH") "bin:" (getenv "PATH")))

Configuration

Include the go-mode5 package for integration with lsp-mode from the Projects module.

(use-package go-mode
  :hook (go-mode . lsp)
  :custom (lsp-go-gopls-server-path "~/.go/bin/gopls"))

Before save hooks

Apply some custom behaviour prior to saving buffers.

  • Format buffers

  • 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)

Babel structure templates

Add a structure template for Golang3 source blocks.

(add-to-list 'org-structure-template-alist '("go" . "src go"))

HTTP

Interactive with HTTP endpoints using the ob-http6 package. You can see how it works in my post Kanye as a Service. Essentialy it adds interactive HTTP blocks that can output their results in place.

(use-package ob-http
  :after org
  :config (org-babel-do-load-languages
            'org-babel-load-languages '((http . t))))

C/C++

Add support for the C/C++ family of languages via the CCLS7 language server.

  • Integrate with LSP2

  • Integrate with DAP1

  • Load babel language modules

  • Create new structure templates

    • <cc for C

    • <cpp for C++

(use-package ccls
  :hook ((c-mode c++-mode objc-mode cuda-mode) .
         (lambda ()
           (require 'ccls)
           (lsp-deferred)))
  :config (add-to-list 'org-structure-template-alist '("cc" . "src C"))
          (add-to-list 'org-structure-template-alist '("cpp" . "src C++"))
          (org-babel-do-load-languages 'org-babel-load-languages '((C . t))))

Installing requirements

Some required packages, here's how to install on Debian/Ubuntu:

sudo apt install ccls

Python

Adds support for Python and Python 38 with DAP1 and LSP2 integration. The built in Emacs mode python-mode9 implements the behaviour.

  • Load the babel language modules for Python

  • Add a structure template with <py

(use-package python-mode
  :hook (python-mode . lsp-deferred)
  :config (require 'dap-python)
          (add-to-list 'org-src-lang-modes '("python" . python))
          (add-to-list 'org-structure-template-alist '("py" . "src python"))
          (org-babel-do-load-languages 'org-babel-load-languages '((python . t)))
  :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3.
          (dap-python-executable "python3")    ;; Same as above.
          (dap-python-debugger 'debugpy))

Installing the language server

Install the pyls10 language server.

pip3 install --user "python-language-server[all]"

PlantUML

Download and install PlantUML11, a text-based markup language for creating UML diagrams. You can read my notes about the tool PlantUML here. Support added through the plantuml-mode12 package.

  • Load the babel module for PlantUML11

  • Create a structure template with <pl

(use-package plantuml-mode
  :after org
  :custom (plantuml-default-exec-mode 'jar)
          (plantuml-jar-path "~/.local/bin/plantuml.jar")
          (org-plantuml-jar-path (expand-file-name "~/.local/bin/plantuml.jar"))
          (org-startup-with-inline-images t)
  :config (add-to-list 'org-src-lang-modes '("plantuml" . plantuml))
          (add-to-list 'org-structure-template-alist '("pl" . "src plantuml"))
          (org-babel-do-load-languages 'org-babel-load-languages '((plantuml . t))))

View inside of buffers

Toggle inline images with SPC t i.

(dotfiles/leader
  "ti" '(org-toggle-inline-images :which-key "Images"))

Resources