sts4 icon indicating copy to clipboard operation
sts4 copied to clipboard

[vscode] Extension issue - code completion in application.properties not working

Open subho2810 opened this issue 2 years ago • 4 comments

  • Issue Type: Bug
  • Extension Name: vscode-spring-boot
  • Extension Version: 1.36.0
  • OS Version: Windows_NT x64 10.0.19044
  • VS Code version: 1.68.1

:warning: We have written the needed data into your clipboard. Please paste! :warning:

subho2810 avatar Jul 07 '22 17:07 subho2810

code completion for application.properties is not enabled

subho2810 avatar Jul 07 '22 17:07 subho2810

Can you provide a few more details on this? Do you have a sample project and a few steps to reproduce this?

martinlippert avatar Jul 08 '22 20:07 martinlippert

Actually this problem came to me suddenly so it can be a problem of vs code but yes code completion provided by spring boot tools extension of vs code is not working at all for application.properties

On Sat, 9 Jul, 2022, 1:33 AM Martin Lippert, @.***> wrote:

Can you provide a few more details on this? Do you have a sample project and a few steps to reproduce this?

— Reply to this email directly, view it on GitHub https://github.com/spring-projects/sts4/issues/796#issuecomment-1179321457, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARRUBS6ETVIPXVQQHH4FJJDVTCCQHANCNFSM526FAC3Q . You are receiving this because you authored the thread.Message ID: @.***>

subho2810 avatar Jul 08 '22 22:07 subho2810

Ok, let's try to see if we can identify the underlying issue somehow. A few more questions to help with diagnosing this:

  • does the Java language support work just fine in your VS Code installation for the same project (including code completion, problem markers, etc.)?
  • if you open the "Output" tab, is there an entry in the dropdown showing vscode-spring-boot-debug-log? And if so, can you share the output that shows up there?
  • if you open the application.properties file, does it show up as Spring Boot Properties file type in the status bar (on the right side)?

P.S.: And sorry for the late reply here (due to vacations)...

martinlippert avatar Jul 26 '22 10:07 martinlippert

code completion for application.properties ,application.yml is not enabled

zwssunny avatar Oct 15 '22 01:10 zwssunny

@zwssunny can you provide more details on this, we described in the above comment?

martinlippert avatar Nov 04 '22 08:11 martinlippert

@zwssunny can you provide more details on this, we described in the above comment?

I encountered the same problem. But mine doesn't work both in application.properties and application.yml. I will try to provide some details. I am not good at english, so some spelling and grammer mistakes may occurred.

Extension Name: Spring Boot Tools Extension Version: v1.41.0 OS Version: Windows_NT x64 10.0.19044 VS Code version: 1.73.1

Does the Java language support work just fine in your VS Code installation for the same project (including code completion, problem markers, etc.)? Yes. If you open the "Output" tab, is there an entry in the dropdown showing vscode-spring-boot-debug-log? And if so, can you share the output that shows up there? Yes. Here are the files. completion-doesnot-work.log completion-is-fine.log If you open the application.properties file, does it show up as Spring Boot Properties file type in the status bar (on the right side)? Yes.

In fact, I detected some interesting phenomenon. Code completion works well after I delete the content in ~/.m2/repository and open vscode again. The dependencies will be installed automatically, and the code completion will work. However, After I close it and open it again, the code completion does not work again.

ShuFengMuYu avatar Dec 07 '22 12:12 ShuFengMuYu

@ShuFengMuYu I was able to see the differences in the log. The working completion log has entries with project: new string. Those entries essentially mean that spring boot project with name new has been detected with its classpath. Therefore, everything seems to be in order. The log was not working completions has no such entries which means there are no spring boot projects detected at all it seems. The fact that Spring Boot LS is running and has log entries means at some point there were spring boot projects discovered but then notifications stopped going through for some reason. I'm seeing the same issue with one of my workspaces but all other workspaces seem fine... The workaround that I've tried was commenting out spring-boot dependency, save the file and then undo the edit (remove the comments). This triggers the restart of boot language server. After the restart it started picking up project classpath changes and everything started to work normally

BoykoAlex avatar Dec 07 '22 18:12 BoykoAlex

@ShuFengMuYu Another workaround that should probably help you is go in VSCode settings and find under Java settings: Java > Server : Launch Mode and switch it to Standard then reload the window

BoykoAlex avatar Dec 07 '22 22:12 BoykoAlex

@ShuFengMuYu I suspect that you've encountered this #919. If the workaround of switching Java LS launch mode to Standard works then it must be it.

BoykoAlex avatar Dec 07 '22 23:12 BoykoAlex

@BoykoAlex Thank you very much. The workaround of switching Java LS launch mode to Standard works. I can continue to learn springboot with vscode.

ShuFengMuYu avatar Dec 08 '22 07:12 ShuFengMuYu

Great to hear that @ShuFengMuYu. Therefore, closing this issue here as a duplicate of #919 .

martinlippert avatar Dec 08 '22 07:12 martinlippert

@ShuFengMuYu Another workaround that should probably help you is go in VSCode settings and find under Java settings: Java > Server : Launch Mode and switch it to Standard then reload the window

i am facing same issue and this workaround did not work. :(

mesnuuu avatar Dec 25 '22 11:12 mesnuuu

@mesnuuu Can you provide a few more details what exactly is not working, maybe attach a sample project and a few steps that you tried? Since there are various reasons why this may not work for you, I am not 100% sure that you are hitting the exact same issue or a slightly different one.

martinlippert avatar Jan 12 '23 14:01 martinlippert