Skip to content

Commit c704948

Browse files
authored
feat: Add cobol language service (#4375)
1 parent 13f400b commit c704948

File tree

5 files changed

+74
-2
lines changed

5 files changed

+74
-2
lines changed

Diff for: CHANGELOG.org

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@
177177
* Add ~iedit~ integration. #2478
178178
* Add client for Verible SystemVerilog language Server ([[https://github.com/chipsalliance/verible]])
179179
* Add Cucumber support.
180+
* Add COBOL support.
180181

181182
** Release 7.0.1
182183
* Introduced ~lsp-diagnostics-mode~.

Diff for: clients/lsp-cobol.el

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
;;; lsp-cobol.el --- COBOL support -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2024 Shen, Jen-Chieh
4+
5+
;; This file is not part of GNU Emacs.
6+
7+
;; This program is free software: you can redistribute it and/or modify
8+
;; it under the terms of the GNU General Public License as published by
9+
;; the Free Software Foundation, either version 3 of the License, or
10+
;; (at your option) any later version.
11+
12+
;; This program is distributed in the hope that it will be useful,
13+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
;; GNU General Public License for more details.
16+
17+
;; You should have received a copy of the GNU General Public License
18+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
19+
20+
;;; Commentary:
21+
;;
22+
;; COBOL support.
23+
;;
24+
25+
;;; Code:
26+
27+
(require 'lsp-mode)
28+
29+
(defgroup lsp-cobol nil
30+
"LSP support for COBOL."
31+
:group 'lsp-mode
32+
:link '(url-link "https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol")
33+
:package-version `(lsp-mode . "8.0.1"))
34+
35+
(defcustom lsp-cobol-port 1044
36+
"Port to connect server to."
37+
:type 'integer
38+
:group 'lsp-cobol)
39+
40+
(defun lsp-cobol--tcp-connect-to-port ()
41+
"Define a TCP connection to language server."
42+
(list
43+
:connect (lambda (filter sentinel name _environment-fn _workspace)
44+
(let* ((host "localhost")
45+
(port lsp-cobol-port)
46+
(tcp-proc (lsp--open-network-stream host port (concat name "::tcp"))))
47+
48+
(set-process-query-on-exit-flag tcp-proc nil)
49+
(set-process-filter tcp-proc filter)
50+
(set-process-sentinel tcp-proc sentinel)
51+
(cons tcp-proc tcp-proc)))
52+
:test? (lambda () t)))
53+
54+
(lsp-register-client
55+
(make-lsp-client :new-connection (lsp-cobol--tcp-connect-to-port)
56+
:activation-fn (lsp-activate-on "cobol")
57+
:server-id 'cobol))
58+
59+
(lsp-consistency-check lsp-cobol)
60+
61+
(provide 'lsp-cobol)
62+
;;; lsp-cobol.el ends here

Diff for: docs/lsp-clients.json

+8
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@
171171
"installation": "pip install cmake-language-server",
172172
"debugger": "Not relevant"
173173
},
174+
{
175+
"name": "cobol",
176+
"full-name": "COBOL",
177+
"server-name": "cobol-language-service",
178+
"server-url": "https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol",
179+
"installation-url": "https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol/releases",
180+
"debugger": "Not relevant"
181+
},
174182
{
175183
"name": "crystal",
176184
"full-name": "Crystal",

Diff for: lsp-mode.el

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ As defined by the Language Server Protocol 3.16."
176176
(defcustom lsp-client-packages
177177
'( ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-autotools lsp-awk
178178
lsp-asm lsp-astro lsp-bash lsp-beancount lsp-bufls lsp-clangd lsp-clojure
179-
lsp-cmake lsp-credo lsp-crystal lsp-csharp lsp-css lsp-cucumber lsp-cypher
180-
lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir
179+
lsp-cmake lsp-cobol lsp-credo lsp-crystal lsp-csharp lsp-css lsp-cucumber
180+
lsp-cypher lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir
181181
lsp-emmet lsp-erlang lsp-eslint lsp-fortran lsp-fsharp lsp-gdscript lsp-go
182182
lsp-golangci-lint lsp-gleam lsp-glsl lsp-graphql lsp-hack lsp-grammarly
183183
lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json

Diff for: mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ nav:
6262
- C# (csharp-ls): page/lsp-csharp-ls.md
6363
- Clojure: page/lsp-clojure.md
6464
- CMake: page/lsp-cmake.md
65+
- COBOL: page/lsp-cobol.md
6566
- Crystal: page/lsp-crystal.md
6667
- CSS/LessCSS/SASS/SCSS: page/lsp-css.md
6768
- Cucumber: page/lsp-cucumber.md

0 commit comments

Comments
 (0)