Sublime Forum

ST3: JavaScript symbol indexing is bad

#1

If i write code in namespace style, like
SomeNamespace.framework.widgets.BigWindowWithUnicornsWidget
i cant go to definition from sublim, sublime says “not found”, and many more…
May be it depends on framework i use - @ work i write code with ehm… backbone.js like framework, and declare classes like:
SomeNamespace.otherNamespace.NewClass = SomeNamespace.otherNamespace.OldClass.extend({
//some things to add to new class.
})

Please fix it :frowning:

0 Likes

#2

up, any reaction on this?

0 Likes

#3

]It’s the Javascript plugin that attempts to interpret and index javascript source. It acutually has nothing to do with Sublime Text. (Although, Javascript, being such a common language these days, one could perhaps expect the defualt plugin to be a bit more polished). You could look for a better javascript plugin / Javascript.tmLanguage online. (or one tailored for Backbone)/]
]SomeNamespace.otherNamespace.NewClass = SomeNamespace.otherNamespace.OldClass.extend({}) is, like you said, specific to the particular framework Backbone.js. It’s actually not possible for any text editor or IDE to really understand the code, because the class really isn’t generated until runtime. It would be possible to make a regex to look for something similar to it, and based on that take reasonable guess. But it is actually impossible to determine the value/class until runtime :wink: /]

You really can’t expect this since it’s not really possible, especially not from a text editor.

0 Likes

#4

ehm, i understand what u said, and i understand the problem, really.
but.
Sublime Text not IDE with primary language support, so it will not “interpret” the code, just indexing some kind of symbols by keywords, like var, function or so.
So why it can find method in some JS “class”, but can’t find, ehm, “hash object field”? I think it’s just some kind of setting (regex may be?), so it’s not the problem to index that kind of symbols.
If there will be available some indexing settings and api everyone will be able to create that functionality, but when i can’t find any information on this it is currently impossible.
So i ask just fix that kind of symbols indexing, bcoz it’ll be usefull for many, many developers, not something impossible, without understanding that question.

sry for my bad english if some mistakes occured;
best regardz

0 Likes

#5

Coincidentally, I was just suffering from this problem yesterday, and wrote a fix for it.

I’ve published my fix on GitHub, along with instructions for installing it.

Unfortunately, due to the nature of the fixes (they need to override some files in the built-in JavaScript package, and so the package needs to be named “JavaScript” exactly) I don’t know of an easy way to publish it on Package Control. Installing by hand is easy: just ‘git clone’ the repo into a directory named “JavaScript” in your Packages directory.

0 Likes