question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import modules unresolved

See original GitHub issue

Problem

A local module is marked as unused (not installed via elm). The function call is marked as unresolved reference.

What have I tried this far?

  • elm.json is connected and loads correctly (altho the module is not mentioned in this file since its not installed via elm install)
  • external libraries are shown
  • elm-stuff is included in intellij
  • cache has been invalidated

Reproduce

Url.elm

module Url exposing (getUrl)


getUrl : String
getUrl =
    "http://localhost:8080/"

NewType.elm referencing Url.elm

module NewType exposing (init, main)

import Browser
import Game exposing (Msg)
import Html exposing (Html, div, text)
import Url exposing (getUrl) -- marked as not used


main =
    Browser.element
        { init = init
        , update = update
        , subscriptions = always Sub.none
        , view = view
        }


type alias Model =
    Int


init : () -> ( Model, Cmd Msg )
init _ =
    ( 1, Cmd.none )


useImport : String
useImport =
    getUrl  -- marked as unresolved


update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    ( model, Cmd.none )


view : Model -> Html Msg
view model =
    div [] [ text "something" ]

image

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
klazukacommented, Nov 30, 2019

We do try to handle shadowing correctly, but I never thought about this case. The problem is that there are 2 Url modules visible: one defined in your project and the other which is an indirect dependency. I assumed that you could never have 2 modules with the same name in the same project, but I forgot about the indirect dependency case. I’ll see what I can do to fix it.

In the meantime, you can workaround the issue by giving your Url module a different name.

0reactions
ajaltcommented, Mar 2, 2020

This should be fixed by #614. If the issue still exists in the latest version of the plugin (3.5.1), please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

local module import not working - unresolved reference
Cant figure out why my local modeule/ file import suddenly isnt working anymore. Here is an example where it is clearly visible that...
Read more >
Unresolved reference in multi-project window to a module ...
Unresolved references in imports of modules appear if: A module is located inside a directory present in sys.path of the project interpreter; And, ......
Read more >
Unresolved import of local python file if main script is not at ...
When importing your own python modules which are in the workspace folder, but the main script is not in the root directory of...
Read more >
Unresolved reference for import, even though the module ...
If that doesnt work it could be inconpatible or maybe wrong syntax. What module is it and qhat Python version. Woupd be helpful...
Read more >
Python unresolved import: How to Solve Pylint Error
For the Python-specific imports, it resolves the unresolved import issue, but it won't resolve your own modules. When importing your own ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found