Skip to content

Commit

Permalink
Update to use the official lsp sub-commmand
Browse files Browse the repository at this point in the history
  • Loading branch information
nberth committed Sep 12, 2023
1 parent e04c080 commit 1aa596c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions emacs/eglot-superbol.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions emacs/lsp-superbol.el
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand All @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions emacs/superbol-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))

;; ---
Expand Down
26 changes: 14 additions & 12 deletions src/superbol-vscode-platform/superbol_languageclient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1aa596c

Please sign in to comment.