@@ -57,7 +57,7 @@ void CodeFormat::SupportNonStandardSymbol() {
5757 _supportNonStandardSymbol = true ;
5858}
5959
60- Result<char *> CodeFormat::Reformat (const std::string &uri, std::string &&text) {
60+ Result<char *> CodeFormat::Reformat (const std::string &uri, std::string &&text) {
6161 auto file = std::make_shared<LuaSource>(std::move (text));
6262 LuaLexer luaLexer (file);
6363 if (_supportNonStandardSymbol) {
@@ -85,14 +85,14 @@ Result<char*> CodeFormat::Reformat(const std::string &uri, std::string &&text) {
8585
8686 auto result = f.GetFormatResult (t);
8787 // 由于可能存在sso string,所以需要拷贝一份
88- char * ptr = new char [result.size () + 1 ];
88+ char * ptr = new char [result.size () + 1 ];
8989 std::copy (result.begin (), result.end (), ptr);
90- ptr[result.size ()] = ' \0 ' ; // [result.size()] = '\0'
90+ ptr[result.size ()] = ' \0 ' ;// [result.size()] = '\0'
9191 return ptr;
9292}
9393
9494Result<RangeFormatResult> CodeFormat::RangeFormat (const std::string &uri, FormatRange &range,
95- std::string &&text) {
95+ std::string &&text) {
9696 auto file = std::make_shared<LuaSource>(std::move (text));
9797 LuaLexer luaLexer (file);
9898 if (_supportNonStandardSymbol) {
@@ -121,16 +121,15 @@ Result<RangeFormatResult> CodeFormat::RangeFormat(const std::string &uri, Format
121121 auto formattedText = f.GetFormatResult (t);
122122 range = f.GetReplaceRange ();
123123
124- char * ptr = new char [formattedText.size () + 1 ];
124+ char * ptr = new char [formattedText.size () + 1 ];
125125 std::copy (formattedText.begin (), formattedText.end (), ptr);
126- ptr[formattedText.size ()] = ' \0 ' ; // [formattedText.size()] = '\0'
126+ ptr[formattedText.size ()] = ' \0 ' ;// [formattedText.size()] = '\0'
127127 return RangeFormatResult{
128- static_cast <int >(range.StartLine ),
129- static_cast <int >(range.StartCol ),
130- static_cast <int >(range.EndLine ),
131- static_cast <int >(range.EndCol ),
132- ptr
133- };
128+ static_cast <int >(range.StartLine ),
129+ static_cast <int >(range.StartCol ),
130+ static_cast <int >(range.EndLine ),
131+ static_cast <int >(range.EndCol ),
132+ ptr};
134133}
135134
136135Result<std::vector<LuaTypeFormat::Result>>
0 commit comments