开发者

Aptana CSS hinting inside jQuery

开发者 https://www.devze.com 2022-12-29 11:15 出处:网络
I have code hinting for Aptana setup for jQuery. However, many jQuery actions use strings, which Aptana does not provide hinting. How can I have Aptana give hinting for html and CSS when I am typing i

I have code hinting for Aptana setup for jQuery. However, many jQuery actions use strings, which Aptana does not provide hinting. How can I have Aptana give hinting for html and CSS when I am typing inside a string?

 $(function() {
    $("#theList tr:even").addClass("stripe1");
    $("#theList tr:odd").addClass("stripe2");
});

I have an id="thelist", but since I am inside a double quote, Aptana provides no help. Similarly, .stripe1 and .stripe2 are not hinted. I know CSS and HTML hinting are开发者_如何学运维 turned on. If Aptana cannot provide this feature, are there other code editors that will?


Aptana doesn't currently offer that functionality. WebStorm appears to offer this functionality, but is a paid product: http://www.jetbrains.com/webstorm/features/


So, this isn't an easy solution, but...

Technically you could write a code assist/completion implementation in a ruble that was tied to the javascript string scope that would then suggest various CSS selectors/ids/classes.

Here's an example where the ruby.ruble contributes a content assistant: https://github.com/aptana/ruby.ruble/blob/master/commands/content_assistant.rb

In your case you'd change the scope to be something like 'source.js string'. Then in the block you'd return an array of strings that you want to suggest. The context object will contain a lot of contextual info you can use to try and narrow/generate that list, but a static array of strings works fine too.

If you wanted to see how we do CSS content assist as an idea, it's at https://github.com/aptana/studio3/blob/development/plugins/com.aptana.editor.css/src/com/aptana/editor/css/contentassist/CSSContentAssistProcessor.java

Since our ruble support actually runs through JRuby you can call into our Java code too. The ruby.ruble's implementation does just that.

The spec for rubles is here: http://wiki.appcelerator.org/display/tis/Ruble+Specification

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号