Skip to content

Commit aa8e45f

Browse files
committed
Properly fixed loading the extension twice
1 parent 8460b16 commit aa8e45f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CHANGELOG.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Change Log
22

3-
## [0.17.3] - 2024-08-15
3+
## [0.17.4] - 2024-08-15
4+
- 0.17.4: Properly fixed loading the extension twice
45
- 0.17.3: Fixed loading the extension twice when the "Activate WoW API extension" command is used
56
- 0.17.2: Fixed [#163](https://github.com/Ketho/vscode-wow-api/issues/163) non-user paths for `Lua.workspace.library`
67
- 0.17.1: Fixed `ScriptType` param-type-mismatch
@@ -140,6 +141,7 @@ To avoid loading for Lua projects not related to World of Warcraft, all settings
140141
- PR [#123](https://github.com/Ketho/vscode-wow-api/pull/123) Make childGroups optional in AceConfig.OptionsTable
141142
- PR [#120](https://github.com/Ketho/vscode-wow-api/pull/120) Add definition for tostringall()
142143

144+
[0.17.4]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.4
143145
[0.17.3]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.3
144146
[0.17.2]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.2
145147
[0.17.1]: https://github.com/Ketho/vscode-wow-api/releases/tag/0.17.1

src/extension.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@ import * as vscode from "vscode";
22
import * as luals from "./luals";
33
import * as subscriptions from "./subscriptions";
44

5-
let isLoaded = false;
6-
75
export async function activate(context: vscode.ExtensionContext) {
86
console.log("loaded", context.extension.id);
97
registerActivationCommand(context);
108

11-
if (!isLoaded && (isWowWorkspace() || await hasTocFile())) {
9+
if (isWowWorkspace() || await hasTocFile()) {
1210
activateWowExtension(context);
1311
}
1412
}
@@ -43,9 +41,10 @@ async function hasTocFile() {
4341
}
4442

4543
function registerActivationCommand(context: vscode.ExtensionContext) {
44+
let isLoaded = false;
4645
const handler = () => {
4746
if (!isLoaded) {
48-
activateWowExtension(context);
47+
isLoaded = true; // using a command already activates the extension
4948
vscode.window.showInformationMessage("Activated WoW API extension.");
5049
}
5150
else {
@@ -68,5 +67,4 @@ async function activateWowExtension(context: vscode.ExtensionContext) {
6867
luals.defineKnownGlobals();
6968
luals.cleanupGlobals();
7069
}
71-
isLoaded = true;
7270
}

0 commit comments

Comments
 (0)