From 9cdaa0a5f28a7bc9f1c054b409d439a0ee5f00d3 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 30 Apr 2018 16:17:44 -0700 Subject: [PATCH 1/7] Bump version to 0.3.4 (#2155) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b8078a828e..0b8802ad25 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "author": "", "email": "bryphe@outlook.com", "homepage": "https://www.onivim.io", - "version": "0.3.3", + "version": "0.3.4", "description": "Code editor with a modern twist on modal editing - powered by neovim.", "keywords": ["vim", "neovim", "text", "editor", "ide", "vim"], "main": "./lib/main/src/main.js", From e445e2040b140750e82f3082fe05a1a9a0a24bd8 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 30 Apr 2018 19:07:57 -0700 Subject: [PATCH 2/7] Fix #2149 - Part 1 - Add configuration setting for explorer refresh (#2154) * Add auto refresh setting * Add command to refresh explorer * Fix plumbing of configuration into ExplorerSplit --- browser/src/App.ts | 8 +++- browser/src/Input/KeyBindings.ts | 1 + .../src/Services/Explorer/ExplorerSplit.tsx | 46 +++++++++++++------ browser/src/Services/Explorer/index.tsx | 14 +++++- 4 files changed, 54 insertions(+), 15 deletions(-) diff --git a/browser/src/App.ts b/browser/src/App.ts index 9d850ae979..336e137b8b 100644 --- a/browser/src/App.ts +++ b/browser/src/App.ts @@ -262,7 +262,13 @@ export const start = async (args: string[]): Promise => { Sidebar.activate(configuration, workspace) const sidebarManager = Sidebar.getInstance() - Explorer.activate(commandManager, editorManager, Sidebar.getInstance(), workspace) + Explorer.activate( + commandManager, + configuration, + editorManager, + Sidebar.getInstance(), + workspace, + ) Search.activate(commandManager, editorManager, Sidebar.getInstance(), workspace) Learning.activate( commandManager, diff --git a/browser/src/Input/KeyBindings.ts b/browser/src/Input/KeyBindings.ts index accdc455b9..fc8126621f 100644 --- a/browser/src/Input/KeyBindings.ts +++ b/browser/src/Input/KeyBindings.ts @@ -144,6 +144,7 @@ export const applyDefaultKeyBindings = (oni: Oni.Plugin.Api, config: Configurati input.bind("r", "explorer.rename", isExplorerActive) input.bind("", "explorer.create.file", isExplorerActive) input.bind("", "explorer.create.folder", isExplorerActive) + input.bind("", "explorer.refresh", isExplorerActive) // Browser input.bind("k", "browser.scrollUp") diff --git a/browser/src/Services/Explorer/ExplorerSplit.tsx b/browser/src/Services/Explorer/ExplorerSplit.tsx index b42a7e170f..126e11f088 100644 --- a/browser/src/Services/Explorer/ExplorerSplit.tsx +++ b/browser/src/Services/Explorer/ExplorerSplit.tsx @@ -12,6 +12,7 @@ import { FileSystemWatcher } from "./../../Services/FileSystemWatcher" import { Event } from "oni-types" import { CallbackCommand, CommandManager } from "./../../Services/CommandManager" +import { Configuration } from "./../../Services/Configuration" import { EditorManager } from "./../../Services/EditorManager" import { getInstance as NotificationsInstance } from "./../../Services/Notifications" import { windowManager } from "./../../Services/WindowManager" @@ -27,8 +28,8 @@ type Node = ExplorerSelectors.ExplorerNode export class ExplorerSplit { private _onEnterEvent: Event = new Event() private _selectedId: string = null - private _store: Store + private _watcher: FileSystemWatcher = null public get id(): string { return "oni.sidebar.explorer" @@ -39,17 +40,14 @@ export class ExplorerSplit { } constructor( - // private _configuration: Configuration, + private _configuration: Configuration, private _workspace: IWorkspace, private _commandManager: CommandManager, private _editorManager: EditorManager, ) { this._store = createStore({ notifications: NotificationsInstance() }) - const Watcher = new FileSystemWatcher({ - target: this._workspace.activeWorkspace, - options: { ignoreInitial: true, ignored: "**/node_modules" }, - }) + this._initializeFileSystemWatcher() this._workspace.onDirectoryChanged.subscribe(newDirectory => { this._store.dispatch({ @@ -57,8 +55,10 @@ export class ExplorerSplit { rootPath: newDirectory, }) - Watcher.unwatch(this._workspace.activeWorkspace) - Watcher.watch(newDirectory) + if (this._watcher) { + this._watcher.unwatch(this._workspace.activeWorkspace) + this._watcher.watch(newDirectory) + } }) if (this._workspace.activeWorkspace) { @@ -67,11 +67,6 @@ export class ExplorerSplit { rootPath: this._workspace.activeWorkspace, }) } - - const events = ["onChange", "onAdd", "onAddDir", "onMove", "onDelete", "onDeleteDir"] - events.forEach(event => - Watcher[event].subscribe(() => this._store.dispatch({ type: "REFRESH" })), - ) } public enter(): void { @@ -104,11 +99,27 @@ export class ExplorerSplit { ) } + private _initializeFileSystemWatcher(): void { + if (this._configuration.getValue("explorer.autoRefresh")) { + this._watcher = new FileSystemWatcher({ + target: this._workspace.activeWorkspace, + options: { ignoreInitial: true, ignored: "**/node_modules" }, + }) + + const events = ["onChange", "onAdd", "onAddDir", "onMove", "onDelete", "onDeleteDir"] + events.forEach(event => this._watcher[event].subscribe(() => this._refresh())) + } + } + private _inputInProgress = () => { const { register: { rename, create } } = this._store.getState() return rename.active || create.active } + private _refresh(): void { + this._store.dispatch({ type: "REFRESH" }) + } + private _initialiseExplorerCommands(): void { this._commandManager.registerCommand( new CallbackCommand( @@ -153,6 +164,15 @@ export class ExplorerSplit { ), ) + this._commandManager.registerCommand( + new CallbackCommand( + "explorer.refresh", + "Explorer: Refresh the tree", + "Updates the explorer with the latest state on the file system", + () => !this._inputInProgress() && this._refresh(), + ), + ) + this._commandManager.registerCommand( new CallbackCommand( "explorer.create.file", diff --git a/browser/src/Services/Explorer/index.tsx b/browser/src/Services/Explorer/index.tsx index 022aefe55e..5add265a9e 100644 --- a/browser/src/Services/Explorer/index.tsx +++ b/browser/src/Services/Explorer/index.tsx @@ -5,6 +5,7 @@ */ import { CommandManager } from "./../CommandManager" +import { Configuration } from "./../Configuration" import { EditorManager } from "./../EditorManager" import { SidebarManager } from "./../Sidebar" import { Workspace } from "./../Workspace" @@ -13,9 +14,20 @@ import { ExplorerSplit } from "./ExplorerSplit" export const activate = ( commandManager: CommandManager, + configuration: Configuration, editorManager: EditorManager, sidebarManager: SidebarManager, workspace: Workspace, ) => { - sidebarManager.add("files-o", new ExplorerSplit(workspace, commandManager, editorManager)) + configuration.registerSetting("explorer.autoRefresh", { + description: + "When set to true, the explorer will listen for changes on the file system and refresh automatically.", + requiresReload: true, + defaultValue: false, + }) + + sidebarManager.add( + "files-o", + new ExplorerSplit(configuration, workspace, commandManager, editorManager), + ) } From eea56b35c106a9f868eab3550e6623b122ebef18 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Tue, 1 May 2018 18:56:46 -0700 Subject: [PATCH 3/7] Add Jerome Pellois as a backer - thank you! :) --- BACKERS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/BACKERS.md b/BACKERS.md index 3d1666022e..22bfbd0ce8 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -113,6 +113,7 @@ Thanks you to all our backers for making Oni possible! * Troy Vitullo * Leo Critchley * Patrick Massot +* Jerome Pellois From 4b7d91d17d406c79875948ac0eb6284700ead202 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Tue, 1 May 2018 18:57:23 -0700 Subject: [PATCH 4/7] Add Wesley Moore as a backer - thank you! :) --- BACKERS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/BACKERS.md b/BACKERS.md index 22bfbd0ce8..59e28dd36b 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -114,6 +114,7 @@ Thanks you to all our backers for making Oni possible! * Leo Critchley * Patrick Massot * Jerome Pellois +* Wesley Moore From 7c390b6e0b9306acfc52e57e0c4a165269c91962 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Tue, 1 May 2018 18:58:37 -0700 Subject: [PATCH 5/7] Add Tom Boland as a backer - thank you! :) --- BACKERS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/BACKERS.md b/BACKERS.md index 59e28dd36b..0e56c65d35 100644 --- a/BACKERS.md +++ b/BACKERS.md @@ -63,6 +63,7 @@ Thanks you to all our backers for making Oni possible! ## VIP Backers via Patreon * @mikl +* Tom Boland ## Backers via BountySource From 2196aa0fdc4b10d0a07232b500c561b0600600e8 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Tue, 1 May 2018 18:59:57 -0700 Subject: [PATCH 6/7] Turn off verbose logging for yarn install, for now (#2111) --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 419613bd72..7e21b50f47 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,7 +27,7 @@ install: - node --version - npm --version # install modules - - yarn install --verbose + - yarn install - npm run check-cached-binaries artifacts: From eaf66952a00c5db8a90947f7388e35bd405e350d Mon Sep 17 00:00:00 2001 From: Ryan C Date: Thu, 3 May 2018 11:11:49 +0100 Subject: [PATCH 7/7] Update delete binding to use the `isExplorerActive` filter. (#2162) --- browser/src/Input/KeyBindings.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/src/Input/KeyBindings.ts b/browser/src/Input/KeyBindings.ts index fc8126621f..a41a38451e 100644 --- a/browser/src/Input/KeyBindings.ts +++ b/browser/src/Input/KeyBindings.ts @@ -125,8 +125,6 @@ export const applyDefaultKeyBindings = (oni: Oni.Plugin.Api, config: Configurati input.bind("", "menu.select") input.bind(["", ""], "select") - input.bind("", "explorer.delete") - // TODO: Scope 's' to just the local window input.bind("", "sneak.show", () => isNormalMode() && !menu.isMenuOpen()) input.bind(["", ""], "sneak.hide") @@ -135,7 +133,9 @@ export const applyDefaultKeyBindings = (oni: Oni.Plugin.Api, config: Configurati // Explorer input.bind("d", "explorer.delete.persist", isExplorerActive) + input.bind("", "explorer.delete.persist", isExplorerActive) input.bind("", "explorer.delete", isExplorerActive) + input.bind("", "explorer.delete", isExplorerActive) input.bind("y", "explorer.yank", isExplorerActive) input.bind("p", "explorer.paste", isExplorerActive) input.bind("u", "explorer.undo", isExplorerActive)