Pure-D / serve-d

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

Serve-d cannot work with local-dependencies #314

Open AssertionBit opened 1 year ago

AssertionBit commented 1 year ago

Specs:

Problem

When I working on my project I find out that serve-d is not showing me internal API from other libraries and local too. For example this code is not indexed at all:

import std.stdio; // Works fine
import toml; // Completions gone
import log4d; // Local-Package, completions gone too

auto parsed_data = toml.parse(...); // No documentation & completions
auto logger = new log4d.logger.TerminalLogger(); // Gone too
// dub.sdl

name "marble"
description "Full stack Web development framework for D."
authors "AssertionBit"
copyright "Copyright © 2023, AssertionBit"
license "proprietary"
targetType "sourceLibrary"

dependency "toml" version="~>2.0.1"
dependency "log4d" version="*" path="vendor/log4d"

Logs

Possible issue

Maybe problem in targetType. If Serve-D works with libraries as they are, then it can not compile program at all and receive errors from it. Maybe need to handle all possible Build Types: staticLibrary, sourceLibrary, sharedLibrary. Wrap those formats into abstract main.d and compile like normal.

WebFreak001 commented 1 year ago

yes sourceLibrary is kinda broken because of how it is handled by dub internally. (It's like targetType none, since it doesn't output anything)

Local dependencies should work fine, I think this is just because of the targetType.

When working on such projects I could probably just tell dub it's a regular source library to make it work properly.

AssertionBit commented 1 year ago

Well, I find out the walk around of it. If pass the dflags in dub.json/dub.sdl the flag.

{
    "dflags": ["-I/vendor/log4d"]
}

Then Serve-D could find a module and handle it normally. Well, it works, but this is still a problem

AssertionBit commented 1 year ago

Problem is still found in staticLibrary. So this is not problem of the sourceLibrary only