Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
finesse-syntax-jupyterlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Philip Jones
finesse-syntax-jupyterlab
Commits
29634d18
Commit
29634d18
authored
Jan 17, 2020
by
Phil Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First properly working state.
Now some finesse syntax for codemirror just needs to be written.
parent
fb7e3107
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
index.ts
src/index.ts
+14
-10
No files found.
src/index.ts
View file @
29634d18
...
...
@@ -7,15 +7,12 @@ import {
}
from
'@jupyterlab/notebook'
;
import
{
CodeCell
C
ell
,
C
odeCell
}
from
'@jupyterlab/cells'
;
import
'./codemirror-finesse'
;
/**
* The plugin registration information.
*/
const
plugin
:
JupyterFrontEndPlugin
<
void
>
=
{
activate
,
id
:
'finesse-syntax-jupyter'
,
...
...
@@ -27,8 +24,7 @@ function activate(app: JupyterFrontEnd, tracker: INotebookTracker) {
tracker
.
widgetAdded
.
connect
(
activate_finesse
)
};
function
check_syntax
(
sender
:
Notebook
):
void
{
function
check_all
(
sender
:
Notebook
):
void
{
sender
.
widgets
.
forEach
(
cell
=>
{
if
(
cell
instanceof
CodeCell
&&
cell
.
model
.
mimeType
!=
"text/x-finesse-python"
)
{
cell
.
model
.
mimeType
=
"text/x-finesse-python"
;
...
...
@@ -36,11 +32,19 @@ function check_syntax(sender: Notebook): void {
});
};
function
check_cell
(
sender
:
Notebook
,
cell
:
Cell
):
void
{
if
(
cell
instanceof
CodeCell
)
{
cell
.
model
.
mimeType
=
"text/x-finesse-python"
;
}
}
function
activate_finesse
(
sender
:
INotebookTracker
,
panel
:
NotebookPanel
):
void
{
panel
.
content
.
modelContentChanged
.
connect
(
check_syntax
);
panel
.
content
.
activeCellChanged
.
connect
(
check_cell
);
// I ain't proud of this, but it's the sanest way I could find to get
// the syntax highlighting to change on startup without selecting a
// different cell
setTimeout
(()
=>
{
check_all
(
panel
.
content
)},
1000
);
};
/**
* Export the plugin as default.
*/
export
default
plugin
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment