mirror of https://github.com/buggins/dlangide.git
parent
cfcf70c1ea
commit
23213147d2
|
@ -72,11 +72,14 @@ class DCDTask {
|
|||
if (_cancelled)
|
||||
return;
|
||||
createRequest();
|
||||
if (_cancelled)
|
||||
return;
|
||||
performRequest();
|
||||
synchronized(this) {
|
||||
if (_cancelled)
|
||||
return;
|
||||
_guiExecutor.executeInUiThread(&postResults);
|
||||
if (_guiExecutor)
|
||||
_guiExecutor.executeInUiThread(&postResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -183,6 +186,29 @@ class DCDInterface : Thread {
|
|||
return "";
|
||||
}
|
||||
|
||||
/// DCD doc comments task
|
||||
class ModuleCacheWarmupTask : DCDTask {
|
||||
|
||||
this(CustomEventTarget guiExecutor, string[] importPaths) {
|
||||
super(guiExecutor, importPaths, null, null, 0);
|
||||
}
|
||||
|
||||
override void performRequest() {
|
||||
debug(DCD) Log.d("DCD - warm up module cache with import paths ", _importPaths);
|
||||
getModuleCache(_importPaths);
|
||||
debug(DCD) Log.d("DCD - module cache warm up finished");
|
||||
}
|
||||
override void postResults() {
|
||||
}
|
||||
}
|
||||
|
||||
DCDTask warmUp(string[] importPaths) {
|
||||
debug(DCD) Log.d("DCD warmUp: ", importPaths);
|
||||
ModuleCacheWarmupTask task = new ModuleCacheWarmupTask(null, importPaths);
|
||||
_queue.put(task);
|
||||
return task;
|
||||
}
|
||||
|
||||
/// DCD doc comments task
|
||||
class DocCommentsTask : DCDTask {
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ class DEditorTool : EditorTool
|
|||
|
||||
override void cancelGetDocComments() {
|
||||
if (_getDocCommentsTask) {
|
||||
Log.d("Cancelling getDocComments()");
|
||||
_getDocCommentsTask.cancel();
|
||||
_getDocCommentsTask = null;
|
||||
}
|
||||
|
@ -70,6 +71,7 @@ class DEditorTool : EditorTool
|
|||
|
||||
override void cancelGoToDefinition() {
|
||||
if (_goToDefinitionTask) {
|
||||
Log.d("Cancelling goToDefinition()");
|
||||
_goToDefinitionTask.cancel();
|
||||
_goToDefinitionTask = null;
|
||||
}
|
||||
|
@ -77,6 +79,7 @@ class DEditorTool : EditorTool
|
|||
|
||||
override void cancelGetCompletions() {
|
||||
if (_getCompletionsTask) {
|
||||
Log.d("Cancelling getCompletions()");
|
||||
_getCompletionsTask.cancel();
|
||||
_getCompletionsTask = null;
|
||||
}
|
||||
|
@ -125,6 +128,7 @@ class DEditorTool : EditorTool
|
|||
|
||||
DCDTask _getCompletionsTask;
|
||||
override void getCompletions(DSourceEdit editor, TextPosition caretPosition, void delegate(dstring[] completions, string[] icons) callback) {
|
||||
cancelGetCompletions();
|
||||
string[] importPaths = editor.importPaths();
|
||||
|
||||
string content = toUTF8(editor.text);
|
||||
|
|
|
@ -1325,6 +1325,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
|||
if (!project)
|
||||
return;
|
||||
currentWorkspace.startupProject = project;
|
||||
warmUpImportPaths(project);
|
||||
if (_wsPanel)
|
||||
_wsPanel.updateDefault();
|
||||
}
|
||||
|
@ -1394,15 +1395,21 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
|||
}
|
||||
const auto msg = UIString.fromId("MSG_OPENED_PROJECT"c);
|
||||
_logPanel.logLine(toUTF32("Project file " ~ project.filename ~ " is opened ok"));
|
||||
|
||||
warmUpImportPaths(project);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void warmUpImportPaths(Project project) {
|
||||
dcdInterface.warmUp(project.importPaths);
|
||||
}
|
||||
|
||||
void openFileOrWorkspace(string filename) {
|
||||
// Open DlangIDE workspace file
|
||||
if (filename.isWorkspaceFile) {
|
||||
Workspace ws = new Workspace(this);
|
||||
if (ws.load(filename)) {
|
||||
askForUnsavedEdits(delegate() {
|
||||
askForUnsavedEdits(delegate() {
|
||||
setWorkspace(ws);
|
||||
hideHomeScreen();
|
||||
// Write workspace to recent workspaces list
|
||||
|
@ -1421,9 +1428,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
|||
const auto msg = UIString.fromId("MSG_TRY_OPEN_PROJECT"c).value;
|
||||
_logPanel.logLine(msg ~ toUTF32(" " ~ filename));
|
||||
Project project = new Project(currentWorkspace, filename);
|
||||
if (!project.load()) {
|
||||
window.showMessageBox(UIString.fromId("MSG_OPEN_PROJECT"c), UIString.fromId("ERROR_INVALID_WS_OR_PROJECT_FILE"c));
|
||||
_logPanel.logLine("File is not recognized as DlangIDE project or workspace file");
|
||||
if (!loadProject(project)) {
|
||||
//window.showMessageBox(UIString.fromId("MSG_OPEN_PROJECT"c), UIString.fromId("ERROR_INVALID_WS_OR_PROJECT_FILE"c));
|
||||
//_logPanel.logLine("File is not recognized as DlangIDE project or workspace file");
|
||||
return;
|
||||
}
|
||||
string defWsFile = project.defWorkspaceFile;
|
||||
|
@ -1508,6 +1515,9 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
|||
_wsPanel.visibility = Visibility.Visible;
|
||||
_settings.updateRecentWorkspace(ws.filename);
|
||||
_settings.setRecentPath(ws.dir, "FILE_OPEN_WORKSPACE_PATH");
|
||||
if (ws.startupProject) {
|
||||
warmUpImportPaths(ws.startupProject);
|
||||
}
|
||||
} else {
|
||||
_wsPanel.visibility = Visibility.Gone;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue