-
Notifications
You must be signed in to change notification settings - Fork 4
feat: Add getAllFeatureVariables to auto-complete #12
feat: Add getAllFeatureVariables to auto-complete #12
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
bdfcac5
to
4b5d597
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few things:
- 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.
- The getAllFeatureVariables test should be with isFeatureEnabled tests as there is no feature variable.
- 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\([\'\"]$/ |
There was a problem hiding this comment.
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') { |
There was a problem hiding this comment.
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(' |
There was a problem hiding this comment.
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(\'') |
There was a problem hiding this comment.
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
90389d9
to
f669177
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Summary
getAllFeatureVariables
to auto-complete