*My notes from getting vscode and Leointeg working today. Both tools are 
completely new to me.*

Chocolatey and Miniconda/Anaconda setup recipe for leointeg, a plugin to 
enable Visual Studio Code to use Leo Editor as an engine for working with 
outlines and nodes and clones.  

 

Starting point: a Win10 admin command prompt with Chocolatey installer, 
Conda, and Git in PATH.  I pinned python to 3.6 as that is Leo's current 
minimum python version. Adjust to suit your preference.

 

Admin prompt

 

:: Install Visual Studio Code & python support, Node.js

choco install vscode vscode-python nodejs

 

Normal command prompt:

 

:: Create anaconda environment for Leo & Leo-integ

conda create -n vscode-leo

conda activate vscode-leo

conda install python=3.6

 

:: Install Leo & dependencies

pushd code

pip install --editor .\leo-editor

 

:: Install Leointeg python dependencies

pip install websockets

 

:: Install Leointeg & Node.js dependencies

git clone https://github.com/boltex/leointeg

cd leointeg

npm install

npm audit fix

 

Run vscode

 

Open Folder >> path\to\leointeg

"This workspace has extension recommendations" >> Install All

 

Open command pallete [Ctrl-Shift-P]

   - type "select inter" and chose "Python: Select interpreter" from the 
   list. Status bar will indicate search for and caching of python 
   environments, followed by list of conda environments. >> Choose the 
   leointeg one, e.g.

 

c:\tools\miniconda3\envs\vscode-leo\python.exe

 

   - Using same technique, change 'Default Terminal' to Command Prompt 
   instead of Powershell. (Apparently if you use Powershell there's more 
   manual things to do.)

 

Run Extension 

   - [Ctrl-Shift-D] to open debugger side panel, then
   - Press play button (right pointing green triangle) - [F5]

 

Vscode will open a new window in foreground. The background vscode window 
should have a highlighted bottom status bar and show the leointeg conda 
python environment.

  

The foreground window should be titled "Extension Development Host". From 
it Open Folder and point to your Leo stuff. A "Welcome to Leointeg" page 
opens.
 

Switch back to the original vscode window. Open a terminal in vscode 
[Ctrl-Shift-`] and start the leobridge server manually.

 

python leobridgeserver.py

 

Now switch to the dev host and in left hand menu >> Leo Integration >> 
[Connect to Server].

 

When connection is established an [Open Leo File] button should replace 
[Connect to Server].

 

….

 

*When things don't work, look to the [Debug Console] panel in the original 
Vscode window. *

 

*What seems to be needed in every new vscode session:*

 

   1. *Selecting the python interpreter*
   2. *Running "python leobridgsever.py" *

 

*I'm confident there's a way to automate this, somewhere.*

 

 

Sources

   - How to run the Leointeg extension: 
   https://github.com/boltex/leointeg/blob/master/CONTRIBUTING.md
   - Setting and using Python environments in Vscode: 
   https://code.visualstudio.com/docs/python/environments

 

 

 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ea7c35d9-9bc7-4275-8e29-d3e1db3026fbo%40googlegroups.com.

Reply via email to