redhat-developer / vscode-java

Java Language Support for Visual Studio Code
Eclipse Public License 2.0
2.08k stars 440 forks source link

Whole project recompiles with each keystroke #1765

Open xster opened 3 years ago

xster commented 3 years ago

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
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]
snjeza commented 1 year ago

@FabianLinn @francescodedomenico I can't reproduce the issue. Could you provide a project example reproducing the error?

snjeza commented 1 year ago

@FabianLinn @francescodedomenico You can also try the Pre-Release version. It includes both PRs.

iamfreeman commented 1 year ago

@iamfreeman Could you try https://github.com/snjeza/vscode-test/raw/master/java-1.15.3.vsix It includes

I tried to install the test version, same as @FabianLinn, lombok totally disappeared. Even I installed another extension "Lombok Annotations Support for VS Code", the lombok did not work.

My java project failed to validate and build

snjeza commented 1 year ago

@iamfreeman Could you try VS Code Pre Release?

snjeza commented 1 year ago

@FabianLinn @francescodedomenico @iamfreeman https://github.com/snjeza/vscode-test/raw/master/java-1.15.3.vsix doesn't include JDK. You can try set the following:

 "java.jdt.ls.vmargs": "-javaagent:<path_to your lombok-1.18.24.jar>  -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms512m",
"java.jdt.ls.lombokSupport.enabled": false,

or use VS Code Pre Release and set

"java.jdt.ls.lombokSupport.enabled": true,
iamfreeman commented 1 year ago

@snjeza @jdneo , I have tried the prerlease version of Redhat. It looks very good to me. Same spot in my code, same command typing in.

https://user-images.githubusercontent.com/4750762/218227288-d8a14729-54cc-4140-818b-737ada2eeb59.mp4

FabianLinn commented 1 year ago

I used the mentionned commands (jvmargs, lomboksupport), in my first look it works also.

Maybe another hint: I changed it in my project settings.json and found that my global settings.json contained already a path to a lombok jar (...gabrielbb-lombok-...) which was not available...

francescodedomenico commented 1 year ago

@snjeza situation is a bit worse for me I am afraid. I did restore lombok as vmargument javaagent, cleaned lsp cache from workspace and then I got a warning that Language server needed more memory.

After accepting the memory increase for Java Language Server the project did compile, but I did get Intellicode recommendation after still a considerable delay (20 seconds) and after the first recommendation I haven't been able to trigger it again, I did get instead build errors because of missed semicolons and unfinished statements (obviously I was trying to trigger intellicode by deleting and writing dot "." next to a symbol.

After a vscode restart I am now stuck with vscode java "Building in lightweight mode"

snjeza commented 1 year ago

@francescodedomenico Could you try the following:

francescodedomenico commented 1 year ago

@snjeza I did try with the mentioned setting and vscode insiders + vscode-java pre-release

situation is vastly improved and I can now generate the intellisense code, performance wise I'd still say we are far from ideal since it comes after a 15 seconds delay while Eclipse manages with a fraction of that time.

jdneo commented 1 year ago

@francescodedomenico

the profiling stopped curiously when the process ended (and of course I wasn't expecting it to end since vscode and the java project was still opened)

That automatically ended server must be the syntax server (or lightweight server), which is used to provide some basic syntax level support before the standard server imported all the projects. The syntax server will exist automatically once the standard server is ready. I guess the profiling snapshots are collected from the syntax server.

You can configure java.server.launchMode to Standard, which makes only the standard server be launched.

How does your project look like? (The scale of your project and the file where you triggered the completion)

francescodedomenico commented 1 year ago

@jdneo It's a Gradle Java 8 project made of 3 subprojects, one of this is indeed the main Spring Boot Application made of 438 Java classes.

The Spring boot application floats around a DB Stored Java Entity that has approx 2k lines of code and several @OneToMany, ManyToMany ManyToOne relationships, Getter, Setters and Constructors generated through lombok. This is the Java Entity I'm struggling to get suggestions on vscode.

Furthermore, this object is handled in a Service class that is meant to implement the business logic and the state transitions of the above mentioned entity which consists in approximately 6500 lines of code.

I did try making it work in smaller classes through smaller entities and it's much faster, but on these particular one vscode is severely underperforming in comparison with other tools.

iamfreeman commented 1 year ago

Hi @jdneo , I noticed that after performing implementation for a while, the intellisense got worse and worse. I have to clean up the workspace cache and reopen the project. After that, the performance back. is this something related to garbage collection?

jdneo commented 1 year ago

@francescodedomenico

Thank you for the information. My guess is that a lot of time is spent to parse the ASTs for those large files, especially when lombok will take part into the parse phase during compilation. - This is what I observed when I editing a complex lombok class on my local machine. But 15 seconds lag for completion surprised me a little bit. You are using the latest pre-release version of redhat-java right?

jdneo commented 1 year ago

@iamfreeman It could be caused by GC.

Maybe you can turn on GC log in the setting java.jdt.ls.vmargs. When the performance starts getting worse, check if GCs are executed frequently.

francescodedomenico commented 1 year ago

@jdneo So since the pre-release switch I have been working again on my project using vscode-insiders + vscode-java pre-release. it's definitely "more usable" than before. I did perform another test and I discovered the performance is not related to the java entity itself but it's bound to the class you are actually typing in.

If I try to gather intellisense completion on the big java entity (the one mentioned before) inside the 6500+ lines of code Service class happens this:

  1. the very first time I gather no intellisense, the build fails because the file gets compiled with the "dot" "." and the line for which I am waiting intellisense is detected as an unterminated java statement.
  2. if I delete then rewrite the dot "." I still won't get any intellisense
  3. if I delete and rewrite the whole variable followed by "." i get the intellisense withing a time range that could go from 10 to 15 seconds

If I try to get the same intellisense by trying to access methods inside a different, much smaller, service class I get the intellisense in 1-2 seconds.

That's why I believe that the performance problem is bound to the size of the hosting class rather then the target class.

renanfranca commented 1 year ago

Thank you @jdneo and the community for everything.

  1. I installed the pre-release
  2. set "java.jdt.ls.lombokSupport.enabled": true, at settings.json

It works great at the start, but after some time it got slow again.

So, I will share what I did that works for me (I don't know why):

The auto-complete is instant know.

PS: I am using Ubuntu with wsl2 at Windows because vscode and java have better performance (imho).

jdneo commented 1 year ago

but after some time it got slow again.

Do you mean the completion become slow? Or the diagnostic publishing becomes slow?

@iamfreeman Same question, is the completion becomes slow, or the diagnostic publishing?

renanfranca commented 1 year ago

Do you mean the completion become slow? Or the diagnostic publishing becomes slow?

The completion become slow and at some point stuck and only show loading at the completion drop down after hit ctrl+space to force completion.

jdneo commented 1 year ago

@renanfranca Ah, it sounds like this issue: https://github.com/eclipse/eclipse.jdt.ls/pull/2453.

We just merged the fix yesterday. Have you tried the latest pre-release?

jdneo commented 1 year ago

@francescodedomenico

have you tried only enable vscode-java and disable all other extensions? Because I noticed that from this reply: https://github.com/redhat-developer/vscode-java/issues/1765#issuecomment-1412062153, you mentioned that the setting boot-java.rewrite.reconcile is turned on.

Meanwhile, turn off java.trace.server might help with the perf a little bit.

francescodedomenico commented 1 year ago

@jdneo thank you, I did try disabling everything besides vscode-java release. I have only been able to generate intellisense suggestion once in the big service class, after that any other attempt loops over the Validate documents/Publish diagnostics.

Whenever I do get it to work it doesn't feel like disabling anything else besides vscode-java did anything performance wise. Note: I have no java.trace.server property anymore and boot-java.rewrite.reconcile is set to false

Edit: this is a curious one, about after 30 minutes of having the project opened, I managed to have a complete and performing intellisense suggestion on the big service class. I did try to have a second intellisense suggestion and... got back at the previous situation.

I'll try to produce a video feed to show you the java build events and how can be inconsistent the timing for intellisense suggestion

renanfranca commented 1 year ago

@renanfranca Ah, it sounds like this issue: eclipse/eclipse.jdt.ls#2453.

We just merged the fix yesterday. Have you tried the latest pre-release?

Thank you @jdneo , I just tried it! I'm facing a problem when I asked for suggestion using ctrl + . and if I press esc to cancel or it keep looking endless, then no longer the auto-complete or ctrl + . works until I restart the vscode.

The publishing diagnostic ran fast but nothing happens. I recorded a video: https://www.loom.com/share/560b7d7238694a139a9a35bc9bb98462

jdneo commented 1 year ago

@renanfranca

Is this the project you are working on? https://github.com/jhipster/jhipster-lite

I tried to randomly type something but not able to reproduce the issue. Any steps to stable reproduce the issue?

renanfranca commented 1 year ago

I tried to randomly type something but not able to reproduce the issue. Any steps to stable reproduce the issue?

Thank you for your attention @jdneo! I recorded a new video, here are the steps:

  1. clone jhipster-lite project at main branch
  2. go to class JHipsterModulesResources
  3. create a new method with three parameters
  4. inside the recently created method, try to create a new method which uses the same parameters
  5. when I tried to trigger the created method assistant by pressing ctrl+. it goes endless
  6. no more auto-complete or assistance, unless I restart the vscode

https://user-images.githubusercontent.com/6011616/219681518-91f06e02-5277-4320-8215-532250c3965f.mp4

snjeza commented 1 year ago

@renanfranca I can't reproduce the issue. Could you show your installed VS Code extensions, global and user snippets and settings.json?

Keetz commented 1 year ago

Working on a rather large maven project I experience the same delay as others have reported in this thread. Even on small files it takes 2-3 seconds for the suggestion dialog to appear, which is enough to often make it useless.

One thing that helped reducing it for me was setting -Xlog:jni+resolve=off in java.jdt,ls.vmargs but it is still too slow.

Full vmargs: "java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx4G -Xms100m -Xlog:jni+resolve=off",

fbricon commented 1 year ago

@Keetz did you upgrade to the newer vscode-java 1.15?

Keetz commented 1 year ago

@fbricon I did, I actually came here because it stopped working completely after the update, so currently I downgraded to 1.14.0

I just tried updating to 1.15.0 again and I get no suggestions. Can't even get the autocomplete suggestions when for example writing for on an empty line and expecting the for or foreach loop completion.

snjeza commented 1 year ago

I did, I actually came here because it stopped working completely after the update, so currently I downgraded to 1.14.0

@Keetz Could you try to clean the workspace after the update? - Clean the workspace directory

Keetz commented 1 year ago

@snjeza I tried running Java: Clean the Java Language Server Workspace and restart and delete afterwards.

When VSCode started, I could immediately make it show suggestions for auto-complete like for and foreach loops and it worked really fast (no suggestions for classes, variables and so on as the project hasn't build yet), but unfortunately as soon as it finished building my whole project it stopped working completely again.

Like something in the build process crashes the language server, but I don't know. What are the correct logs to looks at/share here?

snjeza commented 1 year ago

What are the correct logs to looks at/share here?

@Keetz You may want to take a look at Enable logging

Keetz commented 1 year ago

@snjeza I tried setting logging to verbose, I get some errors which are expected about some maven resources missing, like not having a test folder, and some external resources it can't import, but I don't see anything unexpected at all.

I tried cleaning the log just to be sure and clean the Java language server workspace just to be sure I didn't miss anything.

I checked both the developer tools and the Java language server log file.

snjeza commented 1 year ago

@Keetz Could you attach your log files?

Keetz commented 1 year ago

@snjeza I got some errors to appear when trying to trigger the suggestions/autocomplete list. I cut out some of the .log file just to remove all the build messages.

ClientLog.txt Log.txt

snjeza commented 1 year ago

@Keetz Could you try to exclude or disable the Checkstyle for VS Code extension?

Keetz commented 1 year ago

@snjeza same issues, no suggestions but empty logs now (except for build info).

Could the problem be that I have a resource that doesn't build because it can't resolve an external class path? Will it basically fail the building of the whole workspace because of one resource failing?

It isn't a problem in version 1.14.0 though, i would just have errors and so on in that specific resource.

  message: '[Error - 4:31:11 PM] Feb 23, 2023, 4:31:11 PM Error occured while building workspace. Details: \n' +

  *Handful of lines of code failing because it can't resolve class path*

  level: 'info',
  timestamp: '2023-02-23 16:31:11.619'
snjeza commented 1 year ago

@Keetz Could you try to Clean the workspace directory ?

Keetz commented 1 year ago

@snjeza I tried completely deleting the workspace storage folder, no luck. I did however try another Java project, and everything seems to work flawlessly, so I suspect that the problem is indeed that it fails to resolve a external classpath. I guess I will need to figure out how to make that work in VSCode :thinking:

But there is a difference between 1.14.0 and 1.15.0 because I can work in all other resources without problems in 1.14.0 but not in 1.15.0 where nothing works.

1.15.0 worked really smooth and fast in the smaller java project I tried to import, so that is really nice and promising.

EDIT: Not really an external classpath, but it is some swagger generated classes, I will try to figure out how to let it resolve it. It seems like my issue is not related to this issue at all, so sorry for wasting time on this.

EDIT 2: This seems to be it: https://github.com/redhat-developer/vscode-java/issues/935

EDIT 3: I tried adding the generated source path to the pom file, now everything builds but I still can't get any suggestions in 1.15.0.

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>target/generated-sources/src/main/java/</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
Keetz commented 1 year ago

EDIT: I got it mostly working, I just have a single file that seems to be a bit of a fluke, I cant get suggestions to work in the main class in that file, but it has a small private inner class and if I'm inside that suggestions appear :sweat_smile: :shrug: @snjeza thank you for your time! I hope I didn't waste too much of your time but I will consider this fixed and I can use 1.15.0 now.

@snjeza saw a new error just now after I tried to import my project as a new folder instead of using my workspace, maybe it has some relevance.

{
  message: '  Message: Internal error.\n' +
    '  Code: -32603 \n' +
    'java.util.concurrent.CompletionException: java.lang.IllegalArgumentException: Document does not match the AST\n' +
    '\tat java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)\n' +
    '\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)\n' +
    'Caused by: java.lang.IllegalArgumentException: Document does not match the AST\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.handleException(ASTRewriteAnalyzer.java:4668)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:2345)\n' +
    '\tat org.eclipse.jdt.core.dom.ReturnStatement.accept0(ReturnStatement.java:126)\n' +
    '\tat org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3214)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisit(ASTRewriteAnalyzer.java:429)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisitList(ASTRewriteAnalyzer.java:467)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:461)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisitUnchangedChildren(ASTRewriteAnalyzer.java:474)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:2253)\n' +
    '\tat org.eclipse.jdt.core.dom.Block.accept0(Block.java:126)\n' +
    '\tat org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3214)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:453)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:459)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisitUnchangedChildren(ASTRewriteAnalyzer.java:474)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:2159)\n' +
    '\tat org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:653)\n' +
    '\tat org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3214)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisit(ASTRewriteAnalyzer.java:429)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisitList(ASTRewriteAnalyzer.java:467)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:461)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doVisitUnchangedChildren(ASTRewriteAnalyzer.java:474)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:1838)\n' +
    '\tat org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:482)\n' +
    '\tat org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3214)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.voidVisit(ASTRewriteAnalyzer.java:453)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doTextRemoveAndVisit(ASTRewriteAnalyzer.java:421)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ListRewriter.rewriteList(ASTRewriteAnalyzer.java:791)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer$ListRewriter.rewriteList(ASTRewriteAnalyzer.java:823)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.rewriteParagraphList(ASTRewriteAnalyzer.java:1253)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:1968)\n' +
    '\tat org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:482)\n' +
    '\tat org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3214)\n' +
    '\tat org.eclipse.jdt.core.dom.rewrite.ASTRewrite.internalRewriteAST(ASTRewrite.java:307)\n' +
    '\tat org.eclipse.jdt.core.dom.rewrite.ASTRewrite.rewriteAST(ASTRewrite.java:237)\n' +
    '\tat org.eclipse.jdt.internal.core.SortElementsOperation.calculateEdit(SortElementsOperation.java:146)\n' +
    '\tat org.eclipse.jdt.core.util.CompilationUnitSorter.sort(CompilationUnitSorter.java:451)\n' +
    '\tat org.eclipse.jdt.ls.core.internal.text.correction.SourceAssistProcessor.getSortMembersProposal(SourceAssistProcessor.java:644)\n' +
    '\tat org.eclipse.jdt.ls.core.internal.text.correction.SourceAssistProcessor.getSortMembersAction(SourceAssistProcessor.java:679)\n' +
    '\tat org.eclipse.jdt.ls.core.internal.text.correction.SourceAssistProcessor.getSourceActionCommands(SourceAssistProcessor.java:256)\n' +
    '\tat org.eclipse.jdt.ls.core.internal.handlers.CodeActionHandler.getCodeActionCommands(CodeActionHandler.java:213)\n' +
    '\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$15(JDTLanguageServer.java:700)\n' +
    '\tat org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)\n' +
    '\t... 7 more\n' +
    'Caused by: org.eclipse.core.runtime.CoreException: End Of File\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner.readNext(TokenScanner.java:95)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner.readToToken(TokenScanner.java:152)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner.readToToken(TokenScanner.java:165)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.TokenScanner.getTokenEndOffset(TokenScanner.java:190)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.getTokenEndOffsetFixed(ASTRewriteAnalyzer.java:715)\n' +
    '\tat org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:2335)\n' +
    '\t... 47 more\n',
  level: 'info',
  timestamp: '2023-02-24 13:59:14.592'
}
jihojoo commented 1 year ago

@jdneo

I have same problem. This problem is occurred when many files are opened. The step is below.

  1. run vsc and open java project with no opened file.
  2. open many files(at least over than 40)

after above step, autocomple and diagnostics become very slow.

nikitades commented 1 year ago

@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.

nickzhums commented 1 year ago

@nikitades it could be caused by this issue and the problem is fixed the latest pre-release of the Spring Boot extension: https://github.com/redhat-developer/vscode-java/issues/2941#issuecomment-1458356780

martinlippert commented 1 year ago

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.

nikitades commented 1 year ago

@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: https://github.com/microsoft/vscode-java-test/issues/1420

Thanks

nickzhums commented 1 year ago

Glad the pre-release solved the previous issue. For Java Test Runner, @jdneo will have more knowledge

renanfranca commented 1 year ago

@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:

1) 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 2) My configuration for java at the settings.json:

    // java
    "java.configuration.updateBuildConfiguration": "interactive",
    "java.saveActions.organizeImports": true,
    "java.compile.nullAnalysis.mode": "disabled",
    "java.autobuild.enabled": true, 
    "java.server.launchMode": "Standard",
    "java.trace.server": "off",
    "java.completion.favoriteStaticMembers": [
        "org.junit.Assume.*",
        "org.junit.jupiter.api.Assertions.*",
        "org.junit.jupiter.api.Assumptions.*",
        "org.junit.jupiter.api.DynamicContainer.*",
        "org.junit.jupiter.api.DynamicTest.*",
        "org.mockito.Mockito.*",
        "org.mockito.ArgumentMatchers.*",
        "org.mockito.Answers.*",
        "org.assertj.core.api.Assertions.*",
        "org.hamcrest.CoreMatchers.*",
        "org.apache.commons.collections.*",
        "org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*",
        "tech.jhipster.lite.module.domain.JHipsterModule.*",
        "tech.jhipster.lite.module.domain.JHipsterModulesFixture.*",
        "tech.jhipster.lite.module.domain.replacement.ReplacementCondition.*",
    ],
    "boot-java.rewrite.reconcile": false,
    "vscode-spring-boot.rewrite.reconcile-prompt": false,
    "spring-boot.ls.java.home": "/home/renanfranca/.sdkman/candidates/java/17.0.5-tem",
jdneo commented 1 year ago

@nikitades Let's discuss the problem in https://github.com/microsoft/vscode-java-test/issues/1546

iamfreeman commented 1 year ago

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 commented 1 year ago

@iamfreeman Could you check https://github.com/snjeza/vscode-test/raw/master/java-1.17.2.vsix ? It includes https://github.com/eclipse/eclipse.jdt.ls/pull/2535