MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / TypeFormat

Method TypeFormat

CodeFormatCLib/src/CodeFormat.cpp:148–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148Result<std::vector<LuaTypeFormat::Result>>
149CodeFormat::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
180Result<std::vector<LuaDiagnosticInfo>> CodeFormat::Diagnostic(const std::string &uri, std::string &&text) {
181 auto file = std::make_shared<LuaSource>(std::move(text));

Callers

nothing calls this directly

Calls 8

GetTokensMethod · 0.80
BuildTreeMethod · 0.80
GetResultMethod · 0.80
SupportCLikeCommentsMethod · 0.45
ParseMethod · 0.45
HasErrorMethod · 0.45
AnalyzeMethod · 0.45

Tested by

no test coverage detected