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

feat: Add getAllFeatureVariables to auto-complete #12

Conversation

yavorona
Copy link
Contributor

Summary

  • Add getAllFeatureVariables to auto-complete

@yavorona yavorona self-assigned this Aug 19, 2020
@yavorona yavorona removed their assignment Sep 11, 2020
Copy link
Contributor

@thomaszurkan-optimizely thomaszurkan-optimizely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yavorona yavorona force-pushed the pnguen/add-getAllFeatureVariables-to-auto-complete branch from bdfcac5 to 4b5d597 Compare October 6, 2020 19:25
Copy link
Contributor

@thomaszurkan-optimizely thomaszurkan-optimizely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things:

  1. I am running test (you can debug the project just by running it in debug from vscode and then opening another project you want to test with. The getAllFeatureVariables does not auto-complete on the feature key.
  2. The getAllFeatureVariables test should be with isFeatureEnabled tests as there is no feature variable.
  3. Can we add getAllFeatureVariables to the debug dialog as well?

src/providers.ts Outdated
@@ -30,6 +30,7 @@ export const OP_MODE_JS: vscode.DocumentFilter = {
};

const REGEX = /.*\.getFeatureVariable\([\'\"][a-zA-Z0-9\_\-]+[\',\"], ?[\'\"]$/
const REGEX_A = /.*\.getAllFeatureVariables\([\'\"]$/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here. Is it here for testing?

src/providers.ts Outdated
@@ -439,6 +442,9 @@ export function getFeatureRegEx(reg:string): RegExp {
if (reg == 'getFeatureVariableJSON') {
return REGEX_J
}
if (reg == 'getAllFeatureVariables') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the regex is used for the second parameter of feature calls. There is no second parameter on getAllFeatureVariables.

test/test.txt Outdated
@@ -10,3 +10,5 @@ something.getFeatureVariableBoolean('someFlagKey', '
something.getFeatureVariableBoolean("someFlagKey", "
something.getFeatureVariableJSON('someFlagKey', '
something.getFeatureVariableJSON("someFlagKey", "
something.getAllFeatureVariables('
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these tests should be removed.

@@ -401,6 +402,8 @@ const isFeatureApi = (linePrefix:string): boolean => {
|| linePrefix.endsWith('getFeatureVariableBoolean(\"')
|| linePrefix.endsWith('getFeatureVariableJSON(\'')
|| linePrefix.endsWith('getFeatureVariableJSON(\"')
|| linePrefix.endsWith('getAllFeatureVariables(\'')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this and the tests that you have that are not in test.txt

@yavorona yavorona force-pushed the pnguen/add-getAllFeatureVariables-to-auto-complete branch from 90389d9 to f669177 Compare October 6, 2020 21:04
Copy link
Contributor

@thomaszurkan-optimizely thomaszurkan-optimizely left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@thomaszurkan-optimizely thomaszurkan-optimizely merged commit e0f2930 into master Oct 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants