MPS-extensions icon indicating copy to clipboard operation
MPS-extensions copied to clipboard

Grammarcells: Too long method in GrammarActionsDescriptor.java

Open enikao opened this issue 5 years ago • 3 comments

When using grammar cells extensively, the method doGetSideTransformActions() can get too long:

[jetbrains.mps.make.CompilationErrorsHandler@69c09cb7] Compilation problems
[jetbrains.mps.make.CompilationErrorsHandler@69c09cb7] com\mbeddr\cpp\base\editor\GrammarActionsDescriptor.java : The code of method doGetSideTransformActions(TransformationMenuContext) is exceeding the 65535 bytes limit (line: 999)
Compilation finished: 1 errors, 0 warnings.
Error executing target jetbrains.mps.make.facets.JavaCompile.compile

Code in https://github.com/DSLFoundry/mbeddr.core/tree/grammarcells-issue-too-long-method

Attached the generated code.

GrammarActionsDescriptor.java.txt

enikao avatar Aug 31 '20 15:08 enikao

@alexanderpann do you know if there was any change trageting this issue?

arimer avatar Mar 07 '24 10:03 arimer

No, we didn't change anything. This exception could happen anywhere. If we would fix this, I would like to see a generic solution to the problem. Maybe some code that automatically splits up long methods into multiple methods.

alexanderpann avatar Mar 07 '24 13:03 alexanderpann

The solution would be to extract this code in separate methods and call those methods. We would have to do it also for the other methods in the GrammarActionsDescriptor. To test it, it is enough to use 100 grammar.substitutions cells in one editor.

alexanderpann avatar Nov 25 '24 16:11 alexanderpann