diff --git a/CHANGELOG.org b/CHANGELOG.org index 1ef6ae56d9..e7629a2319 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -2,6 +2,7 @@ ** Unreleased 9.0.1 * Add support for GNAT Project (~gpr-mode~, ~gpr-ts-mode~). * Add SQL support + * Add support for Meson build system. (~meson-mode~). ** 9.0.0 * Add language server config for QML (Qt Modeling Language) using qmlls. * Add new configuration options for lsp-html. Now able to toggle documentation hovers. Custom data is no longer experimental, and is now a vector. diff --git a/clients/lsp-meson.el b/clients/lsp-meson.el new file mode 100644 index 0000000000..00ffa01373 --- /dev/null +++ b/clients/lsp-meson.el @@ -0,0 +1,126 @@ +;;; lsp-meson.el --- lsp client for meson -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 emacs-lsp maintainers + +;; Author: emacs-lsp maintainers +;; Keywords: lsp, meson + +;; 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: +;; +;; LSP client for Meson language. +;; +;;; Code: + +(require 'lsp-mode) + +(defgroup lsp-meson nil + "LSP support for Meson." + :group 'lsp-mode + :link '(url-link "https://github.com/JCWasmx86/mesonlsp")) + +(defcustom lsp-meson-server-executable '("mesonlsp") + "The meson language server executable to use." + :group 'lsp-meson + :risky t + :type '(repeat string)) + +(defcustom lsp-meson-ignore-subproject-diagnostics nil + "Ignore diagnostics from subprojects." + :type '(choice + (const :tag "Off" nil) + (const :tag "All subprojects" t) + (lsp-repeatable-vector :tag "Specific subprojects" string)) + :group 'lsp-meson) + +(defcustom lsp-meson-no-auto-downloads nil + "Never automatically download subprojects/wraps." + :type '(boolean) + :group 'lsp-meson) + +(defcustom lsp-meson-disable-inlay-hints nil + "Disable inlay hints." + :type '(boolean) + :group 'lsp-meson) + +(defgroup lsp-meson-linting nil + "Linting settings for mesonlsp." + :group 'lsp-meson) + +(defcustom lsp-meson-disable-name-linting nil + "Disable checking whether variable names are snake_case." + :type '(boolean) + :group 'lsp-meson-linting) + +(defcustom lsp-meson-disable-all-id-lints nil + "Disable linting for unknown string literals relating to compiler/machine IDs." + :type '(boolean) + :group 'lsp-meson-linting) + +(defcustom lsp-meson-disable-compiler-id-linting nil + "Disable lints for unknown IDs compared against `compiler.get_id()'." + :type '(boolean) + :group 'lsp-meson-linting) + +(defcustom lsp-meson-disable-compiler-argument-id-linting nil + "Disable lints for unknown IDs compared against `compiler.get_argument_syntax()'." + :type '(boolean) + :group 'lsp-meson-linting) + +(defcustom lsp-meson-disable-linker-id-linting nil + "Disable lints for unknown IDs compared against `compiler.get_linker_id()'." + :type '(boolean) + :group 'lsp-meson-linting) + +(defcustom lsp-meson-disable-cpu-family-linting nil + "Disable lints for unknown IDs compared against `X_machine.cpu_family()'." + :type '(boolean) + :group 'lsp-meson-linting) + +(defcustom lsp-meson-disable-os-family-linting nil + "Disable lints for unknown IDs compared against `X_machine.system()'." + :type '(boolean) + :group 'lsp-meson-linting) + +(defun lsp-meson--make-init-options () + "Init options for mesonlsp." + `(:others (:ignoreDiagnosticsFromSubprojects + ,(if (vectorp lsp-meson-ignore-subproject-diagnostics) + lsp-meson-ignore-subproject-diagnostics + (lsp-json-bool lsp-meson-ignore-subproject-diagnostics)) + :neverDownloadAutomatically ,(lsp-json-bool lsp-meson-no-auto-downloads) + :disableInlayHints ,(lsp-json-bool lsp-meson-disable-inlay-hints)) + :linting (:disableNameLinting ,(lsp-json-bool lsp-meson-disable-name-linting) + :disableAllIdLinting ,(lsp-json-bool lsp-meson-disable-all-id-lints) + :disableCompilerIdLinting ,(lsp-json-bool lsp-meson-disable-compiler-id-linting) + :disableCompilerArgumentIdLinting ,(lsp-json-bool lsp-meson-disable-compiler-argument-id-linting) + :disableLinkerIdLinting ,(lsp-json-bool lsp-meson-disable-linker-id-linting) + :disableCpuFamilyLinting ,(lsp-json-bool lsp-meson-disable-cpu-family-linting) + :disableOsFamilyLinting ,(lsp-json-bool lsp-meson-disable-os-family-linting)))) + +(lsp-register-client + (make-lsp-client + :new-connection (lsp-stdio-connection (lambda () (append lsp-meson-server-executable '("--lsp")))) + :activation-fn (lsp-activate-on "meson") + :multi-root nil + :priority -1 + :major-modes '(meson-mode) + :initialization-options #'lsp-meson--make-init-options + :server-id 'mesonlsp)) + +(lsp-consistency-check lsp-meson) + +(provide 'lsp-meson) +;;; lsp-meson.el ends here diff --git a/docs/lsp-clients.json b/docs/lsp-clients.json index 739b20cce6..decd95185a 100644 --- a/docs/lsp-clients.json +++ b/docs/lsp-clients.json @@ -591,6 +591,14 @@ "installation-url": "https://github.com/artempyanykh/marksman", "debugger": "Not available" }, + { + "name": "meson", + "full-name": "Meson", + "server-name": "mesonlsp", + "server-url": "https://github.com/JCWasmx86/mesonlsp", + "installation-url": "https://github.com/JCWasmx86/mesonlsp", + "debugger": "Not available" + }, { "name": "millet", "full-name": "Standard ML (Millet)", diff --git a/lsp-mode.el b/lsp-mode.el index 9893caa2b2..6a50af0bbd 100644 --- a/lsp-mode.el +++ b/lsp-mode.el @@ -181,7 +181,7 @@ As defined by the Language Server Protocol 3.16." lsp-gdscript lsp-gleam lsp-glsl lsp-go lsp-golangci-lint lsp-grammarly lsp-graphql lsp-groovy lsp-hack lsp-haskell lsp-haxe lsp-idris lsp-java lsp-javascript lsp-jq lsp-json lsp-kotlin lsp-latex lsp-lisp lsp-ltex - lsp-lua lsp-magik lsp-markdown lsp-marksman lsp-mdx lsp-metals lsp-mint + lsp-lua lsp-magik lsp-markdown lsp-marksman lsp-mdx lsp-meson lsp-metals lsp-mint lsp-mojo lsp-move lsp-mssql lsp-nginx lsp-nim lsp-nix lsp-nushell lsp-ocaml lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator lsp-php lsp-pls lsp-purescript lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms diff --git a/mkdocs.yml b/mkdocs.yml index fe28a7e520..d24b22498f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -108,6 +108,7 @@ nav: - Magik: page/lsp-magik.md - Markdown: page/lsp-markdown.md - Marksman: page/lsp-marksman.md + - Meson: page/lsp-meson.md - Move: page/lsp-move.md - MDX: page/lsp-mdx.md - MSSQL: https://emacs-lsp.github.io/lsp-mssql