Platformio-vscode-ide: Only activate extension when intending to use PlatformIO

Created on 1 Jan 2018  Â·  13Comments  Â·  Source: platformio/platformio-vscode-ide

Currently, the extension always activates and in many ways "takes over" the editor whenever you load it, even if you aren't working on a PlatformIO project: attempts to check for updates, adds status bar items, creates files in your working directory (!!!), etc.

Can the behavior be changed to only activate the extension when it's needed? Currently, package.json defines activationEvents to be *, meaning "always active". The more surgical approach would be to activate when a command is run and/or when platformio.ini is present.

This would partially help #64 as well, although the better solution for that would be to not dump the whole PATH into an otherwise SCM-able settings file.

enhancement

All 13 comments

I agree, only if the ini is present. Can you have a project file that is opened?

Littering .vscode/settings.json changes in every project directory needs to stop. I use VScode for the rest of my development work. Thanks!

Editing ~/.vscode/extensions/platformio.platformio-ide-0.10.0/package.json to:

"activationEvents": [
    "workspaceContains:platformio.ini"
]

fixes the problem for me. This probably requires UX adjustments to start the extensions for new projects though.

64 is related. This is a partial dupe, but includes additional requests.

@eosrei My solution has been to entirely disable the extension, and then use the "Enable (workspace)" option to only load it in the single project I use this extension in. That should be a bit easier for users to do than editing the manifest, but it doesn't fix #64 and certainly doesn't help the majority of users who suddenly have their project files messed up without understanding the cause.

@ivankravets _please_ take a look at this!

@eosrei

Littering .vscode/settings.json changes in every project directory needs to stop.

Did you disable updateTerminalPathConfiguration?

@WasabiFan

There is a big problem here. We can't depend on platformio.ini because new users will have a problem to create a new project. So, if you don't have a PlatformIO-based project, you will not see PIO Home, etc.
I think the single solution here is to create a new setting where each of you will be able to decide the behaviour of this extension. For example, activateOnlyForPlatformIOProject which will be set to false by default.

Here's my suggestion — technical note at the bottom.

  1. On first run of VSCode following extension installation, open an info message which tells the user the command to create a PlatfotmIO project. Perhaps with a button to open a help page.
  2. On all loads, only register commands initially; do not open Home, add any status bar entries, etc. _The key is to be as lightweight as possible._ Do a single check to see if platformio.ini is present in the workspace.
  3. If the user runs the PlatformIO "create" command or if the config file was discovered in the workspace, load the full extension. One command available is "deactivate" which reverts to the inactive state to unclutter the UI.

One of the big advantages of this design is that there are no settings you must discover. The extension intelligently activates when you need it and gets out of the way otherwise, for all users.

On the technical side, you'll need to retain activationEvents: * as there is no event for "first run". As long as you do absolutely nothing but register commands and a single file check, any perf penalty will be negligible.

@WasabiFan that was the initial workflow for the first versions of this extension. We were attacked by a community with a dozen of questions how to use it. This is very good that you are familiar with VSCode and use its commands, etc. 99% of our customers see VSCode first time.

We have 80K downloads for the last 6 months and only 4 developers participate in this issue. It means that current workflow works well for 99% our customers.

But! Of course, we respect our community and hear your feedback. Please update to 0.11.0 and enable activateOnlyOnPlatformIOProject option.

Did you disable updateTerminalPathConfiguration?

No, because I didn't know it was optional. Changing adding files automatically is a bug... so to the issue queue!

We have 80K downloads for the last 6 months and only 4 developers participate in this issue.

I've used the same argument myself in my projects ;) Although to be fair, this issue hasn't been open for 6 months. :laughing:

This resolution works for me.

As a newbie - this seems like the most rediculous way to act as a group I've seen in a while. I will certainly not think of contributing to PlatformIO and that hideous orange bug I am trying to suppress.

@MickPBduece this issue is fixed. Do you still experience any problems?

I did until I added a settings.jsom entry to only PIO for specific
workspaces

Thanks.

On Thu, Mar 14, 2019 at 6:48 AM Ivan Kravets notifications@github.com
wrote:

@MickPBduece https://github.com/MickPBduece this issue is fixed. Do you
still experience any problems?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/platformio/platformio-vscode-ide/issues/66#issuecomment-472819260,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Atrr0l-EeTnw_g2y8W35IY239y36qOPfks5vWjcOgaJpZM4RQAgL
.

I to have an extension conflict with Arduino. What is the settings.json entry?

add to settings.json
"platformio-ide.activateOnlyOnPlatformIOProject": true,

On Mon, Mar 18, 2019 at 5:19 AM clplaneguy notifications@github.com wrote:

I to have an extension conflict with Arduino. What is the settings.json
entry?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/platformio/platformio-vscode-ide/issues/66#issuecomment-473850947,
or mute the thread
https://github.com/notifications/unsubscribe-auth/Atrr0um8C0G8V4N6GCEEofiAMYB3qG-Tks5vX2g6gaJpZM4RQAgL
.

Was this page helpful?
0 / 5 - 0 ratings