Commit 9e31c473 authored by Günther Wagner's avatar Günther Wagner

Fix diagnostic for LSP provider

Prevent applying single location diagnostic if a range is available
parent 5e934323
Pipeline #191337 failed with stage
in 60 minutes and 1 second
......@@ -2466,33 +2466,35 @@ ide_buffer_apply_diagnostic (IdeBuffer *self,
return;
}
if ((location = ide_diagnostic_get_location (diagnostic)))
n_ranges = ide_diagnostic_get_n_ranges (diagnostic);
if (n_ranges == 0)
{
GtkTextIter begin_iter;
GtkTextIter end_iter;
if ((location = ide_diagnostic_get_location (diagnostic)))
{
GtkTextIter begin_iter;
GtkTextIter end_iter;
ide_buffer_get_iter_at_location (self, &begin_iter, location);
end_iter = begin_iter;
ide_buffer_get_iter_at_location (self, &begin_iter, location);
end_iter = begin_iter;
if (gtk_text_iter_ends_line (&end_iter))
{
gtk_text_iter_backward_char (&begin_iter);
}
else
{
/* Only highlight to next word */
if (_ide_source_iter_inside_word (&end_iter) ||
_ide_source_iter_starts_word (&end_iter))
_ide_source_iter_forward_visible_word_end (&end_iter);
if (gtk_text_iter_ends_line (&end_iter))
{
gtk_text_iter_backward_char (&begin_iter);
}
else
gtk_text_iter_forward_to_line_end (&end_iter);
}
{
/* Only highlight to next word */
if (_ide_source_iter_inside_word (&end_iter) ||
_ide_source_iter_starts_word (&end_iter))
_ide_source_iter_forward_visible_word_end (&end_iter);
else
gtk_text_iter_forward_to_line_end (&end_iter);
}
gtk_text_buffer_apply_tag_by_name (GTK_TEXT_BUFFER (self), tag_name, &begin_iter, &end_iter);
gtk_text_buffer_apply_tag_by_name (GTK_TEXT_BUFFER (self), tag_name, &begin_iter, &end_iter);
}
}
n_ranges = ide_diagnostic_get_n_ranges (diagnostic);
for (guint i = 0; i < n_ranges; i++)
{
GtkTextIter begin_iter;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment