branch: externals/matlab-mode
commit f4b94b1e29c9491d86ba4e3b467e7830933c78eb
Author: John Ciolfi <[email protected]>
Commit: John Ciolfi <[email protected]>
matlab-ts-mode: initial lsp-mode support
---
README.org | 6 +++++
.../matlab-and-lsp-mode-rename.png | Bin 0 -> 67915 bytes
doc/matlab-language-server-lsp-mode.org | 25 +++++++++++++++------
matlab-ts-mode.el | 6 ++---
4 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/README.org b/README.org
index 19af90e05c..bc2045212d 100644
--- a/README.org
+++ b/README.org
@@ -159,6 +159,12 @@
: Language name: matlab
: Major mode: matlab-ts
+ * Setup =lsp-mode=. If using [[file:matlab-language-server-lsp-mode.org]]
(recommended), you should
+ add to your =~/.emacs=
+
+ #+begin_src
+ (add-hook 'matlab-ts-mode-hook 'lsp)
+ #+end_src
3. [Optional]. Install the
[[file:doc/matlab-language-server-lsp-mode.org][MATLAB Language Server]].
diff --git
a/doc/matlab-language-server-lsp-mode-files/matlab-and-lsp-mode-rename.png
b/doc/matlab-language-server-lsp-mode-files/matlab-and-lsp-mode-rename.png
new file mode 100755
index 0000000000..66a5175405
Binary files /dev/null and
b/doc/matlab-language-server-lsp-mode-files/matlab-and-lsp-mode-rename.png
differ
diff --git a/doc/matlab-language-server-lsp-mode.org
b/doc/matlab-language-server-lsp-mode.org
index 9b9b8d0aef..a06bcbc968 100644
--- a/doc/matlab-language-server-lsp-mode.org
+++ b/doc/matlab-language-server-lsp-mode.org
@@ -54,6 +54,10 @@ type =M-,= to jump back.
[[file:matlab-language-server-lsp-mode-files/matlab-and-lsp-mode-find-references.png]]
+* Rename identifiers, M-x lsp-rename
+
+[[file:matlab-language-server-lsp-mode-files/matlab-and-lsp-mode-rename.png]]
+
* Viewing Issues Without the lsp-ui Package
[[file:matlab-language-server-lsp-mode-files/matlab-and-lsp-mode-flycheck.png]]
@@ -90,9 +94,10 @@ type =M-,= to jump back.
Download the language server (clone or unzip):
- git clone https://github.com/mathworks/MATLAB-language-server.git
or
- - Download zip from https://github.com/mathworks/MATLAB-language-server and
unzip.
+ - Download the release zip file from
https://github.com/mathworks/MATLAB-language-server and
+ unzip.
- In the downloaded directory,
+ In the cloned or unziped directory,
#+begin_src bash
npm install
npm run compile
@@ -108,7 +113,7 @@ type =M-,= to jump back.
: M-: (require 'lsp-matlab)
: M-x customize-variable RET lsp-clients-matlab-server RET
- and set to your install directory, e.g. =/usr/local/apps/matlabls=
+ and set to your installation, e.g. =/usr/local/apps/matlabls/out/index.js=
3. Tell lsp-mode where MATLAB is if MATLAB not on the PATH (~which matlab~
does not find MATLAB).
@@ -121,11 +126,17 @@ type =M-,= to jump back.
4. Activate lsp-mode when you open *.m files.
- Add to your ~/.emacs
+ Add to your =~/.emacs=
+
+ - If using matlab-ts-mode
+ #+begin_example
+ (add-hook 'matlab-ts-mode-hook 'lsp)
+ #+end_example
- #+begin_example
- (add-hook 'matlab-mode-hook 'lsp)
- #+end_example
+ - If using matlab-mode
+ #+begin_example
+ (add-hook 'matlab-mode-hook 'lsp)
+ #+end_example
5. After loading a ~*.m~ file, the MATLAB language server will run MATLAB in
the "background" and
use that MATLAB for language server features such as
~xref-find-definitions~. It can take a
diff --git a/matlab-ts-mode.el b/matlab-ts-mode.el
index 111964b1b3..ad1ee238a6 100644
--- a/matlab-ts-mode.el
+++ b/matlab-ts-mode.el
@@ -3049,8 +3049,6 @@ This callback also implements
`matlab-ts-mode-electric-ends'."
(declare-function flycheck-define-command-checker "flycheck")
(declare-function flycheck-buffer-saved-p "flycheck")
-;; TODO - do we need to disable when lsp is active?
-
(when (and matlab-ts-mode-enable-mlint-flycheck
(require 'flycheck nil 'noerror))
(let* ((mlint (matlab--get-mlint-exe)))
@@ -3475,8 +3473,8 @@ so configuration variables of that mode, do not affect
this mode.
;; think it was missing a few toolboxes.
;;
;; TODO LSP
- ;; - Configure LSP
- ;; - Test LSP vs MLint
+ ;; - [done] LSP
+ ;; - [done] Test LSP vs MLint
;; - Rename menu item "Check MLint Setup" to "Check setup" and have it
;; look at both LSP and MLint. Place menu item at bottom.
;;