From a61df968507339f83f5b10559b42dead125f6a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= Date: Fri, 12 Jul 2024 10:04:54 -0600 Subject: [PATCH] vala: Setup Vala project before starting the language server Closes #913 --- src/PanelCode.js | 5 ----- src/langs/vala/vala.js | 12 +++--------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/PanelCode.js b/src/PanelCode.js index 94786d378..5c07fe3a2 100644 --- a/src/PanelCode.js +++ b/src/PanelCode.js @@ -4,7 +4,6 @@ import GObject from "gi://GObject"; import { makeDropdownFlat, settings as global_settings } from "./util.js"; import { setupRustProject } from "./langs/rust/rust.js"; import { setupTypeScriptProject } from "./langs/typescript/typescript.js"; -import { setupValaProject } from "./langs/vala/vala.js"; export default function PanelCode({ builder, @@ -56,10 +55,6 @@ export default function PanelCode({ stack_code.visible_child_name = panel.language; previewer.useInternal().catch(console.error); - if (panel.language.toLowerCase() === "vala") { - setupValaProject(file).catch(console.error); - } - if (panel.language.toLowerCase() === "rust") { setupRustProject(file).catch(console.error); } diff --git a/src/langs/vala/vala.js b/src/langs/vala/vala.js index 8a70bba39..27dd28518 100644 --- a/src/langs/vala/vala.js +++ b/src/langs/vala/vala.js @@ -9,15 +9,9 @@ export function setup({ document }) { const { file, buffer, code_view } = document; - const api_file = Gio.File.new_for_path(pkg.pkgdatadir).get_child( - "workbench.vala", - ); - api_file.copy( - file.get_parent().get_child("workbench.vala"), - Gio.FileCopyFlags.OVERWRITE, - null, - null, - ); + // VLS needs the project to be already setup once it starts, + // otherwise it won't pick it up later. + setupValaProject(file.get_parent()).catch(console.error); const lspc = createLSPClient({ lang: getLanguage("vala"),