Skip to content

Commit

Permalink
chore(vscode): v0.1.11 (#990)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel authored Jul 3, 2023
1 parent 78a3129 commit b96a234
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 6 deletions.
5 changes: 5 additions & 0 deletions extensions/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.1.11

- feat: support `list` variable type in `brick.yaml`
- deps: various dependency updates

# 0.1.10

- feat: support mason new brick
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2022 Felix Angelov
Copyright (c) 2023 Felix Angelov

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mason",
"displayName": "mason",
"description": "Mason support for Visual Studio Code.",
"version": "0.1.10",
"version": "0.1.11",
"publisher": "FelixAngelov",
"repository": {
"type": "git",
Expand Down
21 changes: 19 additions & 2 deletions extensions/vscode/src/commands/make-brick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const makeLocalBrick = async (uri: Uri) => {

const name: string = brickYaml.name;

let vars: string[] = [];
const vars: string[] = [];
for (let key in brickYaml.vars) {
const value = await promptForValue(brickYaml.vars[key]);
if (_.isNil(value)) {
Expand Down Expand Up @@ -159,6 +159,9 @@ const promptForValue = async (args: any): Promise<string | undefined> => {
if (args.type === "array") {
return promptForArray(args.prompt, args.defaults, args.values);
}
if (args.type === "list") {
return promptForList(args.prompt, args.separator);
}
window.showInformationMessage(`${args.type} type is not supported.`);
if (args.default) {
return args.default.toString();
Expand All @@ -174,7 +177,7 @@ const promptForPrimitive = async (
title: string,
_default: string
): Promise<string | undefined> => {
let result = await vscode.window.showInputBox({
const result = await vscode.window.showInputBox({
placeHolder: _default,
prompt: title,
});
Expand Down Expand Up @@ -233,6 +236,20 @@ const promptForArray = async (
return JSON.stringify(JSON.stringify(selections));
};

const promptForList = async (
title: string,
separator?: string
): Promise<string | undefined> => {
const delimeter = separator ?? ",";
const input = await vscode.window.showInputBox({
prompt: title,
placeHolder: `Enter a list separated by "${delimeter}"`,
});
const results = input?.split(delimeter);
const selection = results?.map((r) => r.trimStart());
return JSON.stringify(JSON.stringify(selection));
};

function _rootDir(): string {
const masonCache = env["MASON_CACHE"];
if (!_.isNil(masonCache)) {
Expand Down

0 comments on commit b96a234

Please sign in to comment.