Skip to content

Commit

Permalink
Fix code formatting when matching python-template snippets. (#10237)
Browse files Browse the repository at this point in the history
Because we were only checking the snippet match for "python" and not "python-template", we were adding { } that are (I suppose) expected for typescript but break python parsing. I've gone with the more general language check here instead of just adding another case in the hopes that it will be more future-proof if we add any more possible keywords.
  • Loading branch information
thsparks authored Oct 18, 2024
1 parent de6ec9d commit 3bba3e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pxtlib/tutorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ namespace pxt.tutorial {
m2 = "";
break;
}
code.push(m1 == "python" ? `\n${m2}\n` : `{\n${m2}\n}`);
code.push(language === "python" ? `\n${m2}\n` : `{\n${m2}\n}`);
idx++
return "";
});
Expand Down

0 comments on commit 3bba3e1

Please sign in to comment.