I'm stuck (after hours of trying to get unstuck). Main problem is that I would like to have class-specific code assist for javascript objects I retrieve from the DOM. For example,
if I retrieve a element using document.getElementById("theCanvas"), I only get code assist for a generic DOM object (which is logical). I would like to be able to "tell" the javascript editor that this object is actually a Canvas, so that I could then get code assist for the Canvas object.
I've installed Aptana and JSEclipse. With Aptana, I can't even find an Aptana (or Django) editor to associate with .js files. In the JSEclipse documentation (what of it there is), it mentions that you can enable this with JSDoc, but I have been unable to make this work. Also, JSEclipse doesn't seem to support formatting, which seems really odd.
Does anyone know if it is possible to get code assist for this case and/or how to access the Aptana js editor and/or how to get JSEclipse to format? I was thinking maybe you could cast the element object (a la Java), but the only documentation I could find on this says you can only do 3 casts in Javascript (Number, Boolean and String).
Platform: Eclipse Indigo for Java EE Developers (including WTP), Aptana 3.0.8, jdk 1.6.25, JSEclipse 1.5.5
Thanks in advance.
Well, Javascript isn`t strongly-typed and not compilated, this way is more difficult to IDEs to understand what are you meaning while you are writing.
But fortunately, you can use the Console of Google Chrome to help you with that. It knows the attributes and methods of the objects you are using
Related
This may be dumb idea but here is what I am trying to achieve. A project I am working on has a legacy front-end code. Site is super slow and one of the contributing factor is jQuery. My idea is to write a utility that will tell me all the jQuery functions that were used on the final build. So that I can build jQuery from the source and remove what is unnecessary.
I've tried closure compiler by google with no luck. Even tree-shaking resulted in broken code.
I don't know if this dumb but this is what I could think right off the bat. All criticism, solutions are welcome.
Can you just search file by file for any instance of "$(" ? This indicates something is jQuery.
I've searched with no luck to find a parser for .aspx and .ascx files that could be used to create a VSCode formatting plugin using the Prettier extension.
I've resorted to creating my own parser from scratch, which I have mostly done successfully but I have reached a point where the edge cases are causing the complexity to be difficult to manage.
I am using the Parser Generator called Jison https://github.com/zaach/jison
I am wondering if I am overcomplicating this issue and if it is possible to combine two parsers to return the Abstract Syntax Tree necessary to format the Grammar using Prettier. Does anyone know of a good way to achieve this? I am new to the concept of parsing so this may be simpler than I am making it out to be.
I need to be able to support all valid HTML with embedded C# (deliminated by tags such as <%, <%=, <%#, <%#). As well as Javascript that also has embedded C#, and Jquery.
Any help or idea is greatly appreciated.
I can include my code if needed for reference but I am looking more for ideas than specific code help.
I am using Eclipse IDE for PHP and now that I started using also JS I am missing the autocomplete options. I do not know if they're missing because I did something wrong or because the variables are not defined yet (similiar to MATLAB). Autocomplete works great with PHP, HTML and CSS but not with JS.
I tried the classic
> Window > Preferences > JavaScript > Editor > Content Assist > Advanced
and
Installing extensions
but it did not help. I also tried to reference to some external files, but I am pretty sure that's not what is wrong.
I've been searching the whole day and I did not find an actual answer. As Eclipse has so many multiple options to adjust everything, I am getting a bit overwhelmed with that...
I would appreciate someone explaining to me how the autocompletion works. Where and whwn does it look for the suggestions (definitions in the js file or in the whole script) and why does it not show the DOM methods like window.onload or document.getElementById for example. Is this normal because there is no window/document yet or do I have to check some checkboxes in order to make eclipse do that?
The best content assist (and validation and more) for JavaScript and all dynamic web languages is available in the CodeMix plugin for Eclipse.
Here's a specific comparison between Eclipse JSDT and CodeMix.
You can install CodeMix from the Eclipse Marketplace here.
Hope that helps!
I've been using Sublime Text for creating the Javascript flavor of Extendscript scripts for our company. However, I've been curious about Aptana Studio and whether or not it might be a better choice to move to it. Already, however, I can see two big issues:
Handling Extendscript-specific code
Content assist using a DOM.
In the regular versions of Eclipse, if I wanted to use a specific piece of code from a library and get content assistance with it, I'd just add its .jar file to my build path and I was done. However, Javascript doesn't seem to use libraries, per se, so how would I get it to know the various methods and properties of a TextField object when I use the ol' Ctrl/Cmd+Space after typing in a reference to one, followed by a dot?
And at the beginning of my scripts, I have to use preprocessor directives, such as:
#target indesign;
#targetengine session;
so that the script knows what program I am using, if I want to #include other files, etc. These commands are, of course, specific to Extendscript, so when Aptana sees them, it breaks the Javascript syntax highlighting for the rest of the document. Is there any way to set Aptana to, perhaps, ignore preprocessor directives? Or add their syntax into its rules checking for syntax highlighting?
Also consider the ExtendScript Toolkit, if you haven't tried it yet. While it's not as powerful an editor, it does know about some of the DOM functions, and it has convenient built-in debugging tools for working with CC applications.
I know that Visual Studio 2008 support JavaScript intellisense as I am using it with Jquery. I am wondering if anyone has ever explored how to get other libraries like Dojo and Dijit to work with it as well. I would assume you would have to provide the ///reference tag to your custom code but would still need a vsdoc for visual studio to look in.
Just curious if anyone has tried this or has any suggestions. I might have to hand roll the vsdoc, which might not be too hard based on the api.xml documentation. Thanks for the help!
There is no official Intellisense file for Dojo unfortunately. We could look up the spec and formulate something specific (like we do with Komodo .cix), it is just a matter of using the existing doc parser to scan over the code and generate whatever needs generated.
If you do hand-roll a vsdoc completion file, we'd love to have it. Or if you need any assistance using the doc parser to generate it feel free to contact me offlist (I'm 'dante' # the toolkit domain) and we can see about getting something out there.
We use Visual Assist plugin, and it does pretty well, only thing it lacks is list methods function because of the way you declare objects in Dojo with functions as property values, VA has trouble parsing these. Its OK with old school prototypes though.
They are not officially supported for VS2008, but you may be able to get them to work. Of course, they don't have any of the meta comments in them. If you get any errors, you can create a -vsdoc version of the library and try to edit it to get past the error messages.
JavaScript IntelliSense in VS2010 will be much more robust and you will be able to get good IntelliSense (again without the meta-data) on a much wider range of 3rd party libraries.