platformio / platformio-atom-ide

PlatformIO IDE for Atom: The next generation integrated development environment for IoT
https://atom.io/packages/platformio-ide
Apache License 2.0
476 stars 71 forks source link

Separate platformio atom installation #158

Open ncolomer opened 8 years ago

ncolomer commented 8 years ago

I'm using atom as my primary text editor for my every-day work, which has no relation to neither platformio nor electronics in general. When you install platformio package on an existing atom install, it just swaps the default UI, which is basically quite annoying since I only need platformio stuff when I do work on my personal projects.

It would be cool to have a separate and independent install of Platformio IDE. Do you think this to be possible? Cause I didn't find anything close on the internet.

ivankravets commented 8 years ago

Please go to Atom > Settings > Packages > Community Packages. Find here platformio-ide and click on "Disable". Restart Atom.

If you need enable PlatformIO IDE again, click "Enable" on plugin :)

ncolomer commented 8 years ago

Already known the procedure but will be useful for future readers.

That's precisely what I wanted to avoid in this feature request (go to settings, find and disable the plugin + restart) since I already have intensive use of Atom in my everyday work and moreover don't wan't to mess my personal plugins / GUIs with platformio ones.

But I imagine (and understand) this to be far from current priorities ;)

fabianDadada commented 7 years ago

This is thread is a bit older - but this might be helpful for other people:

I just had the same problem. My solution is to start atom with a different config folder just for PlatformIO. Check this: https://github.com/atom/atom/pull/5385

But it seems like you should not run those at the same time.

thearduinoguy commented 7 years ago

I have done the above but then the HOME tab goes missing so I have no way to create a new Python project. Nothing in FILE to create a new project for Python either.

fabianDadada commented 7 years ago

Hey! For me this works: Open command palette (Ctrl+Shift+P), type "platformio ide: home screen", enter

janstuemmel commented 7 years ago

if youre on a unix like system, simply do an bash alias:

# the editor
alias platformio-ide='ATOM_HOME=$HOME/.platformio-ide atom $@'
# the package manager
alias piopm='ATOM_HOME=$HOME/.platformio-ide apm $@'

(add this to ~/.basrc to make it permanent)

But it seems like you should not run those at the same time.

That's true, but you can download compiled atom, put into something like /opt/platformio-ide and than:

alias platformio-ide='ATOM_HOME=$HOME/.platformio-ide /opt/platformio-ide/atom $@'

... now you can run those two editors at the same time

fabianDadada commented 7 years ago

cool, thanks for sharing!

janstuemmel commented 7 years ago

in addition, for my personal use i just created a platformio-ide.desktop file within /usr/share/applications with following contents:

[Desktop Entry]
Name=PlatformIO
GenericName=Text Editor
Exec=env ATOM_HOME=.platformio-ide /opt/platformio-ide/atom %F
Icon=atom
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;TextEditor;Development;
MimeType=text/plain;

i rarely use PlatformIO, so i dont need the command line tools in my PATH, a .desktop file is enough for me, but you can use it anyway with the above mentioned aliases

ivankravets commented 7 years ago

I reopen this issue, it is useful for others. Also, I think we can gather all solutions and move them to docs.

janstuemmel commented 7 years ago

a more complete solution would be to build a portable version of atom editor with everything already installed. Could be done with a simple sh script:

#!/bin/bash

# builds platformIO IDE portable on debian based machines
# usage: ./install.sh v1.14.4

# add dirs
mkdir -p PlatformIO && cd PlatformIO &&

# downloads compiled atom by version or exits on 404
(wget https://github.com/atom/atom/releases/download/$1/atom-amd64.tar.gz ||
  (echo "No matching version found" && exit 1) ) &&

# extract
tar xzvf atom-amd64.tar.gz &&

# delete archive
rm *.tar.gz &&

# rename
mv atom-* atom &&

# add config folder
mkdir config &&

# add sh wrapper files
echo '#!/bin/bash' >> platformio-ide.sh &&
echo 'ATOM_HOME=$(dirname $(readlink -f $0))/config $(dirname $(readlink -f $0))/atom/atom $@' >> platformio-ide.sh &&
chmod +x platformio-ide.sh &&

echo '#!/bin/bash' >> piopm.sh &&
echo 'ATOM_HOME=$(dirname $(readlink -f $0))/config $(dirname $(readlink -f $0))/atom/resources/app/apm/bin/apm $@' >> piopm.sh &&
chmod +x piopm.sh &&

# install platformio
./piopm.sh install platformio-ide

my gist to that script

... after that you have following directory structure:

.
├── install.sh
└── PlatformIO
    ├── atom # compiled atomsource
    ├── config # your .atom folder, normally located in your home dir
    ├── piopm.sh # atom package manager wrapper
    └── platformio-ide.sh # atom wrapper

there are a bunch of things you can do, like automate compiling for target architectures when a new version of atom arrives and for example then uploading binaries in the releases section of github... would be great benefit but requires a bunch of build scripts.

punitsoni commented 7 years ago

Do you have instructions to achieve this on Windows and Mac? Conceptually, I want to create two shortcuts, one for normal atom editor and one for platformio-ide.

janstuemmel commented 7 years ago

i do not have windows, but try downloading the windows.zip from atom/releases. Unpack it and start the Exe, should be a portable. After this you can install the platform-ide package. Maybe you have to change the ATOM_HOME envvar.

I found an example BATFile here: https://gist.github.com/GGG-KILLER/2851d305302945f69530

zeroby0 commented 7 years ago

Did anybody figure out a complete working method for macOS?

Thanks.

janstuemmel commented 7 years ago

please read the suggestions above, try to compile the sources on your own, then open that application over the terminal and add the ATOM_HOME envar

tripflex commented 7 years ago

I went ahead and created a custom application that will launch Atom using ~/.platformio-ide as ATOM_HOME value, you can find it here: https://github.com/tripflex/platformio-atom-osx

If anybody can take a look at the script file and let me know if they have any thoughts or suggestions on how to make it better?

https://github.com/tripflex/platformio-atom-osx/blob/master/PlatformIO.sh

What would be the ultimate setup is if we could have two separate instances of Atom running, one for PlatformIO and one for Atom ... but unfortunately right now in my tests it seems if Atom is already open, for some reason calling a new instance does not respect the ATOM_HOME being set by my launcher application.

ivankravets commented 7 years ago

@tripflex Thanks a lot for your work!

I think we can dynamically "Turn Off/On" PlatformIO IDE plugin depending on the opened projects. If we see "platformio.ini" in a project, we will enable the plugin.

Will that work for you?

janstuemmel commented 7 years ago

I think we can dynamically "Turn Off/On" PlatformIO IDE plugin depending on the opened projects. If we see "platformio.ini" in a project, we will enable the plugin.

Will that work for you?

bad idea when you have opened several projects on your workspace, thats why he created platform-atom-ide, so seperate applications for two seperate concerns

tripflex commented 7 years ago

@ivankravets no problem, i'm sure as I get to understand how Atom works behind the scenes more when it comes to env vars and configuration I can start adding some more features, but wanted to at least get something simple out for now.

Regarding the platformio.ini file, I agree with @janstuemmel ... I use Atom as my daily driver for basic code/text editing (when don't need full blown jetbrains IDE), and love the PlatformIO integration ... but would rather have them separated.

My normal Atom install has a bunch of packages that I would never need in PlatformIO, as well as vice versa, numerous packages used in PlatformIO not used in my normal Atom usage ... and as such, I like having a completely separate setup and configuration for both 😄 Including the situations mentioned by @janstuemmel where i'm working on multiple projects at once 😛

I first thought about integrating Atom build from source, but for now kept it simple and use the existing Atom install (so Atom upgrades are only required once) ... maybe later on can look at possibly build from source, but for now this workaround works nicely for me 👍

janstuemmel commented 7 years ago

@tripflex consider linking this issue in your projects readme file