Searching good JavaScript formatter for eclipse - javascript

I am using eclipse as my IDE but I don't like the installed formatters. I also builded my own one but didn't get it to work like I want it to. For example things like that happen often:
Is there somebody out there with a good JavaScript formatter or a link with a list of some. I only found a few (e.g. the google formatter) but I don't like one of them.

Try changing the formatting preferences individually.
Window->Preferences->JavaScript->Code Style->Formatter
You'll have to save them as a new file. The only issue i have is that the object declaration won't use tabs instead of spaces for the property declarations.

Related

How can I distinguish typescript from javascript by looking at the source code?

I am inspecting some code on Github and I need to quickly understand if the script is javascript or typescript.
Are there any easy shortcuts or clues to this?
As an example, in this image from https://www.typescriptlang.org/ gives me a clue that if an array is declared with a bracket [] after the variable name, then it is typescript.
You can distinguish between the two formats by looking simply at the functions.
Are any of the functions specifying types such as 'string,integer,object,array,function?...' etc?
In traditionally javascript this is not allowed.
Best,
AT
Also as others may have pointed out, you can also check the file extension

Is there a way to get signature/documentation of a function in Node REPL?

"Tab"ing the REPL gives me a list of functions, but often working with multiple languages, I forget the signature of common functions like fs.open, etc. Is there anyway to show these in the REPL?
Thanks to auto-complete in editors, they seem to be fine. But REPL for writing some quick script, I have pull up the node documentation each time for simple things.
Is there a better way to deal with this?
This semi official project developed under the node umbrella on GitHub offers a few improvement over the default REPL while used interactively:
https://github.com/nodejs/repl
Syntax highlighting is enabled for the input, basic functions signatures are displayed as hints.
As stated in this issue, its future is still uncertain, but it's already quite usable in the current state: https://github.com/nodejs/repl/issues/46

Getting Netbeans autocomplete working for a JavaScript project with lots of classes as includes

I have a project in Netbeans 8.0 with around 12 javascript includes. When in one JavaScript class file, if I instantiate another custom class from the project and press "." after the var name, it does not pop up any autocompletes with my member variables and methods from my classes in the project.
Example: in one javascript file have a class like :
class Person(){
doStuff(){
// sh happens
}
}
and in another javascript include, (both of which are included in index.html as the project's main URL in the project properties) try to reference it mid-code like...
class StaffManager(){
manageStuff(){
var aPerson = new Person();
aPerson.doSt ;/* BY THIS TIME AUTOCOMPLETE SHOULD BE SAYING "doStuff()" right? (I had to add the semicolon for stack overflow not to throw err)*/
}
}
Look at the commment, that's where you stop typing because autocomplete is giving you options from the class... or so it did in my old IDE's.
Is this supposed to work in Netbeans? Or what did I miss?
Do I need to start some kind of class path declaration? (can't it just parse my project?)
Does it parse "new ___()" to reference classes for autocomplete or is there any way to type cast vars that makes autocomplete work?
I'm new to OOP application development in javascript using Netbeans, and am missing something pretty game-changing for rapidly developing software: proper auto complete for custom classes. I'm assuming it MUST do this, as so many other IDEs do, but if not please also feel free to suggest how easy it can be in other IDEs that do this auto-magically.
Thank You.
First you can try to import your Person object via the ES2015 import.
So import * from Person or smth like that. This is, maybe a better way if it is possible on your enviroment. And than you can see, whether it is working or not.
If not feel free to create a ticket here please, with steps to reproduce and maybe a little sample project: https://issues.apache.org/jira/projects/NETBEANS. Would be help a lot. I think it should work, I can test it later too.
Thx :)
Update:
Apparently what I want to do with these classes is only in the ES6 spec that may not have been supported until maybe Netbeans 8.2, I found this article highlighting a bunch of E6 syntax additions to the editor that are right up this alley.
This came out last year (2016) so I don't know how I missed the memo. I've been coding valid programming with no autocomplete and red underlined error flags for too long! If you are doing ES6 and are using Netbeans 8.1 or older you should definitely upgrade asap!
Here's the reference to that article where it gives some nice examples of new features you can do in editor in 8.2+:
https://jaxenter.com/netbeans/ecmascript-6-lands-in-netbeans-ide

Visual representation of classes and/or objects

recently I started to work on some big project written in php/js.
It is really big and I have constant problem of backtracing what functions are called where.
Is there any tool, that would import all the code files and draw/write connections between classes, objects, functions and such?
Regards
BOUML can create UML diagrams out of your code
http://www.bouml.fr/
old 4.23 version is also free if that is needed
http://download.cnet.com/BOUML/3000-2094_4-10788888.html
I am using Intellij IDEA with the PHP Storm Plugin for my PHP/JS-Projects. There I'm able to right click a function and choose "Find Usage ALT+F7". Now I can see, where this function is getting called.
Intellij IDEA/PHP-Storm is also able to generate UML-Diagrams if needed.
I guess Netbeans, Eclipse+PHP-Plugin do have similar functions [maybe execpt of the uml-generator], if you need an IDE at no costs.

Different syntax highlighting on mvim/vim when using console

Using MVIM on GUI I get the syntax on the right. Using mvim -v\ or vim on the console, I get no syntax at all, but after a :syntax on if becomes the image on the left, which is still not the coloring I'm used to. What's going on?
Graphical vim can use other configuration file (~/.gvimrc vs ~/.vimrc), and due to that vim after star differs from mvim. Regarding the differences in colours, consoles aren't able to use full RGB which are available for graphical interfaces, so your colour scheme is somehow 'approximated'.
The color scheme is defined by :colorscheme [scheme]. If you run without the argument, you can check which is in use by running it without the argument.
Two files are normally used to customize vim. You should check then to see where colorscheme is being set.
General vim (GUI and CLI) customization goes on .vimrc.
GUI-only customization goes on .gvimrc.
Scripts can also be overwriting the options in these files. You could use :scriptnames to check which ones are currently in use, to help you find what's going on.

Categories

Resources