LS4P icon indicating copy to clipboard operation
LS4P copied to clipboard

[BUG] Escaped characters and addition of multiple lines in a string give compilation errors

Open Efratror opened this issue 2 years ago • 0 comments

Bug:

code like:

String s = "\n";
String s= "\"";

println("X" +
"X");

Give compilation errors due to the fact the quotation character is replaced with multiple escaped characters ("\"") https://github.com/processing-language-server/LS4P/blob/1998f6e973460b392da3d2bcfa53da494970b9c5/server/src/grammer/terms/preprocessingsnippets.ts#L113-L122

Possible Solution

I think the problem lies at the method to create the java file: https://github.com/processing-language-server/LS4P/blob/1998f6e973460b392da3d2bcfa53da494970b9c5/server/src/parser.ts#L39-L44 It now uses an echo command to create the file. If instead a method like fs.writeFileSync() is used there is no need for escaping quotation characters to write the java file. All characters should be written to the file "as is".

Efratror avatar Mar 21 '22 15:03 Efratror