Skip to content

Commit

Permalink
use multiple subscription.push commands
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Jul 2, 2023
1 parent d49d63f commit 176d994
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
import vscode from 'vscode';
import { commands, type ExtensionContext, languages, window, workspace } from 'vscode';

// Load package components
import { compile, showCompilerFlags, showVersion, showHelp } from './makensis';
import { convert } from './nlf';
import { createTask } from './task';
import { updateDiagnostics } from './diagnostics';

async function activate(context: vscode.ExtensionContext): Promise<void> {
// TextEditor Commands
async function activate(context: ExtensionContext): Promise<void> {
context.subscriptions.push(
vscode.commands.registerTextEditorCommand('extension.nsis.compile', async () => {
// TextEditor Commands
commands.registerTextEditorCommand('extension.nsis.compile', async () => {
return await compile(false);
})
);

context.subscriptions.push(
vscode.commands.registerTextEditorCommand('extension.nsis.compile-strict', async () => {
commands.registerTextEditorCommand('extension.nsis.compile-strict', async () => {
return await compile(true);
})
);

context.subscriptions.push(
vscode.commands.registerTextEditorCommand('extension.nsis.create-build-task', async () => {
commands.registerTextEditorCommand('extension.nsis.create-build-task', async () => {
return await createTask();
})
);

context.subscriptions.push(
vscode.commands.registerTextEditorCommand('extension.nsis.convert-language-file', () => {
commands.registerTextEditorCommand('extension.nsis.convert-language-file', () => {
return convert();
})
);

//Global Commands
context.subscriptions.push(
vscode.commands.registerCommand('extension.nsis.show-version', async () => {
commands.registerCommand('extension.nsis.show-version', async () => {
return await showVersion();
})
);

context.subscriptions.push(
vscode.commands.registerCommand('extension.nsis.show-compiler-flags', async () => {
commands.registerCommand('extension.nsis.show-compiler-flags', async () => {
return await showCompilerFlags();
})
);

context.subscriptions.push(
vscode.commands.registerCommand('extension.nsis.command-reference', async () => {
commands.registerCommand('extension.nsis.command-reference', async () => {
return await showHelp();
})
);

context.subscriptions.push(
vscode.commands.registerCommand('extension.nsis.open-settings', () => {
vscode.commands.executeCommand('workbench.action.openSettings', '@ext:idleberg.nsis');
commands.registerCommand('extension.nsis.open-settings', () => {
commands.executeCommand('workbench.action.openSettings', '@ext:idleberg.nsis');
})
);

// Diagnostics
const collection = vscode.languages.createDiagnosticCollection('nsis');
const collection = languages.createDiagnosticCollection('nsis');

if (vscode.window.activeTextEditor) {
const editor = vscode.window.activeTextEditor;
if (window.activeTextEditor) {
const editor = window.activeTextEditor;

if (editor) {
const document = editor.document || null;
Expand All @@ -70,8 +70,8 @@ async function activate(context: vscode.ExtensionContext): Promise<void> {
}
}

context.subscriptions.push(vscode.workspace.onDidSaveTextDocument(() => {
const editor = vscode.window.activeTextEditor;
context.subscriptions.push(workspace.onDidSaveTextDocument(() => {
const editor = window.activeTextEditor;

if (editor) {
const document = editor.document || null;
Expand All @@ -80,7 +80,7 @@ async function activate(context: vscode.ExtensionContext): Promise<void> {
}
}));

context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(editor => {
context.subscriptions.push(window.onDidChangeActiveTextEditor(editor => {
if (editor) {
const document = editor.document || null;

Expand Down

0 comments on commit 176d994

Please sign in to comment.