Fix #8005 - vala lang server path fix and crash on "..." in autocomplete signature
authorAlan Knowles <alan@roojs.com>
Sat, 3 Feb 2024 11:15:47 +0000 (19:15 +0800)
committerAlan Knowles <alan@roojs.com>
Sat, 3 Feb 2024 11:15:47 +0000 (19:15 +0800)
src/Palete/CompletionProvider.vala
src/Palete/LanguageClientVala.vala

index cf2ff46..9ef4c63 100644 (file)
@@ -59,6 +59,10 @@ namespace Palete {
                                for(var i = 0 ; i < args.length; i++) {
                                        word += i > 0 ? ", " : " ";
                                        var wbit = args[i].strip().split(" ");
+                                       if (wbit.length < 2) {
+                                               word += wbit[0];
+                                               continue;
+                                       }
                                        var ty = wbit[wbit.length - 2];
                                        ty = ty.has_suffix("?") ? "?" : "";  
                                        word += ty + wbit[wbit.length-1]; // property type..?
index 4c78905..ebe35e1 100644 (file)
@@ -35,7 +35,13 @@ namespace Palete {
                }
                void startServer()
                {
-                       this.initProcess("/usr/bin/vala-language-server");
+                       var exe = GLib.Environment.find_program_in_path( "vala-language-server");
+                       if (exe == null) {
+                               GLib.warning("could not find vala-language-server");
+                                
+                               return;
+                       }
+                       this.initProcess(exe);
                }