-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
async startup / fixes settings.json being overwritten / fixes #1210
- Loading branch information
Showing
10 changed files
with
185 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
{ | ||
"lightning_open_component_title": "SFDX: Open Lightning Component", | ||
"lightning_explorer_title": "Lightning Explorer", | ||
"feature_previews_title": "Salesforce Feature Previews", | ||
"feature_previews_title": "Salesforce Lightning ", | ||
"lightning_explorer_name": "Lightning Components", | ||
"show_lightning_explorer_description": "Show the lightning explorer view" | ||
"show_lightning_explorer_description": "Show the lightning explorer view", | ||
"debug_mode_description": "Activate debug mode", | ||
"activation_mode_description": "When the language server should be activated" | ||
} |
53 changes: 53 additions & 0 deletions
53
packages/salesforcedx-vscode-lightning/src/dxsupport/waitForDX.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) 2019, salesforce.com, inc. | ||
* All rights reserved. | ||
* Licensed under the BSD 3-Clause license. | ||
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause | ||
*/ | ||
import * as vscode from 'vscode'; | ||
|
||
let wait: Promise<vscode.Extension<any>>; | ||
|
||
export async function waitForDX(activate: boolean = false) { | ||
if (!wait) { | ||
wait = new Promise((resolve, reject) => { | ||
// 120 seconds from now | ||
const expires = new Date().getTime() + 1000 * 120; | ||
const dosetup = () => { | ||
let success = false; | ||
try { | ||
const coreDependency = vscode.extensions.getExtension( | ||
'salesforce.salesforcedx-vscode-core' | ||
); | ||
if (coreDependency && !coreDependency.isActive && activate) { | ||
return coreDependency.activate().then(api => { | ||
resolve( | ||
vscode.extensions.getExtension( | ||
'salesforce.salesforcedx-vscode-core' | ||
) | ||
); | ||
}); | ||
} | ||
if (coreDependency && coreDependency.exports) { | ||
success = true; | ||
resolve(coreDependency); | ||
} | ||
} catch (ignore) { | ||
// ignore | ||
} | ||
if (!success) { | ||
if (new Date().getTime() > expires) { | ||
const msg = | ||
'salesforce.salesforcedx-vscode-core not installed or activated, some features unavailable'; | ||
console.log(msg); | ||
reject(msg); | ||
} else { | ||
setTimeout(dosetup, 100); | ||
} | ||
} | ||
}; | ||
setTimeout(dosetup, 100); | ||
}); | ||
} | ||
return wait; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters