-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sanitize whitespace by os #255
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #255 +/- ##
==========================================
+ Coverage 89.80% 89.81% +0.01%
==========================================
Files 26 26
Lines 2874 2877 +3
Branches 505 506 +1
==========================================
+ Hits 2581 2584 +3
Misses 157 157
Partials 136 136 ☔ View full report in Codecov by Sentry. |
@@ -103,6 +103,8 @@ const comment = (position: 'start' | 'end' | 'inner') => lazy('comment', () => r | |||
const sameLineComment: Parser<Annotation> = comment('end') | |||
|
|||
export const sanitizeWhitespaces = (originalFrom: SourceIndex, originalTo: SourceIndex, input: string): [SourceIndex, SourceIndex] => { | |||
const EOL = input.includes('\r\n') ? '\r\n' : '\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aca tenia varias opciones para conseguir el valor de EOL
- Se podria sacar del objeto
os
que provee Node, pero no me parecia correcto porque no sabemos con certeza si el string que llega fue generado en el mismo SO que esta corriendo wollok-ts.- Aca fallaban los tests en Windows porque los strings de js van siempre con
\n
me parece, pero se podria mockear supongo.
- Aca fallaban los tests en Windows porque los strings de js van siempre con
- Calcular una vez para todos los archivos que se quieran parsear, pero tambien me hacia ruido y ademas no se que tanto mas performante seria.
Termine dejandolo asi pero no estoy seguro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yo creo que por ahora es una solución good enough para salir. Por la performance no me preocuparía mucho, no veo que vaya a afectar.
👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
nos vemos en agosto!!!
@@ -103,6 +103,8 @@ const comment = (position: 'start' | 'end' | 'inner') => lazy('comment', () => r | |||
const sameLineComment: Parser<Annotation> = comment('end') | |||
|
|||
export const sanitizeWhitespaces = (originalFrom: SourceIndex, originalTo: SourceIndex, input: string): [SourceIndex, SourceIndex] => { | |||
const EOL = input.includes('\r\n') ? '\r\n' : '\n' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yo creo que por ahora es una solución good enough para salir. Por la performance no me preocuparía mucho, no veo que vaya a afectar.
👍🏼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grosssoooo!!! 🪟 🚫 👍
Yo diría de correr el CI en Windows... no sé si agarraba este error pero para estar más seguros (?
En Windows los source maps se estaban formando mal, esto es porque en los sistemas operativos
de bienbasados en Unix el caracter de new line es el\n
pero en Windows son dos caracters\r\n
Ahora el/los caracter/es a utilizar son calculados y el calculo para sanitizar los sourcemaps se basan es esto.