From 472b52cfb7700580b81374bdab0daba1090f83ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Fri, 31 Oct 2025 01:02:41 -0300 Subject: [PATCH] Attempt to fix a possible invalid access in LinterPlugin. Minor visual nit with AI Assistant button. --- src/tools/ecode/applayout.xml.hpp | 8 ++++- .../ecode/plugins/linter/linterplugin.cpp | 33 ++++++++++--------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/tools/ecode/applayout.xml.hpp b/src/tools/ecode/applayout.xml.hpp index 751e333f7..910a92d21 100644 --- a/src/tools/ecode/applayout.xml.hpp +++ b/src/tools/ecode/applayout.xml.hpp @@ -154,7 +154,7 @@ TableView#locate_bar_table > tableview::row:selected > tableview::cell:nth-child border-top-right-radius: 0dp; } #check_for_updates .check_at_startup { - margin: 6dp 0dp 6p 0dp; + margin: 6dp 0dp 6dp 0dp; } #project_view_empty { padding-top: 8dp; @@ -188,6 +188,12 @@ TableView#locate_bar_table > tableview::row:selected > tableview::cell:nth-child #status_bar > .status_but:last-child { border-right-color: transparent; } +#status_bar > #ai_assistant_but.status_but { + padding: 0dp 4dp 0dp 6dp; +} +#status_bar > #ai_assistant_but.status_but > PushButton::icon { + margin-right: 0dp; +} .vertical_bar { background-color: var(--list-back); } diff --git a/src/tools/ecode/plugins/linter/linterplugin.cpp b/src/tools/ecode/plugins/linter/linterplugin.cpp index d40bc4c5c..3d6521b55 100644 --- a/src/tools/ecode/plugins/linter/linterplugin.cpp +++ b/src/tools/ecode/plugins/linter/linterplugin.cpp @@ -538,25 +538,26 @@ PluginRequestHandle LinterPlugin::processMessage( const PluginMessage& notificat notification.format != PluginMessageFormat::Diagnostics ) return PluginRequestHandle::empty(); const auto& diags = notification.asDiagnostics(); - TextDocument* doc = getDocumentFromURI( diags.uri ); - if ( doc == nullptr || - mLSPLanguagesDisabled.find( String::toLower( doc->getSyntaxDefinition().getLSPName() ) ) != - mLSPLanguagesDisabled.end() ) - return PluginRequestHandle::empty(); - std::map> matches; + TextDocument* doc = getDocumentFromURI( diags.uri ); + { + Lock l( mDocMutex ); + if ( doc == nullptr || mLSPLanguagesDisabled.find( + String::toLower( doc->getSyntaxDefinition().getLSPName() ) ) != + mLSPLanguagesDisabled.end() ) + return PluginRequestHandle::empty(); - for ( const auto& diag : diags.diagnostics ) { - LinterMatch match; - match.range = diag.range; - match.text = diag.message; - match.type = getLinterTypeFromSeverity( diag.severity ); - match.lineHash = doc->getLineHash( match.range.start().line() ); - match.origin = MatchOrigin::Diagnostics; - match.diagnostic = std::move( diag ); - matches[match.range.start().line()].emplace_back( std::move( match ) ); + for ( const auto& diag : diags.diagnostics ) { + LinterMatch match; + match.range = diag.range; + match.text = diag.message; + match.type = getLinterTypeFromSeverity( diag.severity ); + match.lineHash = doc->getLineHash( match.range.start().line() ); + match.origin = MatchOrigin::Diagnostics; + match.diagnostic = std::move( diag ); + matches[match.range.start().line()].emplace_back( std::move( match ) ); + } } - setMatches( doc, MatchOrigin::Diagnostics, matches ); return PluginRequestHandle::empty(); }