mirror of https://github.com/buggins/dlangide.git
refactoring
This commit is contained in:
parent
e95a94fcc6
commit
e8bc87380e
|
@ -1,6 +1,6 @@
|
||||||
module app;
|
module app;
|
||||||
|
|
||||||
import dlangui.all;
|
import dlangui;
|
||||||
import std.stdio;
|
import std.stdio;
|
||||||
import std.conv;
|
import std.conv;
|
||||||
import dlangide.ui.frame;
|
import dlangide.ui.frame;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import ddc.lexer.textsource;
|
||||||
import ddc.lexer.exceptions;
|
import ddc.lexer.exceptions;
|
||||||
import ddc.lexer.tokenizer;
|
import ddc.lexer.tokenizer;
|
||||||
|
|
||||||
class SimpleDSyntaxHighlighter : SyntaxHighlighter {
|
class SimpleDSyntaxSupport : SyntaxSupport {
|
||||||
|
|
||||||
EditableContent _content;
|
EditableContent _content;
|
||||||
SourceFile _file;
|
SourceFile _file;
|
||||||
|
@ -26,7 +26,7 @@ class SimpleDSyntaxHighlighter : SyntaxHighlighter {
|
||||||
/// returns editable content
|
/// returns editable content
|
||||||
@property EditableContent content() { return _content; }
|
@property EditableContent content() { return _content; }
|
||||||
/// set editable content
|
/// set editable content
|
||||||
@property SyntaxHighlighter content(EditableContent content) {
|
@property SyntaxSupport content(EditableContent content) {
|
||||||
_content = content;
|
_content = content;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ class DSourceEdit : SourceEdit {
|
||||||
override bool load(string fn) {
|
override bool load(string fn) {
|
||||||
_projectSourceFile = null;
|
_projectSourceFile = null;
|
||||||
bool res = super.load(fn);
|
bool res = super.load(fn);
|
||||||
setHighlighter();
|
setSyntaxSupport();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,11 +70,11 @@ class DSourceEdit : SourceEdit {
|
||||||
return filename.endsWith(".d") || filename.endsWith(".dd") || filename.endsWith(".dh") || filename.endsWith(".ddoc");
|
return filename.endsWith(".d") || filename.endsWith(".dd") || filename.endsWith(".dh") || filename.endsWith(".ddoc");
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHighlighter() {
|
void setSyntaxSupport() {
|
||||||
if (isDSourceFile) {
|
if (isDSourceFile) {
|
||||||
content.syntaxHighlighter = new SimpleDSyntaxHighlighter(filename);
|
content.syntaxSupport = new SimpleDSyntaxSupport(filename);
|
||||||
} else {
|
} else {
|
||||||
content.syntaxHighlighter = null;
|
content.syntaxSupport = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class DSourceEdit : SourceEdit {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_projectSourceFile = f;
|
_projectSourceFile = f;
|
||||||
setHighlighter();
|
setSyntaxSupport();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue