Pure-D / code-d

Fully featured D language extension for Visual Studio Code using Serve-D
MIT License
297 stars 47 forks source link

Spurious DUB "Unable to read module" error with bindbc dependency #474

Open aubade opened 7 months ago

aubade commented 7 months ago

When I create a project that depends on any bindbc project (This may apply to other dependencies but I have not tested them), it works fine except I get the following error in my "Problems" tab

app.d
- unable to read module 'sdl' DUB [ln 1, Col 8]
- app.d[Ln 1, Col 8]: Expected 'bindbc/sdl.d' or 'bindbc/sdl/package.d' in one of the following import paths:

code-d and serve-d report the following in the output tab:

serve-d standalone v0.8.0-beta.15
Included features: "d", "workspaces"
Built: Fri Apr 19 02:24:32 2024
with compiler LDC v2.107 on linux x86_64
dub, dfmt and dscanner are bundled within (compiled in)
2024-04-24T19:35:30.725 [info] extension.d:533:rootsForProject Root Suggestions: [RootSuggestion("/home/<redacted>/Devel/testcase", true)]
2024-04-24T19:35:30.725 [info] extension.d:564:doStartup registering instance for root RootSuggestion("/home/<redacted>/Devel/testcase", true)
2024-04-24T19:35:30.725 [info] extension.d:759:delayedProjectActivation Initializing instance for root RootSuggestion("/home/<redacted>/Devel/testcase", true)
2024-04-24T19:35:32.342 [info] extension.d:892:delayedProjectActivation Root RootSuggestion("/home/<redacted>/Devel/testcase", true) initialized in 1 sec, 616 ms, 637 μs, and 4 hnsecs
2024-04-24T19:35:32.350 [info] extension.d:997:startDCDServer Imports for /home/<redacted>/Devel/testcase: ["/home/<redacted>/.dub/packages/bindbc-common/0.1.5/bindbc-common/source/", "/home/<redacted>/.dub/packages/bindbc-loader/1.1.5/bindbc-loader/source/", "/home/<redacted>/.dub/packages/bindbc-sdl/1.4.7/bindbc-sdl/source/", "/home/<redacted>/.dub/packages/bindbc-common/0.1.5/bindbc-common/source/", "/home/<redacted>/.dub/packages/bindbc-loader/1.1.5/bindbc-loader/source/", "/home/<redacted>/Devel/testcase/source/", "/home/<redacted>/.dub/packages/bindbc-sdl/1.4.7/bindbc-sdl/source/", "/home/<redacted>/.dub/packages/bindbc-common/0.1.5/bindbc-common/source/", "/home/<redacted>/.dub/packages/bindbc-loader/1.1.5/bindbc-loader/source/"]
2024-04-24T19:35:38.286 [warning] first.d:377:visit Could not locate object.d or object.di
2024-04-24T19:35:38.286 [warning] first.d:474:visit Could not resolve location of module 'bindbc/sdl'
2024-04-24T19:35:38.286 [warning] first.d:474:visit Could not resolve location of module 'std/stdio'
2024-04-24T19:35:42.314 [warning] first.d:377:visit Could not locate object.d or object.di
2024-04-24T19:35:42.314 [warning] first.d:474:visit Could not resolve location of module 'bindbc/sdl'
2024-04-24T19:35:42.314 [warning] first.d:474:visit Could not resolve location of module 'std/stdio'

However, despite reporting this error, the import works fine. Dub is able to build the project perfectly well, and if I hilight the import at the top of the module and select "Go to definition" it goes to the appropriate file. Same for any bindbc symbols in the file itself.

enclosing a minimal testcase; all I did here is create a new dub project with bindbc-sdl as a dependency, and pasted some boilerplate initialization code from their documentation to show the library is working.

testcase.tar.gz

HuskyNator commented 2 months ago

Have this same issue a lot as well, though I can't "go to the appropriate file". No more autocomplete or anything because of it. For unclear reason it tends to disappear however. (not always)