Compare commits

...

18 Commits

Author SHA1 Message Date
Vadim Lopatin ec29ced5b6
improve HDPI support 2024-03-08 11:46:42 +00:00
Grim Maple 1bd86c66cd Update code for dlangui 0.10.3 2023-05-18 22:57:40 +03:00
Grim Maple b822795449 Bump dcd version 2023-04-18 17:13:48 +03:00
Grim Maple aeb045e66e Fix logger 2023-04-18 16:58:51 +03:00
Grim Maple e18eaa2b5b
Merge pull request #428 from abstewart/master
Update dlangui dependency to version 0.10.2
2023-04-04 11:48:17 +03:00
abstewart ccac2ad2b9 update dlangui dependency to version 0.10.2 2023-04-03 16:31:32 -04:00
Grim Maple 72ea89b6ec Bump DCD version for tha sweet UFCS support.
Also, removed DCD submodule bacuse it's a dub dependency anyway. Closes #397
2022-10-22 14:42:16 +03:00
Grim Maple 8c072de2af Fix autocompletion crash; autocompletion cancel 2022-04-26 19:29:15 +03:00
Grim Maple 0dee6cb1f1 Add autocompletion on each key press 2022-04-22 23:35:54 +03:00
Grim Maple daeb6f58af Update dlangui dep 2022-04-16 16:18:34 +03:00
Grim Maple 61cda23311 Fix deprecations 2022-04-14 23:57:20 +03:00
Grim Maple 51728e70eb Update DCD 2022-04-06 22:27:22 +03:00
Grim Maple b511e32ca3 Fix autocomplete 2022-04-06 22:18:34 +03:00
Vadim Lopatin c566de2633
Merge pull request #406 from leh103/master
Fix for isuue #398
2019-08-09 11:51:23 +03:00
Lawrence Hemsley eac96a7d05 Fix for isuue #398 2019-03-09 15:12:27 -07:00
Vadim Lopatin 16abdd171b fix SDL build 2018-11-26 12:12:46 +03:00
Vadim Lopatin 4e64798b9b update version 2018-11-26 09:55:19 +03:00
Vadim Lopatin b5333788ae upgrade dlangui version 2018-11-26 09:54:40 +03:00
24 changed files with 209 additions and 184 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "deps/DCD"]
path = deps/DCD
url = https://github.com/Hackerpilot/DCD.git

1
deps/DCD vendored

@ -1 +0,0 @@
Subproject commit cbcc6faac3f820bb8e06ed132d82d13036e34d58

View File

@ -12,9 +12,8 @@
"stringImportPaths": ["views"], "stringImportPaths": ["views"],
"dependencies": { "dependencies": {
"dlangui": "==0.9.180", "dlangui": "~>0.10.3",
"dsymbol": "~>0.4.8", "dcd": "~>0.16.0-beta.1"
"dcd": "~>0.9.13"
}, },
"copyFiles-windows": [ "copyFiles-windows": [

View File

@ -69,7 +69,7 @@ class BasicTypeX : Lexem {
in { in {
assert(isBasicTypeXToken(token)); assert(isBasicTypeXToken(token));
} }
body { do {
_token = token; _token = token;
} }
} }
@ -97,7 +97,7 @@ class TypeCtor : Lexem {
in { in {
assert(isTypeCtorToken(token)); assert(isTypeCtorToken(token));
} }
body { do {
_token = token; _token = token;
} }
} }
@ -112,14 +112,14 @@ class TypeCtors : Lexem {
in { in {
assert(isTypeCtorToken(token)); assert(isTypeCtorToken(token));
} }
body { do {
_list ~= new TypeCtor(token); _list ~= new TypeCtor(token);
} }
public void append(Token token) public void append(Token token)
in { in {
assert(isTypeCtorToken(token)); assert(isTypeCtorToken(token));
} }
body { do {
_list ~= new TypeCtor(token); _list ~= new TypeCtor(token);
} }
} }
@ -134,7 +134,7 @@ class Identifier : Lexem {
in { in {
assert(identifier.type == TokenType.IDENTIFIER); assert(identifier.type == TokenType.IDENTIFIER);
} }
body { do {
_token = cast(IdentToken)identifier; _token = cast(IdentToken)identifier;
} }
} }
@ -157,14 +157,14 @@ class IdentifierList : Lexem {
in { in {
assert(ident.type == TokenType.IDENTIFIER); assert(ident.type == TokenType.IDENTIFIER);
} }
body { do {
_identifier = new Identifier(ident); _identifier = new Identifier(ident);
_identifierList = identifierList; _identifierList = identifierList;
} }
public this(TemplateInstance templateInstance, IdentifierList identifierList = null) public this(TemplateInstance templateInstance, IdentifierList identifierList = null)
in { in {
} }
body { do {
_templateInstance = templateInstance; _templateInstance = templateInstance;
_identifierList = identifierList; _identifierList = identifierList;
} }
@ -181,7 +181,7 @@ class TemplateInstance : Lexem {
public this() public this()
in { in {
} }
body { do {
} }
} }
@ -207,7 +207,7 @@ class BasicType : Lexem {
public this() public this()
in { in {
} }
body { do {
} }
} }
@ -228,7 +228,7 @@ class Typeof : Lexem {
public this(Expression expression) public this(Expression expression)
in { in {
} }
body { do {
_expression = expression; _expression = expression;
} }
} }
@ -245,7 +245,7 @@ class Type : Lexem {
public this() public this()
in { in {
} }
body { do {
} }
} }
@ -259,7 +259,7 @@ class Expression : Lexem {
public this() public this()
in { in {
} }
body { do {
} }
} }
@ -273,7 +273,7 @@ class AltDeclarator : Lexem {
public this() public this()
in { in {
} }
body { do {
} }
} }

View File

@ -6,7 +6,15 @@ import std.conv;
import dlangide.ui.frame; import dlangide.ui.frame;
import dlangide.ui.commands; import dlangide.ui.commands;
import dlangide.workspace.workspace; import dlangide.workspace.workspace;
import std.experimental.logger;
static if(__VERSION__ > 2100)
{
import std.logger;
}
else
{
import std.experimental.logger;
}
mixin APP_ENTRY_POINT; mixin APP_ENTRY_POINT;
@ -26,18 +34,20 @@ extern (C) int UIAppMain(string[] args) {
runParserTests(); runParserTests();
} }
version(Windows) { static if(__VERSION__ > 2100) {
debug {
sharedLog = cast(shared)new FileLogger("dcd.log");
} else {
sharedLog = cast(shared)new NullLogger();
}
}
else
{
debug { debug {
sharedLog = new FileLogger("dcd.log"); sharedLog = new FileLogger("dcd.log");
} else { } else {
sharedLog = new NullLogger(); sharedLog = new NullLogger();
} }
} else {
debug {
//sharedLog = new FileLogger("dcd.log");
} else {
sharedLog = new NullLogger();
}
} }
//version (Windows) { //version (Windows) {

View File

@ -19,11 +19,6 @@ import dcd.server.autocomplete;
import dcd.common.messages; import dcd.common.messages;
import dsymbol.modulecache; import dsymbol.modulecache;
//alias SharedASTAllocator = CAllocatorImpl!(Mallocator);
//alias SharedASTAllocator = CAllocatorImpl!(Mallocator);
//alias SharedASTAllocator = CSharedAllocatorImpl!(Mallocator);
alias SharedASTAllocator = ASTAllocator;
enum DCDResult : int { enum DCDResult : int {
SUCCESS, SUCCESS,
NO_RESULT, NO_RESULT,
@ -92,11 +87,9 @@ class DCDTask {
} }
class ModuleCacheAccessor { class ModuleCacheAccessor {
import dsymbol.modulecache;
//protected ASTAllocator _astAllocator;
protected ModuleCache _moduleCache; protected ModuleCache _moduleCache;
this(in string[] importPaths) { this(in string[] importPaths) {
_moduleCache = ModuleCache(new SharedASTAllocator); _moduleCache = ModuleCache();
_moduleCache.addImportPaths(importPaths); _moduleCache.addImportPaths(importPaths);
} }
protected ModuleCache * getModuleCache(in string[] importPaths) { protected ModuleCache * getModuleCache(in string[] importPaths) {
@ -109,8 +102,6 @@ class ModuleCacheAccessor {
class DCDInterface : Thread { class DCDInterface : Thread {
import dsymbol.modulecache; import dsymbol.modulecache;
//protected ASTAllocator _astAllocator;
//protected ModuleCache * _moduleCache;
ModuleCacheAccessor _moduleCache; ModuleCacheAccessor _moduleCache;
protected BlockingQueue!DCDTask _queue; protected BlockingQueue!DCDTask _queue;
@ -238,7 +229,7 @@ class DCDInterface : Thread {
override void performRequest() { override void performRequest() {
AutocompleteResponse response = getDoc(request, *getModuleCache(_importPaths)); AutocompleteResponse response = getDoc(request, *getModuleCache(_importPaths));
result.docComments = response.docComments.dup; //result.docComments = response.docComments.dup; TODO_GRIM: Fix
result.result = DCDResult.SUCCESS; result.result = DCDResult.SUCCESS;
debug(DCD) Log.d("DCD doc comments:\n", result.docComments); debug(DCD) Log.d("DCD doc comments:\n", result.docComments);
@ -318,11 +309,9 @@ class DCDInterface : Thread {
result.output.length = response.completions.length; result.output.length = response.completions.length;
int i=0; int i=0;
foreach(s;response.completions) { foreach(s;response.completions) {
char type = 0; char type = s.kind;
if (i < response.completionKinds.length)
type = response.completionKinds[i];
result.output[i].kind = type; result.output[i].kind = type;
result.output[i].name = to!dstring(s); result.output[i].name = to!dstring(s.identifier);
i++; i++;
} }
if (response.completionType == "calltips") { if (response.completionType == "calltips") {
@ -364,6 +353,7 @@ int completionTypePriority(char t) {
return 3; return 3;
case 'k': // - keyword, built-in version, scope statement case 'k': // - keyword, built-in version, scope statement
return 20; return 20;
case 'F':
case 'f': // - function or method case 'f': // - function or method
return 2; return 2;
case 'g': // - enum name case 'g': // - enum name

View File

@ -43,7 +43,7 @@ class DMDProfilerView : WidgetGroupDefaultDrawing {
class TraceFuncionGrid : StringGridWidgetBase { class TraceFuncionGrid : StringGridWidgetBase {
protected FunctionNode[] _list; protected FunctionNode[] _list;
protected dstring[] _colTitles; protected UIString[] _colTitles;
protected ulong _ticksPerSecond; protected ulong _ticksPerSecond;
this(string ID, FunctionNode[] list, ulong ticks_per_second) { this(string ID, FunctionNode[] list, ulong ticks_per_second) {
super(ID); super(ID);
@ -53,10 +53,10 @@ class TraceFuncionGrid : StringGridWidgetBase {
fullColumnOnLeft(false); fullColumnOnLeft(false);
fullRowOnTop(false); fullRowOnTop(false);
resize(4, cast(int)list.length); resize(4, cast(int)list.length);
setColTitle(0, "Function name"d); setColTitle(0, UIString.fromRaw("Function name"));
setColTitle(1, "Called"d); setColTitle(1, UIString.fromRaw("Called"));
setColTitle(2, "F us"d); setColTitle(2, UIString.fromRaw("F us"));
setColTitle(3, "F+D us"d); setColTitle(3, UIString.fromRaw("F+D us"));
showRowHeaders = false; showRowHeaders = false;
rowSelect = true; rowSelect = true;
minVisibleRows = 10; minVisibleRows = 10;
@ -80,54 +80,54 @@ class TraceFuncionGrid : StringGridWidgetBase {
buffer[i] = buf[k - i - 1]; buffer[i] = buf[k - i - 1];
return cast(dstring)buffer[0..k]; return cast(dstring)buffer[0..k];
} }
dstring formatDurationTicks(ulong n) { auto formatDurationTicks(ulong n) {
ulong v = n * 1000000 / _ticksPerSecond; ulong v = n * 1000000 / _ticksPerSecond;
return formatNumber(v, _numberFormatBuf[]); return UIString.fromRaw(formatNumber(v, _numberFormatBuf[]));
} }
/// get cell text /// get cell text
override dstring cellText(int col, int row) { override UIString cellText(int col, int row) {
import std.conv : to; import std.conv : to;
if (row < 0 || row >= _list.length) if (row < 0 || row >= _list.length)
return ""d; return UIString.fromRaw(""d);
FunctionNode entry = _list[row]; FunctionNode entry = _list[row];
switch (col) { switch (col) {
case 0: case 0:
string fn = entry.name; string fn = entry.name;
if (fn.length > 256) if (fn.length > 256)
fn = fn[0..256] ~ "..."; fn = fn[0..256] ~ "...";
return fn.to!dstring; return UIString.fromRaw(fn.to!dstring);
case 1: case 1:
return formatNumber(entry.number_of_calls, _numberFormatBuf); return UIString.fromRaw(formatNumber(entry.number_of_calls, _numberFormatBuf));
case 2: case 2:
return formatDurationTicks(entry.function_time); return formatDurationTicks(entry.function_time);
case 3: case 3:
return formatDurationTicks(entry.function_and_descendant_time); return formatDurationTicks(entry.function_and_descendant_time);
default: default:
return ""d; return UIString.fromRaw(""d);
} }
} }
/// set cell text /// set cell text
override StringGridWidgetBase setCellText(int col, int row, dstring text) { override StringGridWidgetBase setCellText(int col, int row, UIString text) {
// do nothing // do nothing
return this; return this;
} }
/// returns row header title /// returns row header title
override dstring rowTitle(int row) { override UIString rowTitle(int row) {
return ""d; return UIString.fromRaw(""d);
} }
/// set row header title /// set row header title
override StringGridWidgetBase setRowTitle(int row, dstring title) { override StringGridWidgetBase setRowTitle(int row, UIString title) {
return this; return this;
} }
/// returns row header title /// returns row header title
override dstring colTitle(int col) { override UIString colTitle(int col) {
return _colTitles[col]; return _colTitles[col];
} }
/// set col header title /// set col header title
override StringGridWidgetBase setColTitle(int col, dstring title) { override StringGridWidgetBase setColTitle(int col, UIString title) {
_colTitles[col] = title; _colTitles[col] = title;
return this; return this;
} }

View File

@ -641,7 +641,8 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener {
return; return;
} }
if (suggestions.length == 1) { // Only insert singular autocompletion if automatic autocomplete is turned off!
if (!_settings.autoAutoComplete && suggestions.length == 1) {
insertCompletion(suggestions[0]); insertCompletion(suggestions[0]);
return; return;
} }
@ -721,13 +722,25 @@ class DSourceEdit : SourceEdit, EditableContentMarksChangeListener {
super.handleFocusChange(focused, receivedFocusFromKeyboard); super.handleFocusChange(focused, receivedFocusFromKeyboard);
} }
private bool isAutoCompleteKey(ref KeyEvent event) {
if((event.keyCode >= KeyCode.KEY_0 && event.keyCode <= KeyCode.KEY_Z) ||
event.keyCode == KeyCode.KEY_PERIOD ||
event.keyCode == KeyCode.BACK ||
event.text == "_")
return true;
return false;
}
protected uint _lastKeyDownCode; protected uint _lastKeyDownCode;
protected uint _periodKeyCode; protected uint _periodKeyCode;
/// handle keys: support autocompletion after . press with delay /// handle keys: support autocompletion after . press with delay
override bool onKeyEvent(KeyEvent event) { override bool onKeyEvent(KeyEvent event) {
if (event.action == KeyAction.KeyDown) if (event.action == KeyAction.KeyDown)
_lastKeyDownCode = event.keyCode; _lastKeyDownCode = event.keyCode;
if (event.action == KeyAction.Text && event.noModifiers && event.text==".") { if(_settings.autoAutoComplete && isAutoCompleteKey(event) && !_completionPopup) {
window.dispatchAction(ACTION_GET_COMPLETIONS, this);
}
else if (event.action == KeyAction.Text && event.noModifiers && event.text==".") {
_periodKeyCode = _lastKeyDownCode; _periodKeyCode = _lastKeyDownCode;
startCompletionTimer(); startCompletionTimer();
} else { } else {
@ -790,7 +803,7 @@ class CompletionPopupMenu : PopupMenu {
MenuItem updateItems() { MenuItem updateItems() {
MenuItem res = new MenuItem(); MenuItem res = new MenuItem();
foreach(int i, dstring suggestion ; _suggestions) { foreach(i, dstring suggestion ; _suggestions) {
if (_prefix.length && !suggestion.startsWith(_prefix)) if (_prefix.length && !suggestion.startsWith(_prefix))
continue; continue;
string iconId; string iconId;
@ -806,19 +819,12 @@ class CompletionPopupMenu : PopupMenu {
/// handle keys /// handle keys
override bool onKeyEvent(KeyEvent event) { override bool onKeyEvent(KeyEvent event) {
if (event.action == KeyAction.Text) { if (event.action == KeyAction.Text) {
_prefix ~= event.text; _editor.onKeyEvent(event);
MenuItem newItems = updateItems(); _editor.closeCompletionPopup(this);
if (newItems.subitemCount == 0) { return true;
// no matches anymore } else if (event.keyCode == KeyCode.ESCAPE) {
_editor.onKeyEvent(event); _editor.closeCompletionPopup(this);
_editor.closeCompletionPopup(this); return true;
return true;
} else {
_editor.onKeyEvent(event);
menuItems = newItems;
selectItem(0);
return true;
}
} else if (event.action == KeyAction.KeyDown && event.keyCode == KeyCode.BACK && event.noModifiers) { } else if (event.action == KeyAction.KeyDown && event.keyCode == KeyCode.BACK && event.noModifiers) {
if (_prefix.length > _initialPrefix.length) { if (_prefix.length > _initialPrefix.length) {
_prefix.length = _prefix.length - 1; _prefix.length = _prefix.length - 1;
@ -831,8 +837,8 @@ class CompletionPopupMenu : PopupMenu {
_editor.closeCompletionPopup(this); _editor.closeCompletionPopup(this);
} }
return true; return true;
} else if (event.action == KeyAction.KeyDown && event.keyCode == KeyCode.RETURN) { } else if ((event.action == KeyAction.KeyDown && event.keyCode == KeyCode.RETURN) ||
} else if (event.action == KeyAction.KeyDown && event.keyCode == KeyCode.SPACE) { (event.action == KeyAction.KeyDown && event.keyCode == KeyCode.SPACE)) {
} }
return super.onKeyEvent(event); return super.onKeyEvent(event);
} }

View File

@ -362,13 +362,13 @@ class NewProjectDlg : Dialog {
project.name = toUTF32(_projectName); project.name = toUTF32(_projectName);
if (!project.save()) if (!project.save())
return setError("Cannot save project"); return setError("Cannot save project");
project.content.setString("targetName", _projectName); project.content.setting.setString("targetName", _projectName);
if (_currentTemplate.isLibrary) { if (_currentTemplate.isLibrary) {
project.content.setString("targetType", "staticLibrary"); project.content.setting.setString("targetType", "staticLibrary");
project.content.setString("targetPath", "lib"); project.content.setting.setString("targetPath", "lib");
} else { } else {
project.content.setString("targetType", "executable"); project.content.setting.setString("targetType", "executable");
project.content.setString("targetPath", "bin"); project.content.setting.setString("targetPath", "bin");
} }
if (_currentTemplate.json) if (_currentTemplate.json)
project.content.merge(_currentTemplate.json); project.content.merge(_currentTemplate.json);

View File

@ -372,11 +372,11 @@ SearchMatchList findMatches(in string filename, in dstring searchString) {
SearchMatchList match; SearchMatchList match;
match.filename = filename; match.filename = filename;
foreach(int lineIndex, dstring line; content.lines) { foreach(lineIndex, dstring line; content.lines) {
auto colIndex = line.indexOf(searchString); auto colIndex = line.indexOf(searchString);
if (colIndex != -1) { if (colIndex != -1) {
match.matches ~= SearchMatch(lineIndex, colIndex, line); match.matches ~= SearchMatch(cast(int)lineIndex, colIndex, line);
} }
} }
return match; return match;

View File

@ -76,7 +76,7 @@ SettingsPage createSettingsPages() {
StringListValue("ru", "MENU_VIEW_LANGUAGE_RU"c), StringListValue("ru", "MENU_VIEW_LANGUAGE_RU"c),
StringListValue("es", "MENU_VIEW_LANGUAGE_ES"c), StringListValue("es", "MENU_VIEW_LANGUAGE_ES"c),
StringListValue("de", "MENU_VIEW_LANGUAGE_DE"c), StringListValue("de", "MENU_VIEW_LANGUAGE_DE"c),
StringListValue("cs", "MENU_VIEW_LANGUAGE_CS"c)]); StringListValue("cs", "MENU_VIEW_LANGUAGE_CS"c)]);
// UI font faces // UI font faces
ui.addStringComboBox("interface/uiFontFace", UIString.fromId("OPTION_FONT_FACE"c), ui.addStringComboBox("interface/uiFontFace", UIString.fromId("OPTION_FONT_FACE"c),
@ -126,6 +126,9 @@ SettingsPage createSettingsPages() {
StringListValue(120, "120"d), StringListValue(120, "120"d),
StringListValue(140, "140"d), StringListValue(140, "140"d),
StringListValue(150, "150"d), StringListValue(150, "150"d),
StringListValue(150, "180"d),
StringListValue(150, "200"d),
StringListValue(150, "250"d),
StringListValue(300, "300"d), StringListValue(300, "300"d),
StringListValue(400, "400"d), StringListValue(400, "400"d),
StringListValue(600, "600"d)]); StringListValue(600, "600"d)]);
@ -144,6 +147,7 @@ SettingsPage createSettingsPages() {
texted.addCheckbox("editors/textEditor/smartIndentsAfterPaste", UIString.fromId("OPTION_SMART_INDENTS_PASTE"c)); texted.addCheckbox("editors/textEditor/smartIndentsAfterPaste", UIString.fromId("OPTION_SMART_INDENTS_PASTE"c));
texted.addCheckbox("editors/textEditor/showWhiteSpaceMarks", UIString.fromId("OPTION_SHOW_SPACES"c)); texted.addCheckbox("editors/textEditor/showWhiteSpaceMarks", UIString.fromId("OPTION_SHOW_SPACES"c));
texted.addCheckbox("editors/textEditor/showTabPositionMarks", UIString.fromId("OPTION_SHOW_TABS"c)); texted.addCheckbox("editors/textEditor/showTabPositionMarks", UIString.fromId("OPTION_SHOW_TABS"c));
texted.addCheckbox("editors/textEditor/autoAutoComplete", UIString.fromId("OPTION_AUTO_AUTOCOMPLETE"c));
// Common page // Common page
SettingsPage common = res.addChild("common", UIString.fromId("OPTION_COMMON"c)); SettingsPage common = res.addChild("common", UIString.fromId("OPTION_COMMON"c));

View File

@ -23,6 +23,7 @@ class IDESettings : SettingsFile {
ed.setBooleanDef("smartIndentsAfterPaste", true); ed.setBooleanDef("smartIndentsAfterPaste", true);
ed.setBooleanDef("showWhiteSpaceMarks", true); ed.setBooleanDef("showWhiteSpaceMarks", true);
ed.setBooleanDef("showTabPositionMarks", true); ed.setBooleanDef("showTabPositionMarks", true);
ed.setBooleanDef("autoAutoComplete", true);
ed.setStringDef("fontFace", "Default"); ed.setStringDef("fontFace", "Default");
ed.setIntegerDef("fontSize", 11); ed.setIntegerDef("fontSize", 11);
Setting ui = uiSettings(); Setting ui = uiSettings();
@ -171,6 +172,16 @@ class IDESettings : SettingsFile {
return this; return this;
} }
/// Text editor setting, true if auto-complete is triggered on each key press
@property bool autoAutoComplete() {
return editorSettings.getBoolean("autoAutoComplete", true);
}
///
@property IDESettings autoAutoComplete(bool v) {
editorSettings.setBoolean("autoAutoComplete", v);
return this;
}
/// true if smart indents are enabled /// true if smart indents are enabled
@property bool smartIndents() { return editorSettings.getBoolean("smartIndents", true); } @property bool smartIndents() { return editorSettings.getBoolean("smartIndents", true); }
/// set smart indents enabled flag /// set smart indents enabled flag

View File

@ -11,6 +11,7 @@ import std.file;
import std.path; import std.path;
import std.process; import std.process;
import std.utf; import std.utf;
import std.ascii : isAlphaNum;
string[] includePath; string[] includePath;
@ -490,7 +491,7 @@ class Project : WorkspaceItem {
/// name /// name
override @property void name(dstring s) { override @property void name(dstring s) {
super.name(s); super.name(s);
_projectFile.setString("name", toUTF8(s)); _projectFile.setting.setString("name", toUTF8(s));
} }
/// name /// name
@ -501,7 +502,7 @@ class Project : WorkspaceItem {
/// name /// name
override @property void description(dstring s) { override @property void description(dstring s) {
super.description(s); super.description(s);
_projectFile.setString("description", toUTF8(s)); _projectFile.setting.setString("description", toUTF8(s));
} }
/// returns project's own source paths /// returns project's own source paths
@ -576,12 +577,12 @@ class Project : WorkspaceItem {
if (!isExecutable) if (!isExecutable)
return null; return null;
string exename = toUTF8(name); string exename = toUTF8(name);
exename = _projectFile.getString("targetName", exename); exename = _projectFile.setting.getString("targetName", exename);
// TODO: use targetName // TODO: use targetName
version (Windows) { version (Windows) {
exename = exename ~ ".exe"; exename = exename ~ ".exe";
} }
string targetPath = _projectFile.getString("targetPath", null); string targetPath = _projectFile.setting.getString("targetPath", null);
string exePath; string exePath;
if (targetPath.length) if (targetPath.length)
exePath = buildNormalizedPath(_filename.dirName, targetPath, exename); // int $targetPath directory exePath = buildNormalizedPath(_filename.dirName, targetPath, exename); // int $targetPath directory
@ -685,10 +686,10 @@ class Project : WorkspaceItem {
protected string[] findSourcePaths() { protected string[] findSourcePaths() {
string[] res; string[] res;
res.assumeSafeAppend; res.assumeSafeAppend;
string[] srcPaths = _projectFile.getStringArray("sourcePaths"); string[] srcPaths = _projectFile.setting.getStringArray("sourcePaths");
foreach(s; srcPaths) foreach(s; srcPaths)
addRelativePathIfExists(res, s); addRelativePathIfExists(res, s);
Setting configs = _projectFile.objectByPath("configurations"); Setting configs = _projectFile.setting.objectByPath("configurations");
if (configs) { if (configs) {
for (int i = 0; i < configs.length; i++) { for (int i = 0; i < configs.length; i++) {
Setting s = configs[i]; Setting s = configs[i];
@ -710,7 +711,7 @@ class Project : WorkspaceItem {
void processSubpackages() { void processSubpackages() {
import dlangui.core.files; import dlangui.core.files;
_subPackages.length = 0; _subPackages.length = 0;
Setting subPackages = _projectFile.settingByPath("subPackages", SettingType.ARRAY, false); Setting subPackages = _projectFile.setting.settingByPath("subPackages", SettingType.ARRAY, false);
if (subPackages) { if (subPackages) {
string p = _projectFile.filename.dirName; string p = _projectFile.filename.dirName;
for(int i = 0; i < subPackages.length; i++) { for(int i = 0; i < subPackages.length; i++) {
@ -761,7 +762,7 @@ class Project : WorkspaceItem {
// //
_mainSourceFile = null; _mainSourceFile = null;
try { try {
_name = toUTF32(_projectFile.getString("name")); _name = toUTF32(_projectFile.setting.getString("name"));
_originalName = _name; _originalName = _name;
if (_baseProjectName) { if (_baseProjectName) {
_name = _baseProjectName ~ ":" ~ _name; _name = _baseProjectName ~ ":" ~ _name;
@ -770,7 +771,7 @@ class Project : WorkspaceItem {
_name ~= "-"d; _name ~= "-"d;
_name ~= toUTF32(_dependencyVersion.startsWith("~") ? _dependencyVersion[1..$] : _dependencyVersion); _name ~= toUTF32(_dependencyVersion.startsWith("~") ? _dependencyVersion[1..$] : _dependencyVersion);
} }
_description = toUTF32(_projectFile.getString("description")); _description = toUTF32(_projectFile.setting.getString("description"));
Log.d(" project name: ", _name); Log.d(" project name: ", _name);
Log.d(" project description: ", _description); Log.d(" project description: ", _description);
@ -786,7 +787,7 @@ class Project : WorkspaceItem {
if (!_isDependency) if (!_isDependency)
loadSelections(); loadSelections();
_configurations = ProjectConfiguration.load(_projectFile); _configurations = ProjectConfiguration.load(_projectFile.setting);
Log.i("Project configurations: ", _configurations); Log.i("Project configurations: ", _configurations);
@ -842,7 +843,7 @@ class Project : WorkspaceItem {
_dependencies = newdeps; _dependencies = newdeps;
return false; return false;
} }
Setting versions = selectionsFile.objectByPath("versions"); Setting versions = selectionsFile.setting.objectByPath("versions");
if (!versions.isObject) { if (!versions.isObject) {
_dependencies = newdeps; _dependencies = newdeps;
return false; return false;
@ -934,19 +935,19 @@ class DubPackageFinder {
bool isValidProjectName(in string s) pure { bool isValidProjectName(in string s) pure {
if (s.empty) if (s.empty)
return false; return false;
return reduce!q{ a && (b == '_' || b == '-' || std.ascii.isAlphaNum(b)) }(true, s); return reduce!((a, b) => a && (b == '_' || b == '-' || isAlphaNum(b)))(true, s);
} }
bool isValidModuleName(in string s) pure { bool isValidModuleName(in string s) pure {
if (s.empty) if (s.empty)
return false; return false;
return reduce!q{ a && (b == '_' || std.ascii.isAlphaNum(b)) }(true, s); return reduce!((a, b) => a && (b == '_' || isAlphaNum(b)))(true, s);
} }
bool isValidFileName(in string s) pure { bool isValidFileName(in string s) pure {
if (s.empty) if (s.empty)
return false; return false;
return reduce!q{ a && (b == '_' || b == '.' || b == '-' || std.ascii.isAlphaNum(b)) }(true, s); return reduce!((a, b) => a && (b == '_' || b == '.' || b == '-' || isAlphaNum(b)))(true, s);
} }
unittest { unittest {

View File

@ -74,7 +74,7 @@ class Workspace : WorkspaceItem {
} }
@property Setting includePath(){ @property Setting includePath(){
Setting res = _workspaceFile.objectByPath("includePath", true); Setting res = _workspaceFile.setting.objectByPath("includePath", true);
return res; return res;
} }
@ -314,11 +314,11 @@ class Workspace : WorkspaceItem {
if (df && !_description.empty) // cut off last delimiter if (df && !_description.empty) // cut off last delimiter
_description = _description[ 0 .. $ - 3 ]; _description = _description[ 0 .. $ - 3 ];
} }
_workspaceFile.setString("name", toUTF8(_name)); _workspaceFile.setting.setString("name", toUTF8(_name));
_workspaceFile.setString("description", toUTF8(_description)); _workspaceFile.setting.setString("description", toUTF8(_description));
Log.d("workspace name: ", _name); Log.d("workspace name: ", _name);
Log.d("workspace description: ", _description); Log.d("workspace description: ", _description);
Setting projects = _workspaceFile.objectByPath("projects", true); Setting projects = _workspaceFile.setting.objectByPath("projects", true);
projects.clear(SettingType.OBJECT); projects.clear(SettingType.OBJECT);
foreach (Project p; _projects) { foreach (Project p; _projects) {
if (p.isDependency) if (p.isDependency)
@ -346,8 +346,8 @@ class Workspace : WorkspaceItem {
return false; return false;
} }
_settings.load(filename ~ WORKSPACE_SETTINGS_EXTENSION); _settings.load(filename ~ WORKSPACE_SETTINGS_EXTENSION);
_name = toUTF32(_workspaceFile["name"].str); _name = toUTF32(_workspaceFile.setting["name"].str);
_description = toUTF32(_workspaceFile["description"].str); _description = toUTF32(_workspaceFile.setting["description"].str);
Log.d("workspace name: ", _name); Log.d("workspace name: ", _name);
Log.d("workspace description: ", _description); Log.d("workspace description: ", _description);
if (_name.empty()) { if (_name.empty()) {
@ -355,7 +355,7 @@ class Workspace : WorkspaceItem {
return false; return false;
} }
auto originalStartupProjectName = _settings.startupProjectName; auto originalStartupProjectName = _settings.startupProjectName;
Setting projects = _workspaceFile.objectByPath("projects", true); Setting projects = _workspaceFile.setting.objectByPath("projects", true);
foreach(string key, Setting value; projects) { foreach(string key, Setting value; projects) {
string path = value.str; string path = value.str;
Log.d("project: ", key, " path:", path); Log.d("project: ", key, " path:", path);

View File

@ -1 +1 @@
v0.8.15 v0.8.17

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -227,6 +227,7 @@ OPTION_VERBOSE=Verbose
OPTION_WORKING_DIR=Working directory OPTION_WORKING_DIR=Working directory
OPTION_WORKSPACE_NAME=Workspace name OPTION_WORKSPACE_NAME=Workspace name
OPTION_USE_SPACES=Use spaces for tabs OPTION_USE_SPACES=Use spaces for tabs
OPTION_AUTO_AUTOCOMPLETE=Automatically suggest auto completion
ERROR=Error ERROR=Error
ERROR_CANNOT_CREATE_PROJECT=Cannot create project ERROR_CANNOT_CREATE_PROJECT=Cannot create project

View File

@ -221,6 +221,7 @@ OPTION_VERBOSE=Показать подробности
OPTION_WORKING_DIR=Рабочий каталог OPTION_WORKING_DIR=Рабочий каталог
OPTION_WORKSPACE_NAME=Имя рабочего пространства OPTION_WORKSPACE_NAME=Имя рабочего пространства
OPTION_USE_SPACES=Использовать пробелы вместо табуляции OPTION_USE_SPACES=Использовать пробелы вместо табуляции
OPTION_AUTO_AUTOCOMPLETE=Автоматически предлагать дополнение кода
ERROR=Ошибка ERROR=Ошибка
ERROR_CANNOT_CREATE_PROJECT=Не могу создать проект ERROR_CANNOT_CREATE_PROJECT=Не могу создать проект

View File

@ -7,6 +7,12 @@ res/i18n/cs.ini
res/i18n/de.ini res/i18n/de.ini
res/hdpi/hdpi_configure.png res/hdpi/hdpi_configure.png
res/hdpi/hdpi_debug-run.png res/hdpi/hdpi_debug-run.png
res/hdpi/hdpi_debug-pause.png
res/hdpi/hdpi_debug-stop.png
res/hdpi/hdpi_debug-restart.png
res/hdpi/hdpi_debug-step-into.png
res/hdpi/hdpi_debug-step-out.png
res/hdpi/hdpi_debug-step-over.png
res/hdpi/hdpi_document-close.png res/hdpi/hdpi_document-close.png
res/hdpi/hdpi_document-open-recent.png res/hdpi/hdpi_document-open-recent.png
res/hdpi/hdpi_document-open.png res/hdpi/hdpi_document-open.png