Skip to content

Commit

Permalink
support customize progress notificaion message
Browse files Browse the repository at this point in the history
  • Loading branch information
xjsender committed Aug 25, 2019
1 parent e51c9ad commit 7d7ba59
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"publisher": "mouseliu",
"repository": "https://github.com/xjsender/haoide-vscode",
"description": "haoide-vscode is a vscode extension for force.com development",
"version": "0.1.3",
"version": "0.1.4",
"engines": {
"vscode": "^1.35.0"
},
Expand Down
10 changes: 7 additions & 3 deletions src/commands/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ export async function updateUserLanguage() {
"serverUrl": "/sobjects/User/" + _session.getUserId(),
"data": {
"LanguageLocaleKey": chosenItem.label
}
},
"progressMessage": "Updating user language"
})
.then( body => {
vscode.window.showInformationMessage(
Expand Down Expand Up @@ -88,7 +89,8 @@ export function executeQuery() {

let restApi = new RestApi();
ProgressNotification.showProgress(restApi, "query", {
soql: soql
soql: soql,
progressMessage: "Executing query request"
})
.then( body => {
util.openNewUntitledFile(
Expand All @@ -112,7 +114,9 @@ export async function reloadSobjectCache(sobjects?: string[]) {
// If sobjects is not specified, describe global
if (!sobjects || sobjects.length === 0) {
return ProgressNotification.showProgress(
restApi, "describeGlobal", {}
restApi, "describeGlobal", {
progressMessage: "Executing describeGlobal request"
}
)
.then( body => {
let sobjectsDesc: any[] = body["sobjects"];
Expand Down
6 changes: 5 additions & 1 deletion src/commands/utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ export async function switchProject(projectName?: string) {
};
})
);
console.log(chosenItem);

// When user cancel request
if (!chosenItem) {
return;
}

projectName = chosenItem.label;
}
Expand Down
9 changes: 5 additions & 4 deletions src/salesforce/api/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export default class RestApi {

// Send notification
ProgressNotification.notify(
options.progress, `Start rest ${options.method} request...`
options.progress,
options.progressMessage ||
`Start rest ${options.method} request...`
);

request(requestOptions).then( body => {
Expand All @@ -90,7 +92,6 @@ export default class RestApi {
options.progress, `${options.method} is finished`, 100
);

console.log(body);
resolve(body);
})
.catch(err => {
Expand Down Expand Up @@ -325,11 +326,11 @@ export default class RestApi {
* @returns Promise<any>
*/
public describeGlobal(options: any) {
return this.get({
return this.get(_.extend(options, {
serverUrl: `/sobjects`,
progress: options.progress,
timeout: options.timeout || 120
});
}));
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/utils/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import * as vscode from "vscode";
export function setHasOpenProject() {
vscode.workspace.findFiles('**/session.json')
.then( files => {
console.log(files);
vscode.commands.executeCommand(
'setContext', 'haoide.hasOpenProject',
files && files.length > 0
Expand Down

0 comments on commit 7d7ba59

Please sign in to comment.