Skip to content

Go to Definition and Rename Symbol don't work for statically-referenced class methods and properties #347

Description

@rafchuk21

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:
Image

Useful Information

  • MATLAB Version: 25.2.0.3055257 (R2025b) Update 2
  • VS Code Version: 1.125.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions