Skip to content

Commit 9df7c1a

Browse files
authored
Merge pull request #685 from jpogran/gh-684-fix-pdk-new-module-activation
(GH-684) Fix pdk new module activation
2 parents eea61a7 + a55cdd4 commit 9df7c1a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/extension.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,14 @@ export function activate(context: vscode.ExtensionContext) {
6969
pdkVersion: configSettings.ruby.pdkVersion,
7070
});
7171

72-
const puppetfile = path.join(vscode.workspace.workspaceFolders[0].uri.fsPath, 'Puppetfile');
73-
const exists = fs.existsSync(puppetfile);
74-
if (exists && configSettings.workspace.editorService.enable) {
75-
vscode.commands.executeCommand('setContext', 'puppet:puppetfileEnabled', true);
72+
const workspaceFolders = vscode.workspace.workspaceFolders;
73+
if (workspaceFolders) {
74+
const currentWorkspaceFolder = workspaceFolders[0];
75+
const puppetfile = path.join(currentWorkspaceFolder.uri.fsPath, 'Puppetfile');
76+
const exists = fs.existsSync(puppetfile);
77+
if (exists && configSettings.workspace.editorService.enable) {
78+
vscode.commands.executeCommand('setContext', 'puppet:puppetfileEnabled', true);
79+
}
7680
}
7781

7882
const statusBar = new PuppetStatusBarFeature([puppetLangID, puppetFileLangID], configSettings, logger, context);

0 commit comments

Comments
 (0)