Skip to content

Commit cd8ace9

Browse files
committed
Switch to disable syntax highlighter for cell comment
1 parent f913bd0 commit cd8ace9

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

pyPadPlusPlus/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, write):
5454
def write(self, s): pass
5555

5656
class pyPad:
57-
def __init__(self, externalPython=None, matplotlib_EventHandler=True):
57+
def __init__(self, externalPython=None, matplotlib_EventHandler=True, cellHighlight=True):
5858
'''Initializes PyPadPlusPlus to prepare Notepad++
5959
for interactive Python development'''
6060
console.show()
@@ -69,14 +69,15 @@ def __init__(self, externalPython=None, matplotlib_EventHandler=True):
6969

7070
self.externalPython = bool(externalPython)
7171
if self.externalPython:
72-
# start syntax highligter
72+
self.interp = pyPadHost.interpreter(externalPython, outBuffer=self.outBuffer)
73+
else:
74+
self.interp = pyPadClient.interpreter()
75+
76+
if cellHighlight:
7377
self.lexer = EnhancedPythonLexer()
7478
self.lexer.main()
75-
self.interp = pyPadHost.interpreter(externalPython, outBuffer=self.outBuffer)
7679
else:
77-
# syntax highligter could slow down notepad++ in this mode
7880
self.lexer = None
79-
self.interp = pyPadClient.interpreter()
8081

8182
self.thread = None
8283
self.threadMarker = None

pyPadStart.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@
2020

2121
matplotlib_EventHandler = True
2222

23+
# Cell highlighter underlines comments starting with #%% to highlight
24+
# code cells. This can slowdown Notpad++ during heavy computational load.
25+
26+
cellHighlight = True
27+
2328

2429
# Start pyPadPlusPlus
2530
import Npp, pyPadPlusPlus
26-
Npp.pypad = pyPadPlusPlus.pyPad(externalPython=pythonPath,
27-
matplotlib_EventHandler=matplotlib_EventHandler)
31+
Npp.pypad = pyPadPlusPlus.pyPad(
32+
externalPython=pythonPath,
33+
matplotlib_EventHandler=matplotlib_EventHandler,
34+
cellHighlight=cellHighlight)

0 commit comments

Comments
 (0)