| 134 | } |
| 135 | |
| 136 | Result<std::vector<LuaTypeFormat::Result>> |
| 137 | LuaCodeFormat::TypeFormat(const std::string &uri, std::size_t line, std::size_t character, std::string &&text, |
| 138 | ConfigMap &configMap, ConfigMap &stringTypeOptions) { |
| 139 | auto file = std::make_shared<LuaSource>(std::move(text)); |
| 140 | LuaLexer luaLexer(file); |
| 141 | if (_supportNonStandardSymbol) { |
| 142 | luaLexer.SupportNonStandardSymbol(); |
| 143 | } |
| 144 | if (_supportCLikeComments) { |
| 145 | luaLexer.SupportCLikeComments(); |
| 146 | } |
| 147 | |
| 148 | luaLexer.Parse(); |
| 149 | |
| 150 | LuaParser p(file, std::move(luaLexer.GetTokens())); |
| 151 | p.Parse(); |
| 152 | |
| 153 | if (p.HasError()) { |
| 154 | return ResultType::Err; |
| 155 | } |
| 156 | |
| 157 | LuaSyntaxTree t; |
| 158 | t.BuildTree(p); |
| 159 | |
| 160 | LuaStyle style = GetStyle(uri); |
| 161 | CalculateTempStyle(style, configMap); |
| 162 | |
| 163 | LuaTypeFormatFeatures typeFormatOptions = LuaTypeFormatFeatures::From(stringTypeOptions); |
| 164 | |
| 165 | LuaTypeFormat tf(typeFormatOptions); |
| 166 | tf.Analyze("\n", line, character, t, style); |
| 167 | return tf.GetResult(); |
| 168 | } |
| 169 | |
| 170 | Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::Diagnostic(const std::string &uri, std::string &&text) { |
| 171 | auto file = std::make_shared<LuaSource>(std::move(text)); |
no test coverage detected