Home Download Buy Blog Forum Support

ST3: JavaScript symbol indexing is bad

ST3: JavaScript symbol indexing is bad

Postby wwwsevolod on Sun Mar 10, 2013 7:23 am

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 :(
wwwsevolod
 
Posts: 17
Joined: Thu Feb 21, 2013 11:19 am

Re: ST3: JavaScript symbol indexing is bad

Postby wwwsevolod on Thu Mar 14, 2013 3:10 pm

up, any reaction on this?
wwwsevolod
 
Posts: 17
Joined: Thu Feb 21, 2013 11:19 am

Re: ST3: JavaScript symbol indexing is bad

Postby 200 on Thu Mar 14, 2013 8:21 pm

  • 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 ;)

You really can't expect this since it's not really possible, especially not from a text editor.
200
 
Posts: 18
Joined: Wed Feb 22, 2012 6:40 pm

Re: ST3: JavaScript symbol indexing is bad

Postby wwwsevolod on Fri Mar 15, 2013 12:53 am

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
wwwsevolod
 
Posts: 17
Joined: Thu Feb 21, 2013 11:19 am

Re: ST3: JavaScript symbol indexing is bad

Postby int3h on Thu Jul 18, 2013 2:38 am

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.
int3h
 
Posts: 3
Joined: Thu Jul 18, 2013 2:24 am


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 30 guests