From 1aa596c0a603bf83e49bfd2191c95950c68e21a4 Mon Sep 17 00:00:00 2001 From: Nicolas Berthier Date: Tue, 12 Sep 2023 17:38:20 +0200 Subject: [PATCH] Update to use the official `lsp` sub-commmand --- emacs/eglot-superbol.el | 6 ++--- emacs/lsp-superbol.el | 6 ++--- emacs/superbol-mode.el | 4 +-- .../superbol_languageclient.ml | 26 ++++++++++--------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/emacs/eglot-superbol.el b/emacs/eglot-superbol.el index ec209a232..8b1cddf28 100644 --- a/emacs/eglot-superbol.el +++ b/emacs/eglot-superbol.el @@ -21,14 +21,14 @@ (defun eglot-superbol--start () "Superbol LSP startup function for Eglot" - ;; Actually the LSP server + ;; Actually start the LSP server (eglot-ensure) ;; Turn on fontification (even if minimal) (funcall font-lock-fontify-buffer-function)) -(add-to-list 'eglot-server-programs '(superbol-mode . ("padbol" "lsp"))) -(add-to-list 'eglot-server-programs '(cobol-mode . ("padbol" "lsp"))) +(add-to-list 'eglot-server-programs '(superbol-mode . ("superbol" "lsp"))) +(add-to-list 'eglot-server-programs '(cobol-mode . ("superbol" "lsp"))) ;; Autostart the LSP when entering superbol-mode (add-hook 'superbol-mode-hook #'eglot-superbol--start) diff --git a/emacs/lsp-superbol.el b/emacs/lsp-superbol.el index 4d5adc6d4..c25784768 100644 --- a/emacs/lsp-superbol.el +++ b/emacs/lsp-superbol.el @@ -34,7 +34,7 @@ (defun lsp-superbol--server-command () "Startup command for the Superbol LSP language server." ;; (list (lsp-package-path 'superbol-language-server) "lsp")) - (list (expand-file-name "padbol" lsp-superbol-path) "lsp")) + (list (expand-file-name "superbol" lsp-superbol-path) "lsp")) ;; (lsp-dependency 'superbol-language-server ;; `(:system ,(executable-find (lsp-package-path 'superbol-language-server)))) @@ -60,11 +60,9 @@ ;; Enable semantic tokens (set (make-local-variable 'lsp-semantic-tokens-enable) t) - ;; Actually the LSP server + ;; Actually start the LSP server (lsp) - ;; (lsp-semantic-tokens-mode 1) - ;; Turn on fontification (funcall font-lock-fontify-buffer-function)) diff --git a/emacs/superbol-mode.el b/emacs/superbol-mode.el index 7a9ed430a..3a8b4276b 100644 --- a/emacs/superbol-mode.el +++ b/emacs/superbol-mode.el @@ -25,7 +25,7 @@ extensions." (define-derived-mode superbol-mode prog-mode "Superbol" "SUPERBOL mode is a major mode for handling COBOL files. It is mostly intended -to be backed by an LSP." +to be backed by an LSP server (see `lsp-superbol.el`, or `eglot-superbol.el`)." ;; XXX: could actually derive from cobol-mode, if available. ;; Straight from cobol-mode @@ -34,7 +34,7 @@ to be backed by an LSP." (set (make-local-variable 'comment-start) "*>") (set (make-local-variable 'comment-end) "") - ;; Forbid tabs in indentation (for now, that's a limitation of Superbol) + ;; Forbid tabs in indentation (for now) (set (make-local-variable 'indent-tabs-mode) nil)) ;; --- diff --git a/src/superbol-vscode-platform/superbol_languageclient.ml b/src/superbol-vscode-platform/superbol_languageclient.ml index 301312975..f68565214 100644 --- a/src/superbol-vscode-platform/superbol_languageclient.ml +++ b/src/superbol-vscode-platform/superbol_languageclient.ml @@ -10,21 +10,23 @@ (**************************************************************************) -let command = - Vscode.Workspace.getConfiguration () +let command + = Vscode.Workspace.getConfiguration () |> Vscode.WorkspaceConfiguration.get ~section:"superbol.path" - |> function Some o -> Ojs.string_of_js o - | None -> "superbol" + |> Option.fold ~some:Ojs.string_of_js ~none:"superbol" -let args = ["x-lsp"] +let args = ["lsp"] -let serverOptions = Vscode_languageclient.ServerOptions.create - ~command - ~args - () +let serverOptions = + Vscode_languageclient.ServerOptions.create () + ~command ~args let documentSelector = - [| `Filter (Vscode_languageclient.DocumentFilter.createLanguage ~language:"cobol" ()) |] - -let clientOptions = Vscode_languageclient.ClientOptions.create ~documentSelector () + [| + `Filter (Vscode_languageclient.DocumentFilter.createLanguage () + ~language:"cobol"); + |] +let clientOptions = + Vscode_languageclient.ClientOptions.create () + ~documentSelector