JetBrains / idea-php-dotenv-plugin

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

Strange Highlighting? #114

Closed iwasherefirst2 closed 1 year ago

iwasherefirst2 commented 1 year ago

Inside my .env file, some values are highlighted green, is that supposed to be like that?

Ubuntu 20.04 Phpstorm 2022.3.1 .env files support plugin 2022.3

image

adelf commented 1 year ago

Yes, it's ok. Hover the mouse and it will show the warning about "duplicate keys"

iwasherefirst2 commented 1 year ago

Ah. thank you! :)

So for anyone who wants to disable this highlighting, you can do in settings:

image

Also if I have more then one whiteline, this gets a warning, not sure how to disable that warning.

adelf commented 1 year ago

The warning is useful since there is no sense to have duplicate keys in one file :)

All inspections are there. If you don't like the inspection, you can click Option(Alt)-Enter on them, then disable it or go to the settings:

image
iwasherefirst2 commented 1 year ago

The warning is useful since there is no sense to have duplicate keys in one file :)

It makes sense sometimes if you constantly need to switch forth and back between multiple envs settings. For example, sometimes I want to connect locally to local db, to staging db, or to prod db, and I just need to move the env variables to activate the right one. Have not found a more convenient way to quickly switch databases.

marcelhillesheim commented 1 year ago

@iwasherefirst2 Okay, thats a good use case. But is the annotation really that annoying? Would you keep it enabled, if only the second duplicated entry is marked? Would add the benefit that you would instantly know which declaration is currently used. Also if the .env is bigger and some months passed, you might not remember that there are duplicated keys and edit the second or third entry. And: if you disable this annotation, there might be other .env files where you dont want duplicated keys/accidently duplicate keys and now the plugin doesnt warn you.

Another suggstion to make it less annoying: only mark the keyword.