From 6acfd13c5360b189e1a7322b765c498e421b2ca2 Mon Sep 17 00:00:00 2001 From: HJfod <60038575+HJfod@users.noreply.github.com> Date: Sun, 17 Nov 2024 11:07:32 +0200 Subject: [PATCH] remove mod.json requirement and make it an activation event instead also removes the publish command --- CHANGELOG.md | 3 +++ package.json | 14 +++---------- src/extension.ts | 51 --------------------------------------------- src/project/lint.ts | 10 ++++----- 4 files changed, 11 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 056523c..0d9dcaa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Geode for VS Code Changelog +## [v1.16.0] + - Remove the `Geode: Publish` command as it no longer works + ## [v1.15.2] - Disable extension if no mod.json is found within workspace - Fix linter triggering on comments diff --git a/package.json b/package.json index 3f9979e..ce63660 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "url": "https://github.com/geode-sdk/vscode" }, "activationEvents": [ - "onLanguage:cpp", + "workspaceContains:**/loader/", "workspaceContains:**/mod.json" ], "galleryBanner": { @@ -50,10 +50,6 @@ { "title": "Geode: Open Sprite Browser", "command": "geode.openSpriteBrowser" - }, - { - "title": "Geode: Publish Mod", - "command": "geode.publishMod" } ], "keybindings": [ @@ -65,12 +61,8 @@ "languages": [ { "id": "bro", - "aliases": [ - "Bro" - ], - "extensions": [ - ".bro" - ], + "aliases": ["Broma"], + "extensions": [".bro"], "configuration": "./src/broma/language-configuration.json" } ], diff --git a/src/extension.ts b/src/extension.ts index 9d5a671..5c1ee38 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -17,10 +17,6 @@ import { SpriteHoverPreview } from "./project/hover"; import { registerLinters } from "./project/lint"; export async function activate(context: ExtensionContext) { - if ((await workspace.findFiles("mod.json")).length == 0) { - return; - } - const channel = window.createOutputChannel("Geode"); // store globals @@ -71,53 +67,6 @@ export async function activate(context: ExtensionContext) { }), ); - context.subscriptions.push( - commands.registerCommand("geode.publishMod", async () => { - const res = geode.cli.runCLICmdInProject(`project publish`); - if (res.isError()) { - window.showErrorMessage( - `Unable to publish mod: ${res.unwrapErr()}`, - ); - return; - } - const value = res.unwrap(); - getOutputChannel().append(value); - // Check if unable to automatically push - let pushCmd = value.match(/`git.*`/g)?.[0]; - pushCmd = pushCmd?.substring(1, pushCmd.length - 1); - if (pushCmd) { - try { - getOutputChannel().appendLine(`Running ${pushCmd}`); - execSync(pushCmd, { - encoding: "utf-8", - cwd: getActiveProject()?.path, - }); - } catch (err) { - window.showErrorMessage(`Syncing publish failed: ${err}`); - } - } - let prURL = value.match(/https:\/\/.*?\.\.\.[a-zA-Z0-9]+/g)?.[0]; - if (!prURL) { - window.showErrorMessage( - `Unable to find Github pull request URL from command output - see output panel for details`, - ); - getOutputChannel().append(value); - getOutputChannel().show(); - return; - } - window - .showInformationMessage( - `To complete the publish, please open a Pull Request in your indexer: ${prURL}`, - "Open URL", - ) - .then((btn) => { - if (btn === "Open URL" && prURL) { - env.openExternal(Uri.parse(prURL)); - } - }); - }), - ); - context.subscriptions.push( languages.registerColorProvider( { language: "cpp" }, diff --git a/src/project/lint.ts b/src/project/lint.ts index 45939ca..abc819c 100644 --- a/src/project/lint.ts +++ b/src/project/lint.ts @@ -55,7 +55,7 @@ function lint( for (const match of document.data.matchAll( new RegExp(`(?:\\/\\/\\s*@geode-begin-ignore\\(${code}\\).*?$)(?:(?!\\/\\/\\s*@geode-end-ignore\\(${code}\\))(?:\\s|.))*|\\/\\*(?:(?!\\*\\/)(?:\\s|.))*`, "gm") )) { - if (match.index != undefined) { + if (match.index !== undefined) { ignoreRanges.push({ from: match.index, to: match.index + match[0].length }); } } @@ -65,7 +65,7 @@ function lint( `(?\\/\\/\\s*@geode-ignore\\(${code}\\).*?$\\r?\\n^.*?|\\/\\/.*?)?${regex.source}`, regex.flags.includes("m") ? regex.flags : regex.flags + "m" ))) { - if (match.index == undefined || match.groups?.ignore || ignoreRanges.some(range => range.from <= match.index! && range.to >= match.index!)) { + if (match.index === undefined || match.groups?.ignore || ignoreRanges.some(range => range.from <= match.index! && range.to >= match.index!)) { continue; } @@ -77,7 +77,7 @@ function lint( const result = condition({ text: match[0], groups: match.groups, range }); if (result !== undefined) { - const isString = typeof result == "string"; + const isString = typeof result === "string"; const diagnostic = new Diagnostic(range, isString ? result : result.msg, isString ? DiagnosticSeverity.Warning : result.level); diagnostic.code = code; diagnostic.source = "geode"; @@ -107,9 +107,9 @@ function lintSettings(document: MaybeDocument, diagnostics: Diagnostic[]) { if (!setting) { return `Unknown setting ${groups!.name}`; - } else if (setting.type == "title") { + } else if (setting.type === "title") { return "Titles can't be used as a setting value"; - } else if (!setting.type.startsWith("custom:") && !groups!.type.split("::").reverse().every((part, i) => part.trim() == types?.[i])) { + } else if (!setting.type.startsWith("custom:") && !groups!.type.split("::").reverse().every((part, i) => part.trim() === types?.[i])) { return `Setting ${groups!.name} is of type ${setting.type}, not ${groups!.type}`; }