-
Notifications
You must be signed in to change notification settings - Fork 14
Support common IDE features (dlang-vscode#53) #9
Comments
Thank you very much! :) 👍 |
So it's been a few months since the original issue was posted, and things haven't really moved regarding the features proposed here; so I thought I'd clear up a few things about what I am doing, and planning to do. Right now, DLS relies on DFMT, DCD and D-Scanner for most things. Although they are mostly working great, there are still some issues: DFMT not being able to properly format struct initializers, or finding declarations being sometimes completely off for example. On top of that there are also lots of things to improve in DLS itself, I've introduced tons of regressions in various releases, and each of these releases also take more and more resources to compile. I've started putting together a test suite. It doesn't test much for now (basic initialization, formatting and symbol searching) but even that alone showed me a few bugs I never realized were there, ready to potentially break things with any client LSP implementation I don't test myself. Heck, if you browse the For DFMT, I counted 2 routes I could take:
The problem I see with patching DFMT is that the code already feels like a big clump of patches itself in a number of places... For DCD, I am thinking about the possibility to replace its usage with custom code (but still using libdparse). Like the others, it was designed to be used via the command line and not as a library, which makes some things awkward (I can't access DCD's inheritance information to show a type hierarchy and would have to re-implement everything myself, even though DCD does it already). I'm also not a fan of the fact that it uses a cache; I would prefer to have a reduced memory footprint. For D-Scanner, I have nothing planned, it works fine and I have no problem with it (other than inconsistent errors codes). TL;DR: re-implementing a formatter and a "symbol handler", so to speak, would help in solving formatting issues, reducing memory usage, maybe getting better definitions/references/... , as well as making further changes easier to implement. |
Thank you for the update appreciate it!
That's a good idea.
I never relied on DFMT. I always found it to be very buggy unfortunately. Instead, I use clang-format. It works for the most part even though it doesn't support D at all. However I have to add things like: // clang-format off
mList ~= item;
// clang-format on Which is obviously not very convenient, but at least it works.
I vaguely remember there were plans to make DMD itself usable as a library kinda like llvm or libclang, but I'm not sure where that went.
Thank you for putting in all those efforts!!! |
UpdateFormattingSince v0.24.0, DLS has a custom formatting backend, that can be enabled by setting void foo()
{
S s = {a:3};
} DFMT will produce this: void foo()
{
S s = {a:
3};
} while the new DLS formatter will keep it as a one-liner: void foo()
{
S s = { a : 3 };
} There are probably still bugs around, but this is how it's shaping up right now. Regarding other things: libdparse/dsymbol/dcd/dscanner...For the foreseeable future, I'm sticking with these libraries. DMD is supposed to be usable as a library; however because it uses versions like Now, it's been around 10 months that DLS has had automated binaries for all major platforms, in both 32bit and 64bit (although the 32bit variants have literally 0 downloads). So I removed the old code that tried to build DLS when it failed to download it, since a failure to download anything would mean the failure to fetch the new package with dub as well anyway. The reason I thought about this is that it has been proposed as a potential GSOC project (https://wiki.dlang.org/GSOC_2019_Ideas#Language_Server_Protocol_for_D), so even if I don't do it, maybe someone else will take a stab at it later this year. |
From mattiascibien/dlang-vscode#53:
The text was updated successfully, but these errors were encountered: