Skip to content

Commit

Permalink
feat: Add cobol language service (#4375)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 authored Mar 17, 2024
1 parent 13f400b commit c704948
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
* Add ~iedit~ integration. #2478
* Add client for Verible SystemVerilog language Server ([[https://github.com/chipsalliance/verible]])
* Add Cucumber support.
* Add COBOL support.

** Release 7.0.1
* Introduced ~lsp-diagnostics-mode~.
Expand Down
62 changes: 62 additions & 0 deletions clients/lsp-cobol.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
;;; lsp-cobol.el --- COBOL support -*- lexical-binding: t; -*-

;; Copyright (C) 2024 Shen, Jen-Chieh

;; This file is not part of GNU Emacs.

;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; COBOL support.
;;

;;; Code:

(require 'lsp-mode)

(defgroup lsp-cobol nil
"LSP support for COBOL."
:group 'lsp-mode
:link '(url-link "https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol")
:package-version `(lsp-mode . "8.0.1"))

(defcustom lsp-cobol-port 1044
"Port to connect server to."
:type 'integer
:group 'lsp-cobol)

(defun lsp-cobol--tcp-connect-to-port ()
"Define a TCP connection to language server."
(list
:connect (lambda (filter sentinel name _environment-fn _workspace)
(let* ((host "localhost")
(port lsp-cobol-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)
(set-process-sentinel tcp-proc sentinel)
(cons tcp-proc tcp-proc)))
:test? (lambda () t)))

(lsp-register-client
(make-lsp-client :new-connection (lsp-cobol--tcp-connect-to-port)
:activation-fn (lsp-activate-on "cobol")
:server-id 'cobol))

(lsp-consistency-check lsp-cobol)

(provide 'lsp-cobol)
;;; lsp-cobol.el ends here
8 changes: 8 additions & 0 deletions docs/lsp-clients.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@
"installation": "pip install cmake-language-server",
"debugger": "Not relevant"
},
{
"name": "cobol",
"full-name": "COBOL",
"server-name": "cobol-language-service",
"server-url": "https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol",
"installation-url": "https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol/releases",
"debugger": "Not relevant"
},
{
"name": "crystal",
"full-name": "Crystal",
Expand Down
4 changes: 2 additions & 2 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ As defined by the Language Server Protocol 3.16."
(defcustom lsp-client-packages
'( ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-autotools lsp-awk
lsp-asm lsp-astro lsp-bash lsp-beancount lsp-bufls lsp-clangd lsp-clojure
lsp-cmake lsp-credo lsp-crystal lsp-csharp lsp-css lsp-cucumber lsp-cypher
lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir
lsp-cmake lsp-cobol lsp-credo lsp-crystal lsp-csharp lsp-css lsp-cucumber
lsp-cypher lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir
lsp-emmet lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go
lsp-golangci-lint lsp-gleam lsp-glsl lsp-graphql lsp-hack lsp-grammarly
lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json
Expand Down
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ nav:
- C# (csharp-ls): page/lsp-csharp-ls.md
- Clojure: page/lsp-clojure.md
- CMake: page/lsp-cmake.md
- COBOL: page/lsp-cobol.md
- Crystal: page/lsp-crystal.md
- CSS/LessCSS/SASS/SCSS: page/lsp-css.md
- Cucumber: page/lsp-cucumber.md
Expand Down

0 comments on commit c704948

Please sign in to comment.