From c81daaed203a665280b494532480763c3539559d Mon Sep 17 00:00:00 2001 From: Gustav Hedengran Date: Thu, 2 Nov 2023 14:21:06 +0100 Subject: [PATCH] Add Cypher language server --- CHANGELOG.org | 1 + clients/lsp-cypher.el | 53 +++++++++++++++++++++++++++++++++++++++++++ docs/lsp-clients.json | 9 ++++++++ lsp-mode.el | 4 +++- mkdocs.yml | 1 + 5 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 clients/lsp-cypher.el diff --git a/CHANGELOG.org b/CHANGELOG.org index cd70fbbd68a..0581c1082e3 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -1,5 +1,6 @@ * Changelog ** Unreleased 8.0.1 + * Add Cypher support. * Add Mojo 🔥 support * Add lsp-solidity, using the implementation from NomicFoundation * Change rust-analyzer base URL to be github.com/rust-lang/rust-analyzer, rather than rust-analyzer/rust-analyzer. diff --git a/clients/lsp-cypher.el b/clients/lsp-cypher.el new file mode 100644 index 00000000000..5f082c6932e --- /dev/null +++ b/clients/lsp-cypher.el @@ -0,0 +1,53 @@ +;;; lsp-cypher.el --- Cypher Client -*- lexical-binding: t; -*- + +;; Copyright (C) 2023 Gustav Hedengran + +;; Author: Gustav Hedengran +;; Keywords: languages lsp cypher + +;; 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 . + +;;; Commentary: + +;;; Code: + +(require 'lsp-mode) + +(defgroup lsp-cypher nil + "LSP support for Cypher." + :group 'lsp-mode + :link '(url-link "https://github.com/neo4j/cypher-language-support/blob/main/packages/language-server")) + +(lsp-dependency 'cypher-language-server + '(:system "cypher-language-server") + '(:npm :package "@neo4j-cypher/language-server" + :path "cypher-language-server")) + +(defun lsp-client--cypher-ls-server-command () + "Startup command for Cypher language server." + (list (lsp-package-path 'cypher-language-server) "--stdio")) + +(lsp-register-client + (make-lsp-client :new-connection (lsp-stdio-connection #'lsp-client--cypher-ls-server-command) + :activation-fn (lsp-activate-on "cypher") + :language-id "cypher" + :server-id 'cypher-ls + :priority 0 + :download-server-fn (lambda (_client callback error-callback _update?) + (lsp-package-ensure 'cypher-language-server callback error-callback)))) + +(lsp-consistency-check lsp-cypher) + +(provide 'lsp-cypher) +;;; lsp-cypher.el ends here diff --git a/docs/lsp-clients.json b/docs/lsp-clients.json index 95aa1271a21..e35d48d7a7f 100644 --- a/docs/lsp-clients.json +++ b/docs/lsp-clients.json @@ -160,6 +160,15 @@ "lsp-install-server": "css-ls", "debugger": "Not available" }, + { + "name": "cypher", + "full-name": "Cypher", + "server-name": "cypher-language-server", + "server-url": "https://github.com/neo4j/cypher-language-support/tree/main/packages/language-server", + "installation": "npm install -g @neo4j-cypher/language-server", + "installation-url": "https://github.com/neo4j/cypher-language-support/tree/main/packages/language-server#installation", + "debugger": "Not available" + }, { "name": "d", "full-name": "D", diff --git a/lsp-mode.el b/lsp-mode.el index 657336ac72b..2232802a355 100644 --- a/lsp-mode.el +++ b/lsp-mode.el @@ -176,7 +176,7 @@ As defined by the Language Server Protocol 3.16." (defcustom lsp-client-packages '( ccls lsp-actionscript lsp-ada lsp-angular lsp-ansible lsp-awk lsp-astro lsp-bash lsp-beancount lsp-clangd lsp-clojure lsp-cmake lsp-credo lsp-crystal lsp-csharp lsp-css - lsp-d lsp-dart lsp-dhall lsp-docker lsp-dockerfile lsp-elm lsp-elixir lsp-emmet + 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-gleam lsp-glsl lsp-graphql lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-json lsp-kotlin lsp-latex lsp-ltex @@ -776,6 +776,7 @@ Changes take effect only when a new session is started." ("\\.php$" . "php") ("\\.rs\\'" . "rust") ("\\.sql$" . "sql") + ("\\.cypher$" . "cypher") ("\\.svelte$" . "svelte") ("\\.toml\\'" . "toml") ("\\.ts$" . "typescript") @@ -887,6 +888,7 @@ Changes take effect only when a new session is started." (csharp-ts-mode . "csharp") (plain-tex-mode . "plaintex") (context-mode . "context") + (cypher-mode . "cypher") (latex-mode . "latex") (v-mode . "v") (vhdl-mode . "vhdl") diff --git a/mkdocs.yml b/mkdocs.yml index 31704710e33..7b86348b8dd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -62,6 +62,7 @@ nav: - CMake: page/lsp-cmake.md - Crystal: page/lsp-crystal.md - CSS/LessCSS/SASS/SCSS: page/lsp-css.md + - Cypher: page/lsp-cypher.md - D: page/lsp-d.md - Dart: https://emacs-lsp.github.io/lsp-dart - Dhall: page/lsp-dhall.md