diff --git a/CHANGELOG.md b/CHANGELOG.md index 3563141f..2b780de8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## 0.1.10 + +- Added more [welcome content](https://code.visualstudio.com/api/extension-guides/tree-view#welcome-content) in outlines panes that have not yet opened a tree for starting a server, connecting to it, and added content to help with automation settings. +- Changed the starting default configuration setting for starting and connecting to the leoBridge server script to false. +- Made starting and connecting to the leoBridge server script easier to access in the interface, and in the welcome/settings webview. +- Added new CONTRIBUTING.md markdown file for running the development version of the leoInteg extension. +- Closes [#44](https://github.com/boltex/leointeg/issues/44) + ## 0.1.9 - Added new compilation configuration (server, extension, or both) to help debugging. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..c489d35e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,99 @@ +# How to install and run the development version + +Thanks for trying out the development version of LeoInteg! :sunglasses: Contributions and pull requests are more than welcome! + +## Introduction + +If you're new to vscode and want to try out Leo with this vscode extension, you might want to look at this [Getting Started](https://code.visualstudio.com/docs#vscode-in-action) page to get an overview. + +Furthermore, if you've never ran a vscode extension in an **Extension Development Host**, here is a [short overview about running and modifying a simple extension](https://code.visualstudio.com/api/get-started/your-first-extension). + +If you're having problems with the procedures below, try [running this sample extension](https://github.com/Microsoft/vscode-extension-samples/tree/master/helloworld-sample#running-the-sample) first to catch underlying problems or missing dependencies. + +## Development requirements + +- Make sure you have Node.js and Git installed. + +- Check your node.js version by typing `node -v` in a terminal. [The latest lts version is 12.18.0](https://nodejs.org/en/download/). + +- Also check your vscode version by opening the 'about' dialog from the help menu. You should at least match or exceed the version below. + +On Windows: + +![about](resources/vscode-about-win.png) + +On Linux: + +![about](resources/vscode-about.png) + +## Getting the source and its development dependencies + +- Clone the repository using the command line by typing : `git clone https://github.com/boltex/leointeg.git` + +![clone](resources/git-clone.png) + +- Although you could 'cd' into the leoInteg folder and run some commands from the same terminal, let's instead use the terminal from within vscode. So open the leoInteg folder with vscode instead: + +![open with vscode](resources/open-with-vscode.png) + +- With vscode now opened with the **leoInteg folder as its workspace**, use the `ctrl+shift+p` keyboard shortcut to open command palette and toggle the terminal. (You can find any command through the command palette) + +![open terminal](resources/open-terminal.png) + +- Install the development dependencies by entering the `npm install` command in the terminal. **(Important if you also just _pulled_ updated sources)** + +- When the command has finished running, you should see logged results in the terminal and also that a new **node_modules** folder was created. + +![dependencies](resources/node-modules.png) + +- You're now ready to **compile and run** the development version of the leoInteg extension. + +## Choosing a debug profile + +- Bring up the **Run view**, by selecting the Run icon in the **Activity Bar**. _(Screenshot below)_ + +- When simply running the extension, choose the **Run Extension** profile. + +![profile](resources/debug-profile.png) + +> (**Optional**) To contribute code to the python server script, or run it through the vscode debugger, you may need to install the [python development extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python). + +- For simply running and using leoInteg, just start the extension and the server as shown below. + +## Starting the extension + +- Use the **Start Debugging** command (or press **F5**) to start another vscode window with the expansion _installed and running_ within it. + +![extension started](resources/leointeg-started.png) + +- If any problems occurred during the extension compilation it will be logged in the vscode instance that started the debug process in its **task-webpack** terminal panel. Otherwise if its running, the extension itself will be logging any messages in the **debug-console** panel. (See animation below) + +![extension logs](resources/debug-anim.gif) + +## The python server script + +- This extension needs the **`leobridgeserver.py`** script to be running. That is where the two extra extension requirements come into play: Having [Leo's path made available in the \$PYTHONPATH environment variable](https://github.com/leo-editor/leo-editor/blob/master/INSTALL.TXT#L126), and having the [Websocket Python Library installed](https://websockets.readthedocs.io/en/stable/intro.html) + +### 3 ways to start the server script + +1. You can have LeoInteg try to start a server script instance itself via the **Start Leo Bridge Server** command or button. It will use the 'py' command on Windows and 'python3' command on other OSes by default. _You can automate this process via leoInteg's configuration settings._ +2. You can have vscode's **Debug View** start it as a debug session starts by choosing a debug profile that includes the server script. It's then possible to step in, inspect and debug the python server script. _The [python development extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python) may be required._ +3. You can also start it yourself manually, by running the leobridgeserver.py script from a command prompt. + +### Using Anaconda or other custom python installations + +- LeoInteg provides configuration options to specify how to launch python interpreter but this may not be enough to get it to start on your system, see [#10](https://github.com/boltex/leointeg/issues/10) and other issues relating to configurations in _sitecustomize.py_ file as noted in [Leo's google group forum](https://groups.google.com/d/msg/leo-editor/FAP8lVnWLyQ/lWHWEYH9AgAJ). + +- If Leointeg or vscode cannot start running the server script on you system or OS, a **workaround** is to start the server script beforehand manually with whichever python interpreter you have installed. + +![launch server](resources/manual-server-start.png) + +- It will terminate automatically when a user disconnect. + +**Note**: If force-closing the server from the integrated vscode terminal, use the 'Kill terminal' button instead of the 'X' that just hides the panel. + +![kill terminal](resources/kill-terminal.png) + +## Issues + +More information can be found on the repository's [Issues Page](https://github.com/boltex/leointeg/issues), where details and troubleshooting can be addressed more directly. diff --git a/README.md b/README.md index b1a697e9..d2837135 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ ### Break your code down into sections structured as an outline, to derive or parse back your files -Leo is a fundamentally different way of using and organizing data, programs and scripts.\ +> Leo is a fundamentally different way of using and organizing data, programs and scripts. + See Leo, the Literate Editor with Outline, at [leoeditor.com](https://leoeditor.com/) -or on [github](https://github.com/leo-editor/leo-editor). +or on [github](https://github.com/leo-editor/leo-editor), and vscode at [code.visualstudio.com](https://code.visualstudio.com/). ![Screenshot](resources/animated-screenshot.gif) @@ -21,33 +22,20 @@ or on [github](https://github.com/leo-editor/leo-editor). ## Development version installation -As you can see from this simple -['Hello-world' expansion example](https://github.com/Microsoft/vscode-extension-samples/tree/master/helloworld-sample#running-the-sample), -cloning and running an expansion from source is quite easy: - -Make sure you have Node.js and Git installed, then: +In addition to the above requirements, make sure you have Node.js and Git installed, then clone the sources and run `npm install` in a terminal to install the remaining development dependencies. -1. Get this repository: `git clone https://github.com/boltex/leointeg.git` -2. Right-click it -> open with vscode (or from a vscode window, File-> Open Folder...) -3. Run `npm install` in terminal before the first run to install dependencies. -4. _(Optional)_ Open vscode's 'Run/Debug' panel to choose a debugging profile (extension, server, or both) -5. Press F5 to run the extension in its own vscode debug instance. (It will try to start its own server by default) +![run extension](/resources/run-extension.png) -After compiling, a new vscode window will be running with leoInteg. +You can then run the **Run Extension** target, as shown above, in the **Debug View**. -The plugin will be activated if the workspace of this new window contains a leo file, -it can also be manually activated by going to the Leo view in the activity bar. - -Once activated, it will start a bridge and connect to it automatically by default. -The 'Open Leo File' button will then be available. +> See [CONTRIBUTING.md](CONTRIBUTING.md) for complete details on how to install and run this extension. ## Features -- A Leo Outline in the explorer view, or in its own panel via the activity bar. -- A welcome screen that also provides access to the configuration settings. -- Derived files change detection.\ - (Set the **'Force reload or ignore changes'** option to **'Reload All'** to automate synchronization) -- Access Leo commands with context menus, outline-node hover icons, keyboard shortcuts, or the command palette: +- A **Leo Outline** in the explorer view, or as a standalone sidebar, **body panes** and **Log Window**. +- A **welcome screen** that also gives access to this extension's **settings**. +- **Derived files change detection**. See [External Files](#derive-external-files) below for more details +- Access **Leo commands** with context menus, outline-node hover icons, keyboard shortcuts, or the command palette: - Open body panes to the side - Outline edition commands - Clipboard operations @@ -55,6 +43,10 @@ The 'Open Leo File' button will then be available. ![Menu](resources/context-hover-menus.png) +## Keybindings + +> _More commands are available by opening the **Command Palette** and typing 'Leo'_ + | Keybinding | | | Command | | :------------------------- | :-- | :-------------------- | :----------------- | | `Alt + -` | | | Contract All | @@ -72,7 +64,21 @@ The 'Open Leo File' button will then be available. | `Ctrl + L` | or | `Shift + Alt + Left` | Move Outline Left | | `Ctrl + R` | or | `Shift + Alt + Right` | Move Outline Right | -### _Status Bar Indicator_ +## Derive External Files + +Use the **Save Leo File** command to derive external files. + +Leo will detect derived file changes and will ask to either **refresh from disk** or **ignore the changes**. + +![derive files](resources/derived-file.gif) + +## Automate Synchronization + +The **change detection** process can be automated to always refresh, or ignore file changes: A **notification** will inform you of the action taken instead. + +![auto sync](resources/auto-sync.gif) + +## Status Bar Indicator A customizable keyboard status bar indicator is shown when this extension is activated. It will turn orange (or your choice of text and color), when leo's **keyboard shortcuts** are active. @@ -82,7 +88,9 @@ This occurs when an outline node or a body pane has focus: ## Extension Settings -### _Open the command palette and start typing_ `leo settings` +### Open the command palette `CTRL+SHIFT+P` and start typing `leo settings` to access LeoInteg's welcome/settings screen + +> _(Changes are auto-saved to the user's profile after 0.5 seconds)_ - Control the visibility of the outline pane in the explorer view. - Decide how and when to refresh and synchronize content when derived (external) file are modified. @@ -95,11 +103,13 @@ This occurs when an outline node or a body pane has focus: ## Issues +Main issues are listed below. See the repository's [Issues Page](https://github.com/boltex/leointeg/issues) to submit issues. + ### Linux Keybindings If you're experiencing trouble with the keyboard shortcuts for the 'Clone Node' or the 'Promote' and 'Demote' commands, -use **"keyboard.dispatch": "keyCode"** in your settings and restart VS Code. +use **"keyboard.dispatch": "keyCode"** in your settings and restart vscode. See [Troubleshoot Linux Keybindings](https://github.com/microsoft/vscode/wiki/Keybinding-Issues#troubleshoot-linux-keybindings) for more information. ### Move outline keyboard commands @@ -109,13 +119,14 @@ To help with this conflict, outline-move keyboard commands will only trigger with the additional condition of having no text selection in the editor. So select at least one character to use the previously assigned **`Ctrl+D`** command in body panes. +> This extension is still in development, so please refer to its [issue tracker for known issues](https://github.com/boltex/leointeg/issues), and please contribute with additional information if you encounter other issues yourself. + ## Intended Features - Support for multiple simultaneous opened Leo files. -- Support multiple connections to the leoBridge server, allowing multi-user live edition of the same Leo file. +- Support multiple connections to the leoBridge server. - Syntax-highlighting for body panes that matches Leo's syntax-highlighting. -- Finding and 'go-to' specific line(s) from derived files in outline nodes (For error lookup, breakpoints, etc.) -- Optionally display line numbers in relation to derived files instead of the standard editor line numbering when applicable. +- Display line numbers in relation to derived files, along with 'go-to' specific line functionality for error lookups and breakpoints. ## How it works diff --git a/package.json b/package.json index 3402e9f5..6a79fc8d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "leointeg", "displayName": "Leo Editor Integration with Visual Studio Code", "description": "Use Leo, the literate editor with outline, directly in vscode.", - "version": "0.1.9", + "version": "0.1.10", "author": { "name": "FĂ©lix" }, @@ -18,9 +18,9 @@ "keywords": [ "leo", "literate", + "editor", "outline", - "programming", - "editor" + "programming" ], "categories": [ "Other" @@ -151,13 +151,13 @@ }, "leoIntegration.startServerAutomatically": { "scope": "application", - "default": true, + "default": false, "type": "boolean", "description": "Starts a LeoBridge server automatically, by running the leobridgeserver.py python script" }, "leoIntegration.connectToServerAutomatically": { "scope": "application", - "default": true, + "default": false, "type": "boolean", "description": "Connect automatically to a Leo server on specified 'Connection Port' upon activation of this extension" }, @@ -190,15 +190,14 @@ "explorer": [ { "id": "leoIntegrationExplorer", - "name": "Leo Outline", - "when": "treeInExplorer && !leoDisconnected" + "name": "Leo Integration", + "when": "treeInExplorer" } ], "leoIntegrationView": [ { "id": "leoIntegration", - "name": "Outline", - "when": "!leoDisconnected" + "name": "Integration" } ] }, @@ -756,23 +755,58 @@ ], "viewsWelcome": [ { + "//": "NOT READY: 3 buttons: [start], [connect] and [settings]", + "view": "leoIntegration", + "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)\nStart a local server\n[Start Server](command:leointeg.startServer)\nServer startup and connection can be automated in LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", + "when": "!leoBridgeReady && !leoServerStarted && !startServerAutomatically && !connectToServerAutomatically" + }, + { + "view": "leoIntegrationExplorer", + "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)\nStart a local server\n[Start Server](command:leointeg.startServer)\nServer startup and connection can be automated in LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", + "when": "!leoBridgeReady && !leoServerStarted && !startServerAutomatically && !connectToServerAutomatically" + }, + { + "//": "NOT READY - JUST STARTED SERVER: 2 buttons: [connect] and [settings]", + "view": "leoIntegration", + "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)\nServer startup and connection can be automated in LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", + "when": "!leoBridgeReady && leoServerStarted && !startServerAutomatically && !connectToServerAutomatically" + }, + { + "view": "leoIntegrationExplorer", + "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)\nServer startup and connection can be automated in LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", + "when": "!leoBridgeReady && leoServerStarted && !startServerAutomatically && !connectToServerAutomatically" + }, + { + "//": "NOT READY - SERVER STARTS ITSELF: 2 buttons: [connect] and [settings]", + "view": "leoIntegration", + "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)\nServer startup and connection can be automated in LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", + "when": "!leoBridgeReady && !leoTreeOpened && startServerAutomatically && !connectToServerAutomatically" + }, + { + "view": "leoIntegrationExplorer", + "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)\nServer startup and connection can be automated in LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", + "when": "!leoBridgeReady && !leoTreeOpened && startServerAutomatically && !connectToServerAutomatically" + }, + { + "//": "NOT READY - CONNECTING", "view": "leoIntegration", - "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)", - "when": "!leoBridgeReady && !leoTreeOpened && !leoDisconnected" + "contents": "Connecting...", + "when": "!leoBridgeReady && !leoTreeOpened && connectToServerAutomatically" }, { "view": "leoIntegrationExplorer", - "contents": "Not Connected\n[Connect to Server](command:leointeg.connectToServer)", - "when": "!leoBridgeReady && !leoTreeOpened && !leoDisconnected" + "contents": "Connecting...", + "when": "!leoBridgeReady && !leoTreeOpened && connectToServerAutomatically" }, { + "//": "READY: 2 buttons: [open] and [settings]", "view": "leoIntegration", - "contents": "leoBridge Connected\n[Open Leo File](command:leointeg.openLeoFile)", + "contents": "leoBridge Connected\n[Open Leo File](command:leointeg.openLeoFile)\nView LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", "when": "leoBridgeReady && !leoTreeOpened" }, { "view": "leoIntegrationExplorer", - "contents": "leoBridge Connected\n[Open Leo File](command:leointeg.openLeoFile)", + "contents": "leoBridge Connected\n[Open Leo File](command:leointeg.openLeoFile)\nView LeoInteg's [configuration settings](command:leointeg.showSettingsPage)", "when": "leoBridgeReady && !leoTreeOpened" } ], @@ -784,7 +818,7 @@ }, { "command": "leointeg.connectToServer", - "when": "!leoBridgeReady && !leoTreeOpened && !leoDisconnected" + "when": "!leoBridgeReady && !leoTreeOpened" }, { "command": "leointeg.openLeoFile", @@ -1134,7 +1168,7 @@ "view/title": [ { "command": "leointeg.connectToServer", - "when": "view =~ /leoIntegration/ && !leoBridgeReady && !leoTreeOpened && !leoDisconnected", + "when": "view =~ /leoIntegration/ && !leoBridgeReady && !leoTreeOpened", "group": "navigation@1" }, { diff --git a/resources/auto-sync.gif b/resources/auto-sync.gif new file mode 100644 index 00000000..e8ce2d46 Binary files /dev/null and b/resources/auto-sync.gif differ diff --git a/resources/debug-anim.gif b/resources/debug-anim.gif new file mode 100644 index 00000000..a9cda51c Binary files /dev/null and b/resources/debug-anim.gif differ diff --git a/resources/debug-profile.png b/resources/debug-profile.png new file mode 100644 index 00000000..15bad41e Binary files /dev/null and b/resources/debug-profile.png differ diff --git a/resources/derived-file.gif b/resources/derived-file.gif new file mode 100644 index 00000000..2b57d346 Binary files /dev/null and b/resources/derived-file.gif differ diff --git a/resources/git-clone.png b/resources/git-clone.png new file mode 100644 index 00000000..a3e77400 Binary files /dev/null and b/resources/git-clone.png differ diff --git a/resources/kill-terminal.png b/resources/kill-terminal.png new file mode 100644 index 00000000..c69eb402 Binary files /dev/null and b/resources/kill-terminal.png differ diff --git a/resources/leointeg-started.png b/resources/leointeg-started.png new file mode 100644 index 00000000..c1c533ff Binary files /dev/null and b/resources/leointeg-started.png differ diff --git a/resources/manual-server-start.png b/resources/manual-server-start.png new file mode 100644 index 00000000..917f8de5 Binary files /dev/null and b/resources/manual-server-start.png differ diff --git a/resources/node-modules.png b/resources/node-modules.png new file mode 100644 index 00000000..7042671f Binary files /dev/null and b/resources/node-modules.png differ diff --git a/resources/npm-install.png b/resources/npm-install.png new file mode 100644 index 00000000..f80d8b9c Binary files /dev/null and b/resources/npm-install.png differ diff --git a/resources/open-terminal.png b/resources/open-terminal.png new file mode 100644 index 00000000..97fca203 Binary files /dev/null and b/resources/open-terminal.png differ diff --git a/resources/open-with-vscode.png b/resources/open-with-vscode.png new file mode 100644 index 00000000..25c3736c Binary files /dev/null and b/resources/open-with-vscode.png differ diff --git a/resources/run-extension.png b/resources/run-extension.png new file mode 100644 index 00000000..3e82c9b8 Binary files /dev/null and b/resources/run-extension.png differ diff --git a/resources/vscode-about-win.png b/resources/vscode-about-win.png new file mode 100644 index 00000000..2834daa5 Binary files /dev/null and b/resources/vscode-about-win.png differ diff --git a/resources/vscode-about.png b/resources/vscode-about.png new file mode 100644 index 00000000..83d54b27 Binary files /dev/null and b/resources/vscode-about.png differ diff --git a/src/config.ts b/src/config.ts index a719ba51..7792e0bf 100644 --- a/src/config.ts +++ b/src/config.ts @@ -9,6 +9,7 @@ import { LeoIntegration } from "./leoIntegration"; */ export class Config implements ConfigMembers { // Some config settings are used in leobridgeserver.py such as defaultReloadIgnore and checkForChangeExternalFiles + // TODO : Should use default values in a centralized way public checkForChangeExternalFiles: string = "none"; // Used in leoBridge script public defaultReloadIgnore: string = "none"; // Used in leoBridge script public treeKeepFocus: boolean = true; @@ -24,8 +25,8 @@ export class Config implements ConfigMembers { public showCopyOnNodes: boolean = false; public invertNodeContrast: boolean = false; public leoPythonCommand: string = ""; - public startServerAutomatically: boolean = true; - public connectToServerAutomatically: boolean = true; + public startServerAutomatically: boolean = false; // Now set this configuration option default to 'false' to showcase treeViews 'welcome content' + public connectToServerAutomatically: boolean = false; // Now set this configuration option default to 'false' public connectionAddress: string = Constants.TCPIP_DEFAULT_ADDRESS; public connectionPort: number = Constants.TCPIP_DEFAULT_PORT; @@ -109,7 +110,8 @@ export class Config implements ConfigMembers { if (!utils.isHexColor(this.statusBarColor)) { this.statusBarColor = Constants.GUI.STATUSBAR_DEFAULT_COLOR; } - // * Interface elements visibility + // * Interface elements visibility defaults + // TODO : Should use default values in a centralized way this.checkForChangeExternalFiles = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.CHECK_FOR_CHANGE_EXTERNAL_FILES, "none"); this.defaultReloadIgnore = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.DEFAULT_RELOAD_IGNORE, "none"); this.treeInExplorer = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.TREE_IN_EXPLORER, true); @@ -124,8 +126,8 @@ export class Config implements ConfigMembers { this.treeKeepFocusWhenAside = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.TREE_KEEP_FOCUS_WHEN_ASIDE, false); // * Server and connection automation this.leoPythonCommand = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.LEO_PYTHON_COMMAND, ""); - this.startServerAutomatically = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.AUTO_START_SERVER, true); - this.connectToServerAutomatically = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.AUTO_CONNECT, true); + this.startServerAutomatically = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.AUTO_START_SERVER, false); + this.connectToServerAutomatically = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.AUTO_CONNECT, false); this.connectionAddress = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.IP_ADDRESS, Constants.TCPIP_DEFAULT_ADDRESS); // 'ws://' this.connectionPort = vscode.workspace.getConfiguration(Constants.CONFIG_SECTION).get(Constants.CONFIGURATION.IP_PORT, Constants.TCPIP_DEFAULT_PORT); // 32125 // * Set context for tree items visibility that are based on config options diff --git a/src/constants.ts b/src/constants.ts index f6055114..242be948 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -44,6 +44,7 @@ export class Constants { TREEVIEW_TITLE: "OUTLINE", TREEVIEW_TITLE_NOT_CONNECTED: "NOT CONNECTED", TREEVIEW_TITLE_CONNECTED: "CONNECTED", + TREEVIEW_TITLE_INTEGRATION: "INTEGRATION", BODY_TITLE: "LEO BODY", LOG_PANE_TITLE: "Leo Log Window", THEME_STATUSBAR: "statusBar.foreground" @@ -104,21 +105,24 @@ export class Constants { * * Used in 'when' clauses, set with vscode.commands.executeCommand("setContext",...) */ public static CONTEXT_FLAGS = { - BRIDGE_READY: "leoBridgeReady", - TREE_OPENED: "leoTreeOpened", - SERVER_STARTED: "leoServerStarted", - DISCONNECTED: "leoDisconnected", - TREE_IN_EXPLORER: Constants.CONFIGURATION.TREE_IN_EXPLORER, - SHOW_OPEN_ASIDE: Constants.CONFIGURATION.SHOW_OPEN_ASIDE, - SHOW_ARROWS: Constants.CONFIGURATION.SHOW_ARROWS, - SHOW_ADD: Constants.CONFIGURATION.SHOW_ADD, - SHOW_MARK: Constants.CONFIGURATION.SHOW_MARK, - SHOW_CLONE: Constants.CONFIGURATION.SHOW_CLONE, - SHOW_COPY: Constants.CONFIGURATION.SHOW_COPY, - LEO_SELECTED: "leoObjectSelected", - SELECTED_MARKED: "leoNodeMarked", - SELECTED_UNMARKED: "leoNodeUnmarked", - SELECTED_ATFILE: "leoNodeAtFile" + BRIDGE_READY: "leoBridgeReady", // Connected to leoBridge + TREE_OPENED: "leoTreeOpened", // At least one Leo file opened + SERVER_STARTED: "leoServerStarted", // Auto_start or manually started + // Flags about current selection + LEO_SELECTED: "leoObjectSelected", // keybindings "On": Outline or body has focus + SELECTED_MARKED: "leoNodeMarked", // Selected node is marked + SELECTED_UNMARKED: "leoNodeUnmarked", // Selected node is unmarked + SELECTED_ATFILE: "leoNodeAtFile", // Selected node is an @file or @clean, etc... + // Flags that match specific LeoInteg config settings + TREE_IN_EXPLORER: Constants.CONFIGURATION.TREE_IN_EXPLORER, // Leo outline also in the explorer view + SHOW_OPEN_ASIDE: Constants.CONFIGURATION.SHOW_OPEN_ASIDE, // Show 'open aside' in context menu + SHOW_ARROWS: Constants.CONFIGURATION.SHOW_ARROWS, // Hover Icons on outline nodes + SHOW_ADD: Constants.CONFIGURATION.SHOW_ADD, // Hover Icons on outline nodes + SHOW_MARK: Constants.CONFIGURATION.SHOW_MARK, // Hover Icons on outline nodes + SHOW_CLONE: Constants.CONFIGURATION.SHOW_CLONE, // Hover Icons on outline nodes + SHOW_COPY: Constants.CONFIGURATION.SHOW_COPY, // Hover Icons on outline nodes + AUTO_START_SERVER: Constants.CONFIGURATION.AUTO_START_SERVER, // Used at startup + AUTO_CONNECT: Constants.CONFIGURATION.AUTO_CONNECT // Used at startup }; /** diff --git a/src/extension.ts b/src/extension.ts index 18555c09..d10d7f6e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -181,7 +181,7 @@ async function showWelcomeIfNewer(p_version: string, p_previousVersion: string | ) { w_showWelcomeScreen = false; } else if (w_major !== w_prevMajor || (w_major === w_prevMajor && w_minor > w_prevMinor)) { - // Will show on major or minor upgrade, Formatted as 'Major.Minor.Revision' eg. 1.2.3 + // Will show on major or minor upgrade (Formatted as 'Major.Minor.Revision' eg. 1.2.3) w_showWelcomeScreen = true; } } diff --git a/src/leoIntegration.ts b/src/leoIntegration.ts index 4d7ecb0d..5ac6029a 100644 --- a/src/leoIntegration.ts +++ b/src/leoIntegration.ts @@ -17,6 +17,7 @@ export class LeoIntegration { // * Status Flags private _leoIsConnecting: boolean = false; // Used in connect method to prevent other attempts while trying private _leoBridgeReadyPromise: Promise | undefined; // Set when leoBridge has a leo controller ready + private _currentOutlineTitle: string = Constants.GUI.TREEVIEW_TITLE_INTEGRATION; // Title has to be kept because it might need to be set (again) when either tree is first shown when switching visibility private _leoBridgeReady: boolean = false; // Used along with executeCommand 'setContext' with Constants.CONTEXT_FLAGS.BRIDGE_READY get leoBridgeReady(): boolean { @@ -34,6 +35,9 @@ export class LeoIntegration { set fileOpenedReady(p_value: boolean) { this._fileOpenedReady = p_value; utils.setContext(Constants.CONTEXT_FLAGS.TREE_OPENED, p_value); + this._setTreeViewTitle( + p_value ? Constants.GUI.TREEVIEW_TITLE : Constants.GUI.TREEVIEW_TITLE_INTEGRATION + ); } // * Frontend command stack @@ -176,7 +180,7 @@ export class LeoIntegration { public startNetworkServices(): void { // * leoIntegration starting entry point: Start a leoBridge server and connect to it based on configuration flags // this.setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE_NOT_CONNECTED); - this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE); // Vanilla title for use with welcome content + // this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE_INTEGRATION); // Vanilla title for use with welcome content // * (via settings) Start a server (and also connect automatically to a server upon extension activation) if (this.config.startServerAutomatically) { this.startServer(); @@ -217,8 +221,8 @@ export class LeoIntegration { } else { this.leoBridgeReady = true; utils.setContext(Constants.CONTEXT_FLAGS.BRIDGE_READY, true); - // this.setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE_CONNECTED); - this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE); // Vanilla title for use with welcome content + // this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE_INTEGRATION); + // this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE); // Vanilla title for use with welcome content this.showLogPane(); if (!this.config.connectToServerAutomatically) { vscode.window.showInformationMessage(Constants.USER_MESSAGES.CONNECTED); @@ -236,11 +240,11 @@ export class LeoIntegration { if (this.leoBridgeReady) { // * Real disconnect error versus a simple 'failed to connect' vscode.window.showErrorMessage(p_message ? p_message : Constants.USER_MESSAGES.DISCONNECTED); - utils.setContext(Constants.CONTEXT_FLAGS.DISCONNECTED, true); } else { vscode.window.showInformationMessage(p_message ? p_message : Constants.USER_MESSAGES.DISCONNECTED); } - this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE); // Generic title instead of Constants.GUI.TREEVIEW_TITLE_NOT_CONNECTED + // this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE); // Generic title instead of Constants.GUI.TREEVIEW_TITLE_NOT_CONNECTED + // this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE_INTEGRATION); this.fileOpenedReady = false; this.leoBridgeReady = false; this._leoBridgeReadyPromise = undefined; @@ -301,6 +305,7 @@ export class LeoIntegration { // (Facultative) Do something different if explorerView is used, instead of the standalone outline pane } if (p_event.visible && this.lastSelectedNode) { + this._setTreeViewTitle(); this._needLastSelectedRefresh = true; // Its a new node in a new tree so refresh lastSelectedNode too this._refreshOutline(RevealType.RevealSelectFocus); // Set focus on outline } @@ -829,7 +834,7 @@ export class LeoIntegration { this.fileOpenedReady = true; // * First valid redraw of tree along with the selected node and its body this._refreshOutline(RevealType.RevealSelectFocus); // p_revealSelection flag set - this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE); // ? Maybe unused when used with welcome content + // this._setTreeViewTitle(Constants.GUI.TREEVIEW_TITLE); // ? Maybe unused when used with welcome content // * First StatusBar appearance this._leoStatusBar.show(); // Just selected a node // * Show leo log pane @@ -841,13 +846,16 @@ export class LeoIntegration { }); } - private _setTreeViewTitle(p_title: string): void { - // * Set/Change outline pane title e.g. "NOT CONNECTED", "CONNECTED", "OUTLINE" + private _setTreeViewTitle(p_title?: string): void { + if (p_title) { + this._currentOutlineTitle = p_title; + } + // * Set/Change outline pane title e.g. "INTEGRATION", "OUTLINE" if (this._leoTreeStandaloneView) { - this._leoTreeStandaloneView.title = p_title; + this._leoTreeStandaloneView.title = this._currentOutlineTitle; } if (this._leoTreeExplorerView) { - this._leoTreeExplorerView.title = Constants.GUI.EXPLORER_TREEVIEW_PREFIX + p_title; // "NOT CONNECTED", "CONNECTED", "LEO: OUTLINE" + this._leoTreeExplorerView.title = Constants.GUI.EXPLORER_TREEVIEW_PREFIX + this._currentOutlineTitle; } } diff --git a/src/webviews/apps/index.html b/src/webviews/apps/index.html index cdbbdbf2..a42ecda4 100644 --- a/src/webviews/apps/index.html +++ b/src/webviews/apps/index.html @@ -22,8 +22,8 @@

LeoInteg

- Use Leo to program with directed acyclic graphs along with section-references, clones, - file derivation and the Mulder/Ream update algorithm. + Use Leo to program with directed acyclic graphs along with + section-references, clones, file derivation and the Mulder/Ream update algorithm.

@@ -55,55 +55,96 @@

LeoInteg

- Welcome to LeoInteg 0.1.9 + Welcome to LeoInteg 0.1.10

See What's New - in LeoInteg 0.1.9 + href="https://github.com/boltex/leointeg#features"> + See What's New in LeoInteg 0.1.10 +
-

- LeoInteg while being designed to mimic Leo's behavior, - is also highly customizable to meet your needs. Do you find - the outline's icons to be intrusive or the current cursor behavior distracting? — - No problem. Quickly turn them off, or change how they behave using the options below. +

+ LeoInteg is designed to mimic Leo's behavior + and can be customized to meet your needs. +

+

+

+ Automate the leoBridge startup, + auto-refresh when external files change, + or choose which node icons + are shown and more with the options below.

-

- Interface Behavior + Leo Bridge Options

-
-
- - +
- Keep focus in the outline when selecting a node + Run the leobridgeserver.py server script at startup
-
- - +
- Keep focus in the outline when opening a body pane on the side + Connects automatically to a LeoBridge server +
+
+
+ + +
+ Command for starting python (Defaults to 'py' on windows, or + 'python3' otherwise) +
+
+
+ + +
+ Connection host +
+
+
+ + +
+ Connection host port number
-
@@ -150,6 +191,44 @@

+
+
+
+

+ Interface Behavior +

+
+ +
+ +
+
+ + +
+ Keep focus in the outline when selecting a node +
+ +
+
+ + +
+ Keep focus in the outline when opening a body pane on the side +
+ +
+
+
+ +
@@ -301,7 +380,7 @@

data-setting />

- Shows 'Move Node' arrows on hover + Shows 'Move' arrows on hover
@@ -364,80 +443,7 @@

-
-
-
-

- Leo Bridge Options -

-
-
-
-
- - -
- Command for starting python (Defaults to 'py' on windows, or - 'python3' otherwise) -
-
-
- - -
- Starts a LeoBridge server automatically, by running the leobridgeserver.py - script -
-
-
- - -
- Connects automatically to a LeoBridge server -
-
-
- - -
- Connection host -
-
-
- - -
- Connection host port number -
- -
-
-