d-language-server / dls

A Language Server implementation for D
http://dls.dub.pm
106 stars 14 forks source link

Add option to not create .dub when dub.json or dub.sdl is not used #11

Closed spikespaz closed 6 years ago

spikespaz commented 6 years ago

Some projects (all of mine) don't use Dub. Could we have an option to disable creation of .dub/version.json if the Dub package configuration doesn't exist?

I'm going to just add .dub/ to my .gitignore for now but it would be nice to see this implemented.

Also, thank you for the VS Code extension and the language server! It hasn't crashed on me yet, this is much better than code-d and serve-d.

LaurentTreguier commented 6 years ago

When does it create the .dub folder ? I just tried to open a folder without any dub file, and I haven't managed to get it created.

(you're lucky if it hasn't crashed on you, it can crash any time you write the beginning of a function with out the braces because libdparse isn't up to date)

spikespaz commented 6 years ago

When reloading the window and the extension starts up, .dub and .dub/version.json.

The contents of this file are very simple.

{
    "version": "~master",
    "commit": "23b0b153fe531e90018483636ecec9650f0caf3d"
}

Steps to reproduce:

  1. dub fetch dls && dub run dls:bootstrap
  2. ext install vscode-dls or from the marketplace
  3. git clone https://github.com/spikespaz/search-deflector ~/github.com/spikespaz/search-deflector
  4. code ~/github.com/spikespaz/search-deflector
  5. Wait a few seconds for VS Code to finish loading itself and extensions.
  6. Observe the .dub folder that has been created.

I should add that I'm running Windows 10 Insider Preview in the slow lane (17758).

spikespaz commented 6 years ago

Also is there a reason libdparse hasn't been updated to fix that problem? I'd like to clone this, update that dependency, and build myself if possible.

LaurentTreguier commented 6 years ago

It's because dfmt hasn't been fully updated to support the latest additions to D (attributes to enum members and function arguments), so the latest release is using an older libdparse and it would cause a conflict if I tried using the newest libdparse.

I just cloned search-deflector and opened it in VSCode, and nothing seems to happen. On which platform are you ? You wrote ~/github.com/spikespaz/search-deflector as if you were on a posix system, yet the search-deflector is a Windows utility, I'm confused a bit...

LaurentTreguier commented 6 years ago

Ah, yes, on Windows it does it, but not on Ubuntu for some reason. Maybe it's because of a difference in the dub version.

spikespaz commented 6 years ago

I use POSIX shells, bash and zsh, on Windows because screw Windows. MinGW is a blessing (sometimes). Besides, I don't know the command syntax niceties for command prompt. Bash is my comfort zone. You can see the build.sh is even targeting bourne again shell.

LaurentTreguier commented 6 years ago

True, I was using https://github.com/mridgers/clink at some point to ba able to use cmd with bash keybindings. The issue is fixed by 6e059995c34e97f14785387d2a5f5db968fadc7e, I'll just ensure things go smoothly with non-dub project before pushing a new release.

spikespaz commented 6 years ago

Great! Just FYI, you can close issues and automatically cross-reference to relevant commits by adding closes #11 to the commit message. For example, Add improved error message for deflecting browser (closes #25).

You don't even have to use closes if the terminology isn't fitting. Any of these will work:

close(?:s|d)?|fix(?:es|ed)?|resolve(?:s|d)?
LaurentTreguier commented 6 years ago

I know, but I commited that on Ubuntu and didn't know if it actually fixed the problem since I hadn't rebooted into Windows and experienced it at that point

spikespaz commented 6 years ago

Works fine, closed.