MCPcopy Create free account
hub / github.com/Koihik/LuaFormatter / fastTestColumnLimit

Method fastTestColumnLimit

src/FormatVisitor.cpp:245–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245bool FormatVisitor::fastTestColumnLimit(tree::ParseTree* node) {
246 int columns = cur_columns();
247 for (int i = firstNodeIndex(node), n = lastNodeIndex(node); i <= n; i++) {
248 if (tokens_[i]->getType() == LuaLexer::COMMENT || tokens_[i]->getType() == LuaLexer::LINE_COMMENT ||
249 tokens_[i]->getType() == LuaLexer::WS) {
250 continue;
251 }
252 columns += tokens_[i]->getText().size();
253 if (columns > config_.get<int>("column_limit")) {
254 return true;
255 }
256 }
257 return false;
258}
259
260SourceWriter& FormatVisitor::cur_writer() { return *writers_.back(); }
261

Callers

nothing calls this directly

Calls 2

firstNodeIndexFunction · 0.85
lastNodeIndexFunction · 0.85

Tested by

no test coverage detected