idaholab / moose-language-support

MOOSE language support for VSCode
Other
5 stars 4 forks source link

Long parsed functions getting newlines in the middle of numbers/coefficients #10

Closed cticenhour closed 2 years ago

cticenhour commented 2 years ago

When parsed functions get a bit long, often the extension makes a good choice about where to cut the function and bring it to a new line, but sometimes, it wants to cut in the middle of a number or function coefficient. For example, the following equation before formatting:

    value = '2*(1.0/(-2.705e-15*t^3+1.263e-11*t^2-1.836e-8*t+1.813e-5))*((1)*2.0025e4*exp(-1.61/8.617343e-5/t))/((1.0/(-2.705e-15*t^3+1.263e-11*t^2-1.836e-8*t+1.813e-5))+((1)*2.0025e4*exp(-1.61/8.617343e-5/t)))'

was reformatted to look like:

    value = '2*(1.0/(-2.705e-15*t^3+1.263e-11*t^2-1.836e-8*t+1.813e-5))*((1)*2.0025e4*exp(-1.61/8.617'
            '343e-5/t))/((1.0/(-2.705e-15*t^3+1.263e-11*t^2-1.836e-8*t+1.813e-5))+((1)*2.0025e4*exp(-'
            '1.61/8.617343e-5/t)))'

This looks great formatting-wise and is fine for functionality, but at a loss of some readability (8.617343e-5 is cut in half here, and the exponential at the end is also cut up in the middle). Can this behavior be adjusted to avoid a case like this?

dschwen commented 2 years ago

This is actually an issue in hit. See https://github.com/idaholab/moose/issues/15797