Created
February 12, 2023 15:58
-
-
Save bsless/95c36c22b69fd44d5e54fd36c1685fa5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'lsp) | |
(defcustom-lsp lsp-unison-lsp-port 5757 | |
"The port of a running UCM language server. You can overwride thise by setting the UNISON_LSP_PORT environment variable when running UCM." | |
:type 'number | |
:group 'lsp-unison | |
:package-version '(lsp-mode . "8.0.1") | |
:lsp-path "unison.lspPort") | |
(defcustom-lsp lsp-unison-trace-server "off" | |
"Traces the communication between VSCode and the language server." | |
:type '(choice (:tag off messages verbose)) | |
:group 'lsp-unison | |
:package-version '(lsp-mode . "8.0.1") | |
:lsp-path "unison.trace.server") | |
(defcustom-lsp lsp-unison-automatically-open-ucm t | |
"Automatically open an embedded terminal and start UCM if no existing UCM session is detected." | |
:type 'boolean | |
:group 'lsp-unison | |
:package-version '(lsp-mode . "8.0.1") | |
:lsp-path "unison.automaticallyOpenUCM") | |
(defcustom-lsp lsp-unison-ucm-command "ucm" | |
"Which command to run when automatically opening ucm in a terminal." | |
:type 'string | |
:group 'lsp-unison | |
:package-version '(lsp-mode . "8.0.1") | |
:lsp-path "unison.ucmCommand") | |
(add-to-list 'lsp-language-id-configuration '(unisonlang-mode . "unisonlang")) | |
;;; This assumes UCM is already running | |
(defun lsp-unison-tcp-connection-query () | |
(list | |
:connect (lambda (filter sentinel name environment-fn workspace) | |
(let* ((host "localhost") | |
(port lsp-unison-lsp-port) | |
(tcp-proc (lsp--open-network-stream host port (concat name "::tcp")))) | |
(set-process-query-on-exit-flag tcp-proc nil) | |
(set-process-filter tcp-proc filter) | |
(cons tcp-proc tcp-proc))) | |
:test? (lambda () t))) | |
(lsp-register-client | |
(make-lsp-client :new-connection (lsp-unison-tcp-connection-query) | |
:activation-fn (lsp-activate-on "unison") | |
:major-modes '(unisonlang-mode) | |
:server-id 'ucm)) | |
(progn | |
(setq lsp-eldoc-enable-hover t) | |
(setq lsp-enable-symbol-highlighting t) | |
(setq lsp-headerline-breadcrumb-enable nil) | |
(setq lsp-lens-enable t) | |
(setq lsp-modeline-code-actions-enable t) | |
(setq lsp-modeline-diagnostics-enable t) | |
(setq lsp-ui-doc-enable t) | |
(setq lsp-ui-doc-show-with-cursor t) | |
(setq lsp-ui-doc-show-with-mouse t) | |
(setq lsp-ui-sideline-enable nil) | |
(setq lsp-ui-sideline-show-code-actions nil) | |
(setq lsp-ui-sideline-show-diagnostics nil) | |
(setq lsp-ui-sideline-show-hover nil) | |
;; (setq lsp-diagnostics-provider :none) | |
;; (setq lsp-signature-auto-activate t) ;; you could manually request them via `lsp-signature-activate` | |
(setq lsp-signature-render-documentation t)) | |
;; (setq lsp-completion-provider :none) | |
;; (setq lsp-completion-show-detail t) | |
;; (setq lsp-completion-show-kind t) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment