Describe the bug
The Go to Definition functionality doesn't seem to work when using functions inside a namespace.
To Reproduce
- In the working folder, create a namespace folder and a function inside it
projectFolder
├── mainfunc.m
├── +mynamep
├── nsfunc.m
- Import and use
nsfunc in mainfunc
function out = mainfunc()
import mynamesp.nsfunc
out = nsfunc(in);
end
- Move the cursor on
nsfunc (either on the import or on the function call) and call the Go to Definition LSP function.
- The LSP returns a No LSP defintion found warning.
Expected behavior
Upon calling Go to Definition, LSP should open the file +mynamesp/nsfunc.m.
Note that Go to Definition works correctly if I call the function directly without importing it first, as in
out = mynamesp.nsfunc(in);
Useful Information
- MATLAB Language Server Version: 1.3.9 (commit 19438c8)
- MATLAB Version: R2025b
- OS Version: Linux
- Language Server Client: Neovim 0.11.6
Additional context
- The Function Signature Help LSP functionality seems to work well in both cases, suggesting that
nsfunc is indexed.
- While writing the
out = mynamesp.nsfunc(in); line, the code completion suggests mynamesp is a function, not a namespace.
- A similar faulty behavior also appears with other functions defined outside of the current file, for instance with class methods (when using the
@class-folder class definition) or when creating stub functions that override built-in ones (e.g., when working with matlab.unittest.fixtures.PathFixture).
Describe the bug
The Go to Definition functionality doesn't seem to work when using functions inside a namespace.
To Reproduce
nsfuncinmainfuncnsfunc(either on the import or on the function call) and call the Go to Definition LSP function.Expected behavior
Upon calling Go to Definition, LSP should open the file
+mynamesp/nsfunc.m.Note that Go to Definition works correctly if I call the function directly without importing it first, as in
Useful Information
Additional context
nsfuncis indexed.out = mynamesp.nsfunc(in);line, the code completion suggestsmynamespis a function, not a namespace.@class-folder class definition) or when creating stub functions that override built-in ones (e.g., when working withmatlab.unittest.fixtures.PathFixture).