www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ide - Visual D issues and suggestions

reply John Chapman <johnch_atms hotmail.com> writes:
Rainer, you may have a lot of these on your to-do list, but I've 
been noting some of the minor issues I've come across using 
Visual D and it might be useful for future releases.

Fixes:
* The Intellisense list for __traits needs updating inline with 
the spec.
* Remove obsolete "classinfo" from completion list.
* Add "typeof" keyword to completion list.
* Show completion list when typing UDAs.
* Support new contract expressions (and upcoming mixin tuple 
syntax).
* Indent function bodies correctly when generating overrides.
* Indenting for enum members is sometimes too much.
* Tooltips on token-string literals adds a lot of extra spacing 
between symbols.
* Tooltips that show documentation can have excessive line breaks.
* Tooltips on variables repeat attributes - eg, "private int 
length;" produces "private private(int) [parent].length" instead 
of perhaps "(variable) private int [parent].length".
* Remove duplicated/disabled entries for "New filter"/"New 
folder" in Solution Explorer > context menu > Add.
* Fix Visual D Search text boxes and buttons for high DPI 
displays.

Suggestions:
* Add option to not indent switch case labels.
* Add refactoring/renaming support.
* When insertion point is inside variable or type name, highlight 
usages.
* For Visual D projects, include option to compile/link in single 
step.
* Automatically include modules in the current project as 
candidates for completion - I seem to have to add my project 
folders to Visual D Settings > DMD Directories > Import paths
* Colourise type names and UDAs in editor.

* Ctrl-click for "Go to definition".
* When user declares variables, suggest possible names based on 
type - eg, a variable of type "FontFaceReference" pops up a list 
including "fontFaceReference", "fontFace" and "reference".
* Fade out unused imports.

Hope this is useful.
Oct 21 2018
next sibling parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 21/10/2018 12:11, John Chapman wrote:
 Rainer, you may have a lot of these on your to-do list, but I've been
 noting some of the minor issues I've come across using Visual D and it
 might be useful for future releases.
Thank you for this extensive list.
 
 Fixes:
 * The Intellisense list for __traits needs updating inline with the spec.
 * Remove obsolete "classinfo" from completion list.
 * Add "typeof" keyword to completion list.
 * Show completion list when typing UDA> * Support new contract expressions
(and upcoming mixin tuple syntax).
I will have to delegate most of these to the author of the semantic engine. Fortunately he has continued to work on it after a couple of years.
 * Indent function bodies correctly when generating overrides.
I guess you mean indentation if "override" is on the line before the function declaration? That happens for any function attribute (or even I was considering integrating dfmt at some point but it seems formatting just a selection doesn't work too well with it.
 * Indenting for enum members is sometimes too much.
Can you provide an example?
 * Tooltips on token-string literals adds a lot of extra spacing between
 symbols.
You mean the space between each token? Yes, that's bad. It should be shown as is.
 * Tooltips that show documentation can have excessive line breaks.
I haven't found a way to format tooltips better than just plain text. What you see is more or less how it is written in the source code.
 * Tooltips on variables repeat attributes - eg, "private int length;"
 produces "private private(int) [parent].length" instead of perhaps
 "(variable) private int [parent].length".
I recently stumbled over a strange extern(function_name), too. I'll look into that.
 * Remove duplicated/disabled entries for "New filter"/"New folder" in
 Solution Explorer > context menu > Add.
These are two slightly different items: "filter" is what you get in a
 * Fix Visual D Search text boxes and buttons for high DPI displays.
Ok, I've tried Visual D on a HiDPI screen yet.
 
 Suggestions:
 * Add option to not indent switch case labels.
In the long run, it should probably follow dfmt's .editorConfig options (no idea if there is something about switch/case in there, though).
 * Add refactoring/renaming support.
That's a tough one as it requires almost flawless semantic analysis... See also https://issues.dlang.org/show_bug.cgi?id=13925
 * When insertion point is inside variable or type name, highlight usages.
Hopefully possible soon, see "Colorize type names".
 * For Visual D projects, include option to compile/link in single step.
What's wrong with the "General->Compilation" option?
 * Automatically include modules in the current project as candidates for
 completion - I seem to have to add my project folders to Visual D
 Settings > DMD Directories > Import paths
You should not have to add that to a global option. If your source files are not in the same folder as the project file, you might have to add the source folder to the project import paths.
 * Colourise type names and UDAs in editor.
This is currently work in progress.

See comment about tooltips above.
 * Ctrl-click for "Go to definition".
I'll have to investigate how a language service is supposed to support that.
 * When user declares variables, suggest possible names based on type -
 eg, a variable of type "FontFaceReference" pops up a list including
 "fontFaceReference", "fontFace" and "reference".
Interesting gimmick.
 * Fade out unused imports.
Again, good semantic analysis is needed. See also https://issues.dlang.org/show_bug.cgi?id=13913
 Hope this is useful.
It is, thanks again. I'll try to get 0.48.0 out of the door before starting to work on new stuff. Do you still have trouble with the beta with respect to crashes (probably due to static foreach)? Can you provide a test case?
Oct 22 2018
next sibling parent reply Laurent =?UTF-8?B?VHLDqWd1aWVy?= <laurent.treguier.sink gmail.com> writes:
On Monday, 22 October 2018 at 17:50:04 UTC, Rainer Schuetze wrote:
 I was considering integrating dfmt at some point but it seems 
 formatting just a selection doesn't work too well with it.
I was able to do some decent (at least, from I've tested it seemed decent) selection formatting with dfmt. I don't know how formatting is handled in Visual Studio, but if it's similar to VSCode (which is basically just text replacement), then it might be possible to do the same. I simply do a diff between the code before and after formatting, to extract the portions of code that have actually changed, and then I only apply the changes affecting the selected zone of text. It's certainly not the most efficient way to do it, as it still requires formatting the whole file in the background, but it works.
Oct 22 2018
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 22/10/2018 22:58, Laurent Tréguier wrote:
 On Monday, 22 October 2018 at 17:50:04 UTC, Rainer Schuetze wrote:
 I was considering integrating dfmt at some point but it seems
 formatting just a selection doesn't work too well with it.
I was able to do some decent (at least, from I've tested it seemed decent) selection formatting with dfmt. I don't know how formatting is handled in Visual Studio, but if it's similar to VSCode (which is basically just text replacement), then it might be possible to do the same. I simply do a diff between the code before and after formatting, to extract the portions of code that have actually changed, and then I only apply the changes affecting the selected zone of text. It's certainly not the most efficient way to do it, as it still requires formatting the whole file in the background, but it works.
Thanks for the hint. I guess the diff only works if the rest of the code is already formatted according to the dfmt rules? Visual D only changes indentation so far, no reflow with insertion or removal of line breaks. IMO all reformatting tools produce strange results, including clang-format, so I usually avoid these. I'm still on the fence whether an integration of dfmt would be a good thing...
Oct 23 2018
parent Laurent =?UTF-8?B?VHLDqWd1aWVy?= <laurent.treguier.sink gmail.com> writes:
On Wednesday, 24 October 2018 at 06:59:39 UTC, Rainer Schuetze 
wrote:
 Thanks for the hint. I guess the diff only works if the rest of 
 the code is already formatted according to the dfmt rules?
No, it works even if the rest of the code isn't properly formatted. This is why I'm using diffs: the extension knows what to change, and where, but all of the changes are independent, so you can apply whichever you want regardless of the rest to format a specific region of the code only.
 Visual D only changes indentation so far, no reflow with 
 insertion or removal of line breaks. IMO all reformatting tools 
 produce strange results, including clang-format, so I usually 
 avoid these. I'm still on the fence whether an integration of 
 dfmt would be a good thing...
That's for sure, there are a lot of weird results with dfmt (https://github.com/dlang-community/dfmt/issues/254 comes to my mind). It could be added as an option in Visual D's settings, while keeping the current re-indentation as the default formatting action.
Oct 24 2018
prev sibling next sibling parent reply John Chapman <johnch_atms hotmail.com> writes:
On Monday, 22 October 2018 at 17:50:04 UTC, Rainer Schuetze wrote:
 * Indent function bodies correctly when generating overrides.
I guess you mean indentation if "override" is on the line before the function declaration?
No - inside a class, if you type "override" then ctrl-space, it shows a list of overridable functions. Choose one and it outputs a function stub, but the generated body is the same indent level as the declaration, e.g.: override protected void myFunction() { super.myFunction(); <- should be indented one level further }
 * Indenting for enum members is sometimes too much.
Can you provide an example?
Funny, I can't reproduce this problem any more.
 I haven't found a way to format tooltips better than just plain 
 text. What you see is more or less how it is written in the 
 source code.
coloured text in tooltips. Not essential obviously, but would be nice.
 What's wrong with the "General->Compilation" option?
Sorry, I meant in mixed Visual D/C++ projects - unless I'm wrong, all the current options there seem to add -c to the command line.
 * Automatically include modules in the current project as 
 candidates for completion - I seem to have to add my project 
 folders to Visual D Settings > DMD Directories > Import paths
You should not have to add that to a global option. If your source files are not in the same folder as the project file, you might have to add the source folder to the project import paths.
OK, I somehow overlooked that option.
 * Ctrl-click for "Go to definition".
I'll have to investigate how a language service is supposed to support that.
the ctrl key is pressed it underlines the text under the cursor, making it clickable like a hyperlink, allowing you to navigate to the definition.
 * When user declares variables, suggest possible names based 
 on type - eg, a variable of type "FontFaceReference" pops up a 
 list including "fontFaceReference", "fontFace" and "reference".
Interesting gimmick.
Yes - like most of the things I've listed, it's not essential, experience.
 Do you still have trouble with the beta with respect to crashes 
 (probably due to static foreach)?
No crashing here, and static foreach works fine for me - perhaps that was another user?
Oct 22 2018
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 22/10/2018 23:15, John Chapman wrote:
 On Monday, 22 October 2018 at 17:50:04 UTC, Rainer Schuetze wrote:
 * Indent function bodies correctly when generating overrides.
I guess you mean indentation if "override" is on the line before the function declaration?
No - inside a class, if you type "override" then ctrl-space, it shows a list of overridable functions. Choose one and it outputs a function stub, but the generated body is the same indent level as the declaration, e.g.:   override protected void myFunction() {   super.myFunction(); <- should be indented one level further   }
Ah, ok. That's a completion containing newlines that need to be indented. Should not be difficult to fix.
 
 * Indenting for enum members is sometimes too much.
Can you provide an example?
Funny, I can't reproduce this problem any more.
 I haven't found a way to format tooltips better than just plain text.
 What you see is more or less how it is written in the source code.
text in tooltips. Not essential obviously, but would be nice.
don't use the usual VS services. C++ doesn't have these and is similar to Visual D.
 What's wrong with the "General->Compilation" option?
Sorry, I meant in mixed Visual D/C++ projects - unless I'm wrong, all the current options there seem to add -c to the command line.
That's how the VC projects work. There is not a big difference any way, a single step "compile and link" also calls the linker internally.
 * Ctrl-click for "Go to definition".
I'll have to investigate how a language service is supposed to support that.
ctrl key is pressed it underlines the text under the cursor, making it clickable like a hyperlink, allowing you to navigate to the definition.
There seems to be a VS extension that used to do that until Microsoft integrated it with VS2017 15.6.
 
 Do you still have trouble with the beta with respect to crashes
 (probably due to static foreach)?
No crashing here, and static foreach works fine for me - perhaps that was another user?
Ah sorry, confused that with https://forum.dlang.org/post/xayhoysgafpgiflomaes forum.dlang.org
Oct 23 2018
parent John Chapman <johnch_atms hotmail.com> writes:
On Wednesday, 24 October 2018 at 06:52:04 UTC, Rainer Schuetze 
wrote:

 If the ctrl key is pressed it underlines the text under the 
 cursor, making it clickable like a hyperlink, allowing you to 
 navigate to the definition.
There seems to be a VS extension that used to do that until Microsoft integrated it with VS2017 15.6.
I installed it at the weekend on VS2017 15.8 and it actually works great (with Peek turned off), although it's no longer supported. I've hit another issue: no completion list is shown after typing a storage class like "static", "final" or "const" before a member declaration - eg: class MyClass { final Obj| <- oops, no suggestions!
Oct 24 2018
prev sibling parent John Chapman <johnch_atms hotmail.com> writes:
On Monday, 22 October 2018 at 17:50:04 UTC, Rainer Schuetze wrote:
 * Indenting for enum members is sometimes too much.
Can you provide an example?
To reproduced this, try declaring an unnamed enum with a protection attribute. private enum { first, | <- cursor is not flush with first member }
Oct 23 2018
prev sibling parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 21/10/2018 12:11, John Chapman wrote:
 Rainer, you may have a lot of these on your to-do list, but I've been
 noting some of the minor issues I've come across using Visual D and it
 might be useful for future releases.
 
 Fixes:
 * The Intellisense list for __traits needs updating inline with the spec.
 * Remove obsolete "classinfo" from completion list.
 * Add "typeof" keyword to completion list.
 * Show completion list when typing UDAs.
 * Support new contract expressions (and upcoming mixin tuple syntax).
 * Indent function bodies correctly when generating overrides.
 * Indenting for enum members is sometimes too much.
 * Tooltips on token-string literals adds a lot of extra spacing between
 symbols.
 * Tooltips that show documentation can have excessive line breaks.
 * Tooltips on variables repeat attributes - eg, "private int length;"
 produces "private private(int) [parent].length" instead of perhaps
 "(variable) private int [parent].length".
 * Remove duplicated/disabled entries for "New filter"/"New folder" in
 Solution Explorer > context menu > Add.
 * Fix Visual D Search text boxes and buttons for high DPI displays.
 
 Suggestions:
 * Add option to not indent switch case labels.
 * Add refactoring/renaming support.
 * When insertion point is inside variable or type name, highlight usages.
 * For Visual D projects, include option to compile/link in single step.
 * Automatically include modules in the current project as candidates for
 completion - I seem to have to add my project folders to Visual D
 Settings > DMD Directories > Import paths
 * Colourise type names and UDAs in editor.

 * Ctrl-click for "Go to definition".
 * When user declares variables, suggest possible names based on type -
 eg, a variable of type "FontFaceReference" pops up a list including
 "fontFaceReference", "fontFace" and "reference".
 * Fade out unused imports.
 
 Hope this is useful.
I have added most of these here: https://issues.dlang.org/show_bug.cgi?id=19353 - 19359
Nov 03 2018
parent John Chapman <johnch_atms hotmail.com> writes:
On Saturday, 3 November 2018 at 09:32:17 UTC, Rainer Schuetze 
wrote:
 I have added most of these here: 
 https://issues.dlang.org/show_bug.cgi?id=19353 - 19359
Thanks - I didn't know VisualD bugs could be reported there too. I will do so in future.
Nov 03 2018