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

Neovim support #4

Open
tiagovla opened this issue Jun 3, 2023 · 45 comments
Open

Neovim support #4

tiagovla opened this issue Jun 3, 2023 · 45 comments

Comments

@tiagovla
Copy link
Contributor

tiagovla commented Jun 3, 2023

Neovim users can now use it with nvim-lspconfig and mason.nvim.

image

@dklilley
Copy link
Member

@tiagovla - Thanks for letting us know! It's exciting to see this being used in other IDEs!

Can you open a pull request to add this new support to the README under "Clients"?

@hamidingit
Copy link
Member

@tiagovla - This is really great! as a new person to neovim, I tried to set it up and I got this now working on my windows machine! it took some pain but I have the functionality working (more in below)

I do however like the visuals and controls that you have in your setup. It would be great if there was a blog post or introduction by experts for new folks that want to adopt neovim and develop matlab code. Please consider contributing more to this cause.

My system and configuration for reference:

init.vim:

call plug#begin()

Plug 'nvim-lua/planetary.nvim'
Plug 'nvim-telescope/telescope.nvim', {'tag': '0.1.1'}
Plug 'williamboman/mason.nvim', { 'do': ':MasonUpdate' }
Plug 'williamboman/mason-lspconfig.nvim'
Plug 'neovim/nvim-lspconfig'

Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'L3MON4D3/LuaSnip'

Plug 'VonHeikemen/lsp-zero.nvim', {'branch': 'v2.x'}

call plug#end()

lua << EOF
require("mason").setup()
require("mason-lspconfig").setup()

local lsp = require('lsp-zero').preset({})
lsp.on_attach(function(client, bufnr)
lsp.default_keymaps({buffer = bufnr})
end)

lsp.setup()

require'lspconfig'.matlab_ls.setup {
settings = {
matlab = {
installPath = "C:\Program Files\MATLAB\R2021b"
}
}
}

EOF

neovim lsp

@tiagovla
Copy link
Contributor Author

tiagovla commented Jun 26, 2023

I do however like the visuals and controls that you have in your setup. It would be great if there was a blog post or introduction by experts for new folks that want to adopt neovim and develop matlab code. Please consider contributing more to this cause.

@dklilley maybe a good place to put a minimal config setup would be in the wiki section?

@hamidingit
Copy link
Member

I do however like the visuals and controls that you have in your setup. It would be great if there was a blog post or introduction by experts for new folks that want to adopt neovim and develop matlab code. Please consider contributing more to this cause.

@dklilley maybe a good place to put a minimal config setup would be in the wiki section?

@tiagovla , Thanks for the idea. we appreciate your help. if you provide such information, we can host it under the wiki so others can follow the steps to set up Neovim.

@ZZT-console
Copy link

ZZT-console commented Sep 3, 2023

why can't I use it? I have tried various methods for a long time, but I still can't find the reason.Please you can tell me. I use Lazyvim as configuration manager and install matlab_ls by Mason. Then here is my configuration:

return {
  "neovim/nvim-lspconfig",

  opts = {
    servers = {
      -- Ensure mason installs the server
      clangd = {
        keys = {
          { "<leader>cR", "<cmd>ClangdSwitchSourceHeader<cr>", desc = "Switch Source/Header (C/C++)" },
        },
        root_dir = function(fname)
          return require("lspconfig.util").find_git_ancestor(fname)
            or require("lspconfig.util").root_pattern("compile_commands.json")(fname)
            or require("lspconfig.util").root_pattern("Makefile")(fname)
            or require("lspconfig.util").root_pattern("xmake.lua")(fname)
        end,
        capabilities = {
          offsetEncoding = { "utf-16" },
        },
        cmd = {
          "clangd",
          "--background-index",
          "--clang-tidy",
          "--header-insertion=iwyu",
          "--completion-style=detailed",
          "--function-arg-placeholders",
          "--fallback-style=llvm",
          "--log=verbose",
          "--all-scopes-completion",
          "--query-driver=/usr/bin/g++-*",
        },
        init_options = {
          usePlaceholders = true,
          completeUnimported = true,
          clangdFileStatus = true,
        },
      },
      matlab_ls = {
        cmd = { "matlab-language-server", "--stdio" },
        matlab = {
          indexWorkspace = true,
          installPath = "/opt/matlab2021b/",
        },
        root_dir = function(fname)
          return require("lspconfig.util").find_git_ancestor(fname)
            or require("lspconfig.util").root_pattern("compile_commands.json")(fname)
            or require("lspconfig.util").root_pattern("Makefile")(fname)
            or require("lspconfig.util").root_pattern("xmake.lua")(fname)
        end,

        single_file_support = true,
      },
    },
    setup = {
      clangd = function(_, opts)
        local clangd_ext_opts = require("lazyvim.util").opts("clangd_extensions.nvim")
        require("clangd_extensions").setup(vim.tbl_deep_extend("force", clangd_ext_opts or {}, { server = opts }))
        return true
      end,
    },
  },
}

@Gerb-Voogt
Copy link

@ZZT-console I am running into a very similar issue. I have configured the LSP more or less identically but it does not seem to attach to the buffer upon opening a matlab file. Biggest difference seems to be that I am using matlab2023a

@tiagovla
Copy link
Contributor Author

tiagovla commented Sep 6, 2023

Here's a minimal config with the lazy.nvim plugin manager:

-- ~/.config/$NVIM_APPNAME/init.lua
vim.lsp.set_log_level "debug"

-- Install the lazy.nvim plugin manager
vim.g.mapleader = " "
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
    vim.fn.system {
        "git",
        "clone",
        "--filter=blob:none",
        "https://github.com/folke/lazy.nvim.git",
        "--branch=stable", -- latest stable release
        lazypath,
    }
end
vim.opt.rtp:prepend(lazypath)

-- Install plugins: mason.nvim, nvim-lspconfig, nvim-cmp
require("lazy").setup {
    { "williamboman/mason.nvim", config = true },
    {
        "neovim/nvim-lspconfig",
        dependencies = {
            "hrsh7th/nvim-cmp",
        },
        config = function()
            require("lspconfig")["matlab_ls"].setup {
                capabilities = require("cmp_nvim_lsp").default_capabilities(),
                settings = {
                    MATLAB = {
                        indexWorkspace = true,
                        installPath = "/usr/local/MATLAB/R2023a", -- might need to change this
                        matlabConnectionTiming = "onStart",
                        telemetry = true,
                    },
                },
            }
        end,
    },
    {
        "hrsh7th/nvim-cmp",
        dependencies = {
            { "hrsh7th/cmp-nvim-lsp" },
            { "hrsh7th/cmp-path" }, --optional
        },
        opts = {
            sources = {
                { name = "nvim_lsp" },
                { name = "path" }, --optional
            },
        },
    },
}

-- Mappings
vim.api.nvim_create_autocmd("LspAttach", {
    callback = function(args)
        local buffer = args.buf
        vim.keymap.set("n", "K", vim.lsp.buf.hover, { buffer = buffer, desc = "Hover" })
        vim.keymap.set("n", "ga", vim.lsp.buf.code_action, { buffer = buffer, desc = "Code action" })
        vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { buffer = buffer, desc = "Go to declaration" })
        vim.keymap.set("n", "gd", vim.lsp.buf.definition, { buffer = buffer, desc = "Go to definition" })
        vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { buffer = buffer, desc = "Go to inplementation" })
        vim.keymap.set("n", "gr", vim.lsp.buf.rename, { buffer = buffer, desc = "Rename" })
        vim.keymap.set("n", "gT", vim.lsp.buf.type_definition, { buffer = buffer, desc = "Type definition" })
        vim.keymap.set("n", "gR", vim.lsp.buf.references, { buffer = buffer, desc = "References" })
        vim.keymap.set("n", "gk", vim.lsp.buf.signature_help, { buffer = buffer, desc = "Signature help" })
        vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { buffer = buffer, desc = "Next diagnostic" })
        vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { buffer = buffer, desc = "Prev diagnostic" })
        vim.keymap.set("n", "gf", function()
            vim.lsp.buf.format {
                timeout_ms = 5000,
            }
        end, { buffer = 0, desc = "Format buffer" })
    end,
})

An example of how use it:

  • Copy it to e.g. `~/.config/matlab_nvim/init.lua;
  • Run NVIM_APPNAME=matlab_nvim nvim;
  • Run :MasonInstall matlab-language-server;
  • Create git repository inside the root of your project git init;
  • Open file .m file;
  • Check :LspInfo;
  • Nvim logs:~/.local/state/matlab_nvim/lsp.log;
  • Uninstall removing ~/.local/{state/share}/matlab_nvim.

@Gerb-Voogt
Copy link

An example of how use it:

* Copy it to e.g. `~/.config/matlab_nvim/init.lua;

* Run `NVIM_APPNAME=matlab_nvim nvim`;

* Run `:MasonInstall matlab-language-server`;

* Open file `.m` file;

* Check `:LspInfo`;

* Nvim logs:`~/.local/state/matlab_nvim/lsp.log`;

* Uninstall removing `~/.local/{state/share}/matlab_nvim`.

@tiagovla I tried doing this but still no luck. The LSP is not even starting as no log seems to be created at ~/.local/state/matlab_nvim/lsp.log

It seems like no matlab session is being launched either which vscode does do when it launches the matlab lsp. Any idea as to what might be happening?

@tiagovla
Copy link
Contributor Author

tiagovla commented Sep 6, 2023

@tiagovla I tried doing this but still no luck. The LSP is not even starting as no log seems to be created at ~/.local/state/matlab_nvim/lsp.log

It seems like no matlab session is being launched either which vscode does do when it launches the matlab lsp. Any idea as to what might be happening?

What's your neovim version? I'm using nightly 0.10.

Check if the matlab-language-server is installed after :MasonInstall matlab-language-server:

  • It should be here ~/.local/share/$NVIM_APPNAME/mason/packages/matlab-language-server;
  • It should also be shown as installed with :Mason.

Check if all plugins were installed using :Lazy.

After opening a matlab .m file:

  • Check if the filetype is correct using :set ft?. Or set it with :set ft=matlab;
  • Run :LspInfo, it should be shown as configured server and hopefully as attached to this buffer. Could you share a screenshot of LspInfo?
  • Also, you need to be inside a git repo, that's how lspconfig detects the root of the project.

@ZZT-console
Copy link

@tiagovla
I'm sorry for not having time to reply you until now.I think I should have understood your configuration, and now I will modify my configuration as follows:

return {
  {
    "neovim/nvim-lspconfig",
    opts = {
      servers = {
        -- Ensure mason installs the server
        clangd = {
          root_dir = function(fname)
            return require("lspconfig.util").find_git_ancestor(fname)
              or require("lspconfig.util").root_pattern("compile_commands.json")(fname)
              or require("lspconfig.util").root_pattern("Makefile")(fname)
              or require("lspconfig.util").root_pattern("xmake.lua")(fname)
          end,
          cmd = {
            "clangd",
            "--background-index",
            "--clang-tidy",
            "--header-insertion=iwyu",
            "--completion-style=detailed",
            "--function-arg-placeholders",
            "--fallback-style=llvm",
            "--log=verbose",
            "--all-scopes-completion",
            "--query-driver=/usr/bin/g++-*",
          },
        },
        matlab_ls = {
          settings = {
            matlab = {
              capabilities = require("cmp_nvim_lsp").default_capabilities(),
              indexWorkspace = true,
              installPath = "/opt/matlab2021b/",
              matlabConnectionTiming = "onStart",
              telemetry = true,
            },
          },
          -- root_dir = function(fname)
          --   return require("lspconfig.util").find_git_ancestor(fname)
          --     or require("lspconfig.util").root_pattern("xmake.lua")(fname)
          --     or require("lspconfig.util").root_pattern("compile_commands.json")(fname)
          --     or require("lspconfig.util").root_pattern("Makefile")(fname)
          -- end,
          single_file_support = true,
        },
      },
    },
  },
  {
    "hrsh7th/nvim-cmp",
    dependencies = {
      { "hrsh7th/cmp-nvim-lsp" },
      { "hrsh7th/cmp-path" }, --optional
    },
    opts = {
      sources = {
        { name = "nvim_lsp" },
        { name = "path" }, --optional
      },
    },
  },
}

The result is still the same. I try to use command:LspInfo and get this result.
image

@ZZT-console
Copy link

@dklilley
I checked other Lsp server carefully. I think my matlab_ls maybe config custom handlers. That's probably why.

@Gerb-Voogt
Copy link

@tiagovla So the issue turned out to be that my files were not contained inside a git repository, thank you very much for your help! Didn't know about this particular detail regarding lspconfig.

@tiagovla
Copy link
Contributor Author

tiagovla commented Sep 8, 2023

@tiagovla So the issue turned out to be that my files were not contained inside a git repository, thank you very much for your help! Didn't know about this particular detail regarding lspconfig.

Glad you found the issue! That's usually the default behavior of most servers on lspconfig https://github.com/neovim/nvim-lspconfig/blob/a27356f1ef9c11e1f459cc96a3fcac5c265e72d6/lua/lspconfig/server_configurations/matlab_ls.lua#L7 . You can also change it to detect the root on custom conditions.

@tiagovla
Copy link
Contributor Author

tiagovla commented Sep 8, 2023

@ZZT-console, you're facing the same issue as mentioned above. Your screenshot indicates that the root directory wasn't detected.

Previously, your configuration looked like this:

root_dir = function(fname)
    return require("lspconfig.util").find_git_ancestor(fname)
        or require("lspconfig.util").root_pattern("xmake.lua")(fname)
        or require("lspconfig.util").root_pattern("compile_commands.json")(fname)
        or require("lspconfig.util").root_pattern("Makefile")(fname)
end,

In this setup, Neovim checks if your current working directory is a Git repository, if it contains an xmake.lua file, if there's a compile_commands.json file, or if it has a Makefile. If any of these conditions are met, Neovim launches the LSP server using that root directory. This configuration is suitable for C/C++ LSP servers.

The default configuration for the matlab-language-server only checks if it's inside a Git repository (as mentioned in my previous comment). To resolve your issue, you can initialize a Git repository within your folder using git init, or you can create custom detection conditions based on your needs.

@ZZT-console
Copy link

@tiagovla
I did what you said, and I initialized the git repository in my project root directory. But I still can't use matlab_ls.
I think it may be my environment issue. I use NVIM v0.10.0-dev-1025+g0e11bf0e1 and Linux Mint 21.2 Cinnamon.
image

@ArtisticZhao
Copy link

@ZZT-console Hi, can you try directly run the ls cmd from console? To make sure the ls can work independly.

image

image

I only found that the git repo is necessary. Very strange....

@ZZT-console
Copy link

@ArtisticZhao Hi, I have done what you said, it seems that it really does not work, please how can I do it?
image

@tiagovla
Copy link
Contributor Author

@ArtisticZhao Hi, I have done what you said, it seems that it really does not work, please how can I do it? !

Try to install it manually:

git clone https://github.com/mathworks/MATLAB-language-server
cd MATLAB-language-server
npm install . && npm run package
node out/index.js --stdio

Also what's your node version?

@ZZT-console
Copy link

@tiagovla , I finally found the reason, it was indeed my version of node, it is too old. Thank you for solving my confusion for so long.

@jueqingsizhe66
Copy link

@tiagovla I did what you said, and I initialized the git repository in my project root directory. But I still can't use matlab_ls. I think it may be my environment issue. I use NVIM v0.10.0-dev-1025+g0e11bf0e1 and Linux Mint 21.2 Cinnamon. image

I have the same issue,

  • use MasonInstall to install matlab-language-server
node --version
v20.8.1
nvim --version
NVIM v0.9.4
  • my init.vim configuration for matlab-ls:
require("mason").setup()
require("mason-lspconfig").setup()

local lsp = require('lsp-zero').preset({})
lsp.on_attach(function(client, bufnr)
lsp.default_keymaps({buffer = bufnr})
end)

lsp.setup()

require 'lspconfig'.matlab_ls.setup {
    settings = {
        matlab = {
            indexWorkspace=true,
            installPath = "C:\\Program Files\\Polyspace\\R2020b",
            matlabConnectionTiming = "onStart",
            telemetry = true
        }
        }
    }

  • edit the .m file, use :LspInfo show the correct information, but cannot complete the word and go to definition etc
    lspinfo

@jueqingsizhe66
Copy link

@tiagovla , I finally found the reason, it was indeed my version of node, it is too old. Thank you for solving my confusion for so long.

@ZZT-console hope you share some ideas for solve the problem

@tiagovla
Copy link
Contributor Author

@jueqingsizhe66 check issue #10.

@jueqingsizhe66
Copy link

Got it, try to update matlab to 2021b version

@tiagovla
Copy link
Contributor Author

Got it, try to update matlab to 2021b version

I would try to downgrade your node version first. I'm sure 16.x works, I have not tested the other ones.

@dklilley
Copy link
Member

@jueqingsizhe66 I believe you will need to update your version of MATLAB. It appears that you are using R2020b, but the language server requires R2021a or later. This is noted in the README for the MATLAB extension for Visual Studio Code, but is missing from the language server's README - I will add a note.

@tiagovla The language server should now work with Node.js v18 and later (#10). If you notice that it isn't working with a particular verison, please feel free to open a new issue.

@jueqingsizhe66
Copy link

I update the matlab version to MATLAB2021b with node 20.8.1, it works fluently
Thanks for all.

@jueqingsizhe66
Copy link

@jueqingsizhe66 I believe you will need to update your version of MATLAB. It appears that you are using R2020b, but the language server requires R2021a or later. This is noted in the README for the MATLAB extension for Visual Studio Code, but is missing from the language server's README - I will add a note.

@tiagovla The language server should now work with Node.js v18 and later (#10). If you notice that it isn't working with a particular verison, please feel free to open a new issue.

Yes, also works with Node21.0.0 and MATALB2023a.

@ZZT-console
Copy link

@jueqingsizhe66 .It is simple. I deleted the old nodejs, whose version only was 12.x.x. Then, I download the LTS version of nodejs from the offical website.

@Shock9616
Copy link

I have been trying to get matlab_ls to work for a few days now and I can't figure out what's going on. I just got the lsp to attach properly, but I'm not getting completions or anything like that.

I installed matlab-language-server through Mason, and have this output when I run :LspInfo
Screenshot 2023-11-02 at 8 48 38 AM

This is my matlab_ls config, I have lsp set up through lsp-zero and have a pretty much default config

require("lspconfig").matlab_ls.setup({
    settings = {
	matlab = {
	    capabilities = require("cmp_nvim_lsp").default_capabilities(),
	    indexWorkspace = true,
	    installPath = "/Applications/MATLAB_R2023b.app",
	    telemetry = false,
	},
    },
    single_file_support = true,
})

I'm on MacOS 14.0, Neovim v0.9.4, Node v21.1.0, MATLAB_R2023b, etc.
Not sure what other info you might need, I can edit with whatever else necessary

@tiagovla
Copy link
Contributor Author

tiagovla commented Nov 2, 2023

Try setting vim.lsp.set_log_level "debug" and checking the logs (path is on your screenshot).

@Shock9616
Copy link

It seems to have randomly started working now, idk why. There do seem to be some errors/warnings in the log though so here it is anyways.

[START][2023-11-02 14:06:19] LSP logging initiated
[ERROR][2023-11-02 14:06:19] .../vim/lsp/rpc.lua:734	"rpc"	"/Users/myusername/.local/share/nvim/mason/bin/matlab-language-server"	"stderr"	"(node:50130) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.\n(Use `node --trace-deprecation ...` to show where the warning was created)\n"
[WARN][2023-11-02 14:06:19] ...lsp/handlers.lua:137	"The language server matlab_ls triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2023-11-02 14:06:19] ...lsp/handlers.lua:137	"The language server matlab_ls triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2023-11-02 14:06:19] ...lsp/handlers.lua:535	"(14:06:19) matlabls - ERROR: Error from mlint executable: spawn /Applications/MATLAB_R2023b.app/bin/maci64/mlint ENOENT\nError: spawn /Applications/MATLAB_R2023b.app/bin/maci64/mlint ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:286:19)\n    at onErrorNT (node:internal/child_process:484:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"

Is there anything I can do to fix those errors? If not then sorry for bothering you 😅

@tiagovla
Copy link
Contributor Author

tiagovla commented Nov 2, 2023

The first error is just a deprecated warning; you can ignore it.
The warning is because nvim hasn't implemented the dynamic registry yet, so it can also be ignored.
The last error, I think you can fix it by adding mlint to your PATH.

@Shock9616
Copy link

Ok thank you!

@YUSIO
Copy link

YUSIO commented Nov 22, 2023

@Shock9616
I encountered the same problem as you. I noticed that the folder where mlint lays is 'maca64/mlint' not 'maci64/mlint'.May be this problem is related to use of Apple Silicon version of Matlab. Do you know how to specific the path of mlint in the config?

@dklilley
Copy link
Member

The issue with maci64 vs maca64 is a known bug, and is currently captured in mathworks/MATLAB-extension-for-vscode#53.

Unfortunately, we do not have a recommended workaround at this time.

@Shock9616
Copy link

Shock9616 commented Nov 22, 2023

@YUSIO I don't, sorry. Here's my matlab_ls config if it helps 🤷‍♂️

require("lspconfig").matlab_ls.setup({
    settings = {
        matlab = {
            capabilities = require("cmp_nvim_lsp").default_capabilities(),
            indexWorkspace = true,
            installPath = "/Applications/MATLAB_R2023b.app",
            telemetry = false,
        },
    },
    single_file_support = true,
})

@tiagovla
Copy link
Contributor Author

@Shock9616 I encountered the same problem as you. I noticed that the folder where mlint lays is 'maca64/mlint' not 'maci64/mlint'.

That seems to be hard coded here. You could probably just create that folder and symlink mlint there?

@toshiakit
Copy link
Member

Hi @tiagovla any plan to support the MATLAB code execution in neovim?

@Twisty9656
Copy link

Hi I seem to be having trouble getting the lsp to run within neovim. It fails and exits with exit code 1 and signal 0. Running it in the terminal with the --stdio flag works however when it attempts to attach within neovim it fails. I've attached the lsp log below however I cannot make any sense of it, it appears to be an excerpt from the index.js file. any help would be appreciated

Screenshot_20240507_004140
Screenshot_20240507_004203

@weigangd
Copy link

weigangd commented May 13, 2024

For anyone interested maybe @Twisty9656 & @Shock9616:
With debug logging activated I saw the line
[DEBUG][2024-05-13 13:41:08] .../vim/lsp/rpc.lua:387 "rpc.receive" { id = 3, jsonrpc = "2.0", method = "workspace/configuration", params = { items = { { section = "MATLAB" } } }}
and i could make it work on MacOS by writting MATLAB in all caps instead of lowercase matlab in the settings e.g.:

    settings = {
      MATLAB = {
        indexWorkspace = true,
        installPath = '/Applications/MATLAB_R2024a.app/',
        matlabConnectionTiming = 'onStart',
        telemetry = false,
      },
    },

diningPhilosopher64 pushed a commit to diningPhilosopher64/MATLAB-language-server that referenced this issue Jul 2, 2024
…gnostic_suppression

Fix diagnostic suppression insertion
Fixes mathworks#4
@tiagovla
Copy link
Contributor Author

tiagovla commented Aug 6, 2024

@Twisty9656 what is the node version you are using?

@Twisty9656
Copy link

version 20.10.0

@Twisty9656
Copy link

wait, its working now
sweet

@Opposite34
Copy link

Opposite34 commented Oct 2, 2024

Hello, I'm having this error:

[ERROR][2024-10-02 16:30:02] ...lsp/handlers.lua:535	"(16:30:02) matlabls - ERROR: Error launching MATLAB: (Error) spawn matlab ENOENT"
[ERROR][2024-10-02 16:30:02] ...lsp/handlers.lua:535	"(16:30:02) matlabls - ERROR: Error stack:\nError: spawn matlab ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:286:19)\n    at onErrorNT (node:internal/child_process:484:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)"
[ERROR][2024-10-02 16:30:02] ...lsp/handlers.lua:535	"(16:30:02) matlabls - ERROR: MATLAB onStart connection failed: Error from MATLAB child process"

My MATLAB installPath is correct, and I have no other leads on why this is happening.

MATLAB version is R2024b, Node version is v20.17.0, and neovim is v0.9.5

My LSP configs can be found here (Note that I have tried using absolute path for installPath as well, and that gives the same result)

EDITED: so I needed matlab in PATH too apparently according to #33 , which works for me.

@KjellWesemann
Copy link

Hello i am using Lazynvim and just cant get the matlab language server to work i am on a macbook air m1
Bildschirmfoto 2024-12-13 um 12 19 26
Bildschirmfoto 2024-12-13 um 12 18 12
Bildschirmfoto 2024-12-13 um 12 18 38
i dont know what other infos would be helpful i am kinda dont know what i am doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests