ZachMassia / PlatformIO-Mode

PlatformIO Integration for Emacs
GNU General Public License v3.0
68 stars 20 forks source link

Warn users if they're not in a projectile project #16

Closed dantecatalfamo closed 3 years ago

dantecatalfamo commented 3 years ago

Currently if users aren't in a projectile project and try to run a platformio command, they receive a cryptic error about an argument not being stringp.

tmp 2021-04-22 14-19-32

Instead now they will get a more helpful message telling them they're not in a projectile project.

tmp 2021-04-22 14-21-20
ZachMassia commented 3 years ago

Looks good to me. Don't see any reason not to have better error messages.

I'm curious though, did you run in to a situation where platformio-mode was enabled when it shouldn't?

It's been a while now, but looking through everything it seems that platformio-conditionally-enable should prevent this.

dantecatalfamo commented 3 years ago

I found that projectile-verify-file will check for a file in the current directory even if it's not a "project". You can end up in a situation where platformio.ini exists in your current directory so platformio-mode gets enabled, but projectile-project-root still returns nil, resulting in an error whenever you try to run a command.

dantecatalfamo commented 3 years ago

It's not likely to happen since you don't edit c++ files in the root of a PlatformIO, but who knows ¯_(ツ)_/¯.

I found the error when I enabled platformio-mode manually in a PlatformIO project I thought was version controlled and I had no idea what was going wrong when I got the stringp error haha