| 228 | } |
| 229 | |
| 230 | Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::NameStyleCheck(const std::string &uri, std::string &&text) { |
| 231 | auto file = LuaSource::From(std::move(text)); |
| 232 | LuaLexer luaLexer(file); |
| 233 | if (_supportNonStandardSymbol) { |
| 234 | luaLexer.SupportNonStandardSymbol(); |
| 235 | } |
| 236 | if (_supportCLikeComments) { |
| 237 | luaLexer.SupportCLikeComments(); |
| 238 | } |
| 239 | |
| 240 | luaLexer.Parse(); |
| 241 | |
| 242 | LuaParser p(file, std::move(luaLexer.GetTokens())); |
| 243 | p.Parse(); |
| 244 | |
| 245 | if (p.HasError()) { |
| 246 | return ResultType::Err; |
| 247 | } |
| 248 | |
| 249 | LuaSyntaxTree t; |
| 250 | t.BuildTree(p); |
| 251 | |
| 252 | LuaStyle style = GetStyle(uri); |
| 253 | |
| 254 | DiagnosticBuilder diagnosticBuilder(style, _diagnosticStyle); |
| 255 | |
| 256 | diagnosticBuilder.NameStyleCheck(t); |
| 257 | return MakeDiagnosticInfo(diagnosticBuilder.GetDiagnosticResults(t), file); |
| 258 | } |
| 259 | |
| 260 | std::vector<SuggestItem> LuaCodeFormat::SpellCorrect(const std::string &word) { |
| 261 | std::string letterWord = word; |
no test coverage detected