You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Whole project recompiles with each keystroke #1765
Sometime between version 0.64.1 and now, the build triggering behavior seems to have changed. Whereas changes within a file still produced a reasonably fast auto-complete, it seems like each keystroke now triggers a rebuild of the entire project including the edited file, other files in the project and all declared Java dependencies. This seems to generally make auto-complete unusable since one is likely typing around the time auto-complete is needed and if each keystroke triggers a 1 minute build, auto-complete is generally always loading.
Perhaps it's possible to restrict the rebuilding to the edited file, or cache all the symbols from the previous build until the next build is ready?
Environment
Operating System: macOS 10.15
JDK version: 11.0.4
Visual Studio Code version: 1.52.1
Java extension version: 0.64.1
Additional Informations
When I start typing, it triggers the below in the Java Build Status pane. Each build takes a few minutes.
8394ded0 Building [Done]
ba7e2d19 Validate documents [Done]
00cd587d Publish Diagnostics [Done]
c9fb754c Building [Done]
467b8d20 Building [Done]
a25e99a1 Validate documents [Done]
411b4544 Publish Diagnostics [Done]
c1bd89da Building [Done]
240f6be2 Building [Done]
a3536bca Building [Done]
6cea6ad2 Building [Done]
Reacted by Rasmus, ahizap, srillia, Simon Campano and Rishi Tank
Your Java extension version is a little old, could you update all Java extensions to the latest version and try again?
AFAIK, the side Java extensions such as Java test runner pushed a bunch of performance improvement against the auto completion performance in the past few months.
BTW, do you enable file auto save? the file save is probably triggering the auto build job.
File auto save is off. I'm trying now on 0.73.0 with Java 11. Same symptom. I think the "building" messages are actually doing something, since each of them breaks down (while running) into a building 123/1000 files message.
I can confirm this issue for me. Each keystroke causes the circular arrow to rotate and I get similar messages like shared above. I had disabled java autobuild and auto save was disabled by default for me
The "Publish Diagnostics" takes the longest for me. I frequently see java processes (2 of them because of the hybrid mode) in the background hugging the CPU (200-300% spikes), notably after the change to a Java file is made. It slows down the intellisence, and one has to wait for good 10-30 seconds for the auto-completion hints to appear. I attempted the following:
setting user-level "telemetry.telemetryLevel": "crash" - didn't have any effect (would be nice if Java respected that, actually).
setting workspace-level "redhat.telemetry.enabled": null or false - seems like does not have any effect and only applies to the Kubernetes plugin.
reloading the vscode, clearing the Java workspace cache, etc - nothing worked.
If I can make a suggestion:
it would be nice if background compilation could be debounced somehow (i.e. start background build after a few seconds of accumulating changes and after there has been no changes for couple more seconds). This way we would not have "wasted" compilation cycles as user types.
do not block intellisense and auto-completion on background tasks. I'd rather have it slightly out of date but immediately available rather than waiting half of minute for it to come back with a better result. For things like refactoring I don't mind waiting though.
Reacted by Brion Swanson, steffenboe, Kenan Kilictepe, François, Rasmus and Wechar Yu
@snjeza I cant share as I am working on a commercial project.Anything else (logs etc?) that I can provide but the project codes itself?
My project is huge, with a lot of internal dependencies.
I actually found out what could be the issue.
I started with the same problem as described by @xster with a cyclic Building,Validate,Publish routine at each keystroke.
After I've searched for build in the full settings page, I found that the extension "Language Support for Java(TM) by Red Hat" (ID: redhat.java) has a setting named "Java > Autobuild: Enabled" ("java.autobuild.enabled") set at True by default.
It triggers (as the name says) an automatic build after some event (code/text changes). After I disabled it the automatic fire of the build has stopped. It only keeps doing the "Validating" step at each keystroke and sometimes the "Publish" one.
Probably the Validating step is controlled by the intellisense to validate the code at each change. It could be made after a delay, but for me it's not impacting the performance a lot as the Build step.
Intellisense speeded up even in complex legacy projects and it seems the entire usability has improved.
Actually I'm still trying to find out what are the downsides of haing disabled that autobuild.
Let me know if you know something about that feature.
I can confirm this is happening to me on a large enterprise Java Project with hundreds of classes (sometimes large ones too, 6000+ lines of code).
It's a Spring Boot Gradle Project, and I got the message that the language server got out of memory.
When I do get an Intellisense suggestion it comes with a 20 seconds delay (when lucky), often it shows no popup at all, making it hardly usable.
The curious thing here is how fast is Language Server for Java by Netbeans instead, while it doesn't have the features I need the code suggestion are almost instantly provided.
I did my tests on a brand new vscode installation with vscode-java only enabled as extension.
As @nickzhums mentioned, please try and switch to the pre-release of the Spring Boot Tools extension, which fixes an important issue that we had that broke java auto-completion. The regular release of the extension - including the fix - will also ship probably sometime this week. But please give the pre-release a try to see if this helps.
@nickzhums@martinlippert I've installed the pre-release version of Spring Boot Tools. I can confirm that I had no issues with autocompletion at the time of the usage. However, the test span was rather short, ~10 minutes. But normally it was enough to just change a symbol once to encounter the bug. So, a green light from me.
However, after installing the said extension I also did launch the test suite run with the other extension that is called Test Runner for Java (vscjava.vscode-java-test). And the difference was, that the test suite that used to be green before Spring Boot Tools installation now became partially red. "SpringBootTest"-based tests went red, with the following error: javax.management.InstanceAlreadyExistsException
I've removed the extension, and the suite went green again. I guess, this issue is well described here: microsoft/vscode-java-test#1420
@renanfranca I had this issue when you ctrl + . once and then it stops working until you restart the whole VSCode. This was solved by removing "Spring Boot Tools" (vmware.vscode-spring-boot) and "Spring Boot Dashboard" (vscjava.vscode-spring-boot-dashboard). However, "Spring Boot Tests Runner" is installed and even though it provides some integration with Spring, it does not harm the performance. So please stop using those two extensions and things might start being fine then.
Thank you @nikitades for our feedback! In my case I solved the problem by doing this:
I create a new vscode profile and configure everything again, step by step, and testing after each step without bringing all my configurations from the old settings.xml
I am not sure what you have done to the latest version 1.16. The problem is, intellisense get even wrose than 1.15. I have to wait for ages to get the intellisense popup come out. The perf is good only for the first 10min, and slow down and down
It's come a long way since taking a few minutes to just a few seconds for each keystroke triggered build, but it's still annoying and causes noticable lag.
Version: 1.78.2
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T14:47:05.613Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 5.15.0-84-generic
Sandboxed: No
It is now 2025. The issue still persists with the latest version at the time of this comment (1.43.1). I have tried everything suggested in this discussion but I am unable to resolve the issue. Why is it painfully slow for every character you type in a Java file to take so long? 💀 From what I can tell, every keystroke triggers a Validate documents and Publish Diagnostics task.
@rishitank , every keystroke should trigger validation/publishing. The original issue was for rebuild being triggered, which is no longer happening here. Was setting XmX to 4G enough to fix the issue ? About how many lines of code is the file you had opened ?
@rishitank , every keystroke should trigger validation/publishing. The original issue was for rebuild being triggered, which is no longer happening here. Was setting XmX to 4G enough to fix the issue ? About how many lines of code is the file you had opened ?
The file I had open was only 60 lines. Yes I believe setting XmX to 4G solved the issue.
Activity
testforstephen commentedon Jan 14, 2021
Duplicated with #996
The "Building" message you saw in the status panel is just a fake message, not representing a compilation operation.
testforstephen commentedon Jan 14, 2021
Your Java extension version is a little old, could you update all Java extensions to the latest version and try again?
AFAIK, the side Java extensions such as Java test runner pushed a bunch of performance improvement against the auto completion performance in the past few months.
BTW, do you enable file auto save? the file save is probably triggering the auto build job.
xster commentedon Jan 15, 2021
Thanks.
File auto save is off. I'm trying now on 0.73.0 with Java 11. Same symptom. I think the "building" messages are actually doing something, since each of them breaks down (while running) into a building 123/1000 files message.
deekshithanand commentedon Jan 18, 2021
I can confirm this issue for me. Each keystroke causes the circular arrow to rotate and I get similar messages like shared above. I had disabled java autobuild and auto save was disabled by default for me
dbarvitsky commentedon Aug 11, 2022
The "Publish Diagnostics" takes the longest for me. I frequently see
javaprocesses (2 of them because of the hybrid mode) in the background hugging the CPU (200-300% spikes), notably after the change to a Java file is made. It slows down the intellisence, and one has to wait for good 10-30 seconds for the auto-completion hints to appear. I attempted the following:"telemetry.telemetryLevel": "crash"- didn't have any effect (would be nice if Java respected that, actually)."redhat.telemetry.enabled": nullorfalse- seems like does not have any effect and only applies to the Kubernetes plugin.If I can make a suggestion:
kkilictepe commentedon Sep 3, 2022
Same here. Intellisense performance is terrible. Any update?
DrewCCannedy commentedon Oct 24, 2022
Same issue, would love an update.
snjeza commentedon Oct 24, 2022
@DrewCCannedy @kkilictepe @dbarvitsky @deekshithanand @xster Could you provide a project example reproducing the issue?
kkilictepe commentedon Oct 25, 2022
@snjeza I cant share as I am working on a commercial project.Anything else (logs etc?) that I can provide but the project codes itself?
My project is huge, with a lot of internal dependencies.
d3milord commentedon Oct 27, 2022
I actually found out what could be the issue.
I started with the same problem as described by @xster with a cyclic Building,Validate,Publish routine at each keystroke.
After I've searched for build in the full settings page, I found that the extension "Language Support for Java(TM) by Red Hat" (ID: redhat.java) has a setting named "Java > Autobuild: Enabled" ("java.autobuild.enabled") set at True by default.
It triggers (as the name says) an automatic build after some event (code/text changes). After I disabled it the automatic fire of the build has stopped. It only keeps doing the "Validating" step at each keystroke and sometimes the "Publish" one.
Probably the Validating step is controlled by the intellisense to validate the code at each change. It could be made after a delay, but for me it's not impacting the performance a lot as the Build step.
Intellisense speeded up even in complex legacy projects and it seems the entire usability has improved.
Actually I'm still trying to find out what are the downsides of haing disabled that autobuild.
Let me know if you know something about that feature.
snjeza commentedon Oct 27, 2022
@d3milord
If you set
java.autobuild.enabled=true, Java LS will build your workspace only when you save a file.Could you show your settings.json?
d3milord commentedon Oct 28, 2022
snjeza commentedon Oct 28, 2022
@d3milord could you remove the gabrielbb.vscode-lombok extension and update
java.jdt.ls.vmargstoSee Lombok Support
francescodedomenico commentedon Jan 27, 2023
I can confirm this is happening to me on a large enterprise Java Project with hundreds of classes (sometimes large ones too, 6000+ lines of code).
It's a Spring Boot Gradle Project, and I got the message that the language server got out of memory.
When I do get an Intellisense suggestion it comes with a 20 seconds delay (when lucky), often it shows no popup at all, making it hardly usable.
The curious thing here is how fast is Language Server for Java by Netbeans instead, while it doesn't have the features I need the code suggestion are almost instantly provided.
I did my tests on a brand new vscode installation with vscode-java only enabled as extension.
82 remaining items
nickzhums commentedon Mar 13, 2023
@nikitades it could be caused by this issue and the problem is fixed the latest pre-release of the Spring Boot extension: #2941 (comment)
martinlippert commentedon Mar 13, 2023
As @nickzhums mentioned, please try and switch to the pre-release of the
Spring Boot Toolsextension, which fixes an important issue that we had that broke java auto-completion. The regular release of the extension - including the fix - will also ship probably sometime this week. But please give the pre-release a try to see if this helps.nikitades commentedon Mar 13, 2023
@nickzhums @martinlippert I've installed the pre-release version of Spring Boot Tools. I can confirm that I had no issues with autocompletion at the time of the usage. However, the test span was rather short, ~10 minutes. But normally it was enough to just change a symbol once to encounter the bug. So, a green light from me.
However, after installing the said extension I also did launch the test suite run with the other extension that is called Test Runner for Java (vscjava.vscode-java-test). And the difference was, that the test suite that used to be green before Spring Boot Tools installation now became partially red. "SpringBootTest"-based tests went red, with the following error:
javax.management.InstanceAlreadyExistsExceptionI've removed the extension, and the suite went green again. I guess, this issue is well described here:
microsoft/vscode-java-test#1420
Thanks
nickzhums commentedon Mar 13, 2023
Glad the pre-release solved the previous issue. For Java Test Runner, @jdneo will have more knowledge
renanfranca commentedon Mar 13, 2023
Thank you @nikitades for our feedback! In my case I solved the problem by doing this:
jdneo commentedon Mar 14, 2023
@nikitades Let's discuss the problem in microsoft/vscode-java-test#1546
iamfreeman commentedon Mar 30, 2023
I am not sure what you have done to the latest version 1.16. The problem is, intellisense get even wrose than 1.15. I have to wait for ages to get the intellisense popup come out. The perf is good only for the first 10min, and slow down and down
snjeza commentedon Mar 30, 2023
@iamfreeman Could you check https://github.com/snjeza/vscode-test/raw/master/java-1.17.2.vsix ?
It includes eclipse-jdtls/eclipse.jdt.ls#2535
iamfreeman commentedon Apr 6, 2023
@snjeza , convincing performance
snjeza commentedon Apr 6, 2023
@iamfreeman Now, you can check VS Code
pre-release.It includes
bucketsize commentedon Sep 25, 2023
It's come a long way since taking a few minutes to just a few seconds for each keystroke triggered build, but it's still annoying and causes noticable lag.
Version: 1.78.2
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T14:47:05.613Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Linux x64 5.15.0-84-generic
Sandboxed: No
ahizap commentedon Jul 18, 2024
Any updates on this?
rishitank commentedon Jul 9, 2025
It is now 2025. The issue still persists with the latest version at the time of this comment (1.43.1). I have tried everything suggested in this discussion but I am unable to resolve the issue. Why is it painfully slow for every character you type in a Java file to take so long? 💀 From what I can tell, every keystroke triggers a Validate documents and Publish Diagnostics task.
When will Java be usable on VSCode? I tried the pre-release but the issue still persists.
EDIT: I believe I solved this by adding
To my workspace settings. This should probably be set as a default since it is not clear that this is required to make Java projects usable.
rgrunber commentedon Jul 9, 2025
@rishitank , every keystroke should trigger validation/publishing. The original issue was for rebuild being triggered, which is no longer happening here. Was setting
XmXto 4G enough to fix the issue ? About how many lines of code is the file you had opened ?rishitank commentedon Jul 9, 2025
The file I had open was only 60 lines. Yes I believe setting
XmXto 4G solved the issue.