I develop Java in vscode + some java extensions (one of them is Red Hat's Java support).
When I last checked in the code, I believe that Red Hat's ext attempted to format the code in some files, which made my boss furious.
If I set the java.format.enabled to off, it should not happen again, should it? I want to be able to preserve the code in whichever shape and style it was there prior to my changes.
I otherwise love working with vscode, but don't want to get into trouble.
yea, it can be.
"java.format.enabled": false,
can do it.
Related
I have recently set up my VS code to be able to run Java. I downloaded the extension pack for java and then downloaded Azul Zulu jdk to run java programs. So far it runs fine, but for certain snippets of code orange blocks of text will appear. They cannot be deleted or modified in any way, and I haven't changed any settings besides changing VS code to use the Zulu jdk as my default jdk.
Example of the orange blocks I'm getting
I have tried going through my setting related to Java in my VS code, but I can't find anything that would cause this. I haven't done anything besides set up my default jdk and installing the extension for java.
Any help with getting rid of these orange blocks would be appreciated.
Edit:
Java> Inlay Hints > parameter names: Enabled, was the setting that was causing it. Setting this to none fixed the issue. I was confused as the guide I was following did not mention this, nor did it show up on their visual examples when writing code, even though our methods from installing to writing java would have been the same.
I had a correctly working/displaying Java Swing app that manipulated text IO in Arabic. Suddenly today, I find every Arabic text word displayed in reverse direction on my MacBook Pro with a Java8u171. To verify it's not something wrong with my programs, I recreated the app on the Oracle Tutorial page and ran it on my laptop. To my surprise, I am getting the same reversed display! Namely, instead of getting this correct image shown below (extracted from the referenced tutorial page):
I am getting this one instead when I build the app as is and run on my laptop:
Could anybody shed light on what happened here please? Thank you.
If you're using a Windows based computer, you're probably fine according to the comments in the original post. For your Mac OS'ers, you need to step away from Java 8 entirely and into Java 11 (or newer going forward). Testing with that gives the desired look shown below. I tested this with my own apps on JTextPane and all those input text components, we're back in business :-)
I've encountered a weird glitch in Android Studio:
As you can see it thinks that it is an error:
'class' or 'interface' expected
But it runs and build just fine, so is this just a visual glitch or can it have any effect during compiling?
I'm running Android Studio 0.5.8 for Mac
Things I've tried so far:
Restart Android Studio
Restart MacBook
Invalidate caches and restart
tried other strings (like "en-US" this result in the same effect)
If I use a string through the resources the glitch isn't visible (which it will be eventually, I'm just curious why this is happening)
IntelliJ and Android Studio have the ability to take string parameters and treat the strings as being in another language. For example, if you have a method that takes a string that's HTML, if you tell the IDE about it, it can give you syntax highlighting and content assist with the HTML in that string.
I think you've inadvertently set this string as being treated as Java, and it's giving you the Java syntax errors on it. You need to un-set that setting. Select the text, bring up the Search Action feature (on Mac it's ⌘ shift a). In the search box that comes up, search for Un-inject Language/Reference, as shown in the screenshot below:
try this
httpReqquest.addHeader("Accept-Language","en-US");
Since Android Studio is a bit raw, you can face the "glitches" in many different ways. They're annoying but don't affect the result, as you said. However, I personally don't think that we should endure the inconveniences (even if the Studio costs nothing).
I see a couple of solutions:
Continue with AS and ignore these weird things, hoping they will release a robust software once
Or, to migrate to IntelliJ IDEA as I did. The procedure is pricey but it's worth it.
I have recently switched from IntelliJ IDEA Community Edition version 12, to version 13 (updated to 13.0.1) and apparently the real-time ("on-the-fly") compilation of code does not work, at least not as found in other major IDEs (e.g., Eclipse).
A similar issue has been brought up in an earlier StackOverflow question and the answer was to check the corresponding option in File -> Settings -> Compiler, which I have of course done, but nothing changed.
The way it currently is, I can type whatever text in the Java code and there is no error highlighting, not even when the file is saved, let alone in real time.
Is there another setting or configuration that needs to be applied?
IntelliJ does something a lot better than compiling your files on the fly. It dynamically parses what you're typing, offering many more warnings than the java compiler produces. In comparison, compiling on the fly is a bad idea. Having said that, it sounds like you're having other problems, because you should have errors and other problems highlighted. At the top right of each editor window is a small coloured square. On good code it's green. It's yellow when there are warnings, and red when there are errors. If it's grey then Idea is analyzing your files. If you hover your mouse over the square it'll give you an idea about what Idea is doing, and how it's progressing. Try that before you try anything else. Idea never gets stuck, but it can run out of memory, if the analysis isn't progressing, then perhaps you've run out of memory, or have other issues, check this in the event log, which is at the bottom right of the window.
I've just been pulling my hair out over this working on my Mac in a coffeeshop running on battery power. Try File | Power Save Mode and make sure it's un-checked.
I have an online sheet music generator that for draws sheet music graphics to an area about 600pixels square. This looks OK on the screen but if printed each note would look blocky.
I always used to be able to print this applet in Internet explorer and get a full vector output of the sheet music so the notes were perfectly rounded, even though they are only a dozen pixels in radius.
Sometime over the summer there must have been an update to java, or (internet explorer?) so my printouts now look horribly blocky. Can anyone think of a reason for this?
I have two versions of my applet, one is double buffered for animation purposes,(which would obviously produce a rasterised image unsuitable for printing) the other draws straight to the screen which is the one which I have been using for printing and has worked fine up until now!
Any help would be much appreciated as I use this program professionally and I have to print several thousand pages from it next week!
Can anyone think of a reason for this?
The obvious answer to that might be 'a change to Java', which can be tested by disabling the later Java version in the Java Control Panel (1), and using the earlier version only.
(1) Java Control Panel
(Close the Java Cache Viewer.)
Navigate to the Java tab of the JCP.
Select the View button
In the Java Runtime Environment Settings dialog, check the earlier versions, uncheck the later ones.
Java Runtime Environment Settings dialog
If that works
Use the earlier version for the 'several thousand pages'.