www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Fix suggestions for missing imports // code-d 0.15.0 & workspace-d

reply WebFreak001 <d.forum webfreak.org> writes:
I recently released workspace-d¹ 2.9.1 with many new additions 
and I released code-d² 0.15.0 just a few hours ago.

code-d (which might be more interesting for the average reader of 
this thread) is my Visual Studio Code D extension with support 
for basically everything vscode allows me to implement. It uses 
workspace-d which bundles together tools like dcd or dscanner.

The big new feature in this code-d release is an automatic 
problem solver fixing compiler and dscanner issues. So far 
support is very limited and only supports importing symbols from 
the project that couldn't be found, but more features will come 
in the future.

See the new feature in action: 
https://twitter.com/WebFreak001/status/806614092236673024

This feature only currently works if the compiler suggests to 
import something (for example when trying to use writeln without 
stdio imported) or if the symbol is defined in the project, so it 
will only suggest importing files that you have created in your 
project and not from any dependencies or the stdlib. Furthermore 
it will only consider files which contain a 'module xxx;' 
definition, so check if your files contain that before reporting 
the feature not working.

I have some more features planned such as:
* removing unused variables
* making variables const/immutable
* fixing identifiers to use phobos style guidelines

If you have some more ideas for auto fixing code, post them as a 
reply on this forum thread or on the issue on the code-d 
repository³.

I can imagine having a config entry to let this feature to run 
automatically on save sometime in the future.

Any issues with the plugin or vscode specific enhancements should 
be posted to the code-d repository². Issues with autocompletion, 
etc or enhancements that should benefit all plugins using 
workspace-d should be posted on the workspace-d repository¹.

Special thanks for 5000 installs on the vscode marketplace for 
code-d and everyone who has contributed on any of the Pure-D 
projects.

If you are also interested in debugging your D code, you can use 
my native debug extension⁴ with gdb, lldb and mago. Also thanks 
for nearly 20k installs on there and every contribution.

All changes:
notable workspace-d changes:
* workspace-d now supports OSX
* there is a command to add imports to the code now (which gets 
used be a new code-d feature)
* dscanner and dfmt configs can now also be loaded from ~/.config
* command wrapping dscanner --findSymbol

notable code-d changes:
* installer uses the http.proxy settings now
* better error checks for invalid executables
* "line is longer than" error now starts at the correct column
* fixed installer with portable/custom git/vscode installation
* auto fix for suggested imports from compiler
* dscanner symbol search fix for missing symbols from compiler

¹: https://github.com/Pure-D/workspace-d
²: https://github.com/Pure-D/code-d
³: https://github.com/Pure-D/code-d/issues/72
⁴: 
https://marketplace.visualstudio.com/items?itemName=webfreak.debug
Dec 12 2016
next sibling parent reply Soulsbane <paul acheronsoft.com> writes:
On Monday, 12 December 2016 at 21:42:50 UTC, WebFreak001 wrote:
 I recently released workspace-d¹ 2.9.1 with many new additions 
 and I released code-d² 0.15.0 just a few hours ago.

 [...]
Question, will(or perhaps there already is an option and I missed it) there be an option to disable dfmt? I don't care anything about using it. I don't have it installed and everytime I open vscode it complains about it missing.
Dec 12 2016
parent reply WebFreak001 <d.forum webfreak.org> writes:
On Tuesday, 13 December 2016 at 00:25:27 UTC, Soulsbane wrote:
 On Monday, 12 December 2016 at 21:42:50 UTC, WebFreak001 wrote:
 I recently released workspace-d¹ 2.9.1 with many new additions 
 and I released code-d² 0.15.0 just a few hours ago.

 [...]
Question, will(or perhaps there already is an option and I missed it) there be an option to disable dfmt? I don't care anything about using it. I don't have it installed and everytime I open vscode it complains about it missing.
Ah good idea, for now you can just set "d.dfmtPath": "echo" or any other executable which does basically nothing and that should work too. Next update will probably include this then.
Dec 13 2016
parent Soulsbane <paul acheronsoft.com> writes:
On Tuesday, 13 December 2016 at 14:09:53 UTC, WebFreak001 wrote:
 On Tuesday, 13 December 2016 at 00:25:27 UTC, Soulsbane wrote:
 On Monday, 12 December 2016 at 21:42:50 UTC, WebFreak001 wrote:
 I recently released workspace-d¹ 2.9.1 with many new 
 additions and I released code-d² 0.15.0 just a few hours ago.

 [...]
Question, will(or perhaps there already is an option and I missed it) there be an option to disable dfmt? I don't care anything about using it. I don't have it installed and everytime I open vscode it complains about it missing.
Ah good idea, for now you can just set "d.dfmtPath": "echo" or any other executable which does basically nothing and that should work too. Next update will probably include this then.
Cool, I'll give that a try thank! This is definitely my favorite D editor extension to use thanks for the hard work.
Dec 13 2016
prev sibling parent reply Anonymouse <asdf asdf.net> writes:
On Monday, 12 December 2016 at 21:42:50 UTC, WebFreak001 wrote:
 [...]
I cannot for the life of me get it to work on Arch. I have workspace-d from the AUR and the rest of dcd, dscanner, dfmt, dub etc from the official repositories. They're all reachable via $PATH so I haven't touched the path settings in vscode. dlang sources on Arch are placed all wonky, right next to each other in /usr/include/dlang/dmd (with no subdirectory distinction for phobos/druntime), so I have a local copy of them in ~/src/dlang/{phobos,druntime}. The settings point there. "d.stdlibPath": [ "/home/zorael/src/dlang/druntime/import", "/home/zorael/src/dlang/phobos" ], What does work is dcd on the current file, so I get local autocompletion but nothing from imports. Aside from syntax highlighting that's all I can see happening. Should there be a menu for D things here somewhere? When trying to install it manually, the last node command exits with errors. I'm not sure if that's relevant to when installing it through vscode itself. $ node ./node_modules/vscode/bin/compile The vscode extension module got updated to TypeScript 2.0.x. Please see https://code.visualstudio.com/updates/v1_6#_extension-authoring for instruction on how to migrate your extension. $ echo $? 1 What am I doing wrong?
Dec 13 2016
parent Anonymouse <asdf asdf.net> writes:
On Tuesday, 13 December 2016 at 21:12:24 UTC, Anonymouse wrote:
 What am I doing wrong?
Sorted it out over IRC, it seems the extension is disabled if you only open discrete files and not folders. https://github.com/Pure-D/code-d/issues/62
Dec 14 2016