Skip to content

Commit

Permalink
shows error if key contains spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
isfopo committed Jul 11, 2024
1 parent 94494b8 commit 80ed95c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/EnvironmentTreeviewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class EnvironmentTreeviewProvider
await vscode.workspace.fs.readFile(element.uri)
);

content = content + `\n${key}=${value}`;
content = content + `\n${key}="${value}"`;

vscode.workspace.fs.writeFile(
element.uri,
Expand Down
5 changes: 5 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ export function activate(context: vscode.ExtensionContext) {

if (!key) {
return;
} else if (key.includes(" ")) {
vscode.window.showErrorMessage(
"Environment variable keys cannot contain spaces"
);
return;
}

const value = await vscode.window.showInputBox({
Expand Down

0 comments on commit 80ed95c

Please sign in to comment.