Eclipse-like error correction in Visual Studio

In Eclipse, when something was wrong with your code, you would get the red squiggly line telling you there was something wrong (such as a variable not existing or not being public, syntax being wrong.) In Visual Studio Code, there isn’t anything like that that I can find, and I was wondering if there was an extension or something I could get to add it.

This is probably a stupid question that is easy to solve but I cant find anything for it.

It is called linting. It should come with the Java plugin for vscode. Here are the plugins I have:

Debugger for Java
Java Extension Pack
Language Support for Java by RedHat

How did you install? Did you use the wpilib installer? Or just manually install the extension. Also, are you getting any classpath or Java 11 not found errors in the bottom right when starting vscode?

How did you install? Did you use the wpilib installer?
Yes
Also, are you getting any classpath or Java 11 not found errors in the bottom right when starting vscode?
Yes, whenever I start VS Code it says something about not being able to find java_home variable, but I was able to manually set the path for jdk in settings config file for VS Code. After I set it it still had the message, but the robot code built just fine.

Those messages would be why intellisense is not showing up.

What version of the jdk did you set that java_home to? What directory?

1 Like

Java 8 jdk 191. I didn’t set the global path value, just visual studio’s

You need to point it to Java 11. If you ran the wpilib installer, you should have had an FRC vscode icon on the desktop, and should be using that. Are you? The installer installs it’s own jdk and vscode to avoid these issues.

Yeah I am using that shortcut, but no it never installed a JDK. Should I manually install Java 11 JDK?

The installer did install a jdk to c:/users/public/frc2019/jdk. Is that there?

You’re on windows, right?

Yes, I’m on windows and that folder is there, I wonder why it didn’t detect it when I first installed it. Should I edit it to point to that folder again?

Yes, that needs to be the folder it points to.

Nope, still says the java.home variable points to a missing folder. It was originally set to “null” when I installed the program which is why I changed it in the first place.

Oh, wait, I got it. There was another part of the file that said it again, I changed both now it works. Thanks a lot!

1 Like