Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.

Commit 2d285a5

Browse files
change to allow chose any feature or experiment and get variables from it
1 parent 1e781c1 commit 2d285a5

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

optimizely-0.0.1.vsix

346 Bytes
Binary file not shown.

src/providers.ts

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -102,29 +102,19 @@ export function register(ctx: vscode.ExtensionContext, optimizelyService: Optimi
102102
return;
103103
}
104104

105-
if (!optimizelyService.isValid()) {
106-
vscode.window.showErrorMessage('[Optimizely] sdkKey is not set.');
107-
return;
108-
}
109-
110-
let linePrefix = editor.document.lineAt(selection.anchor).text.substring(0, selection.anchor.character);
111-
112-
var method = "experiment";
113-
114-
console.log(linePrefix);
115-
116-
if (isFeatureApi(linePrefix)) {
117-
method = "flag";
118-
}
119-
120105
var list = []
121106
try {
122-
if (method == "flag") {
107+
if (optimizelyService.getFeatureFlag(word) != null) {
123108
list = optimizelyService.allFeatureVariables(word, 'all')
124109
}
125-
else {
110+
else if (optimizelyService.getExperiment(word) != null){
126111
list = optimizelyService.allExperimentVariables(word)
127112
}
113+
else {
114+
vscode.window.showErrorMessage(
115+
'[Optimizely] Error retrieving keyword (current cursor position is not a feature flag or experiment).',
116+
);
117+
}
128118
} catch (err) {
129119
let errMsg = `Encountered an unexpected error opening ${word}`;
130120
console.error(err);

0 commit comments

Comments
 (0)