@jupyterlab/fileeditor-extension 4.0.0-alpha.2 → 4.0.0-alpha.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ /*
2
+ * Copyright (c) Jupyter Development Team.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+
6
+ import {
7
+ ILabShell,
8
+ JupyterFrontEnd,
9
+ JupyterFrontEndPlugin
10
+ } from '@jupyterlab/application';
11
+ import { IEditorLanguageRegistry } from '@jupyterlab/codemirror';
12
+ import { IDocumentWidget } from '@jupyterlab/docregistry';
13
+ import {
14
+ EditorSyntaxStatus,
15
+ FileEditor,
16
+ IEditorTracker
17
+ } from '@jupyterlab/fileeditor';
18
+ import { IStatusBar } from '@jupyterlab/statusbar';
19
+ import { ITranslator } from '@jupyterlab/translation';
20
+
21
+ /**
22
+ * The JupyterLab plugin for the EditorSyntax status item.
23
+ */
24
+ export const editorSyntaxStatus: JupyterFrontEndPlugin<void> = {
25
+ id: '@jupyterlab/fileeditor-extension:editor-syntax-status',
26
+ autoStart: true,
27
+ requires: [IEditorTracker, IEditorLanguageRegistry, ILabShell, ITranslator],
28
+ optional: [IStatusBar],
29
+ activate: (
30
+ app: JupyterFrontEnd,
31
+ tracker: IEditorTracker,
32
+ languages: IEditorLanguageRegistry,
33
+ labShell: ILabShell,
34
+ translator: ITranslator,
35
+ statusBar: IStatusBar | null
36
+ ) => {
37
+ if (!statusBar) {
38
+ // Automatically disable if statusbar missing
39
+ return;
40
+ }
41
+ const item = new EditorSyntaxStatus({
42
+ commands: app.commands,
43
+ languages,
44
+ translator
45
+ });
46
+ labShell.currentChanged.connect(() => {
47
+ const current = labShell.currentWidget;
48
+ if (current && tracker.has(current) && item.model) {
49
+ item.model.editor = (
50
+ current as IDocumentWidget<FileEditor>
51
+ ).content.editor;
52
+ }
53
+ });
54
+ statusBar.registerStatusItem(editorSyntaxStatus.id, {
55
+ item,
56
+ align: 'left',
57
+ rank: 0,
58
+ isActive: () =>
59
+ !!labShell.currentWidget &&
60
+ !!tracker.currentWidget &&
61
+ labShell.currentWidget === tracker.currentWidget
62
+ });
63
+ }
64
+ };
package/style/index.css CHANGED
@@ -6,14 +6,18 @@
6
6
  /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
7
  @import url('~@lumino/widgets/style/index.css');
8
8
  @import url('~@jupyterlab/ui-components/style/index.css');
9
+ @import url('~@jupyterlab/statusbar/style/index.css');
9
10
  @import url('~@jupyterlab/apputils/style/index.css');
10
11
  @import url('~@jupyterlab/codeeditor/style/index.css');
11
- @import url('~@jupyterlab/statusbar/style/index.css');
12
- @import url('~@jupyterlab/codemirror/style/index.css');
13
12
  @import url('~@jupyterlab/docregistry/style/index.css');
14
13
  @import url('~@jupyterlab/application/style/index.css');
14
+ @import url('~@jupyterlab/documentsearch/style/index.css');
15
+ @import url('~@jupyterlab/codemirror/style/index.css');
16
+ @import url('~@jupyterlab/completer/style/index.css');
15
17
  @import url('~@jupyterlab/filebrowser/style/index.css');
18
+ @import url('~@jupyterlab/toc/style/index.css');
16
19
  @import url('~@jupyterlab/console/style/index.css');
20
+ @import url('~@jupyterlab/lsp/style/index.css');
17
21
  @import url('~@jupyterlab/fileeditor/style/index.css');
18
22
  @import url('~@jupyterlab/launcher/style/index.css');
19
23
  @import url('~@jupyterlab/mainmenu/style/index.css');
package/style/index.js CHANGED
@@ -6,14 +6,18 @@
6
6
  /* This file was auto-generated by ensurePackage() in @jupyterlab/buildutils */
7
7
  import '@lumino/widgets/style/index.js';
8
8
  import '@jupyterlab/ui-components/style/index.js';
9
+ import '@jupyterlab/statusbar/style/index.js';
9
10
  import '@jupyterlab/apputils/style/index.js';
10
11
  import '@jupyterlab/codeeditor/style/index.js';
11
- import '@jupyterlab/statusbar/style/index.js';
12
- import '@jupyterlab/codemirror/style/index.js';
13
12
  import '@jupyterlab/docregistry/style/index.js';
14
13
  import '@jupyterlab/application/style/index.js';
14
+ import '@jupyterlab/documentsearch/style/index.js';
15
+ import '@jupyterlab/codemirror/style/index.js';
16
+ import '@jupyterlab/completer/style/index.js';
15
17
  import '@jupyterlab/filebrowser/style/index.js';
18
+ import '@jupyterlab/toc/style/index.js';
16
19
  import '@jupyterlab/console/style/index.js';
20
+ import '@jupyterlab/lsp/style/index.js';
17
21
  import '@jupyterlab/fileeditor/style/index.js';
18
22
  import '@jupyterlab/launcher/style/index.js';
19
23
  import '@jupyterlab/mainmenu/style/index.js';