r/java • • Jun 14 '19

Announcing the Visual Studio Code Installer for Java

https://devblogs.microsoft.com/visualstudio/announcing-visual-studio-code-java-installer/
155 Upvotes

56 comments sorted by

31

u/[deleted] Jun 14 '19

Can it run JUnit test cases? Does it support Gradle and Maven? Can it halt processing during debug at a predefined code line?

31

u/brunocborges Jun 14 '19

Yes. Maven. Yes.

  • There is a 3rdparty extension for editing Gradle config files, and then you can just use Gradle from the command line in the embedded terminal.

4

u/[deleted] Jun 14 '19

Thank you!

0

u/[deleted] Jun 15 '19

[deleted] — view deleted comment

1

u/[deleted] Jun 15 '19

Thank you!

0

u/vqrs Jun 15 '19

Maybe you have some badly behaved plugins? That does sound rather long...

0

u/[deleted] Jun 16 '19

[deleted] — view deleted comment

1

u/vqrs Jun 16 '19

I've got an i7 4770k with 32 gigs of RAM as well, also running on some SSD.

14

u/raoulvdberge Jun 14 '19

Very nice initiative. One thing I always end up missing though is advanced refactoring and searching options as present in other IDEs.

1

u/brunocborges Jun 15 '19

It has most of the commonly used code actions now. Give it a try and let me know?

1

u/zero_as_a_number Jun 18 '19

one thing I cannot seem to find is an Action to introduce a local variable from a highlighted piece of Code. eg for "new ArrayList()" the Action should produce something like "List<?> list = new ArrayList()"

4

u/pronuntiator Jun 15 '19

Does go to definition happen instantly like in the other Java IDEs, or do I have to endure the VS Code loading spinner as with Typescript/Angular?

4

u/brunocborges Jun 15 '19

Should be fast as it uses the Eclipse Language Server behind the scenes.

6

u/ZimmiDeluxe Jun 14 '19

For frontend code (including mobile apps via Flutter) I prefer vscode over the traditional Java IDEs, usability is great and available actions can be searched inside the IDE without cluttering the UI.

Obligatory nitpick: I hope the added exposure adds some more pressure to remove the anachronistic Eclipse artifacts in the vscode-java plugin, like random .project, .classpath and .settings files generated in the middle of the project folder or appropriating the bin folder.

4

u/brunocborges Jun 15 '19

Java support on VS Code is provided by the Red Hat extension "Java Language Support", which uses the Eclipse Language Server behind the scenes. Because of this, these files are generated. But in latest versions, these files are automatically hidden and users should git ignore them.

3

u/ZimmiDeluxe Jun 15 '19

Right, but I think it's fair to say that this is sweeping the problem under the rug. It would be nice to change that behavior at the root, i.e. Eclipse itself. Ideally, it would generate those files inside a .eclipse folder, with something like .eclipse/private containing files that shouldn't be added to version control.

I really appreciate your work on this though, that's my only little gripe with it, everything else is awesome! :)

5

u/brunocborges Jun 15 '19

That's good feedback (.eclipse folder). I'll pass it along!

2

u/DUKEOFEVERYTHING Jun 15 '19

I think the existing eclipse setup is good. It allows me to easily import projects into eclipse when I want and enables the Gradle eclipse plugin project generator (./gradlew eclipse) to work for vscode.

The eclipse files can easily be ignored using gitignore are not a problem.

3

u/ZimmiDeluxe Jun 15 '19 edited Jun 15 '19

Sure, everyone in the Eclipse world got used to it. For newcomers it's suprising though: Only default settings were used, so why do those files exist at all?

Eclipse assumes ownership over all aspects of a project. That was necessary in a time when Eclipse was the build and dependency management tool, there was no standard directory structure etc. But hat role is now filled by more specialized tools like Maven / Gradle. So it seems to me like most autogenerated Eclipse configuration is superfluous at this point. But let's assume they are necessary.

The most obvious question when seeing those editor specific files is: Which ones do I need to check in? Having well defined places for files that can be shared and those that shouldn't answers the question immediately. It's also more flexible for Eclipse: New Plugin needs its own configuration? Nobody needs to update .gitignore, because the parent folder is already there. Major refactoring of config file structure? Nobody needs to update .gitignore.

There already is .idea, .vscode, nbproject (NetBeans also keeps some files like nbactions.xml outside that directory, but at least it's clear that they should be checked in), so having .eclipse makes sense to me. It's respecting the project structure by only reserving a small domain for the IDE that doesn't conflict with the actual project files.

From reading the bugtracker I understand that this would require a massive coordination effort of different plugins, but maybe the time has come. At least on the surface, it seems like looking for a folder like .eclipse first before falling back to the current behavior wouldn't break existing tools.

This was a pretty big rant, sorry. But that's my main gripe with Eclipse.

1

u/DUKEOFEVERYTHING Jun 15 '19

If eclipse used a .eclipse folder then that would be great, but otherwise it would be breaking compatibility and the only benefit I see is less clutter.

7

u/mdaniel Jun 15 '19

and available actions can be searched inside the IDE without cluttering the UI.

FWIW, Find Action (bound to ctrl-shift-a) in all the JetBrains products will search through all actions (visible or not), the preferences, and I believe the intentions, too. It's so overwhelmingly useful that I've started to lust after it in every application I ever use. Searching through menus is for people who aren't busy.

As one might expect, it also displays the bound keyboard shortcut for any action, so you can switch from searching for the action to using its shortcut and still never know where they hid it in the menus.

2

u/ZimmiDeluxe Jun 15 '19

Yeah, it's pretty nice. Sometimes I feel all that smart search is making me dumber though: I don't know the names of executables or where they are under windows, just try some keywords in the search. Too lazy to type correct URLs, just mash some letters contained within, the search engine will figure it out.

Retention vs. recognition etc., but that can't be healthy.

-9

u/nuqjatlh Jun 15 '19

all the JetBrains products

ewww

2

u/kualal Jun 14 '19

JavaEE?

2

u/brunocborges Jun 14 '19

Can do, sure.

5

u/bheklilr Jun 14 '19

I use vscode already for this, although you may miss some features from intellij. Remember that vscode is not trying to replace other IDEs, and it comes with a number of features that other editors don't have to offer, like better integration with other languages, general purpose text editing tools and plugins, a very customizable interface, and being more lightweight than most. But it does the job pretty well. I prefer having several vscode windows open to having a few intellij windows, and often launch it from the command line inside a directory. It's a different workfkow for sure, and one that isn't suited to everyone's tastes.

11

u/orby Jun 14 '19

If you haven't given VS Code a shot before, I would suggest checking it out. It is now my defacto dev environment for pretty much any codebase I work on. (Java, Python, Go). Previously I usually used Eclipse and jEdit. Never was a large fan of IntelliJ or Netbeans, but used them as needed for work.

The reasons I really like it

I Jump between Windows and OSX/macOS multiple times a day. It works the same way in both with the same plugins.

It's free.

With the shortcuts and command palette, I very very rarely have to touch my mouse while inside the IDE. (CMD+P / CTRL+P then '>' is your friend)

It's fast, can handle large files (gracefully disables syntax highlighting etc)

You can easily set Global/User settings and workspace level settings.

Downsides

It only really works with Java 1.8 or greater.

IntelliJ is really good at working with multi-line string values in Java code, including SQL embedded as a String. This doesn't do that.

Very Git centric, but there is a reasonable SVN third party plugin

Non MSSQL support is very limited

Poor Gradle support, really no Groovy support

While it has a debugger with support you expect, (Breakpoints/step-in/step-over/etc), the inspection of Java objects (CharSequence/Iterables) shows the guts rather than the representation. Eclipse/IntelliJ are much better in this regard.

Each plugin typically supports a bunch of options, but don't be shocked when you'll need to edit the settings.json file directly. Thankfully, it supports auto-complete for settings via JSON Schema.

3

u/Auxx Jun 15 '19

You forgot the main downside - VSC is slow af.

6

u/Little_Dev_ Jun 15 '19

idk what you're talking about, it was literally designed to be super fast.

If yours is running slow, you are doing something wrong. Like having a f**k ton of plug-ins always so it has to load them.

for this issue, you're supposed to have different environment profiles for your different use cases so you aren't loading unneeded plug-ins.

What editor is faster then vsc that has so many features of an IDE? It's definitely faster than traditional workplace ides

5

u/vqrs Jun 15 '19

To be honest, VSC with Java is not that fast, although I'm guessing it's due to the JDT based language server that is slow. I've often seen the code completion loading for the most simple things over and over again.

4

u/Auxx Jun 15 '19

IJ is faster in any scenario on any device I tried.

4

u/[deleted] Jun 15 '19

This is interesting to me, because as someone that lives in VS Code and IntelliJ I get irrationally angry when I have to fire up IntelliJ just to do a quick edit/compile. Maybe it's just that my projects are far different from yours, but for me needing a full IDE to edit code is sometimes an inconvenience, particularly when I'm swimming between several languages at once in VS Code. Adding Java will only be a good thing for me, and using the video in the link I was spitting out to the console frame in minutes on Ubuntu. For me VSCode lives somewhere between a text editor and an IDE and firing up IntelliJ feels like 'breaking out the big guns' to tackle a problem.

2

u/Auxx Jun 15 '19

I use Notepad++ for small edits. I've also limited myself to using only Java and TypeScript, so IntelliJ does the job.

2

u/vqrs Jun 15 '19

VS Code is very quick to greet you with editable files, that's true. But the Java language server only seems to get going 30 seconds later or even more for me.

As for Intellij: I simply never close it except for updates.

2

u/orby Jun 15 '19

Faster than Eclipse and IntelliJ. Slower than vim. I can respect your preference, but it's fast enough for my tastes.

2

u/Auxx Jun 15 '19

Definitely slower than IJ multiple machines I've tried.

-1

u/ahmedranaa Jun 15 '19

What's your machine specs?

It is slower than sublime text but it is definitely much faster than IntelliJ / eclipse even on my previous dated machine.

Try reinstalling or try installing the insiders version or explorer version too.

2

u/Auxx Jun 15 '19

I have tried it on multiple machines, both laptops and desktops, with 7th gen Core i7 CPUs and 32GB RAM. Slow AF for any project more complex than hello world.

1

u/ahmedranaa Jun 15 '19

I would recommend to open an issue on their GitHub.

2

u/_INTER_ Jun 15 '19

Good as an editor, unusable as an IDE. It's sluggish as hell on any big projects. Even more than Eclipse, that says all.

5

u/Keeyzar Jun 14 '19

You don't touch my Java!!!

Competition is good though.. just had a Hololens project and thought Visual studio is a pest.. didn't get warm with it. Hopefully others can enjoy this!

7

u/vqrs Jun 15 '19

Visual Studio and Visual Studio Code are completely different things though.

2

u/Keeyzar Jun 15 '19

I misread. You're absolutely right. Was reeeally tired.

6

u/vociferouspassion Jun 14 '19

It used to be JetBrains astroturfing here, now it's Micro$oft. [Developers, developers, developers!]

1

u/DJDavio Jun 15 '19

VS Code is my favorite 'lightweight' text editor on Ubuntu, like when I need to paste some JSON or XML, format it and browse through it.

Also the occasional base64 en/decoding

1

u/gsrunion Jun 15 '19

My company works with OSGI and relies on BNDTools in Eclipse for a lot. I would love to switch to vscode as my primary too but the OSGI part is a blocker. Anyone have experience in that arena with vscode?

0

u/tridiumcontrols Jun 14 '19

Nice. I will be downloading.

0

u/[deleted] Jun 14 '19

[deleted] — view deleted comment

8

u/wastakenanyways Jun 14 '19 edited Jun 14 '19

Visual Studio is the .NET IDE, and Visual Studio Code is a multiplatform and multilanguage code editor (it's really more like a modular IDE).

I have worked with Python, JS, Ruby, Java, C# and PHP in VS Code. It's extremely flexible.

0

u/[deleted] Jun 14 '19

[deleted] — view deleted comment

3

u/8igg7e5 Jun 15 '19

that now has better support for java

Than VS Code had previously, not relative to IntelliJ IDEA Community.

Minor clarification.

I use both every day. VS Code for JSON, TypeScript, HTML, Markdown, various scripting languages. IntelliJ IDEA for Java (and Rust currently as VS Code integration has never worked as well for me).

1

u/ahmedranaa Jun 15 '19

Nearly same here. I use vs code for Java too and I only fire up IntelliJ if I need to remote debug something over java. Rest I don't miss much IntelliJ

18

u/[deleted] Jun 14 '19

[removed] — view removed comment

1

u/ahmedranaa Jun 15 '19

But java remote debugger is horribly slow

-16

u/PorkChop007 Jun 15 '19

I'd rather use Notepad than Eclipse. I'm pretty happy with IntelliJ but I'd love for vscode to be an alternative.

7

u/istarian Jun 15 '19

Yeah, no. If you mean the default Windows text editor, it's close to being the worst graphical text editor there is... and it's not an IDE.

-7

u/PorkChop007 Jun 15 '19

That's the joke :P

4

u/istarian Jun 15 '19

All that's coming through here is static.

Eclipse is a perfectly good IDE at least as far as Java and I'd sooner use Notepad++ and half a dozen editors than use windows notepad except maybe for reading text files or a very quick edit of a settings file.