if (this.change_queue_file == null) {
return true;
}
+ if (this.getting_diagnostics) {
+ return true;
+ }
this.countdown--;
+
+
if (this.countdown < 0){
this.document_change_force.begin(this.change_queue_file, this.change_queue_file_source, (o, res) => {
this.document_change_force.end(res);
this.log(LanguageClientAction.LAUNCH, process_path);
GLib.debug("Launching %s", process_path);
this.launcher = new GLib.SubprocessLauncher (SubprocessFlags.STDIN_PIPE | SubprocessFlags.STDOUT_PIPE);
- this.launcher.set_environ(GLib.Environ.get());
+ var env = GLib.Environ.get();
+ env += "G_MESSAGES_DEBUG=all";
+
+ this.launcher.set_environ(env);
+ var logpath = GLib.Environment.get_home_dir() + "/.cache/vala-language-server";
+
+ if (!GLib.FileUtils.test(logpath, GLib.FileTest.IS_DIR)) {
+ Posix.mkdir(logpath, 0700);
+ }
+ // not very reliable..
+ //this.launcher.set_stderr_file_path(
+ // logpath + "/" +
+ // (new GLib.DateTime.now_local()).format("%Y-%m-%d") + ".log"
+ //);
+ //GLib.debug("log lang server to %s", logpath + "/" +
+ // (new GLib.DateTime.now_local()).format("%Y-%m-%d") + ".log");
+
try {
- this.subprocess = launcher.spawnv ({ process_path });
+ this.subprocess = launcher.spawnv ({ process_path , "2>" , "/tmp/vala-language-server.log" });
this.subprocess.wait_async.begin( null, ( obj,res ) => {
try {
this.jsonrpc_client.failed.connect(() => {
this.log(LanguageClientAction.ERROR_RPC, "client failed");
+ GLib.debug("language server server has failed");
this.onClose();
- GLib.debug("language server server has failed");
+
});
this.initialize_server ();
return a.path == b.path;
});
this.initialized = true;
+ this.getting_diagnostics = false;
return;
} catch (GLib.Error e) {
GLib.debug ("LS replied with error %s", e.message);
if (this.launcher == null) {
return;
}
+ this.getting_diagnostics = false;
this.in_close = true;
GLib.debug("onClose called");
switch (method) {
case "textDocument/publishDiagnostics":
//GLib.debug("got notification %s : %s", method , Json.to_string (Json.gvariant_serialize (return_value), true));
- this.onDiagnostic(return_value);
+
+ GLib.Idle.add(() => {
+ this.onDiagnostic(return_value);
+ return false;
+ });
return;
default:
break;
}
+ bool getting_diagnostics = false;
/***
*/
{
//GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
var dg = Json.gobject_deserialize (typeof (Lsp.Diagnostics), Json.gvariant_serialize (return_value)) as Lsp.Diagnostics;
+ GLib.debug("got diag for %s", dg.filename);
this.log(LanguageClientAction.DIAG, dg.filename);
+ if (this.project.path == dg.filename) {
+ this.getting_diagnostics = false;
+ this.log(LanguageClientAction.DIAG_END, "diagnostics done");
+ return;
+
+ }
+ this.getting_diagnostics =true;
var f = this.project.getByPath(dg.filename);
if (f == null) {
//GLib.debug("no file %s", dg.uri);
public override async void document_change_force (JsRender.JsRender file, string contents)
{
+
+
if (!this.isReady()) {
return;
}
- if (!this.open_files.contains(file)) {
+ this.countdown = 9; // not really relivant..
+ this.change_queue_file = null; // this is more important..
+
+ if (!this.open_files.contains(file)) {
this.document_open(file);
}