Skip to content

Instantly share code, notes, and snippets.

@hovsater
Last active October 3, 2020 05:49
Show Gist options
  • Save hovsater/df99db1d32308352c3146102c7427a6f to your computer and use it in GitHub Desktop.
Save hovsater/df99db1d32308352c3146102c7427a6f to your computer and use it in GitHub Desktop.
LSP-elm: Diagnostics were requested due to a file open or save
LSP-elm: Changed text document, going to parse it. file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm
:: -> LSP-elm textDocument/didOpen: {'textDocument': {'version': 0, 'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm', 'languageId': 'elm', 'text': 'module PhotoGroove exposing (main)\n\nimport Browser\nimport Html exposing (..)\nimport Html.Attributes exposing (..)\nimport Html.Events exposing (onClick)\nimport Random\n\n\nurlPrefix : String\nurlPrefix =\n "http://elm-in-action.com/"\n\n\ntype Msg\n = ClickedPhoto String\n | ClickedSize ThumbnailSize\n | ClickedSurpriseMe\n | GotRandomPhoto Photo\n\n\nview : Model -> Html Msg\nview model =\n div [ class "content" ] <|\n case model.status of\n Loaded photos selectedUrl ->\n viewLoaded photos selectedUrl model.chosenSize\n\n Loading ->\n []\n\n Errored errorMessage ->\n [ text ("Error: " ++ errorMessage) ]\n\n\nviewLoaded : List Photo -> String -> ThumbnailSize -> List (Html Msg)\nviewLoaded photos selectedUrl chosenSize =\n [ h1 [] [ text "Photo Groove" ]\n , button\n [ onClick ClickedSurpriseMe ]\n [ text "Surprise Me!" ]\n , h3 [] [ text "Thumbnail Size:" ]\n , div [ id "choose-size" ]\n (List.map (viewSizeChooser chosenSize) [ Small, Medium, Large ])\n , div\n [ id "thumbnails", class (sizeToString chosenSize) ]\n (List.map (viewThumbnail selectedUrl) photos)\n , img\n [ class "large"\n , src (urlPrefix ++ "large/" ++ selectedUrl)\n ]\n []\n ]\n\n\nviewThumbnail : String -> Photo -> Html Msg\nviewThumbnail selectedUrl thumb =\n img\n [ src (urlPrefix ++ thumb.url)\n , classList [ ( "selected", selectedUrl == thumb.url ) ]\n , onClick (ClickedPhoto thumb.url)\n ]\n []\n\n\nviewSizeChooser : ThumbnailSize -> ThumbnailSize -> Html Msg\nviewSizeChooser selectedSize size =\n label []\n [ input [ type_ "radio", name "size", onClick (ClickedSize size), checked (selectedSize == size) ] []\n , text (sizeToString size)\n ]\n\n\nsizeToString : ThumbnailSize -> String\nsizeToString size =\n case size of\n Small ->\n "small"\n\n Medium ->\n "med"\n\n Large ->\n "large"\n\n\ntype ThumbnailSize\n = Small\n | Medium\n | Large\n\n\ntype alias Photo =\n { url : String }\n\n\ntype Status\n = Loading\n | Loaded (List Photo) String\n | Errored String\n\n\ntype alias Model =\n { status : Status\n , chosenSize : ThumbnailSize\n }\n\n\ninitialModel : Model\ninitialModel =\n { status = Loading\n , chosenSize = Medium\n }\n\n\nupdate : Msg -> Model -> ( Model, Cmd Msg )\nupdate msg model =\n case msg of\n ClickedPhoto url ->\n ( { model | status = selectUrl url model.status }, Cmd.none )\n\n GotRandomPhoto photo ->\n ( { model | status = selectUrl photo.url model.status }, Cmd.none )\n\n ClickedSurpriseMe ->\n case model.status of\n Loaded (firstPhoto :: otherPhotos) _ ->\n Random.uniform firstPhoto otherPhotos\n |> Random.generate GotRandomPhoto\n |> Tuple.pair model\n\n Loaded [] _ ->\n ( model, Cmd.none )\n\n Loading ->\n ( model, Cmd.none )\n\n Errored errorMessage ->\n ( model, Cmd.none )\n\n ClickedSize size ->\n ( { model | chosenSize = size }, Cmd.none )\n\n\nselectUrl : String -> Status -> Status\nselectUrl url status =\n case status of\n Loaded photos _ ->\n Loaded photos.url\n\n Loading ->\n status\n\n Errored errorMessage ->\n status\n\n\nmain : Program () Model Msg\nmain =\n Browser.element\n { init = \\flags -> ( initialModel, Cmd.none )\n , view = view\n , update = update\n , subscriptions = \\model -> Sub.none\n }\n'}}
:: <- LSP-elm window/logMessage: {'message': 'Diagnostics were requested due to a file open or save', 'type': 3}
:: <-- LSP-elm workspace/configuration(28): {'items': [{'section': 'elmLS'}]}
:: >>> LSP-elm 28: [None]
:: <- LSP-elm window/logMessage: {'message': 'Changed text document, going to parse it. file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm', 'type': 3}
:: <- LSP-elm textDocument/publishDiagnostics: {'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm', 'diagnostics': [{'severity': 1, 'message': 'TYPE MISMATCH - Something is off with the 1st branch of this `case` expression:\n\n149| Loaded photos.url\n #^^^^^^^^^^^^^^^^^#\nThis `Loaded` call produces:\n\n #String -> Status#\n\nBut the type annotation on `selectUrl` says it should be:\n\n #Status#', 'source': 'Elm', 'range': {'end': {'character': 29, 'line': 148}, 'start': {'character': 12, 'line': 148}}}, {'severity': 1, 'message': 'TYPE MISMATCH - This is not a record, so it has no fields to access!\n\n149| Loaded photos.url\n #^^^^^^#\nThis `photos` value is a:\n\n #List Photo#\n\nBut I need a record with a #url# field!', 'source': 'Elm', 'range': {'end': {'character': 25, 'line': 148}, 'start': {'character': 19, 'line': 148}}}]}
LSP-elm: A code action was requested
:: --> LSP-elm textDocument/codeAction(52): {'textDocument': {'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm'}, 'context': {'diagnostics': []}, 'range': {'end': {'character': 0, 'line': 0}, 'start': {'character': 0, 'line': 0}}}
:: <- LSP-elm window/logMessage: {'message': 'A code action was requested', 'type': 3}
:: <<< LSP-elm 52: []
:: --> LSP-elm textDocument/codeAction(53): {'textDocument': {'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm'}, 'context': {'diagnostics': [{'severity': 1, 'message': 'TYPE MISMATCH - Something is off with the 1st branch of this `case` expression:\n\n149| Loaded photos.url\n #^^^^^^^^^^^^^^^^^#\nThis `Loaded` call produces:\n\n #String -> Status#\n\nBut the type annotation on `selectUrl` says it should be:\n\n #Status#', 'source': 'Elm', 'range': {'end': {'character': 29, 'line': 148}, 'start': {'character': 12, 'line': 148}}}]}, 'range': {'end': {'character': 29, 'line': 148}, 'start': {'character': 12, 'line': 148}}}
LSP-elm: A code action was requested
:: <- LSP-elm window/logMessage: {'message': 'A code action was requested', 'type': 3}
:: <<< LSP-elm 53: []
:: -> LSP-elm textDocument/didChange: {'textDocument': {'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm', 'version': 2}, 'contentChanges': [{'text': 'module PhotoGroove exposing (main)\n\nimport Browser\nimport Html exposing (..)\nimport Html.Attributes exposing (..)\nimport Html.Events exposing (onClick)\nimport Random\n\n\nurlPrefix : String\nurlPrefix =\n "http://elm-in-action.com/"\n\n\ntype Msg\n = ClickedPhoto String\n | ClickedSize ThumbnailSize\n | ClickedSurpriseMe\n | GotRandomPhoto Photo\n\n\nview : Model -> Html Msg\nview model =\n div [ class "content" ] <|\n case model.status of\n Loaded photos selectedUrl ->\n viewLoaded photos selectedUrl model.chosenSize\n\n Loading ->\n []\n\n Errored errorMessage ->\n [ text ("Error: " ++ errorMessage) ]\n\n\nviewLoaded : List Photo -> String -> ThumbnailSize -> List (Html Msg)\nviewLoaded photos selectedUrl chosenSize =\n [ h1 [] [ text "Photo Groove" ]\n , button\n [ onClick ClickedSurpriseMe ]\n [ text "Surprise Me!" ]\n , h3 [] [ text "Thumbnail Size:" ]\n , div [ id "choose-size" ]\n (List.map (viewSizeChooser chosenSize) [ Small, Medium, Large ])\n , div\n [ id "thumbnails", class (sizeToString chosenSize) ]\n (List.map (viewThumbnail selectedUrl) photos)\n , img\n [ class "large"\n , src (urlPrefix ++ "large/" ++ selectedUrl)\n ]\n []\n ]\n\n\nviewThumbnail : String -> Photo -> Html Msg\nviewThumbnail selectedUrl thumb =\n img\n [ src (urlPrefix ++ thumb.url)\n , classList [ ( "selected", selectedUrl == thumb.url ) ]\n , onClick (ClickedPhoto thumb.url)\n ]\n []\n\n\nviewSizeChooser : ThumbnailSize -> ThumbnailSize -> Html Msg\nviewSizeChooser selectedSize size =\n label []\n [ input [ type_ "radio", name "size", onClick (ClickedSize size), checked (selectedSize == size) ] []\n , text (sizeToString size)\n ]\n\n\nsizeToString : ThumbnailSize -> String\nsizeToString size =\n case size of\n Small ->\n "small"\n\n Medium ->\n "med"\n\n Large ->\n "large"\n\n\ntype ThumbnailSize\n = Small\n | Medium\n | Large\n\n\ntype alias Photo =\n { url : String }\n\n\ntype Status\n = Loading\n | Loaded (List Photo) String\n | Errored String\n\n\ntype alias Model =\n { status : Status\n , chosenSize : ThumbnailSize\n }\n\n\ninitialModel : Model\ninitialModel =\n { status = Loading\n , chosenSize = Medium\n }\n\n\nupdate : Msg -> Model -> ( Model, Cmd Msg )\nupdate msg model =\n case msg of\n ClickedPhoto url ->\n ( { model | status = selectUrl url model.status }, Cmd.none )\n\n GotRandomPhoto photo ->\n ( { model | status = selectUrl photo.url model.status }, Cmd.none )\n\n ClickedSurpriseMe ->\n case model.status of\n Loaded (firstPhoto :: otherPhotos) _ ->\n Random.uniform firstPhoto otherPhotos\n |> Random.generate GotRandomPhoto\n |> Tuple.pair model\n\n Loaded [] _ ->\n ( model, Cmd.none )\n\n Loading ->\n ( model, Cmd.none )\n\n Errored errorMessage ->\n ( model, Cmd.none )\n\n ClickedSize size ->\n ( { model | chosenSize = size }, Cmd.none )\n\n\nselectUrl : String -> Status -> Status\nselectUrl url status =\n case status of\n Loaded photos _ ->\n Loaded photos url\n\n Loading ->\n status\n\n Errored errorMessage ->\n status\n\n\nmain : Program () Model Msg\nmain =\n Browser.element\n { init = \\flags -> ( initialModel, Cmd.none )\n , view = view\n , update = update\n , subscriptions = \\model -> Sub.none\n }\n'}]}
LSP-elm: Diagnostics were requested due to a file change
LSP-elm: Changed text document, going to parse it. file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm
:: <- LSP-elm window/logMessage: {'message': 'Diagnostics were requested due to a file change', 'type': 3}
:: <- LSP-elm textDocument/publishDiagnostics: {'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm', 'diagnostics': [{'severity': 1, 'message': 'TYPE MISMATCH - Something is off with the 1st branch of this `case` expression:\n\n149| Loaded photos.url\n #^^^^^^^^^^^^^^^^^#\nThis `Loaded` call produces:\n\n #String -> Status#\n\nBut the type annotation on `selectUrl` says it should be:\n\n #Status#', 'source': 'Elm', 'range': {'end': {'character': 29, 'line': 148}, 'start': {'character': 12, 'line': 148}}}, {'severity': 1, 'message': 'TYPE MISMATCH - This is not a record, so it has no fields to access!\n\n149| Loaded photos.url\n #^^^^^^#\nThis `photos` value is a:\n\n #List Photo#\n\nBut I need a record with a #url# field!', 'source': 'Elm', 'range': {'end': {'character': 25, 'line': 148}, 'start': {'character': 19, 'line': 148}}}]}
LSP-elm: A code action was requested
:: <- LSP-elm window/logMessage: {'message': 'Changed text document, going to parse it. file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm', 'type': 3}
:: --> LSP-elm textDocument/codeAction(54): {'textDocument': {'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm'}, 'context': {'diagnostics': [{'severity': 1, 'message': 'TYPE MISMATCH - Something is off with the 1st branch of this `case` expression:\n\n149| Loaded photos.url\n #^^^^^^^^^^^^^^^^^#\nThis `Loaded` call produces:\n\n #String -> Status#\n\nBut the type annotation on `selectUrl` says it should be:\n\n #Status#', 'source': 'Elm', 'range': {'end': {'character': 29, 'line': 148}, 'start': {'character': 12, 'line': 148}}}]}, 'range': {'end': {'character': 29, 'line': 148}, 'start': {'character': 12, 'line': 148}}}
:: <- LSP-elm window/logMessage: {'message': 'A code action was requested', 'type': 3}
:: <<< LSP-elm 54: []
:: --> LSP-elm textDocument/formatting(55): {'textDocument': {'uri': 'file:///Users/kevinsjoberg/code/PhotoGroove/src/PhotoGroove.elm'}, 'options': {'tabSize': 4, 'insertFinalNewline': True, 'trimFinalNewlines': True, 'insertSpaces': True, 'trimTrailingWhitespace': True}}
LSP-elm: Formatting was requested
:: <- LSP-elm window/logMessage: {'message': 'Formatting was requested', 'type': 3}
:: <-- LSP-elm workspace/configuration(29): {'items': [{'section': 'elmLS'}]}
:: >>> LSP-elm 29: [None]
:: <<< LSP-elm 55: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment