| 146 | } |
| 147 | |
| 148 | Result<std::vector<LuaTypeFormat::Result>> |
| 149 | CodeFormat::TypeFormat(const std::string &uri, std::size_t line, std::size_t character, std::string &&text) { |
| 150 | auto file = std::make_shared<LuaSource>(std::move(text)); |
| 151 | LuaLexer luaLexer(file); |
| 152 | if (_supportNonStandardSymbol) { |
| 153 | luaLexer.SupportNonStandardSymbol(); |
| 154 | } |
| 155 | if (_supportCLikeComments) { |
| 156 | luaLexer.SupportCLikeComments(); |
| 157 | } |
| 158 | |
| 159 | luaLexer.Parse(); |
| 160 | |
| 161 | LuaParser p(file, std::move(luaLexer.GetTokens())); |
| 162 | p.Parse(); |
| 163 | |
| 164 | if (p.HasError()) { |
| 165 | return ResultType::Err; |
| 166 | } |
| 167 | |
| 168 | LuaSyntaxTree t; |
| 169 | t.BuildTree(p); |
| 170 | |
| 171 | LuaStyle style = GetStyle(uri); |
| 172 | |
| 173 | LuaTypeFormatFeatures typeFormatOptions; |
| 174 | typeFormatOptions.auto_complete_end = false; |
| 175 | LuaTypeFormat tf(typeFormatOptions); |
| 176 | tf.Analyze("\n", line, character, t, style); |
| 177 | return tf.GetResult(); |
| 178 | } |
| 179 | |
| 180 | Result<std::vector<LuaDiagnosticInfo>> CodeFormat::Diagnostic(const std::string &uri, std::string &&text) { |
| 181 | auto file = std::make_shared<LuaSource>(std::move(text)); |
nothing calls this directly
no test coverage detected