Skip to content
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

Multi-line strings don't work on Windows #254

Closed
mbartlett21 opened this issue Jul 31, 2024 · 1 comment · Fixed by #255
Closed

Multi-line strings don't work on Windows #254

mbartlett21 opened this issue Jul 31, 2024 · 1 comment · Fixed by #255
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@mbartlett21
Copy link
Contributor

mbartlett21 commented Jul 31, 2024

Original error

I recently tried to use a new version of Gren (previously on 0.2.0) and was unuable to get it to compile. As a result I tried just doing a simple project with default dependencies.

My gren.json (created by gren init) is below:

{
    "type": "application",
    "platform": "browser",
    "source-directories": [
        "src"
    ],
    "gren-version": "0.4.4",
    "dependencies": {
        "direct": {
            "gren-lang/browser": "4.0.0",
            "gren-lang/core": "5.0.2"
        },
        "indirect": {
            "gren-lang/url": "4.0.0"
        }
    }
}

and it results in this error:

Dependency problem!
-- PROBLEM BUILDING DEPENDENCIES -----------------------------------------------

I ran into a compilation error when trying to build the following package:

    gren-lang/browser 4.0.0

This probably means it has package constraints that are too wide. It may be
possible to tweak your gren.json to avoid the root problem as a stopgap. Head
over to https://gren-lang.org/community to get help figuring out how to take
this path!

Note: To help with the root problem, please report this to the package author
along with the following information:

    gren-lang/core 5.0.2
    gren-lang/url 4.0.0

If you want to help out even more, try building the package locally. That should
give you much more specific information about why this package is failing to
build, which will in turn make it easier for the package author to fix it!

Actually it looks like the error is that Git on Windows likes changing line endings to \r\n rather than just \n and Gren doesn't like that with multiline strings:

AppData\Local\gren\0.4.4\packages\gren-lang\browser\4.0.0
> gren make
Dependencies ready!
Detected problems in 2 modules.
-- MULTILINE STRING WITHOUT LEADING NEWLINE ---------- src\Debugger\History.gren

The contents of a multiline sting must start on a new line

447|     Html.node "style" [] [ text """
                                     ^
Add a """ a new line right after the opening quotes.

Note: Here is a valid multi-line string for reference:

    """
    # Multi-line Strings

    - start with triple double quotes
    - write whatever you want
    - no need to escape newlines or double quotes
    - end with triple double quotes
    """

                                                         Debugger.History  Γåæ
====o======================================================================o====
    Γåô  Debugger.Overlay


-- MULTILINE STRING WITHOUT LEADING NEWLINE ---------- src\Debugger\Overlay.gren

The contents of a multiline sting must start on a new line

297|     """
         ^
Add a """ a new line right after the opening quotes.

Note: Here is a valid multi-line string for reference:

    """
    # Multi-line Strings

    - start with triple double quotes
    - write whatever you want
    - no need to escape newlines or double quotes
    - end with triple double quotes
    """

My system git has core.autocrlf set to true, but everything else is generally happy.

@mbartlett21 mbartlett21 changed the title Confusing error when trying to start a new project on Windows Multi-line strings don't work on Windows Jul 31, 2024
@robinheghan robinheghan added bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed labels Aug 1, 2024
@mbartlett21
Copy link
Contributor Author

@robinheghan
I've done some changes on this branch which I think should fix the issue (I haven't got an install of Haskell etc, so haven't tested it)

https://github.com/mbartlett21/gren-compiler/tree/multiline-string-crlf

I've opened a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants