@@ -11,7 +11,8 @@ LuaCodeFormat &LuaCodeFormat::GetInstance() {
1111}
1212
1313LuaCodeFormat::LuaCodeFormat ()
14- : _supportNonStandardSymbol(false ) {
14+ : _supportNonStandardSymbol(false ),
15+ _supportCLikeComments(false ) {
1516}
1617
1718void LuaCodeFormat::UpdateCodeStyle (const std::string &workspaceUri, const std::string &configPath) {
@@ -58,6 +59,10 @@ void LuaCodeFormat::SupportNonStandardSymbol() {
5859 _supportNonStandardSymbol = true ;
5960}
6061
62+ void LuaCodeFormat::SupportCLikeComments () {
63+ _supportCLikeComments = true ;
64+ }
65+
6166void LuaCodeFormat::LoadSpellDictionary (const std::string &path) {
6267 _spellChecker.LoadDictionary (path);
6368}
@@ -72,6 +77,10 @@ Result<std::string> LuaCodeFormat::Reformat(const std::string &uri, std::string
7277 if (_supportNonStandardSymbol) {
7378 luaLexer.SupportNonStandardSymbol ();
7479 }
80+ if (_supportCLikeComments) {
81+ luaLexer.SupportCLikeComments ();
82+ }
83+
7584 luaLexer.Parse ();
7685
7786 LuaParser p (file, std::move (luaLexer.GetTokens ()));
@@ -100,6 +109,10 @@ Result<std::string> LuaCodeFormat::RangeFormat(const std::string &uri, FormatRan
100109 if (_supportNonStandardSymbol) {
101110 luaLexer.SupportNonStandardSymbol ();
102111 }
112+ if (_supportCLikeComments) {
113+ luaLexer.SupportCLikeComments ();
114+ }
115+
103116 luaLexer.Parse ();
104117
105118 LuaParser p (file, std::move (luaLexer.GetTokens ()));
@@ -130,6 +143,10 @@ LuaCodeFormat::TypeFormat(const std::string &uri, std::size_t line, std::size_t
130143 if (_supportNonStandardSymbol) {
131144 luaLexer.SupportNonStandardSymbol ();
132145 }
146+ if (_supportCLikeComments) {
147+ luaLexer.SupportCLikeComments ();
148+ }
149+
133150 luaLexer.Parse ();
134151
135152 LuaParser p (file, std::move (luaLexer.GetTokens ()));
@@ -158,6 +175,10 @@ Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::Diagnostic(const std::stri
158175 if (_supportNonStandardSymbol) {
159176 luaLexer.SupportNonStandardSymbol ();
160177 }
178+ if (_supportCLikeComments) {
179+ luaLexer.SupportCLikeComments ();
180+ }
181+
161182 luaLexer.Parse ();
162183
163184 LuaParser p (file, std::move (luaLexer.GetTokens ()));
@@ -184,6 +205,10 @@ Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::SpellCheck(const std::stri
184205 if (_supportNonStandardSymbol) {
185206 luaLexer.SupportNonStandardSymbol ();
186207 }
208+ if (_supportCLikeComments) {
209+ luaLexer.SupportCLikeComments ();
210+ }
211+
187212 luaLexer.Parse ();
188213
189214 LuaParser p (file, std::move (luaLexer.GetTokens ()));
@@ -210,6 +235,10 @@ Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::NameStyleCheck(const std::
210235 if (_supportNonStandardSymbol) {
211236 luaLexer.SupportNonStandardSymbol ();
212237 }
238+ if (_supportCLikeComments) {
239+ luaLexer.SupportCLikeComments ();
240+ }
241+
213242 luaLexer.Parse ();
214243
215244 LuaParser p (file, std::move (luaLexer.GetTokens ()));
0 commit comments