Indenting Javascript file line by line? - javascript

Is there any way in visual studio 2010 to indent javascript file line by line? I have got a big javascript file where all code is just on one line, so readability of the code is too much compromised.
Any hint? Thanks

One solution is to copy the entire file content in this site : http://jsbeautifier.org/ then press the Beatify JavaScript or HTML button, and you will get the js properly formated.
Now I suppose that Visual Studio could have a service identical to the sugested one, but I have not used it at all.
The PhpStorm that I am in love with it, has this option, to beautify the code if the code is compressed, as well allows me to define the look of the code format.
Also, as already described by #Andreas, you can use the plugin : http://visualstudiogallery.msdn.microsoft.com/41a0cc2f-eefd-4342-9fa9-3626855ca22a

Related

Multiple File Associations in VSCode for Mixed PHP and JS Syntax Highlighting

I have a file, source.php, that contains Javascript after the closing PHP tag. Is there a way to make Visual Studio Code do syntax highlighting/completion on the Javascript code. It currently only highlights the PHP code.
It'd be great if settings.json supported something like the following:
"files.associations": {
"source.php": ["javascript", "php"]
}
No, this is not possible without writing your own VSCode extension to understands the combined file
For syntax highlighting, you'd need to define a new grammar that combines the php and javascript grammars.
Completions are even more complicated. You need a language server / extension that can understand the new combined document. How our html server handles script blocks is probably the best example of this: https://github.com/Microsoft/vscode/blob/master/extensions/html/server/src/modes/javascriptMode.ts
This extension could help.
One Dark Theme
It is based in this Git Repo : https://github.com/atom/one-dark-syntax

After save (ctrl+s) Javascript file change all format

I am having a problem with intellij IDE community edition 14.03 version that i hope you can help me,
when i modify a javascript file (an small change like a space) looks like intellij is changing the format or something behind scenes because when i check with svn tortoise in show differences as unified diff option looks like i was changing all my file, removing all the lines and the adding them again with the new change(the space that i added).
note: i was modifying the same file with webstorm IDE and when i select the same option(show differences as unified diff), this is just modifying the line that i change. i dont know if is something in my setting or a bug.
after checking this problenm with intellij team, in the bug
https://youtrack.jetbrains.com/issue/WEB-15304
We realize that the problem was due to .editorconfig file, we can work with .editconfig file to standarize the format of our files, doesn't matter what IDE are you working on, but in my case this file was getting my a headache, in my case the only thing that i need to do to solve my problem was remove does files in my project and everything is working fine now.
but i just wanna to mention that this file could solve a lot of our problems if our team work with differents IDEs
I am leaving the link about this if you are interested on it.
http://editorconfig.org/

NetBeans: Javascript Code Completion doesn't work as expected

I've just started using NetBeans (PHP version 7.2 for Mac) and love it so far. One thing that I haven't been able to figure out is how to get Code Completion to work for Javascript files in the same fashion as it does for PHP, CSS and HTML files. For example, if I type "fun" in a PHP file, it'll pop up a box that allows me to choose "function":
If I do the same thing in a Javascript file, I get nada:
I've looked all over the place and I have not found a way to add this functionality. Your help would be greatly appreciated.
For this example, try the Source-> Complete Code command (Ctrl+Space by default).
In any case, the JavaScript editor is currently being rewritten from scratch so better code intelligence is to be expected in the near future.
Edit: I almost forget the most obvious answer... Make sure your file belongs to a loaded project. Code intelligence doesn't work properly outside projects.

Reference javascript files to use visual studio 2010 intellisense

I have a website with very heavy (long javascript > 100KB + JQuery). So, for making the javascript re-useable, I want to separate the logic in different javascript files.
So, I want to make an aggregated javascript file
Please tell me how (I even want to use the VS2010 intellisense in my main JS file about the functions of the other JS files.)
Javascript Intellisense tends to be extremely unreliable as some updates broke it some updates fixed it, and there are a lot of extensions around it, breaking each other.
Still there is a /// <reference> element for cases like this.
See MSDN article and add line:
/// <reference path="otherscript.js" />
at the top of your script file.
Try to test it with the jQuery vsdoc and your other script files.
Also installing MVC4 installed some dependency or whatever that more-or-less fixed javascript intellisense for me.
I would recommend Resharper: http://www.jetbrains.com/resharper/whatsnew/
You can separate your Javascript files and use SquishIt to concatinate and compress/minify them all into one single file to reduce the file size and the number of requests.
I don´t know of any solution that allows you to work in both the concatinated file as well as each separated file ...and I don´t understand why anyone would want to.
IMO, Visual Studio has a quite poor intellisense for Javascript.

JavaScript code analysis in VS2010

It is possible to enable a code editor helpers for .js files in Visual Studio 2010.
I am tasked to alter the existing JavaSript files, and I am having a hard time to even getting around the written codes, since VS editor treats JS as text. I think Notepad++ would do a better job in this case.
Consider a simple example in the image below:
When an opening braces are selected, the closing ones should also be highlighted so see the boundaries of the function.
The question is: Is there an extension, or some other add-in to VS to enable comfort javascript editing?
JScript Editor Extensions looks good

Categories

Resources