Better error handling
This commit is contained in:
@@ -26,9 +26,9 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
pluginPath = context.asAbsolutePath('lua-addons');
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.enable', () => {
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.enable', async () => {
|
||||
addPluginPathToSettings();
|
||||
vscode.commands.executeCommand(
|
||||
await vscode.commands.executeCommand(
|
||||
"lua.startServer"
|
||||
);
|
||||
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools enabled.');
|
||||
@@ -36,9 +36,9 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
);
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.disable', () => {
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.disable', async () => {
|
||||
removePluginPathFromSettings();
|
||||
vscode.commands.executeCommand(
|
||||
await vscode.commands.executeCommand(
|
||||
"lua.startServer"
|
||||
);
|
||||
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools disabled.');
|
||||
@@ -46,8 +46,8 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
);
|
||||
|
||||
context.subscriptions.push(
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.openSettings', () => {
|
||||
vscode.commands.executeCommand("workbench.action.openSettings", `@ext:${extensionSettingsFilter}`);
|
||||
vscode.commands.registerCommand('dutchies-dcs-scripting-tools.openSettings', async () => {
|
||||
await vscode.commands.executeCommand("workbench.action.openSettings", `@ext:${extensionSettingsFilter}`);
|
||||
}));
|
||||
|
||||
context.subscriptions.push(
|
||||
@@ -74,6 +74,18 @@ export function activate(context: vscode.ExtensionContext) {
|
||||
}
|
||||
});
|
||||
|
||||
vscode.workspace.onDidChangeConfiguration(async(event) => {
|
||||
if (event.affectsConfiguration(`${extensionName}.dcsTypes`)) {
|
||||
const config = vscode.workspace.getConfiguration(extensionName);
|
||||
const dcsTypesEnabled = config.get<boolean>('dcsTypes') || false;
|
||||
if (dcsTypesEnabled) {
|
||||
addPluginPathToSettings();
|
||||
} else {
|
||||
removePluginPathFromSettings();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
logger.info('Dutchies DCS Scripting Tools extension activated');
|
||||
}
|
||||
|
||||
@@ -148,6 +160,22 @@ async function compileLuaScripts() {
|
||||
}
|
||||
}
|
||||
|
||||
async function enableIntellisense() {
|
||||
addPluginPathToSettings();
|
||||
await vscode.commands.executeCommand(
|
||||
"lua.startServer"
|
||||
);
|
||||
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools enabled.');
|
||||
}
|
||||
|
||||
async function disableIntellisense() {
|
||||
removePluginPathFromSettings();
|
||||
await vscode.commands.executeCommand(
|
||||
"lua.startServer"
|
||||
);
|
||||
vscode.window.showInformationMessage('Dutchies DCS Scripting Tools disabled.');
|
||||
}
|
||||
|
||||
function addPluginPathToSettings() {
|
||||
if (pluginPath) {
|
||||
const luaSettings = vscode.workspace.getConfiguration(luaWorkSpaceSettingKey);
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"dcs-script-compiler": ["../compiler/src/ScriptCompiler.ts"]
|
||||
},
|
||||
"types": [
|
||||
"node"
|
||||
"node",
|
||||
"mocha"
|
||||
],
|
||||
/* Additional Checks */
|
||||
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
|
||||
Reference in New Issue
Block a user