Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.

Commit 4aaffa7

Browse files
committed
Merge branch 'master' into stable
2 parents 3569110 + eaf6695 commit 4aaffa7

File tree

7 files changed

+61
-19
lines changed

7 files changed

+61
-19
lines changed

BACKERS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Thanks you to all our backers for making Oni possible!
6363
## VIP Backers via Patreon
6464

6565
* @mikl
66+
* Tom Boland
6667

6768
## Backers via BountySource
6869

@@ -113,6 +114,8 @@ Thanks you to all our backers for making Oni possible!
113114
* Troy Vitullo
114115
* Leo Critchley
115116
* Patrick Massot
117+
* Jerome Pellois
118+
* Wesley Moore
116119

117120
<a href="https://opencollective.com/oni/tiers/backer/0/website" target="_blank"><img src="https://opencollective.com/oni/tiers/backer/0/avatar.png"></a>
118121
<a href="https://opencollective.com/oni/tiers/backer/1/website" target="_blank"><img src="https://opencollective.com/oni/tiers/backer/1/avatar.png"></a>

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ install:
2727
- node --version
2828
- npm --version
2929
# install modules
30-
- yarn install --verbose
30+
- yarn install
3131
- npm run check-cached-binaries
3232

3333
artifacts:

browser/src/App.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,13 @@ export const start = async (args: string[]): Promise<void> => {
262262
Sidebar.activate(configuration, workspace)
263263
const sidebarManager = Sidebar.getInstance()
264264

265-
Explorer.activate(commandManager, editorManager, Sidebar.getInstance(), workspace)
265+
Explorer.activate(
266+
commandManager,
267+
configuration,
268+
editorManager,
269+
Sidebar.getInstance(),
270+
workspace,
271+
)
266272
Search.activate(commandManager, editorManager, Sidebar.getInstance(), workspace)
267273
Learning.activate(
268274
commandManager,

browser/src/Input/KeyBindings.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ export const applyDefaultKeyBindings = (oni: Oni.Plugin.Api, config: Configurati
125125
input.bind("<enter>", "menu.select")
126126
input.bind(["<enter>", "<space>"], "select")
127127

128-
input.bind("<delete>", "explorer.delete")
129-
130128
// TODO: Scope 's' to just the local window
131129
input.bind("<c-g>", "sneak.show", () => isNormalMode() && !menu.isMenuOpen())
132130
input.bind(["<esc>", "<c-c>"], "sneak.hide")
@@ -135,7 +133,9 @@ export const applyDefaultKeyBindings = (oni: Oni.Plugin.Api, config: Configurati
135133

136134
// Explorer
137135
input.bind("d", "explorer.delete.persist", isExplorerActive)
136+
input.bind("<c-delete>", "explorer.delete.persist", isExplorerActive)
138137
input.bind("<c-d>", "explorer.delete", isExplorerActive)
138+
input.bind("<delete>", "explorer.delete", isExplorerActive)
139139
input.bind("y", "explorer.yank", isExplorerActive)
140140
input.bind("p", "explorer.paste", isExplorerActive)
141141
input.bind("u", "explorer.undo", isExplorerActive)
@@ -144,6 +144,7 @@ export const applyDefaultKeyBindings = (oni: Oni.Plugin.Api, config: Configurati
144144
input.bind("r", "explorer.rename", isExplorerActive)
145145
input.bind("<c-e>", "explorer.create.file", isExplorerActive)
146146
input.bind("<c-f>", "explorer.create.folder", isExplorerActive)
147+
input.bind("<c-r>", "explorer.refresh", isExplorerActive)
147148

148149
// Browser
149150
input.bind("k", "browser.scrollUp")

browser/src/Services/Explorer/ExplorerSplit.tsx

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { FileSystemWatcher } from "./../../Services/FileSystemWatcher"
1212
import { Event } from "oni-types"
1313

1414
import { CallbackCommand, CommandManager } from "./../../Services/CommandManager"
15+
import { Configuration } from "./../../Services/Configuration"
1516
import { EditorManager } from "./../../Services/EditorManager"
1617
import { getInstance as NotificationsInstance } from "./../../Services/Notifications"
1718
import { windowManager } from "./../../Services/WindowManager"
@@ -27,8 +28,8 @@ type Node = ExplorerSelectors.ExplorerNode
2728
export class ExplorerSplit {
2829
private _onEnterEvent: Event<void> = new Event<void>()
2930
private _selectedId: string = null
30-
3131
private _store: Store<IExplorerState>
32+
private _watcher: FileSystemWatcher = null
3233

3334
public get id(): string {
3435
return "oni.sidebar.explorer"
@@ -39,26 +40,25 @@ export class ExplorerSplit {
3940
}
4041

4142
constructor(
42-
// private _configuration: Configuration,
43+
private _configuration: Configuration,
4344
private _workspace: IWorkspace,
4445
private _commandManager: CommandManager,
4546
private _editorManager: EditorManager,
4647
) {
4748
this._store = createStore({ notifications: NotificationsInstance() })
4849

49-
const Watcher = new FileSystemWatcher({
50-
target: this._workspace.activeWorkspace,
51-
options: { ignoreInitial: true, ignored: "**/node_modules" },
52-
})
50+
this._initializeFileSystemWatcher()
5351

5452
this._workspace.onDirectoryChanged.subscribe(newDirectory => {
5553
this._store.dispatch({
5654
type: "SET_ROOT_DIRECTORY",
5755
rootPath: newDirectory,
5856
})
5957

60-
Watcher.unwatch(this._workspace.activeWorkspace)
61-
Watcher.watch(newDirectory)
58+
if (this._watcher) {
59+
this._watcher.unwatch(this._workspace.activeWorkspace)
60+
this._watcher.watch(newDirectory)
61+
}
6262
})
6363

6464
if (this._workspace.activeWorkspace) {
@@ -67,11 +67,6 @@ export class ExplorerSplit {
6767
rootPath: this._workspace.activeWorkspace,
6868
})
6969
}
70-
71-
const events = ["onChange", "onAdd", "onAddDir", "onMove", "onDelete", "onDeleteDir"]
72-
events.forEach(event =>
73-
Watcher[event].subscribe(() => this._store.dispatch({ type: "REFRESH" })),
74-
)
7570
}
7671

7772
public enter(): void {
@@ -104,11 +99,27 @@ export class ExplorerSplit {
10499
)
105100
}
106101

102+
private _initializeFileSystemWatcher(): void {
103+
if (this._configuration.getValue("explorer.autoRefresh")) {
104+
this._watcher = new FileSystemWatcher({
105+
target: this._workspace.activeWorkspace,
106+
options: { ignoreInitial: true, ignored: "**/node_modules" },
107+
})
108+
109+
const events = ["onChange", "onAdd", "onAddDir", "onMove", "onDelete", "onDeleteDir"]
110+
events.forEach(event => this._watcher[event].subscribe(() => this._refresh()))
111+
}
112+
}
113+
107114
private _inputInProgress = () => {
108115
const { register: { rename, create } } = this._store.getState()
109116
return rename.active || create.active
110117
}
111118

119+
private _refresh(): void {
120+
this._store.dispatch({ type: "REFRESH" })
121+
}
122+
112123
private _initialiseExplorerCommands(): void {
113124
this._commandManager.registerCommand(
114125
new CallbackCommand(
@@ -153,6 +164,15 @@ export class ExplorerSplit {
153164
),
154165
)
155166

167+
this._commandManager.registerCommand(
168+
new CallbackCommand(
169+
"explorer.refresh",
170+
"Explorer: Refresh the tree",
171+
"Updates the explorer with the latest state on the file system",
172+
() => !this._inputInProgress() && this._refresh(),
173+
),
174+
)
175+
156176
this._commandManager.registerCommand(
157177
new CallbackCommand(
158178
"explorer.create.file",

browser/src/Services/Explorer/index.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import { CommandManager } from "./../CommandManager"
8+
import { Configuration } from "./../Configuration"
89
import { EditorManager } from "./../EditorManager"
910
import { SidebarManager } from "./../Sidebar"
1011
import { Workspace } from "./../Workspace"
@@ -13,9 +14,20 @@ import { ExplorerSplit } from "./ExplorerSplit"
1314

1415
export const activate = (
1516
commandManager: CommandManager,
17+
configuration: Configuration,
1618
editorManager: EditorManager,
1719
sidebarManager: SidebarManager,
1820
workspace: Workspace,
1921
) => {
20-
sidebarManager.add("files-o", new ExplorerSplit(workspace, commandManager, editorManager))
22+
configuration.registerSetting("explorer.autoRefresh", {
23+
description:
24+
"When set to true, the explorer will listen for changes on the file system and refresh automatically.",
25+
requiresReload: true,
26+
defaultValue: false,
27+
})
28+
29+
sidebarManager.add(
30+
"files-o",
31+
new ExplorerSplit(configuration, workspace, commandManager, editorManager),
32+
)
2133
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"author": "",
44
"email": "bryphe@outlook.com",
55
"homepage": "https://www.onivim.io",
6-
"version": "0.3.3",
6+
"version": "0.3.4",
77
"description": "Code editor with a modern twist on modal editing - powered by neovim.",
88
"keywords": ["vim", "neovim", "text", "editor", "ide", "vim"],
99
"main": "./lib/main/src/main.js",

0 commit comments

Comments
 (0)