-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open code in local editor #28
Comments
Possibly supplants VizierDB/web-ui#92 |
A fourth option would be to create a script that runs locally and does the same thing as option 1. Register this script with a URL handler (OSX and Linux both support this) and have it talk to the API. |
I wonder if there's a Chrome/Firefox plugin that lets you edit the content of a text field in a text editor. |
Alternatively, we use flask to implement a really really simple webdav server. That might not actually be all that hard. |
I'm going to simplify the goals here a little bit and focus exclusively on getting this implemented for use in the desktop version. |
For this to work, we need a way to signal the UI that code is being edited/updated. That pretty much means websockets (#59 ). Deferring this feature until later. |
@okennedy Question: When does the file watcher/ agent stop watching the file for changes? Is it when the file is closed by the user or shall we have put some TTL or both? |
This is a good question. I don't have a great answer. Even if it is a temporary directory, you can't assume that it will get cleaned out with any frequency. This is a somewhat common pattern for [S]FTP editor support (e.g., SublimeText's FTP plugin, CyberDuck). I would suggest doing some market research to see what options are used, and what their tradeoffs are. |
A prototype of this issue was implemented by a 611 team. Thanks to Aniruddha Thaksen Parvat, Nikhil Naresh Vatwani, Paramveer Singh, @sakshi-mehra , Soma Naga Venkata Sai Anvesh Motamarri, and Sphoorthi Keshannagari. The prototype is in 4 parts:
The central component is an agent deployed on the client's machine (this could be integrated into the backend server for Vizier desktop) that is responsible for opening an editor and monitoring the edited file for changes. When the file contents change, the agent performs a cell update on the relevant cell. Notably, the agent uses a URL scheme to communicate with the UI (probably move this to the Websocket in the desktop version), which is nice, since the agent doesn't need to be running to work. Supporting MyPyOne of the goals of the project was to be able to use automatic code completion, type linting, etc...
There are a few limitations:
Further Design Considerations
|
…d for different chart types, need to have currentState send to backend
…enu Object, css class changes per each editor
…d for different chart types, need to have currentState send to backend
…he datasets, Drop 'sort' dropdown from the scatterplot and CDF
…(dataset * ys * categories), Add a category dropdown
…ier-scala into #28-Edit-Chart-Menu
Currently code editing has to happen in the notebook itself. This is cumbersome for large files and user-hostile.
Suggestion: Add a feature to open code in a local editor.
Desiderata
(in decreasing-order of value)
Implementation Strategies
Create and monitor a temp file.
Dump the cell script to something like
/tmp/[xxxxxxx].py
and useopen
(OSX) orxdg-open
(Linux) to open the script in the user's preferred editor. Monitor the script file for edits (e.g., polling or using inode watchers or something similar) and re-run the notebook whenever an edit is saved. This is simple and easy to pull off, but only works on local Vizier instances.WebDAV
Have the server expose a WEBDAV filesystem listing available notebooks, with a file per (script) cell. The difficulty here is that right now module identifiers are versioned. That means the filename would change with every iteration. For this to work, we'd need a new "version independent" identifier in addition to the version.
The advantage is that this would work regardless of whether we're running desktop or server vizier, but doesn't give us a neat 'open' button on the UI.
FUSE
Like WebDAV, but use FUSE. This provides more reliable edit detection and client-side experience, but requires users to install fuse and a client-side app. With this requiring a client, however, an 'open' button would be possible.
The text was updated successfully, but these errors were encountered: