mirror of https://github.com/buggins/dlangide.git
fix issue #160
This commit is contained in:
parent
5abc7bf27c
commit
fa3691897f
|
|
@ -11,6 +11,13 @@ import std.regex;
|
|||
import std.algorithm : startsWith;
|
||||
import std.string;
|
||||
|
||||
version (Windows) {
|
||||
enum ENABLE_INTERNAL_TERMINAL = false;
|
||||
} else {
|
||||
enum ENABLE_INTERNAL_TERMINAL = true;
|
||||
}
|
||||
|
||||
|
||||
/// event listener to navigate by error/warning position
|
||||
interface CompilerLogIssueClickHandler {
|
||||
bool onCompilerLogIssueClick(dstring filename, int line, int column);
|
||||
|
|
@ -22,11 +29,16 @@ class CompilerLogWidget : LogWidget {
|
|||
|
||||
Signal!CompilerLogIssueClickHandler compilerLogIssueClickHandler;
|
||||
|
||||
auto ctr = ctRegex!(r"(.+)\((\d+)\): (Error|Warning|Deprecation): (.+)"d);
|
||||
//auto ctr = ctRegex!(r"(.+)\((\d+)\): (Error|Warning|Deprecation): (.+)"d);
|
||||
auto ctr = ctRegex!(r"(.+)\((\d+)(?:,(\d+))?\): (Error|Warning|Deprecation): (.+)"d);
|
||||
|
||||
/// forward to super c'tor
|
||||
this(string ID) {
|
||||
super(ID);
|
||||
//auto match2 = matchFirst("file.d(123,234): Error: bla bla"d, ctr2);
|
||||
//if (!match2.empty) {
|
||||
// Log.d("found");
|
||||
//}
|
||||
}
|
||||
|
||||
protected uint _filenameColor = 0x0000C0;
|
||||
|
|
@ -90,6 +102,31 @@ class CompilerLogWidget : LogWidget {
|
|||
colors[i].textFlags = flags;
|
||||
}
|
||||
return colors;
|
||||
} else if ((txt.startsWith("Performing ") && txt.indexOf(" build using ") > 0)
|
||||
|| txt.startsWith("Upgrading project in ")
|
||||
) {
|
||||
CustomCharProps[] colors = new CustomCharProps[txt.length];
|
||||
uint cl = defColor;
|
||||
flags |= TextFlag.Underline;
|
||||
for (int i = 0; i < txt.length; i++) {
|
||||
colors[i].color = cl;
|
||||
colors[i].textFlags = flags;
|
||||
}
|
||||
return colors;
|
||||
} else if (txt.indexOf(": building configuration ") > 0) {
|
||||
CustomCharProps[] colors = new CustomCharProps[txt.length];
|
||||
uint cl = _filenameColor;
|
||||
flags |= TextFlag.Underline;
|
||||
for (int i = 0; i < txt.length; i++) {
|
||||
dstring rest = txt[i..$];
|
||||
if (rest.startsWith(": building configuration "d)) {
|
||||
//cl = defColor;
|
||||
flags &= ~TextFlag.Underline;
|
||||
}
|
||||
colors[i].color = cl;
|
||||
colors[i].textFlags = flags;
|
||||
}
|
||||
return colors;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
@ -109,7 +146,17 @@ class CompilerLogWidget : LogWidget {
|
|||
if(!match.empty) {
|
||||
if (compilerLogIssueClickHandler.assigned) {
|
||||
import std.conv:to;
|
||||
compilerLogIssueClickHandler(match[1], to!int(match[2]), 0);
|
||||
int row = to!int(match[2]) - 1;
|
||||
if (row < 0)
|
||||
row = 0;
|
||||
int col = 0;
|
||||
if (match[3]) {
|
||||
col = to!int(match[3]) - 1;
|
||||
if (col < 0)
|
||||
col = 0;
|
||||
}
|
||||
|
||||
compilerLogIssueClickHandler(match[1], row, col);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -137,10 +184,12 @@ class OutputPanel : DockWindow {
|
|||
}
|
||||
|
||||
void activateTerminalTab(bool clear = false) {
|
||||
static if (ENABLE_INTERNAL_TERMINAL) {
|
||||
_tabs.selectTab("TERMINAL");
|
||||
if (clear)
|
||||
_terminalWidget.resetTerminal();
|
||||
}
|
||||
}
|
||||
|
||||
this(string id) {
|
||||
_showCloseButton = false;
|
||||
|
|
@ -150,8 +199,10 @@ class OutputPanel : DockWindow {
|
|||
|
||||
/// terminal device for Console tab
|
||||
@property string terminalDeviceName() {
|
||||
static if (ENABLE_INTERNAL_TERMINAL) {
|
||||
if (_terminalWidget)
|
||||
return _terminalWidget.deviceName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +224,7 @@ class OutputPanel : DockWindow {
|
|||
_tabs.addTab(_logWidget, "Compiler Log"d);
|
||||
_tabs.selectTab("logwidget");
|
||||
|
||||
static if (ENABLE_INTERNAL_TERMINAL) {
|
||||
_terminalWidget = new TerminalWidget("TERMINAL");
|
||||
_terminalWidget.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
|
||||
_tabs.addTab(_terminalWidget, "Output"d);
|
||||
|
|
@ -204,6 +256,7 @@ class OutputPanel : DockWindow {
|
|||
//}
|
||||
_terminalWidget.write("\n\n\n\nDevice: "d ~ toUTF32(_terminalWidget.deviceName));
|
||||
_terminalWidget.write("\x1b[0m\nnormal text\n"d);
|
||||
}
|
||||
return _tabs;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue