Skip to content

Improve variable detection #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

fflaten
Copy link
Contributor

@fflaten fflaten commented Jun 3, 2022

Rewritten variable detection to:

  • Validate variable names against character rules defined in about_Variables
  • Validate scope in scoped variables
  • Fix special character variable matching. Current version used greedy match that didn't stop at the correct }
  • Detect variables inside arrays, subexpression, dictionary/hashtable or variable used as dict key

Other changes:

  • Lots of variable detection tests added for better coverage
  • Moved patterns and other constants to class-level

Fix #9

@fflaten
Copy link
Contributor Author

fflaten commented Jun 3, 2022

@TylerLeonhardt Please review. Learning TS/JS as I go here 🙂

@fflaten
Copy link
Contributor Author

fflaten commented Jun 7, 2022

Remaining scopes not added as supported:

  • workflow: Ignored as it's niche and not available in cross-platform.
  • function: Would require expression, but ignored as it's usually multi-line, so not suitable.
  • Can be implemented using expression values (see Support environment variables #12)
    • Alias: Aliases defined in the current scope
    • Env: Environment variables defined in the current scope

@fflaten fflaten mentioned this pull request Jun 7, 2022
7 tasks
Copy link
Owner

@TylerLeonhardt TylerLeonhardt left a comment

Choose a reason for hiding this comment

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

Looks fantastic! Awesome work 👏

@TylerLeonhardt TylerLeonhardt merged commit 7b80144 into TylerLeonhardt:master Jun 9, 2022
@TylerLeonhardt
Copy link
Owner

This has now been published in 0.0.6

@fflaten fflaten deleted the improve-variabledetection branch June 9, 2022 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variables not detected when followed by end of collection or dictionary
2 participants