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

Errors from elm make: Received an invalid json, skipping error. #654

Open
Yarith opened this issue Nov 2, 2021 · 2 comments
Open

Errors from elm make: Received an invalid json, skipping error. #654

Yarith opened this issue Nov 2, 2021 · 2 comments

Comments

@Yarith
Copy link

Yarith commented Nov 2, 2021

No errors shown in the editor when passing from a case of to a function with the wrong type. It doesn't matter if it is with <| pipe or with parentheses. If you look in the Output log you will get the Received an invalid json, skipping error. warning. With parentheses at least you get an error by the language server, but still none from elm make.

Expected Behavior

Showing the error which is provided by elm make.

Current Behavior

The errors are not shown and instead in the Output log of the extension is the warning Received an invalid json, skipping error. written 3 times directly after the elm make command. Also the language server itself seems to not detect the type mismatch.

Possible Solution

As i found out after sending this issue, the problem came from the missing elm-test tool. After installing it, the log entry and the missing errors got visible.

Steps to Reproduce (for bugs)

  1. Open Visual Studio Code create a new module with following text in a new elm project:
module Test exposing (..)


type Tree
    = Tree


tree : Tree
tree =
    Tree


node : String -> Tree
node _ =
    Debug.todo "node"


combine : Tree -> Tree
combine value =
    -- If you change <| to parentheses the "Received an invalid json, skipping error."
    -- is still there, but now the tree gets a red squiggle
    node <|
        case value of
            Tree ->
                tree
  1. After saving there are no red squiggles, but the code is not compiling.

The output from elm make for the example is:

{
    "type": "compile-errors",
    "errors": [
        {
            "path": "D:\\temp\\elm\\test-project\\src\\Test.elm",
            "name": "Test",
            "problems": [
                {
                    "title": "TYPE MISMATCH",
                    "region": {
                        "start": {
                            "line": 21,
                            "column": 9
                        },
                        "end": {
                            "line": 23,
                            "column": 21
                        }
                    },
                    "message": [
                        "I cannot send this through the (<|) pipe:\n\n20|     node <|\r\n21|",
                        {
                            "bold": false,
                            "underline": false,
                            "color": "RED",
                            "string": ">"
                        },
                        "        case value of\r\n22|",
                        {
                            "bold": false,
                            "underline": false,
                            "color": "RED",
                            "string": ">"
                        },
                        "            Tree ->\r\n23|",
                        {
                            "bold": false,
                            "underline": false,
                            "color": "RED",
                            "string": ">"
                        },
                        "                tree\r\n\nThe argument is:\n\n    ",
                        {
                            "bold": false,
                            "underline": false,
                            "color": "yellow",
                            "string": "Tree"
                        },
                        "\n\nBut (<|) is piping it to a function that expects:\n\n    ",
                        {
                            "bold": false,
                            "underline": false,
                            "color": "yellow",
                            "string": "String"
                        },
                        ""
                    ]
                }
            ]
        }
    ]
}

Context

I was refactoring some code where i replaced a simple String with a specific type like a Tree. I noticed, that my code was not compiling, but in Visual Studio Code were no red squiggles. I looked in the Output log of the extension and noticed three Received an invalid json, skipping error..

Your Environment

  • Version used: 2.3.0
  • Editor used:
Version: 1.61.2 (user setup)
Commit: 6cba118ac49a1b88332f312a8f67186f7f3c1643
Datum: 2021-10-19T14:57:20.575Z
Electron: 13.5.1
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
Betriebssystem: Windows_NT x64 10.0.19042
  • Environment name and version (e.g. node.js 5.4): node v14.16.0
  • Operating System and version: Windows 10 - 20H2 Build 19042.1288
@Yarith
Copy link
Author

Yarith commented Nov 2, 2021

Submitted the issue too early. It looks like the warning is generated by the output of the missing elm-test. If i install it, the errors from elm make are shown and the warnings are gone. I didn't noticed that elm-test is missing, because i thought it is getting installed by the elm-tooling.json anyway, but this is not the case and not supported. Was also not expecting that a missing elm-test will hide the errors from elm make and was not thinking that far.

@razzeee
Copy link
Member

razzeee commented Dec 25, 2021

Yeah, I think this might be due to a fairly recent change, will have to double check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants