Skip to content

Commit

Permalink
improve type handling
Browse files Browse the repository at this point in the history
  • Loading branch information
idleberg committed Jul 9, 2023
1 parent 84fb255 commit dc4fe33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/diagnostics.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { compile } from 'makensis';
import * as NSIS from 'makensis';
import { findErrors, findWarnings, getMakensisPath, getNullDevice, getPreprocessMode, getOverrideCompression, getSpawnEnv } from './util';
import { getConfig } from 'vscode-get-config';
import micromatch from 'micromatch';
import type { CompilerOptions } from 'makensis';
import vscode from 'vscode';
import type { DiagnosticCollection } from '../types';

Expand Down Expand Up @@ -38,7 +37,7 @@ export async function updateDiagnostics(document: vscode.TextDocument | null, co
return;
}

const options: CompilerOptions = {
const options: NSIS.CompilerOptions = {
verbose: 2,
pathToMakensis,
postExecute: [
Expand All @@ -63,7 +62,7 @@ export async function updateDiagnostics(document: vscode.TextDocument | null, co
let output;

try {
output = await compile(document.fileName, options, await getSpawnEnv());
output = await NSIS.compile(document.fileName, options, await getSpawnEnv());
} catch (error) {
console.error('[vscode-nsis]', error instanceof Error ? error.message : error);
}
Expand All @@ -84,4 +83,6 @@ export async function updateDiagnostics(document: vscode.TextDocument | null, co
} else {
collection.clear();
}

NSIS.events.removeAllListeners();
}
5 changes: 5 additions & 0 deletions src/makensis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export async function compile(strictMode: boolean): Promise<void> {
hasErrors
});
}

NSIS.events.removeAllListeners();
}

Expand Down Expand Up @@ -113,6 +114,7 @@ export async function showVersion(): Promise<void> {
});
}

NSIS.events.removeAllListeners();
}

export async function showCompilerFlags(): Promise<void> {
Expand Down Expand Up @@ -143,6 +145,7 @@ export async function showCompilerFlags(): Promise<void> {
});
}

NSIS.events.removeAllListeners();
}

export async function showHelp(): Promise<void> {
Expand Down Expand Up @@ -184,4 +187,6 @@ export async function showHelp(): Promise<void> {
hasErrors
});
}

NSIS.events.removeAllListeners();
}

0 comments on commit dc4fe33

Please sign in to comment.