Open
Description
Describe the bug
MATLAB disconnects from language server after initial start.
This results in hints being displayed initially, but not disappearing after correction & saving until full neovim restart.
Additionally this seems temperemental and appears to happen sometimes and not others. The same with hints, sometimes they appear sometimes they do not
To Reproduce
Steps to reproduce the behavior:
- Config: Neovim config using lazy.nvim, neovim/nvim-lspconfig & blink.cmp
{
"neovim/nvim-lspconfig",
dependencies = {
'saghen/blink.cmp',
},
config = function()
-- autocompletion
local capabilities = require('blink.cmp').get_lsp_capabilities()
--matlab
require 'lspconfig'.matlab_ls.setup {
cmd = { 'matlab-language-server', '--stdio', '--matlabInstallPath="C:\\Program Files\\MATLAB\\R2024b"' },
filetypes = { 'matlab' },
root_dir = function(fname)
return vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1])
end,
capabilites = capabilities,
settings = {
MATLAB = {
indexWorkspace = true,
matlabConnectionTiming = 'onStart',
telemetry = true,
},
},
single_file_support = false,
}
--autoformat on save
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(args)
local client = vim.lsp.get_client_by_id(args.data.client_id)
if not client then return end
if client.supports_method('textDocument/formatting') then
-- format the current buffer onsave
vim.api.nvim_create_autocmd('BufWritePre', {
buffer = args.buf,
callback = function()
vim.lsp.buf.format({ bufnr = args.buf, id = client.id })
end,
})
-- Create a keymap for vim.lsp.buf.rename()
end
end
})
end,
}
}
- Click on '....'
- Open a matlab file within a git directory in neovim
- go to some for of error e.g. missing semicolon
- Correct behaviour
- Save
- See errorExpected behavior
- Expected: LSP corrects notification of missing semi colon disappears on correction and save
- A clear and concise description of what you expected to happen.
- Actual:
- WARNING: Error while communicating with MATLAB - disconnecting"
- or cannot find release message (see LspLog in additional context)
- Actual:
Screenshots
Useful Information
- OS Version: Windows 22 Pro - 22H2 Build: 22621.4317
- Language Server Client: 1.3.1
- Client Version: NVIM v0.10.4
- MATLAB Version: R2024b
- Node Version: 23.1.0
Additional context
- Log output from :LspLog
[START][2025-02-27 11:56:46] LSP logging initiated
[ERROR][2025-02-27 11:56:46] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "(node:24240) [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][2025-02-27 11:56:46] ...lsp/handlers.lua:135 "The language server matlab_ls triggers a registerCapability handler for workspace/didChangeConfiguration despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2025-02-27 11:56:46] ...lsp/handlers.lua:135 "The language server matlab_ls triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2025-02-27 11:56:52] ...lsp/handlers.lua:625 "(11:56:52) matlabls - WARNING: Error while communicating with MATLAB - disconnecting"
[ERROR][2025-02-27 11:56:55] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 11:56:58] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 11:57:01] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[START][2025-02-27 12:08:19] LSP logging initiated
[ERROR][2025-02-27 12:08:19] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "(node:12156) [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][2025-02-27 12:08:19] ...lsp/handlers.lua:135 "The language server matlab_ls triggers a registerCapability handler for workspace/didChangeConfiguration despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2025-02-27 12:08:19] ...lsp/handlers.lua:135 "The language server matlab_ls triggers a registerCapability handler for workspace/didChangeWorkspaceFolders despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[WARN][2025-02-27 12:08:24] ...lsp/handlers.lua:625 "(12:08:24) matlabls - WARNING: Error while communicating with MATLAB - disconnecting"
[ERROR][2025-02-27 12:08:27] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 12:08:30] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 12:08:33] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[WARN][2025-02-27 12:08:52] ...lsp/handlers.lua:625 "(12:08:52) matlabls - WARNING: Error while communicating with MATLAB - disconnecting"
[ERROR][2025-02-27 12:08:55] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 12:08:58] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 12:09:01] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[WARN][2025-02-27 12:09:06] ...lsp/handlers.lua:625 "(12:09:06) matlabls - WARNING: Error while communicating with MATLAB - disconnecting"
[ERROR][2025-02-27 12:09:09] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 12:09:12] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
[ERROR][2025-02-27 12:09:15] .../vim/lsp/rpc.lua:770 "rpc" "C:\\scripts\\matlab-language-server.CMD" "stderr" "Timeout when attaching to release: 24b\n"
- :LspInfo vim command
==============================================================================
lspconfig: require("lspconfig.health").check()
LSP configs active in this session (globally) ~
- Configured servers: matlab_ls, pylsp, lua_ls, marksman
- OK Deprecated servers: (none)
LSP configs active in this buffer (bufnr: 25) ~
- Language client log: ~\AppData\Local\nvim-data\lsp.log
- Detected filetype: `matlab`
- 1 client(s) attached to this buffer
- Client: `matlab_ls` (id: 1, bufnr: [25, 12])
root directory: ~\Documents\git-repos\233-sedentex-ct-iq-analyser/
filetypes: matlab
cmd: C:\scripts\matlab-language-server.CMD --stdio --matlabInstallPath="C:\Program Files\MATLAB\R2024b"
version: `unknown Usage: index.js {--node-ipc | --stdio | --socket=socket} options An L…` (Failed to get version) Tried:
`C:\scripts\matlab-language-server.CMD --version`
`C:\scripts\matlab-language-server.CMD -version`
`C:\scripts\matlab-language-server.CMD version`
`C:\scripts\matlab-language-server.CMD --help`
executable: true
autostart: true
Docs for active configs: ~
- matlab_ls docs: >markdown
https://github.com/mathworks/MATLAB-language-server
MATLAB® language server implements the Microsoft® Language Server Protocol for the MATLAB language.
- matlab-language-server.cmd:
@echo off
setlocal
::RUN server
node "C:/<PATH-TO-SERVER>/MATLAB-language-server/out/index.js" %*