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

Allow toggling of the Plugins pane in the sidebar #2417

Merged
merged 2 commits into from
Jul 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion browser/src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ export const start = async (args: string[]): Promise<void> => {
Bookmarks.activate(configuration, editorManager, Sidebar.getInstance())

const PluginsSidebarPane = await import("./Plugins/PluginSidebarPane")
PluginsSidebarPane.activate(configuration, pluginManager, sidebarManager)
PluginsSidebarPane.activate(commandManager, configuration, pluginManager, sidebarManager)

const Terminal = await terminalPromise
Terminal.activate(commandManager, configuration, editorManager)
Expand Down
14 changes: 14 additions & 0 deletions browser/src/Plugins/PluginSidebarPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as React from "react"

import { Event, IDisposable, IEvent } from "oni-types"

import { CommandManager } from "./../Services/CommandManager"
import { Configuration } from "./../Services/Configuration"
import { SidebarManager, SidebarPane } from "./../Services/Sidebar"

Expand Down Expand Up @@ -256,6 +257,7 @@ export class PluginsSidebarPaneView extends React.PureComponent<
}

export const activate = (
commandManager: CommandManager,
configuration: Configuration,
pluginManager: PluginManager,
sidebarManager: SidebarManager,
Expand All @@ -264,4 +266,16 @@ export const activate = (
const pane = new PluginsSidebarPane(pluginManager)
sidebarManager.add("plug", pane)
}

const togglePlugins = () => {
sidebarManager.toggleVisibilityById("oni.sidebar.plugins")
}

commandManager.registerCommand({
command: "plugins.toggle",
name: "Plugins: Toggle Visibility",
detail: "Toggles the plugins pane in the sidebar",
execute: togglePlugins,
enabled: () => configuration.getValue("sidebar.plugins.enabled"),
})
}