Repository navigation
fix(editor): highlight scoped dotenv filenames on desktop and mobile - #22416
Conversation
Co-authored-by: willydallas <willy.dallas@pm.me> Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
…28-dotenv-highlighting
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughDesktop and mobile language detection now map Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The scoped dotenv highlighting change appears ready to merge after normal checks; no actionable merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Dotenv fallback (desktop) —
detectLanguagenow falls back toiniwhen the lowercased basename is.envor starts with.env., after exact-filename and extension lookups. - Dotenv fallback (mobile) —
detectMobileFileLanguagegains the identical fallback, preservingpreferredLanguageprecedence. - Desktop tests — a 26-case
it.eachtable covering scoped names, case variants, Windows/UNC paths, extension precedence, and non-dotenv near-misses. - Mobile tests — the same detection table plus an end-to-end proof that the
inigrammar highlights file and diff content.
The precedence contract holds: .env.sh → shell, .env.json → json, .env.local.ts → typescript, .env/CMakeLists.txt → cmake, and non-dotenv names (.envrc, .environment, dev.env, other.env.local, ..env.local) stay plaintext. .ini was already a live language id on desktop, and ini is in lowlight's common bundle, so no grammar registration is needed. The tests pin exact values rather than loose assertions, so they would have failed before the fallback existed.
I verified desktop tests pass locally (42) and independently confirmed lowlight's ini grammar emits the asserted comment/variable/string kinds. Mobile tests could not be run in this sandbox because mobile/node_modules is absent (expo/tsconfig.base.json unresolved), but the detection table was traced by hand against the extname semantics and matches.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…/external-13028-dotenv-highlighting
|
Main has now landed the same 4216-module census repair in #22430 ( Resolve by retaining the landed census file and preserving the four-file dotenv highlighting change; the measured module graph is unchanged. The independent census repair no longer needs to appear in this PR's diff. |

ELI5
Environment files such as
.env.stagingand.env.functions.localnow receive syntax colors on desktop and mobile.What Changed
Add a basename fallback for
.envand.env.*to the existing INI grammar in both language detectors. Exact names, known final extensions (for example.env.sh) and mobile language preferences retain priority.Why
The existing four-name allowlist misses deployment-specific names. A fallback reuses both existing detectors and grammars without broadening
*.envor adding another shared detection layer. Adapted from @WillyDallas in #13029 and @innocarpe in #13239; both receive commit attribution.Linked Issue
Fixes #13028.
Visual Proof
Real hidden macOS file editor before/after, captured on baseline
da1c322b000with this same fallback during the prior validation pass. Cropped to exclude local paths. Desktop file and diff behavior and headless mobile component rendering were also checked; the mobile capture used synthetic component props, not a device or runtime connection.Testing
Current-base detector tests: 42 desktop and 37 mobile pass. Renderer types and changed-code quality pass. Mobile production types pass. Earlier hidden desktop and headless mobile file/diff checks passed; broad mobile test types retain 484 baseline-identical diagnostics.
The earlier RPC recording pin failure was fixed upstream in #22407. This branch includes that upstream repair; all 79 focused desktop/mobile tests and changed-code quality pass after that merge, and full-history CI passed the RPC pin gate. No recording corpus pin or golden was edited by this PR.
The mobile bundle CI exposed an inherited stale module-count assertion: branch and exact base both measured 4,216 modules (1,030 local) with identical module lists. Upstream #22430 has now landed the same census repair. This branch includes main at
293c2508fcd, retains the upstream census, and changes only the four intended dotenv files. The dotenv files are unchanged by this merge. At389e98a2f7b7, both PR Checks and Mobile Checks passed, including their separate verification aggregates; 79 detector tests, five closure tests and changed-code quality also passed locally after the merge.Review
Reviewed filename/extension precedence, case variants, Windows and POSIX path boundaries, language-preference priority and desktop/mobile agreement. The test cases are placed separately from the independent Apex and ABAP changes so they can merge in any order.
Agent skill upstream boundary
Notes
Local validation did not include native Windows/Linux, live SSH, a native mobile device, the full suite or release packaging. CI provides the broader tests and packaging coverage recorded above. File transport, host selection, Git providers and remote wire behavior are unchanged.
Checklist