redhat-developer / redhat-developer/vscode-java

Formatter changes/deletes my code

オープン
#1,132 コメント 15 件 リアクション 2 件 担当者 1 名 GitHub で見る

@snjeza がすでに取り組んでいます。

2020年11月3日 から。

bug formatter
主要言語
TypeScript
スター
2.3k
フォーク
546
平均マージ
20時間 1分
マージ済み PR(30日)
11

説明

I have the following code

class A {
    String get(Client a) {
        return "AC";
    }
}

class B extends A {
    String get(SpecialClient a) {
        return "BS";
    }
}

class C extends B {
} 
    
    
    

    
        
            

        

      
    

    



    

    

I am keeping all the white spaces here in case they could affect the behavior of the formatter.
With the code above, when I try to save in VS Code (I have turned on formatOnSave), the code becomes

class A {
    String get(Client a) {
        return "AC";
    }
}

class B extends A {
    String get(SpecialClient a) {
        return "BS";
    }
}

class C}

            

    
    
    

    

    
        

    

    
        
    

 

         

     

    



      

    
        

or

class A {
    String get(Client a) {
        return "AC";
    }
}

class B extends A {
    String get(SpecialClient a) {
        return "BS";
    }
}


    class
    C extends
    B {
    
    

    
    
    
     

    
    


    
    
        

        
        
     



    

    

Actually, the code changes to something slightly different every time I tried to reproduce this problem.
This is certainly not the first time I encountered this issue, but since I am not a Java developer, I was not quite bothered by this funny bug.

All java-related extensions I installed are Maven for Java, Debugger for Java, Language Support for Java(TM) by Red Hat, Language Extension Pack, and Java Dependency Viewer.

P.S. I didn't quite remember installing the extensions above, it could be the default extensions installed by VS Code when I wrote my first java file there?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。