Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(vscode): v0.1.11 #990

Merged
merged 3 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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