adelf / idea-php-dotenv-plugin

environment parameters completion, based on .env file keys
MIT License
166 stars 13 forks source link

Support all .env* files #72

Closed lk77 closed 3 years ago

lk77 commented 3 years ago

Hello,

it would be great to support all .env files, like .env.testing/.env.local/.env.dusk.local etc...

i think all files starting with .env should be supported.

thanks.

adelf commented 3 years ago

Hi, Mathias. Actually, I declare 3 patterns for .env files by default:

.env
*.env
.env.*

The last one should work for you.

lk77 commented 3 years ago

Well that's strange, only .env seems to be working, i can mark it as plain text or as .env file, but i don't have the option for the others .env.* files.

The other .env.* files are all white, without highlight

if i rename my .env.testing to .env.* it works. i don't think your patterns works, they are treated as filenames, perhaps an issue with my version of phpstorm i don't know, i'm on 2020.1.2

adelf commented 3 years ago

Exactly. The Javascript plugin made a mistake in 2020.1 and replaced my mapping for .env files. They fixed it immediately.. but maybe your version is still wrong.

lk77 commented 3 years ago

ok, i will update my version then, thanks.

dahei commented 3 years ago

I have the same issue with latest PHPStorm 2021.1.1 - env.local and similar names files have no syntax highlighting. I can see the the filetype patterns, but .env.* doesn't seem to match.

Any idea where to fix this?

lk77 commented 3 years ago

Hello,

i'm now fully updated and it works for me on 2021.1.2

PhpStorm 2021.1.2
Build #PS-211.7142.44, built on April 30, 2021
dahei commented 3 years ago

Can't confirm. I am on the same PHPStorm Version and build.

Plugin version: image

.env.local still has no syntax highlighting.

adelf commented 3 years ago

@dahei what file type do you see for .env.local file(it should be shown in the right bottom corner of editor)? Text? Or?

Then, please, check Editor - File types in the Settings and find this file type. I’m sure the problem is there. “.env.*” pattern usually works if there is no any overriding.

dahei commented 3 years ago

Here are my settings and 2 example files:

image

image

adelf commented 3 years ago

@dahei could you check Text file type?

dahei commented 3 years ago

That's it!! - .env.local was explicitly set there 🤦 . I guess it happened before I installed your plugin (PHPStorm asking for file type as it couldn't know what it was). Sorry for the confusion! All fine!

lk77 commented 3 years ago

yeah, you should right click on the file and choose "Mark as '.env file'"