Skip to content

Commit a0f2865

Browse files
fix(aegis-vscode): added check for file associations
1 parent b15a89f commit a0f2865

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

aegis-vscode/src/extension.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,18 @@ export async function activate(context: vscode.ExtensionContext) {
187187
)
188188
return;
189189

190+
if (e.fileName.endsWith(".bolt") && e.languageId !== "mcfunction") {
191+
vscode.window
192+
.showWarningMessage(
193+
".bolt files aren't associated with mcfunction, this might break highlighting.",
194+
"Configure Language Mode"
195+
)
196+
.then((s) => {
197+
if (s == "Configure Language Mode")
198+
updateFileAssociation();
199+
});
200+
}
201+
190202
if (!client && !didClientFail) {
191203
await startLangServer(context);
192204
}
@@ -332,6 +344,15 @@ async function checkEnviroment(pythonCommand: string[]): Promise<boolean> {
332344
return true;
333345
}
334346

347+
function updateFileAssociation() {
348+
const config = vscode.workspace.getConfiguration();
349+
const associations: Record<string, string> =
350+
config.get("files.associations");
351+
352+
associations["*.bolt"] = "mcfunction";
353+
config.update("files.associations", associations);
354+
}
355+
335356
async function runPythonCommand(
336357
pythonCommand: string,
337358
args: string[]

0 commit comments

Comments
 (0)