Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lsp-mojo): add LSP support for Mojo 🔥 #4207

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.org
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* Changelog
** Unreleased 8.0.1
* 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.
* Add [[https://github.com/wader/jq-lsp][jq-lsp]]
Expand Down
50 changes: 50 additions & 0 deletions clients/lsp-mojo.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
;;; lsp-mojo.el --- lsp-mode Mojo integration -*- lexical-binding: t; -*-

;; Copyright (C) 2023 Adam Liter

;; Author: Adam Liter <[email protected]>
;; Keywords: languages,tools

;; 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:

;; client for Mojo 🔥

;;; Code:

(require 'lsp-mode)

(defgroup lsp-mojo nil
"LSP support for Mojo 🔥, using mojo-lsp-server."
:group 'lsp-mode
:link '(url-link "https://github.com/modularml/mojo"))

(defcustom lsp-mojo-executable "mojo-lsp-server"
"The Mojo 🔥 LSP executable to use.
Leave as just the executable name to use the default behavior of
finding the executable with variable `exec-path'."
:group 'lsp-mojo
:type 'string)

(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection (lambda () lsp-mojo-executable))
:activation-fn (lsp-activate-on "mojo")
:server-id 'mojo))

(lsp-consistency-check lsp-mojo)

(provide 'lsp-mojo)
;;; lsp-mojo.el ends here
3 changes: 2 additions & 1 deletion lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ As defined by the Language Server Protocol 3.16."
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
lsp-lua lsp-markdown lsp-marksman lsp-mdx lsp-mint lsp-move lsp-nginx lsp-nim lsp-nix lsp-magik
lsp-metals lsp-mssql lsp-ocaml lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator
lsp-mojo lsp-metals lsp-mssql lsp-ocaml lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator
lsp-pls lsp-php lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms lsp-purescript
lsp-r lsp-racket lsp-remark lsp-ruff-lsp lsp-rf lsp-rubocop lsp-rust lsp-semgrep lsp-shader
lsp-solargraph lsp-sorbet lsp-sourcekit lsp-sonarlint lsp-tailwindcss lsp-tex lsp-terraform
Expand Down Expand Up @@ -812,6 +812,7 @@ Changes take effect only when a new session is started."
(python-mode . "python")
(python-ts-mode . "python")
(cython-mode . "python")
("\\(\\.mojo\\|\\.🔥\\)\\'" . "mojo")
(lsp--render-markdown . "markdown")
(move-mode . "move")
(rust-mode . "rust")
Expand Down
Loading