import { CommentSyntax } from "../Entity/Config/Contributes/Configuration" ; import { SyntacticAnalysisCSharp } from "../SyntacticAnalysis/SyntacticAnalysisCSharp" ; export class FormatterCSharp { public static Format ( docommentList , indent , syntax , activateOnEnter ) { switch ( syntax ) { case CommentSyntax . single : return FormatterCSharp . FormatAsSingle ( docommentList , indent , syntax ) ; case CommentSyntax . delimited : return FormatterCSharp . FormatAsDelimited ( docommentList , indent , syntax , activateOnEnter ) ; } } private static FormatAsSingle ( docommentList , indent , syntax ) { let docomment = ' ' + docommentList [ 0 ] + '\n' ; for ( let i = 1 ; i < docommentList . length ; i ++ ) { docomment += indent + SyntacticAnalysisCSharp . GetCommentSyntax ( syntax ) + ' ' + docommentList [ i ] ; if ( i !== docommentList . length - 1 ) { docomment += '\n' ; } } return docomment ; } private static FormatAsDelimited ( docommentList , indent , syntax , activateOnEnter ) { let docomment = '\n' ; for ( let i = 0 ; i < docommentList . length ; i ++ ) { docomment += indent + ' ' + SyntacticAnalysisCSharp . GetCommentSyntax ( syntax ) + ' ' + docommentList [ i ] ; if ( i !== docommentList . length - 1 ) { docomment += '\n' ; } } docomment += '\n' ; docomment += indent ; docomment += ' */' ; return docomment ; } }