serve-d
serve-d copied to clipboard
importPaths in dub "configurations" is ignored where there are multiple, only the 1st config works
Let's take this dub:
{
"name": "my_project",
"targetPath": "bin",
"workingDirectory": "bin",
"stringImportPaths": [ "bin/" ],
"configurations": [
{
"name": "app",
"targetType": "executable",
"targetName": "app",
"sourcePaths": [
"app/src",
],
"importPaths": [
"app/src",
],
},
{
"name": "dll",
"targetType": "dynamicLibrary",
"targetName": "dll",
"excludedSourceFiles": [
"src"
],
"sourcePaths": [
"dll/src",
],
"importPaths": [
"dll/src",
],
}
]
}
2 configs: 'app' and 'dll'
By default i get completion for everything that is specified in importPaths from 'app' configuration
app/src/main.d <---- here i can 'import data;' and get completion
app/src/data.d
However, when i am in:
dll/src/dllmain.d <--- here, i can't 'import other;', i get 0 completion
dll/src/other.d
To fix that i must add 'importPaths' at the root of the 'dub.json' file, wich is the indication that 'importPaths' is ignored from the configuration
"importPaths": [
"dll/src"
],
And yes, i tried to switch it here:

It's on 'dll' and no changes, doesn't work
[0] C:\Users\ryuukk\AppData\Roaming\code-d\bin\dcd-server.exe
[1] --port
[2] 9166
[3] -IC:\D\dmd2\windows\bin\..\..\src\phobos
[4] -IC:\D\dmd2\windows\bin\..\..\src\druntime\import
[FULL] C:\Users\ryuukk\AppData\Roaming\code-d\bin\dcd-server.exe --port "9166" -IC:\D\dmd2\windows\bin\..\..\src\phobos -IC:\D\dmd2\windows\bin\..\..\src\druntime\import
dcd-server was starting with these paths, why it's missing the projects paths?
serve-d should parse all the dub.json file and append to -I all the import paths
then serve-d should communicate with dcd-server based on what file you are working with and filter things based on the configuration
I think i'll write an alternative to serve-d it's too slow to compile for me to do any work with it, all my projects compile under 1 second
@WebFreak001 could you maybe point me in the right direction if i want to fix this? I am not really familliar with the codebase
@lucasnethaj the import paths are gathered from DUB inside workspaced/com/dub.d (it registers itself through importPathProvider = &imports; in load())
in workspaced/com/dcd.d it uses the importPathProvider through just the property importPaths, e.g. refreshImports
now this may either be:
- the configuration isn't properly loaded inside dub.d / it doesn't return the correct import paths in the provider
- DCD doesn't get its import paths reloaded properly
Back when I implemented the dcd code it also wasn't possible to remove import paths, but that is now possible. That might also be a factor at play here.
Okay thank you, i'll give it a look :-)