sts4 icon indicating copy to clipboard operation
sts4 copied to clipboard

"Code Completion" works fine in `application.properties` file, but does not work for `application.yml` file.

Open qinlinwang opened this issue 1 year ago • 7 comments

Describe the bug my environment: os: macos 12.4 vscode: 1.88.0 (Universal) jdk:jdk-11.0.16.1.jdk vscode extensions: Language Support for Java(TM) by Red Hat: v1.30.0 Spring Boot Tools: v1.53.0

"Code Completion" works fine in application.properties file, but does not work for application.yml file. When i type in application.properties file, spring-boot.ls.logfile is displayed as shown in the below image(in the vscode terminal window): image

When i type in application.yml file, spring-boot.ls.logfile is displayed as shown in the below image: image

and the vscode-sping-boot-debug-log shows an below: image

However, the Information Hovers feature is working fine. image

qinlinwang avatar Apr 27 '24 04:04 qinlinwang

Hmm... I cannot reproduce this unfortunately... When you have properties in yaml and see hovers showing up does the content assist work then?

I've tried petclinic and consume rest guide project - yaml completions show up fine.

Not really sure what to suggest... Could you attach your project with both properties and yaml file for us to try. Also the spring boot ls log file might be useful.

BoykoAlex avatar Apr 27 '24 16:04 BoykoAlex

Hmm... I cannot reproduce this unfortunately... When you have properties in yaml and see hovers showing up does the content assist work then?

I've tried petclinic and consume rest guide project - yaml completions show up fine.

Not really sure what to suggest... Could you attach your project with both properties and yaml file for us to try. Also the spring boot ls log file might be useful.

On my machine, none of the projects are good. For example, the simplest Spring Boot project I newly created below. spring-boot-demo.zip

qinlinwang avatar Apr 30 '24 07:04 qinlinwang

Still cannot reproduce... as you can see below completion proposals are showing up for the project in the yaml file: Screenshot 2024-04-30 at 16 21 02

I'll give this a try on an older mac maybe it has something to do with the OS. One thing to try would be JDK 17 for the Java LS and Spring Boot LS. I see you have JDK 11 listed. I thought both of these extensions require JDK 17 (although if that was off i think boot ls log would have been full of various errors)

Java LS Java Home:

Screenshot 2024-04-30 at 16 25 59

Spring Boot LS Java Home:

Screenshot 2024-04-30 at 16 26 08

BoykoAlex avatar Apr 30 '24 20:04 BoykoAlex

I specify the path for the jdk17 in the settings.json, but it still does't work.

    "java.jdt.ls.java.home": "/Library/Java/JavaVirtualMachines/jdk-17.0.11.jdk/Contents/Home",
    "spring-boot.ls.java.home": "/Library/Java/JavaVirtualMachines/jdk-17.0.11.jdk/Contents/Home"

If it's because of the JDK, then the properties file should have the same issue, right? Is there anything else I can provide?

qinlinwang avatar May 01 '24 02:05 qinlinwang

Okay is the issue that once you type in the application.properties file that completion proposals just show up as you type the word port? Looks like you expect the same in the application.yml file... In other words you do not invoke completion proposals with Ctrl-Space (Cmd-Space on mac) but expect completion proposals to show up as you type? Is this the issue?

. is the trigger character in yaml... if you type . then completion proposals would show up. Otherwise Ctrl-Space or Cmd-Space is the universal way to invoke completion proposals in any IDE everything else is just tiny perks here and there.

BoykoAlex avatar May 01 '24 20:05 BoykoAlex

Okay is the issue that once you type in the application.properties file that completion proposals just show up as you type the word port? Looks like you expect the same in the application.yml file... In other words you do not invoke completion proposals with Ctrl-Space (Cmd-Space on mac) but expect completion proposals to show up as you type? Is this the issue?

. is the trigger character in yaml... if you type . then completion proposals would show up. Otherwise Ctrl-Space or Cmd-Space is the universal way to invoke completion proposals in any IDE everything else is just tiny perks here and there.

Thanks a lot, . did work in yaml。 Why isn't the behavior designed to be the same in both file types?

qinlinwang avatar May 04 '24 10:05 qinlinwang

It is designed to be roughly the same however for some reason only a few trigger chars are working in VSCode for YAML. Something must be consuming the rest of the trigger chars... It is a rather low priority issue but requires quite a bit of preparation work to demonstrate the problem to vscode team.

BoykoAlex avatar May 04 '24 14:05 BoykoAlex

I'm having the same problem, yaml and yml suffix endings won't prompt, system is windows 10, vscode version is 1.92.0

661913 avatar Aug 07 '24 05:08 661913

I also have the same problem. It worked fine the first time, but when I input other attributes with the same prefix the second time, it doesn't prompt

wangqing1001 avatar Aug 09 '24 11:08 wangqing1001

@661913 and @wangqing1001 Can you provide more details here, maybe sample snippets of your application.yml files and steps how to reproduce the issue? That would be awesome.

martinlippert avatar Aug 12 '24 10:08 martinlippert

@661913 , @wangqing1001 Any news on this? Any snippets or samples you can share?

martinlippert avatar Aug 15 '24 08:08 martinlippert

No additional feedback so far, so closing this one for now. If you have additional details, feel free to add them and we can re-open anytime.

martinlippert avatar Aug 29 '24 08:08 martinlippert