-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Draft version of basic superbol-mode for GNU/Emacs
- Loading branch information
Showing
7 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
;;; lsp-superbol.el --- LSP client for Superbol COBOL -*- lexical-binding: t; -*- | ||
;; | ||
;; Copyright (c) 2023 OCamlPro SAS | ||
;; | ||
;; All rights reserved. | ||
;; This source code is licensed under the MIT license found in the | ||
;; LICENSE.md file in the root directory of this source tree. | ||
|
||
;;; Commentary: | ||
|
||
;; LSP client for Superbol COBOL | ||
|
||
;;; Code: | ||
|
||
(require 'lsp-mode) | ||
|
||
;; --- | ||
|
||
(defgroup lsp-superbol nil | ||
"Settings for the Superbol Language Server for COBOL." | ||
:group 'lsp-mode | ||
:link '(url-link "https://github.com/OCamlPro/superbol-vscode-extension") | ||
:package-version '(lsp-mode . "8.0.1")) | ||
|
||
(load (expand-file-name "lsp-superbol-customs.el" | ||
(file-name-directory load-file-name))) | ||
|
||
;; --- | ||
|
||
(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")) | ||
|
||
;; (lsp-dependency 'superbol-language-server | ||
;; `(:system ,(executable-find (lsp-package-path 'superbol-language-server)))) | ||
;; '(:system "superbol-language-server")) | ||
|
||
(lsp-register-client | ||
(make-lsp-client | ||
:new-connection (lsp-stdio-connection #'lsp-superbol--server-command) | ||
:priority 0 | ||
:activation-fn (lsp-activate-on "superbol" "cobol" "COBOL") | ||
:server-id 'superbol-ls | ||
)) | ||
|
||
;; --- | ||
|
||
(lsp-consistency-check lsp-superbol) | ||
|
||
(provide 'lsp-superbol) | ||
|
||
;;; lsp-superbol.el ends here |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
;;; superbol-mode.el --- Superbol COBOL major mode -*- lexical-binding: t; -*- | ||
;; | ||
;; Copyright (c) 2023 OCamlPro SAS | ||
;; | ||
;; All rights reserved. | ||
;; This source code is licensed under the MIT license found in the | ||
;; LICENSE.md file in the root directory of this source tree. | ||
|
||
;;; Commentary: | ||
|
||
;; Major mode for editing COBOL files using Superbol as a LSP server | ||
|
||
;;; Code: | ||
|
||
(require 'lsp-mode) | ||
(require 'lsp-superbol) | ||
|
||
(add-to-list 'lsp-language-id-configuration | ||
'(superbol-mode . "cobol")) | ||
|
||
;; CHECKME: Force association right here? | ||
(defun superbol-mode-for-default-extensions () | ||
"Automatically associate `superbol-mode` with a few common COBOL file | ||
extensions." | ||
(dolist (regex '("\\.[cC][oO][bB]\\'" | ||
"\\.[cC][bB][lL]\\'" | ||
"\\.[cC][pP][yY]\\'")) | ||
(add-to-list 'auto-mode-alist `(,regex . superbol-mode)))) | ||
|
||
;;;###autoload | ||
(define-derived-mode | ||
superbol-mode prog-mode "Superbol" | ||
"SUPERBOL mode is a major mode for handling COBOL files." | ||
;; XXX: could actually derive from cobol-mode, if available. | ||
|
||
;; Straight from cobol-mode | ||
(set (make-local-variable 'comment-start-skip) | ||
"\\(^.\\{6\\}\\*\\|\\*>\\)\\s-* *") | ||
(set (make-local-variable 'comment-start) "*>") | ||
(set (make-local-variable 'comment-end) "") | ||
|
||
;; Start the LSP client | ||
(lsp)) | ||
|
||
;; --- | ||
|
||
(provide 'superbol-mode) | ||
;;; superbol-mode.el ends here |