Skip to content
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

Support highlighting of hyphenated environment variables #211

Closed
salittle0 opened this issue Aug 9, 2024 · 1 comment
Closed

Support highlighting of hyphenated environment variables #211

salittle0 opened this issue Aug 9, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@salittle0
Copy link

Environment variables with a hyphenated name are injected into requests correctly, but they aren't highlighted/resolved on-hover in the UI. I assume this is a bug because of the mismatch in injection/highlighting behaviour, but it could be a feature request.

As an example, if you have the environment file

{
    "my_key": "underscore",
    "my-key": "hyphen"
}

Then a request using both environment variables correctly highlights the one with the underscore only.
restfox-2

I'm not very familiar with this code/what it's built with, but it might be enough to update the regex in codemirror-extensions.ts to include a hyphen

// current
export const variableMatchingRegex = /{{ ([.|\w]*?) }}|{{([.|\w]*?)}}/g

// new
export const variableMatchingRegex = /{{ ([-.|\w]*?) }}|{{([-.|\w]*?)}}/g

Side note: the current regex specifically includes the vertical bar (|), so an environment variable such as my|key would inject/highlight correctly.

@flawiddsouza flawiddsouza added the bug Something isn't working label Aug 9, 2024
@flawiddsouza
Copy link
Owner

Hi, this looks like a bug since the substitution behavior doesn't match the highlighting. Will fix this soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants