File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,11 @@ function escapeCode(code: string) {
1414 return code . replace ( / ` (? = ` ) / g, '`\u200B' ) ;
1515}
1616
17+ // Remove `@noErrorTruncation` from the source; this can cause lag/crashes for large errors
18+ function redactNoErrorTruncation ( code : string ) {
19+ return code . replace ( / @ n o E r r o r T r u n c a t i o n / g, '' ) ;
20+ }
21+
1722export class TwoslashModule extends Module {
1823 @command ( {
1924 single : true ,
@@ -40,7 +45,7 @@ export class TwoslashModule extends Module {
4045 `:warning: could not find any TypeScript codeblocks in the past 10 messages` ,
4146 ) ;
4247
43- const ret = twoslasher ( code , 'ts' , {
48+ const ret = twoslasher ( redactNoErrorTruncation ( code ) , 'ts' , {
4449 defaultOptions : { noErrorValidation : true } ,
4550 } ) ;
4651
@@ -85,7 +90,7 @@ export class TwoslashModule extends Module {
8590 }
8691
8792 private async twoslashBlock ( msg : Message , code : string ) {
88- const ret = twoslasher ( code , 'ts' , {
93+ const ret = twoslasher ( redactNoErrorTruncation ( code ) , 'ts' , {
8994 defaultOptions : {
9095 noErrorValidation : true ,
9196 noStaticSemanticInfo : false ,
You can’t perform that action at this time.
0 commit comments