Sublime Forum

Javascript "Goto Symbol" not working like before

#1

This is less about asking for help and more about sharing what I’ve learned recently.

Different Behavior

Sublime (v3) stopped showing me my methods in the Goto Symbol list (Ctrl+R). It showed me simple functions still, and when I tried recreating the problem by writing a simple object literal with methods or ES2015 class, everything worked. I discovered that if I tried using “one-off” objects or classes (as can be seen in my “not working” examples), Sublime wouldn’t add the methods to the Symbol list.

Examples - not working

// ES2015 case - declare and immediately instantiate a new class
new class MyClass {
    myMethod() { ... }
}

// Vanilla JS case - define & pass object literal as param
funcTakesObject({
    objLiteralMethod : function() { ... }
});

Once I changed the code to the following:

Examples - working

// ES2015 case
class MyClass {
    myMethod() { ... }
}
new MyClass();

// Vanilla JS case
var objLiteral = {
    objLiteralMethod : function() { ... }
};
funcTakesObject(objLiteral);

… the methods started showing again. I am able to reproduce this behavior, now knowing what the problem is.

Like I said, not a request, just a share. Hope this is helpful for anyone else having the same problem. It’s probably a good change. My first attempts were slightly hackey.

0 Likes

#2

Looks like it has been logged here: https://github.com/sublimehq/Packages/issues/615

0 Likes