mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-16 03:16:20 +00:00
fixing code mirror mode to ignore :! things
This commit is contained in:
parent
7f23e743b7
commit
92361c93c2
7
build.sh
7
build.sh
@ -4,6 +4,10 @@ rm -f profile.tar
|
||||
tar -cvf profile.tar *
|
||||
cd ..
|
||||
cabal install --force-reinstalls || exit 1
|
||||
|
||||
# Remove my profile
|
||||
rm -rf ~/.ipython/profile_haskell
|
||||
|
||||
cd ihaskell-display
|
||||
for dir in `ls`
|
||||
do
|
||||
@ -11,6 +15,3 @@ do
|
||||
cabal install || exit 1
|
||||
cd ..
|
||||
done
|
||||
|
||||
# Remove my profile
|
||||
rm -rf ~/.ipython/profile_haskell
|
||||
|
@ -17,6 +17,20 @@ $([IPython.events]).on('app_initialized.NotebookApp', function(){
|
||||
// of codecell highlight.
|
||||
|
||||
CodeMirror.requireMode('haskell', function(){
|
||||
// Create a multiplexing mode that uses Haskell highlighting by default but
|
||||
// doesn't highlight command-line directives.
|
||||
CodeMirror.defineMode("ihaskell", function(config) {
|
||||
return CodeMirror.multiplexingMode(
|
||||
CodeMirror.getMode(config, "haskell"),
|
||||
{
|
||||
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"
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
cells = IPython.notebook.get_cells();
|
||||
for(var i in cells){
|
||||
c = cells[i];
|
||||
@ -24,7 +38,7 @@ $([IPython.events]).on('app_initialized.NotebookApp', function(){
|
||||
// Force the mode to be Haskell
|
||||
// This is necessary, otherwise sometimes highlighting just doesn't happen.
|
||||
// This may be an IPython bug.
|
||||
c.code_mirror.setOption('mode', 'haskell');
|
||||
c.code_mirror.setOption('mode', 'ihaskell');
|
||||
|
||||
c.auto_highlight()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user