Skip to content

Commit 4dc9b95

Browse files
committed
Merge branch 'release/1.0.1' into lint/organize-imports
2 parents 9cc0b18 + 989ceb0 commit 4dc9b95

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/pythonParsing.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class ManimClass {
206206
/**
207207
* Regular expression to match the construct() method definition.
208208
*/
209-
private static CONSTRUCT_METHOD_REGEX = /^\s*def\s+construct\s*\(self\)\s*:/;
209+
private static CONSTRUCT_METHOD_REGEX = /^\s*def\s+construct\s*\(self\)\s*(->\s*None)?\s*:/;
210210

211211
/**
212212
* The 0-based line number where the Manim Class is defined.

tests/cellRanges.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe("Manim Cell Ranges", function () {
99
const tests = [
1010
{
1111
filename: "detection_basic.py",
12-
expectedRanges: [[5, 7], [9, 10]],
12+
expectedRanges: [[5, 7], [9, 10], [16, 18]],
1313
},
1414
{
1515
filename: "detection_class_definition.py",

tests/fixtures/detection_basic.py

+8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ def construct(self):
1111
print("And even more code")
1212

1313

14+
class BasicNotebookWithType(Scene):
15+
16+
def construct(self) -> None:
17+
## Cell inside construct(self) marked with "None" type
18+
print("With some code None")
19+
print("With some more code None")
20+
21+
1422
class NoManimScene(Scene):
1523
def constructtttt(self):
1624
## Should not be detected as Manim Cell

0 commit comments

Comments
 (0)