Options
All
  • Public
  • Public/Protected
  • All
Menu

Module fileeditor-extension

Index

Namespaces

Variables

Variables

Const default

default: JupyterFrontEndPlugin<any>[] = [plugin, tabSpaceStatus]

Export the plugins as default.

Const tabSpaceStatus

tabSpaceStatus: JupyterFrontEndPlugin<void> = {id: '@jupyterlab/fileeditor-extension:tab-space-status',autoStart: true,requires: [IEditorTracker, ISettingRegistry, ITranslator],optional: [IStatusBar],activate: (app: JupyterFrontEnd,editorTracker: IEditorTracker,settingRegistry: ISettingRegistry,translator: ITranslator,statusBar: IStatusBar | null) => {const trans = translator.load('jupyterlab');if (!statusBar) {// Automatically disable if statusbar missingreturn;}// Create a menu for switching tabs vs spaces.const menu = new Menu({ commands: app.commands });const command = 'fileeditor:change-tabs';const { shell } = app;const args: JSONObject = {insertSpaces: false,size: 4,name: trans.__('Indent with Tab')};menu.addItem({ command, args });for (const size of [1, 2, 4, 8]) {const args: JSONObject = {insertSpaces: true,size,name: trans._n('Spaces: %1', 'Spaces: %1', size)};menu.addItem({ command, args });}// Create the status item.const item = new TabSpaceStatus({ menu, translator });// Keep a reference to the code editor config from the settings system.const updateSettings = (settings: ISettingRegistry.ISettings): void => {item.model!.config = {...CodeEditor.defaultConfig,...(settings.get('editorConfig').composite as JSONObject)};};void Promise.all([settingRegistry.load('@jupyterlab/fileeditor-extension:plugin'),app.restored]).then(([settings]) => {updateSettings(settings);settings.changed.connect(updateSettings);});// Add the status item.statusBar.registerStatusItem('@jupyterlab/fileeditor-extension:tab-space-status',{item,align: 'right',rank: 1,isActive: () => {return (!!shell.currentWidget && editorTracker.has(shell.currentWidget));}});}}

A plugin that provides a status item allowing the user to switch tabs vs spaces and tab widths for text editors.

Generated using TypeDoc