From 3d28ae570e1e85da06d12a997ce459faaf9695b3 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Fri, 19 Jul 2024 11:11:30 +0200 Subject: [PATCH 1/3] cli: type checks --- src/cli/main.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/cli/main.js b/src/cli/main.js index 77ca0f791..f0f578843 100644 --- a/src/cli/main.js +++ b/src/cli/main.js @@ -111,6 +111,11 @@ async function checkFile({ lspc, file, lang, uri }) { print(` ✅ checks`); return true; } else { + console.log("NOOOOOOO"); + console.log(buffer_tmp.text.length, buffer.text.length); + console.log(`@@${buffer_tmp}@@`); + console.log(`@@${buffer.text.length}@@`); + printerr( ` ❌ formatting differs - open and run ${file .get_parent() @@ -288,6 +293,18 @@ async function ci({ filenames }) { const [contents] = await file_javascript.load_contents_async(null); const text = new TextDecoder().decode(contents); + const file_jsconfig = Gio.File.new_for_path(pkg.pkgdatadir).get_child( + "langs/javascript/template/jsconfig.json", + ); + const dest = demo_dir.get_child("jsconfig.json"); + file_jsconfig.copy(dest, Gio.FileCopyFlags.OVERWRITE, null, null); + + // Notify the language server that the jsconfig file was created + // to initialize diagnostics and type checkings + await lsp_clients.javascript._notify("workspace/didCreateFile", { + files: [{ uri: dest.get_uri() }], + }); + await lsp_clients.javascript._notify("textDocument/didOpen", { textDocument: { uri, @@ -301,6 +318,7 @@ async function ci({ filenames }) { uri, lspc: lsp_clients.javascript, }); + console.log(diagnostics); if (diagnostics.length > 0) { printerr(serializeDiagnostics({ diagnostics })); return false; From 95188a3657c544e785989e837372d946d56a8823 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Fri, 19 Jul 2024 11:52:19 +0200 Subject: [PATCH 2/3] yey --- demos | 2 +- src/cli/main.js | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/demos b/demos index f0e3559c0..10e8a8fe0 160000 --- a/demos +++ b/demos @@ -1 +1 @@ -Subproject commit f0e3559c0f7cfd8a083bac51d17374f9460d624d +Subproject commit 10e8a8fe0c1d2081d2d31e5da620751c9bd99a98 diff --git a/src/cli/main.js b/src/cli/main.js index f0f578843..a708a0417 100644 --- a/src/cli/main.js +++ b/src/cli/main.js @@ -314,11 +314,15 @@ async function ci({ filenames }) { }, }); - const diagnostics = await waitForDiagnostics({ + let diagnostics = await waitForDiagnostics({ uri, lspc: lsp_clients.javascript, }); - console.log(diagnostics); + diagnostics = diagnostics.filter((diagnostic) => { + return ![ + "'await' has no effect on the type of this expression.", + ].includes(diagnostic.message); + }); if (diagnostics.length > 0) { printerr(serializeDiagnostics({ diagnostics })); return false; From 42976004ef10a1318ecb5aa3978bf85a3d9a32c0 Mon Sep 17 00:00:00 2001 From: Sonny Piers Date: Fri, 19 Jul 2024 17:23:42 +0200 Subject: [PATCH 3/3] f --- demos | 2 +- src/cli/main.js | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/demos b/demos index 10e8a8fe0..0d46b4fbb 160000 --- a/demos +++ b/demos @@ -1 +1 @@ -Subproject commit 10e8a8fe0c1d2081d2d31e5da620751c9bd99a98 +Subproject commit 0d46b4fbb0fa548f82fe158de4c3228c4d59da2c diff --git a/src/cli/main.js b/src/cli/main.js index a708a0417..d7a9ab853 100644 --- a/src/cli/main.js +++ b/src/cli/main.js @@ -111,11 +111,6 @@ async function checkFile({ lspc, file, lang, uri }) { print(` ✅ checks`); return true; } else { - console.log("NOOOOOOO"); - console.log(buffer_tmp.text.length, buffer.text.length); - console.log(`@@${buffer_tmp}@@`); - console.log(`@@${buffer.text.length}@@`); - printerr( ` ❌ formatting differs - open and run ${file .get_parent()