Namespaces and "go to definition"
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- tooling
Research direction
Start by reproducing the Go to Definition failure with the namespace layout and imported nsfunc shown in the issue, then trace the LSP's definition lookup for imported names. Done means Go to Definition opens +mynamesp/nsfunc.m and also handles the related class-method and stub-function cases without regressing direct namespace calls.
Written by the indexing model from the issue text.
Description
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
nsfuncinmainfunc
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
nsfuncis indexed. - While writing the
out = mynamesp.nsfunc(in);line, the code completion suggestsmynamespis 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 withmatlab.unittest.fixtures.PathFixture).
- Dominant language
- TypeScript
- Stars
- 125
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mathworks/MATLAB-language-server
-
documentation enhancement
Difficulty 1/5 1-3 hours Newbie friendliness 62/100
mathworks/MATLAB-language-server#27 · 10 comments ·
-
Add progress handler Openenhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
mathworks/MATLAB-language-server#81 · 4 comments ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 35/100
mathworks/MATLAB-language-server#79 · 7 comments ·
-
`--matlabLaunchCommandArgs` does not accept value starting with "-" (Not enough arguments following) Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
mathworks/MATLAB-language-server#78 · 8 comments ·
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 45/100
mathworks/MATLAB-language-server#76 · 5 comments ·
All issues in mathworks/MATLAB-language-server
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
0xMiden/bridge-portal#132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:tools bug good first issue help wanted priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
TaewoooPark/Motifcode#14 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
newrelic-experimental/preflight#793 · 1 comment ·