MCPcopy Create free account
hub / github.com/SpartanJ/eepp / goToNextError

Method goToNextError

src/tools/ecode/plugins/linter/linterplugin.cpp:1243–1312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1241}
1242
1243void LinterPlugin::goToNextError( UICodeEditor* editor ) {
1244 if ( nullptr == editor || !editor->hasDocument() )
1245 return;
1246 TextDocument* doc = &editor->getDocument();
1247 auto pos = doc->getSelection().start();
1248
1249 Lock l( mMatchesMutex );
1250 auto fMatch = mMatches.find( doc );
1251 if ( fMatch == mMatches.end() ) {
1252 doc->execute( "spellchecker-go-to-next-error", editor );
1253 return;
1254 }
1255 const auto& matches = fMatch->second;
1256 if ( matches.empty() ) {
1257 doc->execute( "spellchecker-go-to-next-error", editor );
1258 return;
1259 }
1260
1261 const LinterMatch* matched = nullptr;
1262 for ( const auto& match : matches ) {
1263 if ( match.first > pos.line() ) {
1264 if ( mGoToIgnoreWarnings ) {
1265 for ( const auto& m : match.second ) {
1266 if ( m.type == LinterType::Error ) {
1267 matched = &m;
1268 break;
1269 }
1270 }
1271
1272 if ( matched )
1273 break;
1274 } else {
1275 matched = &match.second.front();
1276 break;
1277 }
1278 }
1279 }
1280
1281 if ( matched != nullptr ) {
1282 editor->goToLine( matched->range.start() );
1283 mManager->getSplitter()->addCurrentPositionToNavigationHistory();
1284 return;
1285 } else {
1286 if ( mGoToIgnoreWarnings ) {
1287 for ( const auto& m : matches ) {
1288 if ( m.first < pos.line() ) {
1289 for ( const auto& lm : m.second ) {
1290 if ( lm.type == LinterType::Error ) {
1291 editor->goToLine( lm.range.start() );
1292 mManager->getSplitter()->addCurrentPositionToNavigationHistory();
1293 return;
1294 }
1295 }
1296 } else {
1297 break;
1298 }
1299 }
1300 } else if ( matches.begin()->second.front().range.start().line() != pos.line() ) {

Callers

nothing calls this directly

Calls 12

getDocumentMethod · 0.80
hasDocumentMethod · 0.45
startMethod · 0.45
getSelectionMethod · 0.45
findMethod · 0.45
endMethod · 0.45
executeMethod · 0.45
emptyMethod · 0.45
goToLineMethod · 0.45
getSplitterMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected