mirror of
https://github.com/open-goal/opengoal-vscode.git
synced 2024-10-19 20:47:37 -04:00
settings: write settings safely if they are unregistered (ie. vscode-icons)
This commit is contained in:
parent
c9c1a36f13
commit
6e9f4495fd
|
@ -1,4 +1,5 @@
|
|||
import * as vscode from "vscode";
|
||||
import { getMainChannel } from "../context";
|
||||
import { getConfig } from "./config";
|
||||
|
||||
// Settings defined in `configurationDefaults` are not merged with user settings
|
||||
|
@ -58,11 +59,18 @@ export async function setVSIconAssociations() {
|
|||
}
|
||||
}
|
||||
}
|
||||
await userConfig.update(
|
||||
"vsicons.associations.files",
|
||||
currentIconAssociations,
|
||||
vscode.ConfigurationTarget.Global
|
||||
);
|
||||
// Throws error if the user doesn't have these settings
|
||||
try {
|
||||
await userConfig.update(
|
||||
"vsicons.associations.files",
|
||||
currentIconAssociations,
|
||||
vscode.ConfigurationTarget.Global
|
||||
);
|
||||
} catch (err) {
|
||||
getMainChannel().append(
|
||||
`Failed to write icon configuration override - ${err}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Could not use colors because of - https://github.com/Microsoft/vscode/issues/32813
|
||||
|
@ -275,9 +283,14 @@ export async function setTextmateColors() {
|
|||
|
||||
currentTokenColorCustomizations.textMateRules = newRules;
|
||||
|
||||
await userConfig.update(
|
||||
"editor.tokenColorCustomizations",
|
||||
currentTokenColorCustomizations,
|
||||
vscode.ConfigurationTarget.Global
|
||||
);
|
||||
// Throws error if the user doesn't have these settings
|
||||
try {
|
||||
await userConfig.update(
|
||||
"editor.tokenColorCustomizations",
|
||||
currentTokenColorCustomizations,
|
||||
vscode.ConfigurationTarget.Global
|
||||
);
|
||||
} catch (err) {
|
||||
getMainChannel().append(`Failed to write textmate rule override - ${err}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
import * as vscode from "vscode";
|
||||
import { RecentFiles } from "./RecentFiles";
|
||||
|
||||
const channel = vscode.window.createOutputChannel("OpenGOAL");
|
||||
let extensionContext: vscode.ExtensionContext;
|
||||
let recentFiles: RecentFiles;
|
||||
|
||||
|
@ -22,3 +23,7 @@ export function getRecentFiles() {
|
|||
export function getExtensionContext() {
|
||||
return extensionContext;
|
||||
}
|
||||
|
||||
export function getMainChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
|
|
@ -7,13 +7,11 @@ import {
|
|||
import { PdfCustomProvider } from "./vendor/vscode-pdfviewer/pdfProvider";
|
||||
import { switchFile } from "./utils/file-utils";
|
||||
import { activateDecompTools } from "./decomp/decomp-tools";
|
||||
import { initContext } from "./context";
|
||||
import { getMainChannel, initContext } from "./context";
|
||||
import { IRFoldingRangeProvider } from "./languages/ir2-folder";
|
||||
import { activateTypeCastTools } from "./decomp/type-caster";
|
||||
import { IRInlayHintsProvider } from "./languages/ir2-inlay-hinter";
|
||||
|
||||
const channel = vscode.window.createOutputChannel("OpenGOAL");
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
try {
|
||||
// Init Context
|
||||
|
@ -66,7 +64,10 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||
// Start the LSP
|
||||
lsp.activate(context);
|
||||
} catch (err) {
|
||||
channel.append(`Failed to activate extension - ${err}`);
|
||||
vscode.window.showErrorMessage(
|
||||
"Failed to activate OpenGOAL extension, see logs for details"
|
||||
);
|
||||
getMainChannel().append(`Failed to activate extension - ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue