Skip to content

Commit b2c3db3

Browse files
fix: start/stop/reset commands, enable setting works (#27)
1 parent d40c90a commit b2c3db3

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export async function activate(context: vscode.ExtensionContext) {
1515
);
1616
state.context = context;
1717

18-
logger.info(`Starting with config…`, { config: getFullConfig() });
18+
const config = getFullConfig();
19+
20+
logger.info(`Starting with config…`, { config });
1921

2022
await createExtension();
2123
}

src/lifecycle.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,6 @@ const doStop = async () => {
5757

5858
if (state.activeSession) {
5959
destroySession(state.activeSession);
60+
state.activeSession = undefined;
6061
}
6162
};

src/session.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { getActiveProject, type Project } from "./project";
1919
import { state } from "./state";
2020
import { fileExists, fileIsExecutable, subtractURI } from "./utils";
2121
import { CONSTANTS, OperatingMode } from "./constants";
22+
import { getConfig, isEnabledForFolder } from "./config";
2223

2324
export type Session = {
2425
bin: Uri;
@@ -175,6 +176,16 @@ export const createActiveSession = async () => {
175176
return;
176177
}
177178

179+
if (activeProject.folder && !isEnabledForFolder(activeProject.folder)) {
180+
logger.info("Extension disabled for project.");
181+
return;
182+
}
183+
184+
if (!activeProject.folder && !getConfig<boolean>("enabled")) {
185+
logger.info("Extension disabled.");
186+
return;
187+
}
188+
178189
state.activeSession = await createSession(activeProject);
179190

180191
try {

0 commit comments

Comments
 (0)