From 2f3157b64d6c2e219390cd2415cda1709879fe42 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sun, 26 Feb 2023 21:41:15 +0100 Subject: [PATCH] Try to force definitions file to have LF endings --- .gitattributes | 5 +++++ packages/cli/src/gen/definitions/parser.rs | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index ca985ca..cf332f3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,9 @@ * text=auto + # Temporarily highlight luau as normal lua files # until we get native linguist support for Luau *.luau linguist-language=Lua + +# Ensure all lua files use LF +*.lua eol=lf +*.luau eol=lf diff --git a/packages/cli/src/gen/definitions/parser.rs b/packages/cli/src/gen/definitions/parser.rs index 1c09882..0b47cc5 100644 --- a/packages/cli/src/gen/definitions/parser.rs +++ b/packages/cli/src/gen/definitions/parser.rs @@ -49,7 +49,7 @@ impl DefinitionsParser { S: AsRef, { // TODO: Properly handle the "declare class" syntax, for now we just skip it - let mut no_class_declares = contents.as_ref().to_string(); + let mut no_class_declares = contents.as_ref().replace("\r\n", "\n"); while let Some(dec) = no_class_declares.find("\ndeclare class") { let end = no_class_declares.find("\nend").unwrap(); let before = &no_class_declares[0..dec];