Attempt to fix a possible invalid access in LinterPlugin.

Minor visual nit with AI Assistant button.
This commit is contained in:
Martín Lucas Golini
2025-10-31 01:02:41 -03:00
parent 4814569db1
commit 472b52cfb7
2 changed files with 24 additions and 17 deletions

View File

@@ -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);
}

View File

@@ -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<Int64, std::vector<LinterMatch>> 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();
}