www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.announce - Visual D 0.51.0 - semantic engine based on dmd frontend

reply Rainer Schuetze <r.sagitario gmx.de> writes:
Hello,

I'm happy to announce the release of Visual D 0.51.0.

Visual D is a Visual Studio extension that adds D language support to
VS2008-2019. The installers can be found at
http://rainers.github.io/visuald/visuald/StartPage.html


This version features a first version of an intellisense engine that is
based on the DMD frontend (as of version 2.090) for semantic analysis.
It is still considered experimental and has to be enabled on the
respective language options page. When comparing this new engine to the
regular engine which is based on DParser that used to power Mono-D:

- it does a full semantic analysis and shows the same errors as dmd
would do. DParser only marks parser issues.

- browsing compilable code works quite well (e.g. inference of auto
types is not an issue anymore).

- semantic highlighting is faster and more accurate.

- completion is yet not very good, especially while the currently edited
code has parsing errors.

- as dmd itself it can require quite a bit of memory, though a variety
of false and stale pointer issues have been fixed to help the precise GC.

Other highlights of this release:

- Ctrl+Click goto definition added for VS2017+

- visualdproj projects: basic DUB support: upgrade and refresh if
project contains dub.json or dub.sdl

See https://rainers.github.io/visuald/visuald/VersionHistory.html for
the complete list of changes

Cheers,
Rainer
Jan 18
next sibling parent kinke <noone nowhere.com> writes:
Awesome, very much appreciated, thanks Rainer.
Jan 18
prev sibling next sibling parent drug <drug2004 bk.ru> writes:
18.01.2020 17:22, Rainer Schuetze пишет:
 Hello,
 
 I'm happy to announce the release of Visual D 0.51.0.
 
 Visual D is a Visual Studio extension that adds D language support to
 VS2008-2019. The installers can be found at
 http://rainers.github.io/visuald/visuald/StartPage.html
 
 
 This version features a first version of an intellisense engine that is
 based on the DMD frontend (as of version 2.090) for semantic analysis.
 It is still considered experimental and has to be enabled on the
 respective language options page. When comparing this new engine to the
 regular engine which is based on DParser that used to power Mono-D:
 
 - it does a full semantic analysis and shows the same errors as dmd
 would do. DParser only marks parser issues.
 
 - browsing compilable code works quite well (e.g. inference of auto
 types is not an issue anymore).
 
 - semantic highlighting is faster and more accurate.
 
 - completion is yet not very good, especially while the currently edited
 code has parsing errors.
 
 - as dmd itself it can require quite a bit of memory, though a variety
 of false and stale pointer issues have been fixed to help the precise GC.
 
 Other highlights of this release:
 
 - Ctrl+Click goto definition added for VS2017+
 
 - visualdproj projects: basic DUB support: upgrade and refresh if
 project contains dub.json or dub.sdl
 
 See https://rainers.github.io/visuald/visuald/VersionHistory.html for
 the complete list of changes
 
 Cheers,
 Rainer
 
Don't use Windows for long time but I'm impressed by your great work. Keep it up!
Jan 18
prev sibling next sibling parent reply Sebastiaan Koppe <mail skoppe.eu> writes:
On Saturday, 18 January 2020 at 14:22:41 UTC, Rainer Schuetze 
wrote:
 This version features a first version of an intellisense engine 
 that is based on the DMD frontend (as of version 2.090) for 
 semantic analysis. It is still considered experimental and has 
 to be enabled on the respective language options page.

 Cheers,
 Rainer
Nice, that is awesome. Could the engine also be re-used for in e.g. the D lsp server?
Jan 18
parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 18/01/2020 17:43, Sebastiaan Koppe wrote:
 On Saturday, 18 January 2020 at 14:22:41 UTC, Rainer Schuetze wrote:
 This version features a first version of an intellisense engine that
 is based on the DMD frontend (as of version 2.090) for semantic
 analysis. It is still considered experimental and has to be enabled on
 the respective language options page.

 Cheers,
 Rainer
Nice, that is awesome. Could the engine also be re-used for in e.g. the D lsp server?
Sure, this should be possible. This is the used dmd fork: https://github.com/rainers/dmd/tree/dmdserver and most of the client code is here: https://github.com/dlang/visuald/tree/master/vdc/dmdserver The frontend doesn't make it easy to implement other functionality like refactoring and formatting, though. On the other hand, running both libdparse and another engine in parallel doesn't seem desirable, too. So it is not easy to get the best of both engines (it is currently similar with DParser and dmdserver).
Jan 18
prev sibling next sibling parent reply kinke <noone nowhere.com> writes:
On Saturday, 18 January 2020 at 14:22:41 UTC, Rainer Schuetze 
wrote:
 It is still considered experimental and has to be enabled on 
 the respective language options page.
Is there a way to enforce it, e.g., via registry or by hacking the project files, for regular VS projects (such as the VS solution for LDC generated by CMake)? I can't find any such options page.
Jan 18
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 18/01/2020 22:25, kinke wrote:
 On Saturday, 18 January 2020 at 14:22:41 UTC, Rainer Schuetze wrote:
 It is still considered experimental and has to be enabled on the
 respective language options page.
Is there a way to enforce it, e.g., via registry or by hacking the project files, for regular VS projects (such as the VS solution for LDC generated by CMake)? I can't find any such options page.
It's not in the project configuration, but the global options "Tools->Options->Text Editor->D->Intellisense" or via the Visual D menu "Open Language Options...".
Jan 18
parent reply kinke <noone nowhere.com> writes:
On Saturday, 18 January 2020 at 22:32:00 UTC, Rainer Schuetze 
wrote:
 It's not in the project configuration, but the global options 
 "Tools->Options->Text Editor->D->Intellisense"
Thx! I've immediately stumbled on an apparent missing import dir with the LDC solution, i.e., the project's src dir root doesn't seem to get added - no problem with the old engine. To reproduce: * cmake -G "Visual Studio 16 2019" -A x64 -DLLVM_ROOT_DIR=... -DD_COMPILER=...\ldmd2 ...\ldc-src * Open solution * Open any .d file in the LDCShared project and notice that all imports fail with the new engine
Jan 18
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 19/01/2020 04:32, kinke wrote:
 On Saturday, 18 January 2020 at 22:32:00 UTC, Rainer Schuetze wrote:
 It's not in the project configuration, but the global options
 "Tools->Options->Text Editor->D->Intellisense"
Thx! I've immediately stumbled on an apparent missing import dir with the LDC solution, i.e., the project's src dir root doesn't seem to get added - no problem with the old engine. To reproduce: * cmake -G "Visual Studio 16 2019" -A x64 -DLLVM_ROOT_DIR=... -DD_COMPILER=...\ldmd2 ...\ldc-src * Open solution * Open any .d file in the LDCShared project and notice that all imports fail with the new engine
It seems the problem is that LDC doesn't use the Visual D integration into msbuild, but custom build rules. That hides the import settings. If you switch "Item Type" of one of the D files to use the "D Compiler", you can set the import path to "..\ldc" so the engine can find imported files. The old engine scans the source folder for any D files, but that can also cause problems if there are multiple versions of the same module in some subdirectory.
Jan 18
parent reply kinke <kinke gmx.net> writes:
On Sunday, 19 January 2020 at 07:04:35 UTC, Rainer Schuetze wrote:
 If you switch "Item Type" of one of the D files to use the "D 
 Compiler", you can set the import path to "..\ldc" so the 
 engine can find imported files.
After figuring that one has to open the file properties via right-click (i.e., not available in the quick properties or however they are called), that worked, thx. It doesn't get past the 'Analyzing...' stage though (in tooltips), no [IntelliSense] errors show up in the errors pane.
Jan 20
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 20/01/2020 14:48, kinke wrote:
 On Sunday, 19 January 2020 at 07:04:35 UTC, Rainer Schuetze wrote:
 If you switch "Item Type" of one of the D files to use the "D
 Compiler", you can set the import path to "..\ldc" so the engine can
 find imported files.
After figuring that one has to open the file properties via right-click (i.e., not available in the quick properties or however they are called), that worked, thx. It doesn't get past the 'Analyzing...' stage though (in tooltips), no [IntelliSense] errors show up in the errors pane.
That can happen when the semantic analysis asserts and crashes the background process. It works better if you also configure the LDCshared project to define version identifiers MARS and IN_LLVM (separated by a ';' as in "MARS;IN_LLVM"), set the string import path "../ldc/res" and disable warnings for deprecations.
Jan 20
parent reply kinke <noone nowhere.com> writes:
On Monday, 20 January 2020 at 22:10:58 UTC, Rainer Schuetze wrote:
 That can happen when the semantic analysis asserts and crashes 
 the background process.

 It works better if you also configure the LDCshared project to 
 define version identifiers MARS and IN_LLVM (separated by a ';' 
 as in "MARS;IN_LLVM"), set the string import path "../ldc/res" 
 and disable warnings for deprecations.
Thx again, now I'm finally getting somewhere! Wrt. earlier, dmdserver.exe was still running in the background (but had only consumed 3 secs of CPU time and didn't seem to do anything anymore). Btw nice that that's a 64-bit executable, lots of memory for huge projects...
Jan 20
parent Rainer Schuetze <r.sagitario gmx.de> writes:
On 21/01/2020 00:07, kinke wrote:
 On Monday, 20 January 2020 at 22:10:58 UTC, Rainer Schuetze wrote:
 That can happen when the semantic analysis asserts and crashes the
 background process.

 It works better if you also configure the LDCshared project to define
 version identifiers MARS and IN_LLVM (separated by a ';' as in
 "MARS;IN_LLVM"), set the string import path "../ldc/res" and disable
 warnings for deprecations.
Thx again, now I'm finally getting somewhere! Wrt. earlier, dmdserver.exe was still running in the background (but had only consumed 3 secs of CPU time and didn't seem to do anything anymore). Btw nice that that's a 64-bit executable, lots of memory for huge projects...
I could avoid the crashes with this change to dmd: https://github.com/rainers/dmd/commit/2b3fc197bd86fc358f349182798d8142f1564177 BTW: Don't miss to enable "Colorize identifiers from semantic analysis" for more colorful editing. This also helps the debugger a bit by identifying compile time entities that should not be displayed in a data tooltip, but the regular one which can show aliases and enum values not found in the debug information.
Jan 20
prev sibling parent =?iso-8859-1?Q?Robert_M._M=FCnch?= <robert.muench saphirion.com> writes:
On 2020-01-18 14:22:41 +0000, Rainer Schuetze said:

 I'm happy to announce the release of Visual D 0.51.0.
Great stuff! Especially the debugging support. -- Robert M. Mnch http://www.saphirion.com smarter | better | faster
Jan 19