Pure-D / serve-d

D LSP server (dlang language server protocol server)
MIT License
200 stars 48 forks source link

No completion if modules have prefix `module myroot.filea` and setup to not use dub #311

Closed ryuukk closed 1 year ago

ryuukk commented 1 year ago

Let's take this example:

import path is properly found: c:\\dev\\kdom\\projects\\server_game

2023-03-26T00:20:37.726 [info] source\served\extension.d:797:startDCDServer Imports for c:\dev\kdom: ["c:\\dev\\kdom", "c:/D/dmd2/src/druntime/import", "c:\\dev\\kdom\\better_d", "c:\\dev\\kdom\\projects\\server_game"]

So the root is: server_game/

It knows modules if file is:

server_game/a.d

module a;

But it doesn't know modules if file is: server_game/a.d

module sgame.a;

image

Expected:

It should recognize this behavior, the language server shouldn't tell me how to name my modules

If that's a limitation from DCD than this needs to be solved

I refuse to name my modules in a specific way to comply with a broken design

My code compile fine, so it's not a language problem, it's a server problem

WebFreak001 commented 1 year ago

this is fine since it's how the language works with import paths (using -i) and it's not working unless you specify all your files in the command line to prepare the compiler to find all of them.

In serve-d you also need to list all your source D files, using d.projectImportPaths you can manually list all of your D files.

However I would strongly recommend using matching folder & module names, since that's required to be able to use custom libraries properly without the need to pass them into the cmdline again.