Aptana Studio 2 - Code Assist for JS is not working - javascript

My problem is somewhat strange. I have started developing a web page with Aptana Studio build 2.0.5.1278522500. Everything went fine up to the moment when I wanted to start writing JavaScript in a separate .js file - there's no code assist for it. In the preferences it's enabled, and - that's the strange part - it works perfectly well in the .html files (when typing code in the script tag). The only thing that could remotely tell there's something wrong is the fact, that when I type, say, "document" and hit the '.' key, the cursor disappears for a split of a second.
Did anyone have the same problem? Is there any solution to that? I'd like code assist for JS very much, without it Aptana somewhat loses it's appeal.

As CodeMonkey mentioned we can do the same at Aptana Stuidio version 3. I mean follow this path: (Preferences->General->Editors->File Associations). Select js at top list but because at studio 3 we should select JavaScript Source Editor as default. It did not work change it to another option save and again bring it back to JavaScript Source Editor (It happened for me). Now you can use it.

I found an answer to my question, I'll post because maybe it'll help someone. To get the code assist working I just changed file the default editor for .js files from JavaScript editor to Aptana JS editor (Preferences->General->Editors->File Associations, then selected *.js in the top list and Aptana JS Editor in the bottom list, then clicked the "Default" button). Now it works like a charm.

I got a similar problem on Aptana 3 Studio. I cannot reproduce the problem now and there is no option for Aptana JS Editor in 3. I think the key to solve the problem is: used the template to generate a new file, don't try to just rename a blank normal file, if so, you need to closed the file and reopen it.

Associating .js files with Aptana did not resolve this problem.
I noticed that when I type jquery(this). , I get code assistance and there was no assistance when I types $(this). So I fixed this thing temporarily by placing this statement
$ = jQuery;
at the start of my .js file, thus declaring the $ as an equivalent to the jquery function.
While writing Javascript code in HTML editor, you don't need to do that becuase you have included the jQuery reference at the top which has the above setting ($ = jquery).

Related

How to add script tags to html

Here in the image you see the code is greyed out. Before I put in the <script> tag everything was not greyed out. Once I put in the tag is greys out the rest of the code. I might be missing a file needed to run the script tags?
I have been working with code for a while, but I am still a little stuck on how to get the code set up. I am wanting to use html/css and JavaScript to make a couple websites. I am not sure how to set everything up to make it work. I also am using github, and trying to figure out how to use github-pages.
A simple solution that works:
Just close the file being edited
Click "File->Reopen Last Item" to re-open it
This is an issue with Atom, it does not detect the tag when it auto completes, it works fine in VSCode, so it's not really a problem with your code, it's the IDE
enter image description here
As i recognize, the Atom text editor makes this error.
The best solution i tried:
IN ATOM TEXT EDITOR
Windows:
Ctrl + ,
MAC:
Cmd + ,
In settings:
1. Scroll to the bottom,
2. Uncheck "Use Tree Sitter Parsers",
3. Restart Atom IDE.
That works fine for me!
This is a known bug, but it seems no fix have been done yet, you can report your case here, I guess: HTML Syntax Colour Bug
But you may have solution in that StackOverflow subject, if so, it would be a duplicate: Atom Code Editor. Why is my code not in color?

Atom editor - TODO highlight for JS?

In Atom editor, TODOs are automatically highlighted with atom/language-todo package, and I can change the style using user stylesheet. That much I know.
So I'm developing a webpage right now, and have to simultaneously work with HTML, CSS, and JS. However it seems that TODOs are only highlighted for HTML and CSS files, not JS files. This is strange because in the settings for atom/language-todo, the scope for all triggers are .html.php.text - HTML is included; CSS and JS are not. So reasonably thinking, either both CSS and JS should have highlight enabled, or both should have it disabled.
What is causing this strange behavior? Is there anything I can do to enable highlighting for JS?
P.S. Currently mrodalgaard/atom-todo-show is my alternate solution. It's quite good but I would still like to have my highlights.
This problem is probably related to this open issue on the atom/language-todo repository: https://github.com/atom/language-todo/issues/82.
As someone suggests in the issue conversation, the todo highlighting can be restored by disabling Atom tree-sitter in the settings:core page.
For more information on how the tree-sitter improves code parsing, see the release article on the Github blog

VSCode - Weird syntax formatting for JavaScript files upon saving

I noticed something weird going on when hitting ctrl+s in VSCode.
I have some JavaScript here and each time I hit ctrl+s lines 7+8 will get indented. At first I thought it was because of some extension rules (using Beautify for example). So I disabled all my extensions but still the following happens:
Then I noticed that removing the tags fixes the auto-formatting issue.
But why is that, any ideas?
Thanks.
Then I noticed that removing the tags fixes the auto-formatting issue.
If this is a .js file, you shouldn't have HTML in it. The tags shouldn't be there.

TinyMCE - How can I turn off Visual Aids for printing?

I recently added TinyMCE 4.0b2 to a web application I've been developing.
I needed to have visual aids turned on for editing, however turned off when printing and spent a fair amount of time looking for a solution through their forums, StackOverflow and google to no avail!
So... I decided to investigate the issue myself!
To get this to work I had to manually 'adjust' the print command of the print plugin.
The following fix applies to TinyMCE v.4.0b2, the version available at time of writing; it may or may not work with previous and future versions of TinyMCE.
The print plugin file can be found in the js/tinymce/plugin/print/ directory.
Open the plugin.min.js file in your favourite editor and you'll see something like this:
tinymce.PluginManager.add("print",function(e){e.addCommand("mcePrint",function(){e.getWin().print();}),e.addButton("print",{title:"Print",cmd:"mcePrint"}),e.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Ctrl+P",context:"file"})});
After poking around the tinymce source code I found the hasVisual editor property and mceToggleVisualAid command. I then added these two to the printing plugin as
if(e.hasVisual){e.execCommand("mceToggleVisualAid");}
just prior to the code calling
e.getWin().print();
The finished product looks like so:
tinymce.PluginManager.add("print",function(e){e.addCommand("mcePrint",function(){if(e.hasVisual){e.execCommand("mceToggleVisualAid");} e.getWin().print();}),e.addButton("print",{title:"Print",cmd:"mcePrint"}),e.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Ctrl+P",context:"file"})});
I hope this helps someone struggling with this issue in future.

My javascript file is displayed as a single line of text in the chrome debugger. Why?

I seem to run into this randomly. It usually displays the file normally, but sometimes it's all scrunched onto one line. I can't figure out what's causing it.
N.B.: In the current version of Chrome, this is actually done by clicking on the {} icon ("pretty print") on the lower left of the developer tools pane.
Ah, figured it out. The line endings on the problem file got set to Mac format somehow, while the rest of the files were Windows format. Not sure how the format swapped but it's easy to convert back (in Notepad++ just go Edit -> EOL Conversion).
You already answered your own question, but this is a good place to note that Chrome (as of v12, currently in dev channel) has a built-in pretty-print function that can make quick work of the typical one-line JavaScript files that all well-behaved websites generate. In Web Inspector's Scripts tab, select a file via the usual dropdown, and right click on the source code. Selecting "De-obsfucate Source" will format the file in a reasonable way, and even allow you to set breakpoints inside the newly reformated code. It's quite helpful.

Categories

Resources