Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gargantext-ihaskell
Project
Project
Details
Activity
Releases
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
gargantext
gargantext-ihaskell
Commits
7a4c4869
Unverified
Commit
7a4c4869
authored
Aug 28, 2021
by
Vaibhav Sagar
Committed by
GitHub
Aug 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jupyterlab-ihaskell: make compatible with JupyterLab 3 (#1267)
parent
0ff0e319
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
42 deletions
+61
-42
package-lock.json
jupyterlab-ihaskell/package-lock.json
+18
-0
package.json
jupyterlab-ihaskell/package.json
+5
-4
codemirror-ihaskell.ts
jupyterlab-ihaskell/src/codemirror-ihaskell.ts
+32
-27
index.ts
jupyterlab-ihaskell/src/index.ts
+6
-11
index.css
jupyterlab-ihaskell/style/index.css
+0
-0
No files found.
jupyterlab-ihaskell/package-lock.json
View file @
7a4c4869
...
...
@@ -809,6 +809,15 @@
"defer-to-connect"
:
"^1.0.1"
}
},
"@types/codemirror"
:
{
"version"
:
"5.60.2"
,
"resolved"
:
"https://registry.npmjs.org/@types/codemirror/-/codemirror-5.60.2.tgz"
,
"integrity"
:
"sha512-tk8YxckrdU49GaJYRKxdzzzXrTlyT2nQGnobb8rAk34jt+kYXOxPKGqNgr7SJpl5r6YGaRD4CDfqiL+6A+/z7w=="
,
"dev"
:
true
,
"requires"
:
{
"@types/tern"
:
"*"
}
},
"@types/dom4"
:
{
"version"
:
"2.0.2"
,
"resolved"
:
"https://registry.npmjs.org/@types/dom4/-/dom4-2.0.2.tgz"
,
...
...
@@ -901,6 +910,15 @@
"integrity"
:
"sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA=="
,
"dev"
:
true
},
"@types/tern"
:
{
"version"
:
"0.23.4"
,
"resolved"
:
"https://registry.npmjs.org/@types/tern/-/tern-0.23.4.tgz"
,
"integrity"
:
"sha512-JAUw1iXGO1qaWwEOzxTKJZ/5JxVeON9kvGZ/osgZaJImBnyjyn0cjovPsf6FNLmyGY8Vw9DoXZCMlfMkMwHRWg=="
,
"dev"
:
true
,
"requires"
:
{
"@types/estree"
:
"*"
}
},
"@types/webpack-sources"
:
{
"version"
:
"0.1.9"
,
"resolved"
:
"https://registry.npmjs.org/@types/webpack-sources/-/webpack-sources-0.1.9.tgz"
,
...
...
jupyterlab-ihaskell/package.json
View file @
7a4c4869
{
"name"
:
"jupyterlab-ihaskell"
,
"version"
:
"0.0.1
3
"
,
"version"
:
"0.0.1
4
"
,
"description"
:
"adds ihaskell syntax highlighting to jupyterlab"
,
"keywords"
:
[
"jupyter"
,
...
...
@@ -15,8 +15,7 @@
"license"
:
"BSD-3-Clause"
,
"author"
:
"MMesch"
,
"files"
:
[
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}"
,
"style/**/*.{css,eot,gif,html,jpg,json,png,svg,woff2,ttf}"
"lib/**/*.{d.ts,js,js.map,json}"
],
"main"
:
"lib/index.js"
,
"types"
:
"lib/index.d.ts"
,
...
...
@@ -31,6 +30,7 @@
},
"dependencies"
:
{
"@jupyterlab/application"
:
">=3.0.0"
,
"@jupyterlab/codemirror"
:
">=3.0.0"
,
"@jupyterlab/apputils"
:
">=3.0.0"
,
"@jupyterlab/docregistry"
:
">=3.0.0"
,
"@jupyterlab/notebook"
:
">=3.0.0"
,
...
...
@@ -40,7 +40,8 @@
"devDependencies"
:
{
"rimraf"
:
"^3.0.0"
,
"typescript"
:
"~3.7.3"
,
"@jupyterlab/builder"
:
"^3.0.8"
"@types/codemirror"
:
">=0.0.0"
,
"@jupyterlab/builder"
:
">=3.0.0"
},
"jupyterlab"
:
{
"extension"
:
true
,
...
...
jupyterlab-ihaskell/src/codemirror-ihaskell.ts
View file @
7a4c4869
import
*
as
CodeMirror
from
'codemirror'
;
// @ts-nocheck
// The types for CodeMirror don't accept a RegExp for 'open' and 'close'
import
'codemirror/lib/codemirror'
;
import
'codemirror/mode/haskell/haskell'
;
import
{
ICodeMirror
,
Mode
}
from
'@jupyterlab/codemirror'
;
CodeMirror
.
defineMode
(
"ihaskell"
,
(
config
)
=>
{
let
hmode
=
CodeMirror
.
getMode
(
config
,
"haskell"
);
return
CodeMirror
.
multiplexingMode
(
hmode
,
{
open
:
/:
(?=
!
)
/
,
// Matches : followed by !, but doesn't consume !
close
:
/^
(?!
!
)
/
,
// Matches start of line not followed by !, doesn't consume character
mode
:
CodeMirror
.
getMode
(
config
,
"text/plain"
),
delimStyle
:
"delimit"
},
{
open
:
/
\[
r
\|
|
\[
rprint
\|
|
\[
rgraph
\|
/
,
close
:
/
\|\]
/
,
mode
:
CodeMirror
.
getMode
(
config
,
"text/x-rsrc"
),
delimStyle
:
"delimit"
}
);
});
export
function
defineIHaskellMode
({
CodeMirror
}:
ICodeMirror
)
{
Mode
.
ensure
(
"haskell"
);
Mode
.
ensure
(
"r"
);
CodeMirror
.
defineMode
(
"ihaskell"
,
(
config
)
=>
{
let
hmode
=
CodeMirror
.
getMode
(
config
,
"haskell"
);
return
CodeMirror
.
multiplexingMode
(
hmode
,
{
open
:
/:
(?=
!
)
/
,
// Matches : followed by !, but doesn't consume !
close
:
/^
(?!
!
)
/
,
// Matches start of line not followed by !, doesn't consume character
mode
:
CodeMirror
.
getMode
(
config
,
"text/plain"
),
delimStyle
:
"delimit"
},
{
open
:
/
\[
r
\|
|
\[
rprint
\|
|
\[
rgraph
\|
/
,
close
:
/
\|\]
/
,
mode
:
CodeMirror
.
getMode
(
config
,
"text/x-rsrc"
),
delimStyle
:
"delimit"
}
);
});
CodeMirror
.
defineMIME
(
"text/x-ihaskell"
,
"ihaskell"
);
CodeMirror
.
defineMIME
(
"text/x-ihaskell"
,
"ihaskell"
);
CodeMirror
.
modeInfo
.
push
({
ext
:
[
'hs'
],
mime
:
"text/x-ihaskell"
,
mode
:
'ihaskell'
,
name
:
'ihaskell'
});
CodeMirror
.
modeInfo
.
push
({
ext
:
[
'hs'
],
mime
:
"text/x-ihaskell"
,
mode
:
'ihaskell'
,
name
:
'ihaskell'
});
}
jupyterlab-ihaskell/src/index.ts
View file @
7a4c4869
...
...
@@ -2,9 +2,9 @@ import {
JupyterFrontEnd
,
JupyterFrontEndPlugin
}
from
'@jupyterlab/application'
;
import
'./codemirror-ihaskell
'
;
import
{
ICodeMirror
}
from
'@jupyterlab/codemirror
'
;
import
'../style/index.css
'
;
import
{
defineIHaskellMode
}
from
'./codemirror-ihaskell
'
;
/**
* Initialization data for the extension1 extension.
...
...
@@ -12,17 +12,12 @@ import '../style/index.css';
const
extension
:
JupyterFrontEndPlugin
<
void
>
=
{
id
:
'ihaskell'
,
autoStart
:
true
,
requires
:
[],
activate
:
(
app
:
JupyterFrontEnd
)
=>
requires
:
[
ICodeMirror
],
activate
:
(
app
:
JupyterFrontEnd
,
codeMirror
:
ICodeMirror
)
=>
{
app
.
serviceManager
.
ready
.
then
(()
=>
{
defineIHaskell
()}
);
defineIHaskellMode
(
codeMirror
);
console
.
log
(
'ihaskell codemirror activated'
);
}
};
function
defineIHaskell
()
{
console
.
log
(
'ihaskell codemirror activated'
);
}
export
default
extension
;
jupyterlab-ihaskell/style/index.css
deleted
100644 → 0
View file @
0ff0e319
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