Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for compilation database #930

Open
ricardaxel opened this issue Sep 13, 2023 · 1 comment
Open

Support for compilation database #930

ricardaxel opened this issue Sep 13, 2023 · 1 comment

Comments

@ricardaxel
Copy link
Contributor

Some build systems (bazel, meson, ..) can generate compilation database, that contain information about import directories.

For D code, such file looks like that :

[
      { 
        "directory": "build", 
        "command": "dmd -I=hello.p -I=. -I=.. -color=on -wi -g -debug -makedeps=hello.p/main.d.o.deps -of=hello.p/main.d.o -c ../main.d",
        "file": "../main.d",
        "output": "hello.p/main.d.o"
      }
    ]

Would it be possible to add an option --compile-database that could automatically resolve imports from compilation database ?
I might do a PR if you're ok with the concept.

@WebFreak001
Copy link
Member

D-Scanner doesn't currently properly expose the import path setting, although it is used for some checks. However it fails even including phobos on its own and also explicitly hides the warnings that show that your import paths are not configured properly, to not break compatibility with people's projects that would suddenly start giving linter warnings just after upgrading the tool and not having the newly exposed old feature configured.

So it would first be a good idea to properly expose the import paths / dsymbol index through the D-Scanner API (for serve-d to manipulate) and then also include code to automatically include the default import paths for the current / user specified compiler that also works in the standalone version.

A lot of this work, including compilation database support and extended linter things, are already implemented in serve-d, however it's not possible to run the improved linting standalone for CI output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants