Editor: add text style for diagnostic info

Fixes: QTCREATORBUG-32163
Change-Id: Ifc066c7845afa3374f97c278e4481d81bfcc67c2
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
David Schulz
2024-12-13 14:32:28 +01:00
parent 94c4360085
commit 00cef252c5
12 changed files with 34 additions and 0 deletions

View File

@@ -68,6 +68,8 @@
<style name="LogCommitHash" foreground="#ff0000"/> <style name="LogCommitHash" foreground="#ff0000"/>
<style name="LogCommitSubject" foreground="#d6cf9a"/> <style name="LogCommitSubject" foreground="#d6cf9a"/>
<style name="LogDecoration" foreground="#ff00ff"/> <style name="LogDecoration" foreground="#ff00ff"/>
<style name="Info" underlineColor="#b6aef1" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#b6aef1" underlineStyle="Dotline"/>
<style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/> <style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/>
<style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/> <style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/>
<style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/> <style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/>

View File

@@ -68,6 +68,8 @@
<style name="LogCommitHash" foreground="#ff0000"/> <style name="LogCommitHash" foreground="#ff0000"/>
<style name="LogCommitSubject" foreground="#d6cf9a"/> <style name="LogCommitSubject" foreground="#d6cf9a"/>
<style name="LogDecoration" foreground="#ff00ff"/> <style name="LogDecoration" foreground="#ff00ff"/>
<style name="Info" underlineColor="#b6aef1" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#b6aef1" underlineStyle="DotLine"/>
<style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/> <style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/>
<style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/> <style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/>
<style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/> <style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/>

View File

@@ -70,4 +70,6 @@
<style name="LogCommitHash" foreground="#ff0000"/> <style name="LogCommitHash" foreground="#ff0000"/>
<style name="LogCommitSubject" foreground="#d6cf9a"/> <style name="LogCommitSubject" foreground="#d6cf9a"/>
<style name="LogDecoration" foreground="#ff00ff"/> <style name="LogDecoration" foreground="#ff00ff"/>
<style name="Info" underlineColor="#b6aef1" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#b6aef1" underlineStyle="DotLine"/>
</style-scheme> </style-scheme>

View File

@@ -59,6 +59,8 @@
<style name="DiffDestLine" background="#dfffdf"/> <style name="DiffDestLine" background="#dfffdf"/>
<style name="DiffDestChar" background="#afffaf"/> <style name="DiffDestChar" background="#afffaf"/>
<style name="LogChangeLine" foreground="#c00000"/> <style name="LogChangeLine" foreground="#c00000"/>
<style name="Info" underlineColor="#262088" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#262088" underlineStyle="DotLine"/>
<style name="Warning" underlineColor="#ffbe00" underlineStyle="SingleUnderline"/> <style name="Warning" underlineColor="#ffbe00" underlineStyle="SingleUnderline"/>
<style name="WarningContext" underlineColor="#ffbe00" underlineStyle="DotLine"/> <style name="WarningContext" underlineColor="#ffbe00" underlineStyle="DotLine"/>
<style name="Error" underlineColor="#ff0000" underlineStyle="SingleUnderline"/> <style name="Error" underlineColor="#ff0000" underlineStyle="SingleUnderline"/>

View File

@@ -40,6 +40,8 @@
<style name="Namespace"/> <style name="Namespace"/>
<style name="VirtualMethod" italic="true"/> <style name="VirtualMethod" italic="true"/>
<style name="Occurrences.Unused" underlineColor="#8F8F8F" underlineStyle="SingleUnderline"/> <style name="Occurrences.Unused" underlineColor="#8F8F8F" underlineStyle="SingleUnderline"/>
<style name="Info" underlineColor="#707070" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#707070" underlineStyle="DotLine"/>
<style name="Warning" underlineColor="#505050" underlineStyle="SingleUnderline"/> <style name="Warning" underlineColor="#505050" underlineStyle="SingleUnderline"/>
<style name="WarningContext" underlineColor="#505050" underlineStyle="DotLine"/> <style name="WarningContext" underlineColor="#505050" underlineStyle="DotLine"/>
<style name="Error" underlineColor="#000000" underlineStyle="WaveUnderline"/> <style name="Error" underlineColor="#000000" underlineStyle="WaveUnderline"/>

View File

@@ -68,6 +68,8 @@
<style name="LogCommitHash" foreground="#c06060"/> <style name="LogCommitHash" foreground="#c06060"/>
<style name="LogCommitSubject" foreground="#d6cf9a"/> <style name="LogCommitSubject" foreground="#d6cf9a"/>
<style name="LogDecoration" foreground="#c060c0"/> <style name="LogDecoration" foreground="#c060c0"/>
<style name="Info" underlineColor="#b6aef1" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#b6aef1" underlineStyle="DotLine"/>
<style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/> <style name="Warning" underlineColor="#d6c545" underlineStyle="SingleUnderline"/>
<style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/> <style name="WarningContext" underlineColor="#d6c545" underlineStyle="DotLine"/>
<style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/> <style name="Error" underlineColor="#d65645" underlineStyle="SingleUnderline"/>

View File

@@ -74,6 +74,8 @@
<style name="LogCommitHash" foreground="#ff0000"/> <style name="LogCommitHash" foreground="#ff0000"/>
<style name="LogCommitSubject" foreground="#d6cf9a"/> <style name="LogCommitSubject" foreground="#d6cf9a"/>
<style name="LogDecoration" foreground="#ff00ff"/> <style name="LogDecoration" foreground="#ff00ff"/>
<style name="Info" underlineColor="#268bd2" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#268bd2" underlineStyle="DotLine"/>
<style name="Warning" underlineColor="#b58900" underlineStyle="SingleUnderline"/> <style name="Warning" underlineColor="#b58900" underlineStyle="SingleUnderline"/>
<style name="WarningContext" underlineColor="#b58900" underlineStyle="DotLine"/> <style name="WarningContext" underlineColor="#b58900" underlineStyle="DotLine"/>
<style name="Error" underlineColor="#dc322f" underlineStyle="SingleUnderline"/> <style name="Error" underlineColor="#dc322f" underlineStyle="SingleUnderline"/>

View File

@@ -71,6 +71,8 @@
<style name="LogChangeLine" foreground="#c00000"/> <style name="LogChangeLine" foreground="#c00000"/>
<style name="Warning" underlineColor="#b58900" underlineStyle="SingleUnderline"/> <style name="Warning" underlineColor="#b58900" underlineStyle="SingleUnderline"/>
<style name="WarningContext" underlineColor="#b58900" underlineStyle="DotLine"/> <style name="WarningContext" underlineColor="#b58900" underlineStyle="DotLine"/>
<style name="Info" underlineColor="#268bd2" underlineStyle="DashUnderline"/>
<style name="InfoContext" underlineColor="#268bd2" underlineStyle="DotLine"/>
<style name="Error" underlineColor="#dc322f" underlineStyle="SingleUnderline"/> <style name="Error" underlineColor="#dc322f" underlineStyle="SingleUnderline"/>
<style name="ErrorContext" underlineColor="#dc322f" underlineStyle="DotLine"/> <style name="ErrorContext" underlineColor="#dc322f" underlineStyle="DotLine"/>
<style name="Declaration"/> <style name="Declaration"/>

View File

@@ -269,6 +269,8 @@ QTextEdit::ExtraSelection DiagnosticManager::createDiagnosticSelection(
style = C_ERROR; style = C_ERROR;
else if (severity == DiagnosticSeverity::Warning) else if (severity == DiagnosticSeverity::Warning)
style = C_WARNING; style = C_WARNING;
else if (severity == DiagnosticSeverity::Information)
style = C_INFO;
else else
return {}; return {};

View File

@@ -93,6 +93,8 @@ const char *nameForStyle(TextStyle style)
case C_ERROR_CONTEXT: return "ErrorContext"; case C_ERROR_CONTEXT: return "ErrorContext";
case C_WARNING: return "Warning"; case C_WARNING: return "Warning";
case C_WARNING_CONTEXT: return "WarningContext"; case C_WARNING_CONTEXT: return "WarningContext";
case C_INFO: return "Info";
case C_INFO_CONTEXT: return "InfoContext";
case C_DECLARATION: return "Declaration"; case C_DECLARATION: return "Declaration";
case C_FUNCTION_DEFINITION: return "FunctionDefinition"; case C_FUNCTION_DEFINITION: return "FunctionDefinition";

View File

@@ -88,6 +88,8 @@ enum TextStyle : quint8 {
C_LOG_COMMIT_SUBJECT, C_LOG_COMMIT_SUBJECT,
C_LOG_DECORATION, C_LOG_DECORATION,
C_INFO,
C_INFO_CONTEXT,
C_WARNING, C_WARNING,
C_WARNING_CONTEXT, C_WARNING_CONTEXT,
C_ERROR, C_ERROR,

View File

@@ -346,6 +346,18 @@ FormatDescriptions TextEditorSettingsPrivate::initialFormats()
QColor(255, 190, 0), QColor(255, 190, 0),
QTextCharFormat::DotLine, QTextCharFormat::DotLine,
FormatDescription::ShowAllControls); FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_INFO,
Tr::tr("Info"),
Tr::tr("Underline color of info diagnostics."),
QColor(38, 32, 136),
QTextCharFormat::DashUnderline,
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_INFO_CONTEXT,
Tr::tr("Info Context"),
Tr::tr("Underline color of the contexts of info diagnostics."),
QColor(38, 32, 136),
QTextCharFormat::DotLine,
FormatDescription::ShowAllControls);
Format outputArgumentFormat; Format outputArgumentFormat;
outputArgumentFormat.setItalic(true); outputArgumentFormat.setItalic(true);
formatDescr.emplace_back(C_OUTPUT_ARGUMENT, formatDescr.emplace_back(C_OUTPUT_ARGUMENT,