Dotenv file was recognized as ini file

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

dotenv file was recognized as ini file then comment shortcut not working.
currently use extension DotENV to resovle problem

Steps to Reproduce

create a .env file and add a variable.

Expected Behavior

recognized as dotenv file?

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 3.11.13
VS Code Extension API: 1.125.0
Commit: 3f21b08f0b436a07be29fbfe00b304fa15553350
Date: 2026-07-10T01:45:28.254Z
Layout: IDE
Build Type: Stable
Release Track: Default
Electron: 40.10.3
Chromium: 144.0.7559.236
Node.js: 24.15.0
V8: 14.4.258.32-electron.0
xterm.js: 6.1.0-beta.256
OS: Darwin arm64 25.5.0

Does this stop you from using Cursor

Sometimes - I can sometimes use Cursor

Hey, thanks for the report. This isn’t exactly a bug, it’s behavior inherited from VS Code. Cursor doesn’t have a native language mode for .env, so the file opens as Plain Text, then automatic language detection guesses ini or Properties based on KEY=VALUE content. In ini, the comment character is ;, so Cmd+/ inserts ; instead of #.

The approach you already found with the mikestead.dotenv extension is the right one. It registers .env as its own language with # comments.

A couple alternatives without an extension, in case it helps:

  • Add a settings association to properties, it also uses # for comments:
    "files.associations": { "*.env": "properties" }
    
  • Or disable auto language detection so it won’t guess ini:
    "workbench.editor.languageDetection": false
    

This same issue was discussed here: ">Toggle Comment" command uses improper syntax in `.env` files. It includes the properties workaround. Let me know if any of this doesn’t work.