{ "skip-file", 0, 0, OptionArg.STRING, ref opt_compile_skip ,"For test compiles do not add this (usually used in conjunction with add-file ", null },
{ "add-file", 0, 0, OptionArg.STRING, ref opt_compile_add, "Add this file to compile list", null },
{ "output", 0, 0, OptionArg.STRING, ref opt_compile_output, "output binary file path", null },
- { "debug", 0, 0, OptionArg.NONE, ref opt_debug, "Show debug messages", null },
+ { "debug", 0, 0, OptionArg.NONE, ref opt_debug, "Show debug messages for non-ui, or crash on warnings for gdb ", null },
{ "pull-resources", 0, 0, OptionArg.NONE, ref opt_pull_resources, "Fetch the online resources", null },
// some testing code.
{ "bjs-test-all", 0, 0, OptionArg.NONE, ref opt_bjs_test, "Test all the BJS files to see if the new parser/writer would change anything", null },
{ "bjs-target", 0, 0, OptionArg.STRING, ref opt_bjs_compile_target, "convert bjs file to tareet : vala / js", null },
{ "test", 0, 0, OptionArg.STRING, ref opt_test, "run a test use 'help' to list the available tests", null },
-
+ { "language-server", 0, 0, OptionArg.STRING, ref opt_language_server, "run language server on this file", null },
{ "drop-list", 0, 0, OptionArg.STRING, ref opt_drop_list, "show droplist / children for a Gtk type (eg. Gtk.Widget)", null },
public static string opt_compile_skip;
public static string opt_compile_add;
public static string opt_compile_output;
- public static string opt_bjs_compile;
- public static string opt_bjs_compile_target;
- public static string opt_test;
- public static string opt_drop_list;
-
+ public static string opt_bjs_compile;
+ public static string opt_bjs_compile_target;
+ public static string opt_test;
+ public static string opt_drop_list;
+ public static string opt_language_server;
public static bool opt_skip_linking = false;
public static bool opt_debug = false;
- public static Palete.ValaCompileQueue valacompilequeue;
+ //public static Palete.ValaCompileQueue valacompilequeue;
public BuilderApplication ( string[] args)
flags: ApplicationFlags.FLAGS_NONE
);
BuilderApplication.windows = new Gee.ArrayList<Xcls_MainWindow>();
- BuilderApplication.valacompilequeue = new Palete.ValaCompileQueue();
+ //BuilderApplication.valacompilequeue = new Palete.ValaCompileQueue();
configDirectory();
Project.Project.loadAll();
this.listProjects();
var cur_project = this.compileProject();
- this.dropList(cur_project);
+ this.dropList(cur_project); // --drop-list
+ this.languageServer(cur_project); // --language-server
this.listFiles(cur_project);
this.testBjs(cur_project);
+ this.languageServer(cur_project);
this.compileBjs(cur_project);
- this.compileVala();
+ //this.compileVala();
}
void initDebug()
{
-
+
+
if (BuilderApplication.opt_debug || BuilderApplication.opt_compile_project == null) {
- GLib.Log.set_handler(null,
- GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING | GLib.LogLevelFlags.LEVEL_CRITICAL,
+ GLib.Log.set_default_handler(
+ // GLib.LogLevelFlags.LEVEL_DEBUG | GLib.LogLevelFlags.LEVEL_WARNING | GLib.LogLevelFlags.LEVEL_CRITICAL,
(dom, lvl, msg) => {
- print("%s: %s\n", (new DateTime.now_local()).format("%H:%M:%S.%f"), msg);
+
+ print("%s: %s : %s\n", (new DateTime.now_local()).format("%H:%M:%S.%f"), lvl.to_string(), msg);
+
+ if (dom== "GtkSourceView") { // seems to be some critical wanrings comming from gtksourceview related to insert?
+ return;
+ }
+ //if (msg.contains("gdk_popup_present")) { // seems to be problems with the popup present on gtksourceview competion.
+ // return;
+ //}
+ if (BuilderApplication.opt_debug && lvl == GLib.LogLevelFlags.LEVEL_CRITICAL) {
+ GLib.error(msg);
+ }
});
}
+
}
void listProjects()
var ar = cur_project.sortedFiles();
foreach(var file in ar) {
- string oldstr;
+
+ if (file is JsRender.PlainFile) {
+ continue;
+ }
+
file.loadItems();
var oldfn = file.targetName();
- GLib.FileUtils.get_contents(oldfn, out oldstr);
+
+ print("\n\n\n\nFile : %s\n", oldfn);
+ //GLib.FileUtils.get_contents(oldfn, out oldstr);
var outstr = file.toSourceCode();
+ var bad = false;
+ // check line numbers:
+ var bits = outstr.split("\n");
+ var end = bits.length;
+ for(var i = 0;i < end; i++) {
+ print("%i : %s\n", i+1 , bits[i]);
+ if (!bad && bits[i].has_prefix("/*") && !bits[i].has_prefix("/*%d*/".printf(i+1))) {
+ end = i + 5 > bits.length ? bits.length: (i + 5);
+ print ("^^^^ mismatch\null");
+ bad = true;
+ }
+
+
+ }
+ if (bad) {
+ GLib.error("got bad file");
+ }
+ /*
if (outstr != oldstr) {
GLib.FileUtils.set_contents("/tmp/" + file.name + ".out", outstr);
print("meld %s /tmp/%s\n", oldfn, file.name + ".out");
//GLib.Process.exit(Posix.EXIT_SUCCESS);
}
- print("# Files match %s\n", file.name);
+*.* */
+ //print("# Files match %s\n", file.name);
}
} catch (FileError e) {
GLib.debug("Got error %s", e.message);
- var file = cur_project.getByName(BuilderApplication.opt_bjs_compile);
+ var file = cur_project.getByRelPath(BuilderApplication.opt_bjs_compile);
if (file == null) {
// then compile them all, and compare them...
-
-
-
-
+
GLib.error("missing file %s in project %s", BuilderApplication.opt_bjs_compile, cur_project.name);
}
GLib.Process.exit(Posix.EXIT_SUCCESS);
}
-
+ void languageServer(Project.Project? cur_project)
+ {
+ if (BuilderApplication.opt_language_server == null) {
+ return;
+ }
+ if (cur_project == null) {
+ GLib.error("missing project, use --project to select which project");
+ }
+ var file = cur_project.getByRelPath(BuilderApplication.opt_language_server);
+ if (file == null) {
+ // then compile them all, and compare them...
+ GLib.error("missing file %s in project %s", BuilderApplication.opt_language_server, cur_project.name);
+ }
+
+ var ls = file.getLanguageServer();
+ if (ls == null) {
+ GLib.error("No langauge server returned for file:%s", file.relpath);
+ }
+ var loop = new MainLoop();
+ GLib.Timeout.add_seconds(1, () => {
+
+ GLib.debug("Sending document_open");
+ // it's ready..
+
+ ls.document_open(file);
+
+ ls.syntax.begin(file, (obj,res) => {
+ ls.syntax.end(res);
+
+ });
+ return false;
+
+ });
+
+
+ loop.run();
+ GLib.Process.exit(Posix.EXIT_SUCCESS);
+ }
+
+ /*
void compileVala()
{
if (BuilderApplication.opt_compile_target == null) {
GLib.Process.exit(Posix.EXIT_SUCCESS);
}
+ */
void pullResources()
{
if (!opt_pull_resources) {
case "help":
print("""
help - list available tests
-flutter-project - create a flutter project in /tmp/test-flutter
+flutter-project - was try and read flutter data (but desnt work.)
""");
break;
case "flutter-project":
*/
break;
+
+
+
default:
print("Invalid test\n");
break;
public static void removeWindow(Xcls_MainWindow w)
{
-
+ //GLib.debug("remove window before = %d", BuilderApplication.windows.size);
BuilderApplication.windows.remove(w);
BuilderApplication.updateWindows();
w.el.hide();
w.el.close();
w.el.destroy();
+ //GLib.debug("remove window after = %d", BuilderApplication.windows.size);
}
}
+ static int queue_update_compile_countdown = -1;
+ static uint queue_update_compile_id = 0;
+
public static void updateCompileResults( )
{
+ queue_update_compile_countdown = 4; // 1 second after last call.
+ if (queue_update_compile_id == 0) {
+ queue_update_compile_id = GLib.Timeout.add(250, () => {
+ if (queue_update_compile_countdown < 0) {
+ return true;
+ }
+ queue_update_compile_countdown--;
+ if (queue_update_compile_countdown < 0) {
+ realUpdateCompileResults();
+ }
+
+ return true;
+ });
+ }
+ }
+
+
+ public static void realUpdateCompileResults( )
+ {
+
+
+
foreach(var ww in BuilderApplication.windows) {
if (ww == null || ww.windowstate == null || ww.windowstate.project ==null) {
continue;
}
- if (ww.windowstate.project.last_request == null) {
- ww.updateErrors(null);
- return;
- }
- var req = ww.windowstate.project.last_request;
- GLib.debug("checking errors editor for %s", ww.windowstate.file.targetName());
-
- if (req.errorByFile.has_key(ww.windowstate.file.targetName())) {
- GLib.debug("calling update Error margs for %s", ww.windowstate.file.targetName());
- ww.windowstate.code_editor_tab.updateErrorMarks(req.errorByFile.get(ww.windowstate.file.targetName()));
- } else {
- ww.windowstate.code_editor_tab.updateErrorMarks(null);
+
+ ww.windowstate.updateErrorMarksAll();
- GLib.debug("no errors in errrobyfile for %s", ww.windowstate.file.targetName());
- }
-
GLib.debug("calling udate Errors of window %s", ww.windowstate.file.targetName());
- ww.updateErrors(req);
+ ww.updateErrors();
}
}
+ public static void showSpinnerLspLog(Palete.LanguageClientAction action, string message) {
+
+ var msg = action.to_string() + " " + message;
+ switch(action) {
+
+ case Palete.LanguageClientAction.INIT:
+ case Palete.LanguageClientAction.LAUNCH:
+ case Palete.LanguageClientAction.ACCEPT:
+ BuilderApplication.showSpinner( "software-update-available", msg );
+ return;
+
+ case Palete.LanguageClientAction.DIAG:
+ BuilderApplication.showSpinner( "format-justify-fill", msg);
+ return;
+
+ case Palete.LanguageClientAction.OPEN:
+ BuilderApplication.showSpinner( "document-open", msg);
+ return;
+ case Palete.LanguageClientAction.SAVE:
+ BuilderApplication.showSpinner( "document-save", msg);
+ return;
+ case Palete.LanguageClientAction.CLOSE:
+ BuilderApplication.showSpinner( "window.close", msg);
+ return;
+ case Palete.LanguageClientAction.CHANGE:
+ BuilderApplication.showSpinner( "format-text-direction-ltr", msg);
+ return;
+ case Palete.LanguageClientAction.TERM:
+ BuilderApplication.showSpinner( "media-playback-stop", msg);
+ return;
+ case Palete.LanguageClientAction.COMPLETE:
+ BuilderApplication.showSpinner( "mail-send-recieve", msg);
+ return;
+
+ case Palete.LanguageClientAction.COMPLETE_REPLY:
+ BuilderApplication.showSpinner( "face-cool", msg);
+ return;
+
+ case Palete.LanguageClientAction.RESTART:
+ case Palete.LanguageClientAction.ERROR:
+ case Palete.LanguageClientAction.ERROR_START:
+ case Palete.LanguageClientAction.ERROR_RPC:
+ case Palete.LanguageClientAction.ERROR_REPLY:
+ BuilderApplication.showSpinner( "software-update-urgent", msg );
+ return;
+
+ case Palete.LanguageClientAction.EXIT:
+ BuilderApplication.showSpinner( "face-sick", msg);
+ return;
+
+
+ }
+ }
+
+ public static void showSpinner(string icon, string tooltip = "")
+ {
+
+ // events:
+ // doc change send: - spinner -
+
+
+ // ?? restart = software-update-urgent - crash?
+
+
+ foreach (var win in BuilderApplication.windows) {
+ if (icon != "") {
+ win.statusbar_compile_spinner.start(icon, tooltip);
+ } else {
+ win.statusbar_compile_spinner.stop();
+ }
+ }
+ }
+
+
}