Skip to content

Commit 3abe0e2

Browse files
authored
feat(lsp-mojo): add LSP support for Mojo 🔥 (#4207)
1 parent 291f730 commit 3abe0e2

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

CHANGELOG.org

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
* Changelog
22
** Unreleased 8.0.1
3+
* Add Mojo 🔥 support
34
* Add lsp-solidity, using the implementation from NomicFoundation
45
* Change rust-analyzer base URL to be github.com/rust-lang/rust-analyzer, rather than rust-analyzer/rust-analyzer.
56
* Add [[https://github.com/wader/jq-lsp][jq-lsp]]

clients/lsp-mojo.el

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
;;; lsp-mojo.el --- lsp-mode Mojo integration -*- lexical-binding: t; -*-
2+
3+
;; Copyright (C) 2023 Adam Liter
4+
5+
;; Author: Adam Liter <[email protected]>
6+
;; Keywords: languages,tools
7+
8+
;; This program is free software; you can redistribute it and/or modify
9+
;; it under the terms of the GNU General Public License as published by
10+
;; the Free Software Foundation, either version 3 of the License, or
11+
;; (at your option) any later version.
12+
13+
;; This program is distributed in the hope that it will be useful,
14+
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
;; GNU General Public License for more details.
17+
18+
;; You should have received a copy of the GNU General Public License
19+
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
21+
;;; Commentary:
22+
23+
;; client for Mojo 🔥
24+
25+
;;; Code:
26+
27+
(require 'lsp-mode)
28+
29+
(defgroup lsp-mojo nil
30+
"LSP support for Mojo 🔥, using mojo-lsp-server."
31+
:group 'lsp-mode
32+
:link '(url-link "https://github.com/modularml/mojo"))
33+
34+
(defcustom lsp-mojo-executable "mojo-lsp-server"
35+
"The Mojo 🔥 LSP executable to use.
36+
Leave as just the executable name to use the default behavior of
37+
finding the executable with variable `exec-path'."
38+
:group 'lsp-mojo
39+
:type 'string)
40+
41+
(lsp-register-client
42+
(make-lsp-client
43+
:new-connection (lsp-stdio-connection (lambda () lsp-mojo-executable))
44+
:activation-fn (lsp-activate-on "mojo")
45+
:server-id 'mojo))
46+
47+
(lsp-consistency-check lsp-mojo)
48+
49+
(provide 'lsp-mojo)
50+
;;; lsp-mojo.el ends here

lsp-mode.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ As defined by the Language Server Protocol 3.16."
181181
lsp-glsl lsp-graphql lsp-hack lsp-grammarly lsp-groovy lsp-haskell lsp-haxe
182182
lsp-idris lsp-java lsp-javascript lsp-json lsp-kotlin lsp-latex lsp-ltex
183183
lsp-lua lsp-markdown lsp-marksman lsp-mdx lsp-mint lsp-move lsp-nginx lsp-nim lsp-nix lsp-magik
184-
lsp-metals lsp-mssql lsp-ocaml lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator
184+
lsp-mojo lsp-metals lsp-mssql lsp-ocaml lsp-openscad lsp-pascal lsp-perl lsp-perlnavigator
185185
lsp-pls lsp-php lsp-pwsh lsp-pyls lsp-pylsp lsp-pyright lsp-python-ms lsp-purescript
186186
lsp-r lsp-racket lsp-remark lsp-ruff-lsp lsp-rf lsp-rubocop lsp-rust lsp-semgrep lsp-shader
187187
lsp-solargraph lsp-sorbet lsp-sourcekit lsp-sonarlint lsp-tailwindcss lsp-tex lsp-terraform
@@ -812,6 +812,7 @@ Changes take effect only when a new session is started."
812812
(python-mode . "python")
813813
(python-ts-mode . "python")
814814
(cython-mode . "python")
815+
("\\(\\.mojo\\|\\.🔥\\)\\'" . "mojo")
815816
(lsp--render-markdown . "markdown")
816817
(move-mode . "move")
817818
(rust-mode . "rust")

0 commit comments

Comments
 (0)