-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
14 changed files
with
319 additions
and
115 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,11 @@ | ||
{ | ||
"lightning_open_component_title": "SFDX: Open Lightning Component", | ||
"lightning_explorer_title": "Lightning Explorer", | ||
"feature_previews_title": "Salesforce Feature Previews", | ||
"lightning_preferences": "Salesforce Lightning", | ||
"lightning_explorer_name": "Lightning Components", | ||
"show_lightning_explorer_description": "Show the lightning explorer view" | ||
"show_lightning_explorer_description": "Preview Feature: Show the Lightning Explorer View", | ||
"activation_mode_description": "Configures when the Aura and LWC language servers (LSPs) should be active (requires restart)", | ||
"activation_mode_always_on": "Lighning LSPs will always be activate, regardless of vscode workspace structure", | ||
"activation_mode_autodetect": "Lighning LSPs will only become active if a valid vscode workspace is detected", | ||
"activation_mode_off": "Lighning LSPs will never be activated" | ||
} |
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
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
Oops, something went wrong.