I wrote my first Leo plugin: python_auto_imports. It works for me --- but there is still a lot of work to be done before it can be shared.
My question is: What is the best place to discuss the different aspects of the work and to keep the work itself?
(A) Do the work in private until we have some project that can be integrated and used by others.
(B) "Work in the open" --- discuss the design choices with anyone interested, share the work-in-progress code in github and release it to the official Leo source when it's ready.
For option (B), there may be different appropriate locations for the different parts of the work:
(1) Motivation and normal UX design/documentation.
(2) UX design/documentation for error reporting and user choices --- integration with pylint and other error detection extensions.
(3) Technical integration with the Leo sources.
(1) Motivation and normal UX design/documentation:
In order for other people to use the plugin, I need to clearly motivate it and explain how to use it.
For most parts, the `import` statements in python are trivial -- but for some case (e.g. import cycles and import side-effects), things can become complicated. These problems need to be discovered and discussed.
For documentation, I believe a simple LeoVue page could collect all the relevant information. For discussion we may either continue in this e-mail thread or create a github issue in the leo-editor repository for this extension.
(2) UX design/documentation for user choices and error reporting --- fix-errors and pyflakes integration:
Instead of copying the UI/UX of the automatic imports from PyCharm (that opens modal input windows whenever the user needs to make a choice), I want to create a UX that lives inside the Leo outline. This same UX will integrate with other features that can detect errors and warnings about the project currently edited -- e.g. pyflakes and capturing stack traces from test exceptions.
Here is the idea: You define all choices as configurations (e.g. with @auto-import nodes) in the outline of your project. It's OK not to create any such configuration at the outset. This will simply trigger errors --- to be fixed with `fix-errors`.
The fix-errors command works similar to the cfa command: it populates a 'fix-errors' node at the bottom of the outline with explanations of any detected errors/warnings, suggestions of corrections and clones of the offending source nodes. These child nodes will be organized into an easy-to navigate tree so that you can quickly get to the action that you want to perform to resolve the problem.
For example, you may see just two direct children of the `fix-errors` node: One exception trace (showing just the message of the exception) and one node titled '4 auto-import problems'.
By expanding the first child (exceptions) -- you would see the code lines of the exception stack trace that are appear as clones of the actual sources of these lines. Just with the cursor keys, you can flip through these code nodes until you find the problem and fix it on the spot.
Alternatively, you could expand the node '4 auto-import problems' -- which has four children. One for each discovered problem. By expanding one of these problems, you will see the relevant problem information --- and children with suggested solutions (e.g. imports from external libraries). If we have more information about a suggestion, we can add as sub-children to each option. Hence, just with your cursor keys you can investigate all problems, suggested solutions --- and solve the problem on the spot.
This fix-errors extension is a project by itself --- and should be documented in a separate project page and discussed in a separate e-mail thread or in a separate github issue.
(3) Technical integration with the Leo sources:
Currently, my plugin is a hack. I just started to play with Leo a few days ago and needed some solution quickly to continue with my main day job (with Leo). Very likely, I will need to change the current Leo source to add hooks that my extensions can connect to.
For coding we have two choices: Either work on feature branches inside the leo-editor repository or to clone this repository and send pull requests from this external copy.
What are your preferences for these choices?
Yaakov