Skip to content

Commit 81f4e5e

Browse files
JohnC32John Ciolfi
andauthored
lsp-matlab: add support for newer matlab-ts-mode and matlab ls 1.3.3 (#4860)
Co-authored-by: John Ciolfi <[email protected]>
1 parent 19ba542 commit 81f4e5e

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

clients/lsp-matlab.el

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,26 @@
2020
:type '(string))
2121

2222
(defcustom lsp-clients-matlab-server "/usr/local/apps/matlabls/out/index.js"
23-
"Path to the MATLAB language server.
23+
"Path to the MATLAB language server, index.js.
24+
25+
For an overview and detailed install instructions, see:
26+
https://github.com/mathworks/Emacs-MATLAB-Mode/blob/doc/\
27+
matlab-language-server-lsp-mode.org
28+
2429
To setup,
25-
- Download the language server (clone or unzip):
26-
- git clone https://github.com/mathworks/MATLAB-language-server.git
27-
or
28-
- Download zip from https://github.com/mathworks/MATLAB-language-server
29-
and unzip.
30-
- In the downloaded directory,
31-
npm install
32-
npm run compile
33-
npm run package # optional JavaScript minimization
34-
- Set lsp-clients-matlab-server to the download directory, or
35-
copy the ./out and ./matlab/ directory trees to an install location, e.g.
36-
cp -r ./out/ /usr/local/apps/matlabls/out/
37-
cp -r ./matlab/ /usr/local/apps/matlabls/matlab/
38-
then set `lsp-clients-matlab-server' to the install location."
30+
1. Download the language server (clone or unzip):
31+
git clone https://github.com/mathworks/MATLAB-language-server.git
32+
or Download and unzip a release from
33+
https://github.com/mathworks/MATLAB-language-server
34+
2. In the clone or unzip directory,
35+
npm install
36+
npm run compile
37+
npm run package # optional JavaScript minimization
38+
3. Set lsp-clients-matlab-server to the download directory, or
39+
copy the ./out and ./matlab/ directory trees to an install location, e.g.
40+
cp -r ./out/ /usr/local/apps/matlabls/out/
41+
cp -r ./matlab/ /usr/local/apps/matlabls/matlab/
42+
then set `lsp-clients-matlab-server' to the install location."
3943
:group 'lsp-matlab
4044
:type '(string))
4145

@@ -74,9 +78,6 @@ causing hangs."
7478
:group 'lsp-matlab
7579
:type '(boolean))
7680

77-
;; Tell lsp-mode about MATLAB language
78-
(add-to-list 'lsp-language-id-configuration '(matlab-mode . "MATLAB"))
79-
8081
(defun matlabls-command ()
8182
"Return matlabls launch command LIST."
8283
(let ((cmd (flatten-tree `(,lsp-clients-matlab-nodejs
@@ -120,7 +121,7 @@ causing hangs."
120121

121122
(lsp-register-client
122123
(make-lsp-client :new-connection (lsp-stdio-connection #'matlabls-command)
123-
:major-modes '(matlab-mode)
124+
:major-modes '(matlab-ts-mode matlab-mode)
124125
:ignore-messages '("readFile .*? requested by MATLAB but content not available")
125126
:server-id 'matlab-ls
126127
:language-id "MATLAB"
@@ -130,8 +131,10 @@ causing hangs."
130131
(lsp-configuration-section "MATLAB"))))
131132
:notification-handlers ;; See src/notifications/NotificationService.ts
132133
(ht ("telemetry/logdata" #'ignore)
133-
("mvmStateChange" #'ignore)
134-
("matlab/connection/update/server" #'ignore))))
134+
("matlab/connection/update/server" #'ignore)
135+
("matlab/sections" #'ignore)
136+
("mvmPromptChange" #'ignore)
137+
("mvmStateChange" #'ignore))))
135138

136139
(provide 'lsp-matlab)
137140
;;; lsp-matlab.el ends here

lsp-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,7 @@ Changes take effect only when a new session is started."
10031003
(meson-mode . "meson")
10041004
(yang-mode . "yang")
10051005
(matlab-mode . "matlab")
1006+
(matlab-ts-mode . "matlab")
10061007
(message-mode . "plaintext")
10071008
(mu4e-compose-mode . "plaintext")
10081009
(odin-mode . "odin")

0 commit comments

Comments
 (0)