mathworks / mathworks/MATLAB-extension-for-vscode
Go to Definition and Rename Symbol don't work for statically-referenced class methods and properties
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 435
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When a class has Constant properties or Static methods and those properties and methods are referenced statically (e.g. Class.CONST or Class.foo() vs obj.CONST or obj.foo()), Go to Definition and Peek report "No definition found for..." and Rename Symbol fails to rename the properties/functions.
To Reproduce
Place this sample code in Test.m and try to Go to Definition/Peek from go_to_def_test or Rename Symbols and and see what changes in go_to_def_test.
classdef Test
properties(Constant)
STATIC_CONST = 1;
end
properties
instance_var = 2;
end
methods(Static)
function static_fun()
fprintf('static\n')
end
end
methods
function obj = Test()
obj.instance_var = 3;
end
function instance_fun(obj)
fprintf('instance\n')
end
function go_to_def_test(obj)
% doesn't Go To Definition and doesn't Rename Symbol
Test.STATIC_CONST;
% works for both
obj.STATIC_CONST;
% works for both
obj.instance_var;
% doesn't go to def and doesn't Rename Symbol
Test.static_fun();
% works for both
obj.static_fun();
% works for both
obj.instance_fun();
end
end
end
Expected behavior
Go to Definition should properly go to the definition on statically referenced methods and properties, and Rename Symbol should not skip statically referenced methods and properties.
Screenshots
Results from using Peek Definition on the same property when it's statically referenced vs not:
Useful Information
- MATLAB Version: 25.2.0.3055257 (R2025b) Update 2
- VS Code Version: 1.125.0
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.
Research direction
Start by reproducing the failure with the sample class in Test.m, using go_to_def_test to check Go to Definition, Peek Definition, and Rename Symbol for static references. Confirm that instance-style references continue to work, then verify that static methods and constant properties resolve and rename correctly in the same example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100