[PR #5630] [MERGED] fix: support dots/dashes in environment variable autocomplete #5287

Closed
opened 2026-03-17 02:45:00 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5630
Author: @myeonbi
Created: 11/28/2025
Status: Merged
Merged: 12/2/2025
Merged by: @jamesgeorge007

Base: patchHead: fix/env-autocomplete-regex


📝 Commits (2)

  • 042316d fix: support dot/dash in env autocomplete names
  • a361018 fix: enhance env auto-completion to handle existing closing brackets

📊 Changes

2 files changed (+32 additions, -11 deletions)

View changed files

📝 packages/hoppscotch-common/src/components.d.ts (+4 -1)
📝 packages/hoppscotch-common/src/components/smart/EnvInput.vue (+28 -10)

📄 Description

Closes #

Summary

This PR aligns the environment variable autocomplete regex with the shared pattern defined in environment-regex.ts.

Currently, environment-regex.ts defines ENV_VAR_NAME_PATTERN as [a-zA-Z0-9_.-]+, which allows dots (.) and dashes (-). However, the autocomplete logic in EnvInput.vue was using \w*, which only supports [A-Za-z0-9_]. This caused inconsistency where variables like <<client.id>> or <<client-id>> were not properly recognized in the autocomplete dropdown.

What's changed

  • Updated Regex: tagBefore and validFor regexes in EnvInput.vue now allow [A-Za-z0-9_.-].
  • Consistency: This ensures the autocomplete logic matches ENV_VAR_NAME_PATTERN from environment-regex.ts.
  • Behavior Change: - Before: Environment variables with dots or dashes (e.g., client.id) did not trigger autocomplete properly.
    • After: These variables are now correctly recognized and autocompleted.

Notes to reviewers

  • This may be related to issue #5513 (Desktop app environment recognition), as it involves similar regex inconsistencies with special characters in variable names.

Summary by cubic

Updated environment variable autocomplete to allow dots and dashes in names, matching the shared ENV_VAR_NAME_PATTERN. Tags like <<client.id>> and <> now trigger suggestions and won’t insert duplicate >> if closing brackets already exist.

Written for commit a361018fd0. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5630 **Author:** [@myeonbi](https://github.com/myeonbi) **Created:** 11/28/2025 **Status:** ✅ Merged **Merged:** 12/2/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `patch` ← **Head:** `fix/env-autocomplete-regex` --- ### 📝 Commits (2) - [`042316d`](https://github.com/hoppscotch/hoppscotch/commit/042316df5c2db1e02d4130c15c26a04a66ffa385) fix: support dot/dash in env autocomplete names - [`a361018`](https://github.com/hoppscotch/hoppscotch/commit/a361018fd072d9d54826b50eb25d81cd8d9fff01) fix: enhance env auto-completion to handle existing closing brackets ### 📊 Changes **2 files changed** (+32 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/components.d.ts` (+4 -1) 📝 `packages/hoppscotch-common/src/components/smart/EnvInput.vue` (+28 -10) </details> ### 📄 Description Closes # ### Summary This PR aligns the environment variable autocomplete regex with the shared pattern defined in `environment-regex.ts`. Currently, `environment-regex.ts` defines `ENV_VAR_NAME_PATTERN` as `[a-zA-Z0-9_.-]+`, which allows dots (`.`) and dashes (`-`). However, the autocomplete logic in `EnvInput.vue` was using `\w*`, which only supports `[A-Za-z0-9_]`. This caused inconsistency where variables like `<<client.id>>` or `<<client-id>>` were not properly recognized in the autocomplete dropdown. ### What's changed - **Updated Regex:** `tagBefore` and `validFor` regexes in `EnvInput.vue` now allow `[A-Za-z0-9_.-]`. - **Consistency:** This ensures the autocomplete logic matches `ENV_VAR_NAME_PATTERN` from `environment-regex.ts`. - **Behavior Change:** - *Before:* Environment variables with dots or dashes (e.g., `client.id`) did not trigger autocomplete properly. - *After:* These variables are now correctly recognized and autocompleted. ### Notes to reviewers - This may be related to issue #5513 (Desktop app environment recognition), as it involves similar regex inconsistencies with special characters in variable names. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Updated environment variable autocomplete to allow dots and dashes in names, matching the shared ENV_VAR_NAME_PATTERN. Tags like <<client.id>> and <<client-id>> now trigger suggestions and won’t insert duplicate >> if closing brackets already exist. <sup>Written for commit a361018fd072d9d54826b50eb25d81cd8d9fff01. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:45:00 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5287
No description provided.