118 lines
3.0 KiB
EmacsLisp
118 lines
3.0 KiB
EmacsLisp
;;; 15-lsp.el --- Setup LSP -*- no-byte-compile: t; lexical-binding: t; -*-
|
|
|
|
;;; Description:
|
|
;; Despite the name, this file not only sets up LSP integration, but
|
|
;; also native emacs modes for various programming lanuguages, such as
|
|
;; Prolog, that do not use LSP.
|
|
|
|
;;; Code:
|
|
|
|
;; Eglot is the built-in LSP client.
|
|
(use-package eglot
|
|
:ensure nil
|
|
:defer t
|
|
:commands (eglot
|
|
eglot-rename
|
|
eglot-ensure
|
|
eglot-rename
|
|
eglot-format-buffer)
|
|
|
|
:custom
|
|
(eglot-report-progress nil) ; Prevent minibuffer spam
|
|
|
|
:config
|
|
(add-to-list 'eglot-server-programs '((rust-mode) . ("rust-analyzer")))
|
|
(add-to-list 'eglot-server-programs '(nix-mode . ("nil")))
|
|
;; Optimizations
|
|
(fset #'jsonrpc--log-event #'ignore)
|
|
(setq jsonrpc-event-hook nil))
|
|
|
|
;; This function raises the window to the front using KDE KWin.
|
|
(defun my/raise-window ()
|
|
(call-process-shell-command "~/wayland-window -f emacs &" nil 0))
|
|
|
|
;; Usually, when I open a file with emacsclient and the frame already exists, I
|
|
;; want it to be raised to the top. Unfortunately, that does not happen by
|
|
;; default. Here is my solution.
|
|
(add-hook 'server-visit-hook #'my/raise-window)
|
|
|
|
;; This package provides syntax highlighting for gdscript.
|
|
(use-package gdscript-mode
|
|
:ensure t
|
|
:defer t
|
|
:commands (gdscript-mode))
|
|
|
|
(add-hook 'gdscript-mode-hook #'eglot-ensure)
|
|
|
|
;; This package provides syntax highlighting and some utilities for
|
|
;; working with rust code.
|
|
(use-package rust-mode
|
|
:ensure t
|
|
:defer t
|
|
:commands (rust-mode))
|
|
|
|
(add-hook 'rust-mode-hook #'eglot-ensure)
|
|
|
|
;; This package provides integration with Prolog (SWI).
|
|
(use-package sweeprolog
|
|
:straight (sweeprolog :type git
|
|
:host nil
|
|
:repo "https://git.sr.ht/~eshel/sweep"
|
|
:branch "main"
|
|
:files ("*.el" "sweep.pl" "sweep.texi")) ; Custom recipe because
|
|
; the normal one did not
|
|
; build properly.
|
|
:ensure t
|
|
:defer t
|
|
:commands (sweeprolog-mode
|
|
sweeprolog-top-level)
|
|
:init
|
|
(setq sweeprolog-swipl-path "swipl"))
|
|
|
|
|
|
;; This package provides integration with Prolog (scryer) Note that editing
|
|
;; prolog is supported through built-in prolog-mode, this only allows actually
|
|
;; consulting prolog from within emacs.
|
|
(use-package ediprolog
|
|
:ensure t
|
|
:defer t
|
|
:commands (prolog-mode)
|
|
:init
|
|
(setq ediprolog-program "systemd-run")
|
|
(setq ediprolog-program-switches '("--user" "--scope" "-p" "MemoryMax=2G" "-p" "MemoryHigh=1.9G" "scryer-prolog")))
|
|
|
|
(with-eval-after-load "prolog"
|
|
(bind-key "C-c C-e" #'ediprolog-dwim prolog-mode-map))
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.plt?\\'" . prolog-mode))
|
|
|
|
;; Nix language
|
|
(use-package nix-mode
|
|
:ensure t
|
|
:defer t
|
|
:commands (nix-mode)
|
|
:hook
|
|
(nix-mode . eglot-ensure))
|
|
|
|
;; Common Lisp
|
|
(use-package sly
|
|
:ensure t
|
|
:defer t
|
|
:commands (sly)
|
|
:init
|
|
(setq inferior-lisp-program "sbcl"))
|
|
|
|
;; Markdown
|
|
(use-package markdown-mode
|
|
:ensure t
|
|
:defer t)
|
|
|
|
;; Lispy provides structural editing to lisp modes.
|
|
(use-package lispy
|
|
:ensure t
|
|
:defer t)
|
|
|
|
(add-hook 'emacs-lisp-mode-hook (lambda () (lispy-mode 1)))
|
|
|
|
;;; 15-lsp.el end here
|