apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.69k stars 853 forks source link

sout + <tab> does not work under `for` #5244

Open d01010101 opened 1 year ago

d01010101 commented 1 year ago

Apache NetBeans version

Apache NetBeans 16

What happened

sout is at least one of the abbreviations which do not in certain contexts

How to reproduce

Write a for-loop's header, press enter, write sout, press tab, the abbreviation does not change into System.out.println("").

Did this work correctly in an earlier version?

No / Don't know

Operating System

Linux Mint 20.2 Uma

JDK

OpenJDK Runtime Environment (build 14.0.1+7)

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

Code of Conduct

Yes

neilcsmith-net commented 1 year ago

Cannot reproduce this at all. Can you share all the surrounding code for a simple example that exhibits the problem? Anything in View / IDE log after you tab?

d01010101 commented 1 year ago

In the case of for without braces, it never works. Even in a test project which has just been created. Maybe it clashes with some configuration option.

public class NewClass {
    public static void main(String[] args) {
        System.out.println("");
        while(true)
            System.out.println("");
        for(int i = 0; i < 10; ++i) {
            System.out.println("");
        }
        int j = 1;
        if(j == 1)
            System.out.println("");
        for(int i = 0; i < 10; ++i)
            sout    
    }
}
neilcsmith-net commented 1 year ago

OK, yes, without braces it doesn't work. Whereas while and if do. Workaround is obviously to use better code formatting braces. :smile: Adding labels for contributions.

TheMarvelFan commented 1 year ago

Hi. Is anyone working on this issue? If not I would like to do it.

harshit391 commented 3 months ago

Solution :- https://singla391.notion.site/TMC-Net-beans-Sout-Problem-546ba7c0a21f4acab8998f597e829bb7?pvs=25