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

Browse opens expected folder #1799

Merged
merged 7 commits into from
May 18, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const ProjectOutput = (props: Props) => {
}, [vscode]);

const handleSaveClick = () => {
browseNewOutputPath(vscode).then((event) => {
browseNewOutputPath(outputPath, vscode).then((event) => {
const message = event.data;
if (message.payload !== null && message.payload.outputPath !== undefined) {
dispatch(setOutputPathAction(message.payload.outputPath));
Expand Down
5 changes: 4 additions & 1 deletion src/client/src/utils/extensionService/extensionService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,15 @@ const getOutputPathFromConfig = (vscode: IVSCodeObject): Promise<any> => {
);
};

const browseNewOutputPath = (vscode: IVSCodeObject): Promise<any> => {
const browseNewOutputPath = (outputPath: string, vscode: IVSCodeObject): Promise<any> => {
return postMessageAsync(
EXTENSION_COMMANDS.BROWSE_NEW_OUTPUT_PATH,
{
module: EXTENSION_MODULES.DEFAULTS,
command: EXTENSION_COMMANDS.BROWSE_NEW_OUTPUT_PATH,
payload: {
outputPath,
},
},
vscode
);
Expand Down
11 changes: 9 additions & 2 deletions src/extension/src/client-modules/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,15 @@ export class Defaults extends WizardServant {
};
}

public async browseNewOutputPath(): Promise<IPayloadResponse> {
const openDialogConfig = { canSelectFiles: false, canSelectFolders: true, canSelectMany: false };
public async browseNewOutputPath(message: any): Promise<IPayloadResponse> {
const currentLocation = vscode.Uri.file(message.payload.outputPath ?? this.getDefaultProjectPath());
const openDialogConfig = {
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false,
defaultUri: currentLocation,
};

return vscode.window.showOpenDialog(openDialogConfig).then((response) => {
const outputPath = this.getOutputPath(response);
return {
Expand Down