Skip to content

Commit 84af6e0

Browse files
committed
Merge pull request #16 from rainers/master
changes for 0.3.38-rc2
2 parents 3374af5 + 89f59b2 commit 84af6e0

File tree

9 files changed

+128
-54
lines changed

9 files changed

+128
-54
lines changed

CHANGES

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -610,21 +610,23 @@ unreleased Version 0.3.38
610610
* tool tips now expand some Ddoc macros for better readability
611611

612612
* update SDK conversion for VS2013 and Windws SDK 8.1
613-
* change some default colors when using dark theme in VS 2012+ (restart required)
613+
* bugzilla 11786: change some default colors when using dark theme in VS 2012+ (restart required)
614614
* Windows SDK 8.0/8.1 detection
615615
* fix bad "\n" in default x64 library search path
616616
* x64 executable and library search path not correctly saved for next VS start
617-
* improve project automation to mute NuGet (still empty project pretended)
617+
* bugzilla 12052: improve project automation to mute NuGet (still empty project pretended)
618618

619619
* add source control support for git in VS2013 (and maybe others)
620620
* fix DnD of project items in VS2013
621-
* disguise functionality of pipedmd.exe and filemonitor.dll to let it pass
621+
* bugzilla 12187: disguise functionality of pipedmd.exe and filemonitor.dll to let it pass
622622
most anti-virus checks
623-
* added option to select the C runtime library when compiling for x64
623+
* bugzilla 11962: added option to select the C runtime library when compiling for x64
624624

625-
* completion on import statements no longer showed folder icons
626-
* completion on selective import now lists identifiers from imported module
625+
* bugzilla 11940: completion on import statements no longer showed folder icons
626+
* bugzilla 11649: completion on selective import now lists identifiers from imported module
627627
* dparser: fixed completion for symbols without description
628628
* dparser: added support for multi line completions (including override completion)
629+
* parameter tool tips now use prototype from dparser and shows documentation
629630

630-
* cv2pdb: modified visualizer for void[] to also show bytes
631+
* bugzilla 11898: cv2pdb: modified visualizer for void[] to also show bytes
632+
* bugzilla 12353: option "Show Type In Tooltip" not saved and restored across restart

TODO

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Project:
3939
- custom command: quotes in dependencies not supported
4040
- VS2013: property pages don't follow resize
4141
- custom command: writes build batch to source folder
42-
- VS2013: moving project item with DnD does not remove source
42+
- VS2013: possible to copy a project item with DnD into the same project again
4343

4444
Language service:
4545
-----------------

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
#define VERSION_MINOR 3
33
#define VERSION_REVISION 38
44
#define VERSION_BETA -rc
5-
#define VERSION_BUILD 1
5+
#define VERSION_BUILD 2

vdc/abothe/VDServer.cs

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ public VDServerCompletionDataGenerator (string pre)
5555
prefix = pre;
5656
}
5757

58+
public void NotifyTimeout()
59+
{
60+
61+
}
62+
5863
/// <summary>
5964
/// Adds a token entry
6065
/// </summary>
@@ -115,8 +120,8 @@ public void Add(INode Node)
115120
type = "MOD";
116121

117122
string desc = Node.Description;
118-
if(!string.IsNullOrEmpty(desc))
119-
desc = desc.Trim();
123+
if(!string.IsNullOrEmpty(desc))
124+
desc = desc.Trim();
120125

121126
string proto = VDServerCompletionDataGenerator.GeneratePrototype(Node);
122127
if (!string.IsNullOrEmpty(proto) && !string.IsNullOrEmpty(desc))
@@ -169,8 +174,6 @@ public static string GeneratePrototype(INode node, int currentParameter = -1, bo
169174
return VDServerCompletionDataGenerator.GeneratePrototype(node as DVariable);
170175
if(node is DelegateType)
171176
return VDServerCompletionDataGenerator.GeneratePrototype(node as DelegateType, currentParameter);
172-
if(node is DelegateDeclaration)
173-
return VDServerCompletionDataGenerator.GeneratePrototype(node as DelegateDeclaration, currentParameter);
174177
if(node is AbstractType)
175178
return VDServerCompletionDataGenerator.GeneratePrototype(node as AbstractType, currentParameter, isInTemplateArgInsight);
176179
return null;
@@ -183,57 +186,56 @@ public static string GeneratePrototype(AbstractType t, int currentParameter = -1
183186
{
184187
if (ms.Definition is DVariable)
185188
{
186-
var bt = DResolver.StripAliasSymbol(ms.Base);
189+
var bt = ms.Base;
187190
if (bt is DelegateType)
188-
return VDServerCompletionDataGenerator.GeneratePrototype(bt as DelegateType, currentParameter);
191+
return VDServerCompletionDataGenerator.GeneratePrototype(bt as DelegateType, isInTemplateArgInsight, currentParameter);
189192
}
190193
else if (ms.Definition is DMethod)
191194
return VDServerCompletionDataGenerator.GeneratePrototype(ms.Definition as DMethod, isInTemplateArgInsight, currentParameter);
192195
}
193-
else if (t is TemplateIntermediateType)
194-
return VDServerCompletionDataGenerator.GeneratePrototype(t as TemplateIntermediateType, currentParameter);
196+
else if (t is TemplateIntermediateType || t is EponymousTemplateType)
197+
return VDServerCompletionDataGenerator.GeneratePrototype(t as DSymbol, currentParameter);
195198

196199
return null;
197200
}
198201

199-
public static string GeneratePrototype(DelegateType dt, int currentParam = -1)
200-
{
201-
var dd = dt.TypeDeclarationOf as DelegateDeclaration;
202-
if (dd != null)
203-
return VDServerCompletionDataGenerator.GeneratePrototype(dd, currentParam);
204-
205-
return null;
206-
}
207-
208-
public static string GeneratePrototype(DelegateDeclaration dd, int currentParam = -1)
202+
public static string GeneratePrototype(DelegateType dd, bool isInTemplateArgInsight, int currentParam = -1)
209203
{
210204
var sb = new StringBuilder("Delegate: ");
211205

212206
if (dd.ReturnType != null)
213-
sb.Append(dd.ReturnType.ToString(true)).Append(' ');
207+
sb.Append(dd.ReturnType.ToString()).Append(' ');
214208

215209
if (dd.IsFunction)
216210
sb.Append("function");
217211
else
218212
sb.Append("delegate");
219213

220-
sb.Append('(');
221-
if (dd.Parameters != null && dd.Parameters.Count != 0)
214+
var fn = dd.DeclarationOrExpressionBase as D_Parser.Dom.Expressions.FunctionLiteral;
215+
if (fn != null)
216+
RenderParametersAndFooters(fn.AnonymousMethod, sb, isInTemplateArgInsight, currentParam);
217+
else
222218
{
223-
for (int i = 0; i < dd.Parameters.Count; i++)
219+
sb.Append('(');
220+
var parms = dd.Parameters;
221+
if (parms != null && parms.Length != 0)
224222
{
225-
var p = dd.Parameters[i] as DNode;
226-
if (i == currentParam)
223+
for (int i = 0; i < parms.Length; i++)
227224
{
228-
sb.Append(p.ToString(false)).Append(',');
225+
if (i == currentParam)
226+
sb.Append("<u>");
227+
228+
sb.Append(parms[i] is DSymbol ? (parms[i] as DSymbol).Definition.ToString(true, false) : parms[i].ToCode());
229+
230+
if (i == currentParam)
231+
sb.Append("</u>");
232+
sb.Append(',');
229233
}
230-
else
231-
sb.Append(p.ToString(false)).Append(',');
232-
}
233234

234-
sb.Remove(sb.Length - 1, 1);
235+
sb.Remove(sb.Length - 1, 1);
236+
}
237+
sb.Append(')');
235238
}
236-
sb.Append(')');
237239

238240
return sb.ToString();
239241
}
@@ -300,6 +302,12 @@ public static string GeneratePrototype(DMethod dm, bool isTemplateParamInsight=f
300302

301303
sb.Append(name);
302304

305+
RenderParametersAndFooters(dm, sb, isTemplateParamInsight, currentParam);
306+
return sb.ToString();
307+
}
308+
309+
static void RenderParametersAndFooters(DMethod dm, StringBuilder sb, bool isTemplateParamInsight, int currentParam = -1)
310+
{
303311
// Template parameters
304312
if (dm.TemplateParameters != null && dm.TemplateParameters.Length > 0)
305313
{
@@ -340,7 +348,6 @@ public static string GeneratePrototype(DMethod dm, bool isTemplateParamInsight=f
340348
}
341349

342350
sb.Append(")");
343-
return sb.ToString();
344351
}
345352

346353
public static string GeneratePrototype(TemplateIntermediateType tit, int currentParam = -1)
@@ -488,7 +495,7 @@ public void GetTip(string filename, int startLine, int startIndex, int endLine,
488495
foreach (var c in content)
489496
{
490497
if (!string.IsNullOrEmpty (_tipText))
491-
_tipText += "\n\n";
498+
_tipText += "\a";
492499
if (string.IsNullOrWhiteSpace (c.Description))
493500
_tipText += c.Title;
494501
else
@@ -601,10 +608,9 @@ public void GetDefinition(string filename, int startLine, int startIndex, int en
601608
var rr = DResolver.ResolveType(_editorData, ctxt);
602609

603610
_tipText = "";
604-
if (rr != null && rr.Length > 0)
611+
if (rr != null)
605612
{
606-
var res = rr[rr.Length - 1];
607-
var n = DResolver.GetResultMember(res);
613+
var n = DResolver.GetResultMember(rr);
608614

609615
_tipStart = n.Location;
610616
_tipEnd = n.EndLocation;
@@ -656,6 +662,7 @@ void _setupEditorData()
656662
CompletionOptions.Instance.ShowUFCSItems = (_flags & 0x2000000) != 0;
657663
CompletionOptions.Instance.DisableMixinAnalysis = (_flags & 0x1000000) == 0;
658664
CompletionOptions.Instance.HideDeprecatedNodes = (_flags & 128) != 0;
665+
CompletionOptions.Instance.CompletionTimeout = 500;
659666
}
660667

661668
#if false

visuald/completion.d

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,10 @@ class MethodData : DisposingComObject, IVsMethodData
10691069
break;
10701070

10711071
case MTT_DESCRIPTION:
1072-
result = format("%s %s @ %s(%d)", mMethods[method].kind, mMethods[method].inScope, mMethods[method].filename, mMethods[method].line);
1072+
if(mMethods[method].help)
1073+
result = phobosDdocExpand(mMethods[method].help);
1074+
else if(mMethods[method].line > 0)
1075+
result = format("%s %s @ %s(%d)", mMethods[method].kind, mMethods[method].inScope, mMethods[method].filename, mMethods[method].line);
10731076
break;
10741077

10751078
case MTT_TYPEPREFIX:

visuald/dlangsvc.d

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3120,7 +3120,7 @@ else
31203120
return false;
31213121
}
31223122

3123-
wstring FindIdentifierBackward(int line, int tok)
3123+
wstring FindIdentifierBackward(int line, int tok, int* pline, int* pindex)
31243124
{
31253125
while(line >= 0)
31263126
{
@@ -3144,7 +3144,13 @@ else
31443144
{
31453145
pos = tokpos[p];
31463146
if(toktype[p] == TokenCat.Identifier)
3147+
{
3148+
if(pline)
3149+
*pline = line;
3150+
if(pindex)
3151+
*pindex = pos;
31473152
return text[pos .. ppos];
3153+
}
31483154
if(ppos > pos + 1 || !isWhite(text[pos]))
31493155
return ""w;
31503156
ppos = pos;

visuald/dpackage.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ class GlobalOptions
14191419
keyToolOpts.Set("expandFromBuffer", expandFromBuffer);
14201420
keyToolOpts.Set("expandFromJSON", expandFromJSON);
14211421
keyToolOpts.Set("expandTrigger", expandTrigger);
1422-
keyToolOpts.Set("showTypeInTooltip", showTypeInTooltip);
1422+
keyToolOpts.Set("showTypeInTooltip2", showTypeInTooltip);
14231423
keyToolOpts.Set("semanticGotoDef", semanticGotoDef);
14241424
keyToolOpts.Set("useDParser2", useDParser);
14251425
keyToolOpts.Set("mixinAnalysis", mixinAnalysis);

visuald/intellisense.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ struct Definition
613613
string kind;
614614
string filename;
615615
string deco;
616+
string help;
616617
int line;
617618

618619
private string _type;
@@ -622,6 +623,10 @@ struct Definition
622623
(cast()this)._type = demangleType(deco, name);
623624
return _type;
624625
}
626+
void setType(string t)
627+
{
628+
_type = t;
629+
}
625630

626631
string inScope; // enclosing scope
627632

visuald/viewfilter.d

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,9 @@ version(tip)
424424
break;
425425

426426
case ECMD_LEFT:
427+
case ECMD_WORDPREV:
427428
case ECMD_RIGHT:
429+
case ECMD_WORDNEXT:
428430
stopCompletions();
429431
goto case ECMD_UP;
430432

@@ -1400,7 +1402,7 @@ else
14001402
return S_FALSE;
14011403

14021404
tok = mCodeWinMgr.mSource.FindLineToken(otherLine, otherIndex, iState, pos);
1403-
string word = toUTF8(src.FindIdentifierBackward(otherLine, tok));
1405+
string word = toUTF8(src.FindIdentifierBackward(otherLine, tok, &line, &idx));
14041406
if(word.length <= 0)
14051407
{
14061408
line = otherLine;
@@ -1410,18 +1412,64 @@ else
14101412
goto stepUp;
14111413
}
14121414

1413-
Definition[] defs = Package.GetLibInfos().findDefinition(word);
1415+
span.iStartIndex = idx;
1416+
span.iStartLine = line;
1417+
span.iEndIndex = idx + 1;
1418+
span.iEndLine = line;
1419+
1420+
mPendingMethodTipWord = word;
1421+
mPendingMethodTipComma = cntComma;
1422+
mPendingRequest = Package.GetLanguageService().GetTip(mCodeWinMgr.mSource, &span, &OnGetMethodTipText);
1423+
return S_OK;
1424+
}
1425+
1426+
extern(D) void OnGetMethodTipText(uint request, string filename, string text, TextSpan span)
1427+
{
1428+
Definition[] defs;
1429+
string[] funcs = split(text, "\a");
1430+
if(funcs.empty)
1431+
{
1432+
defs = Package.GetLibInfos().findDefinition(mPendingMethodTipWord);
1433+
}
1434+
else
1435+
{
1436+
foreach(fn; funcs)
1437+
{
1438+
Definition def;
1439+
def.name = mPendingMethodTipWord;
1440+
int pos = fn.indexOf("\n");
1441+
if(pos >= 0)
1442+
{
1443+
def.help = fn[pos + 1 .. $];
1444+
if(def.help.startsWith("(Deduced Type"))
1445+
if(!findSkip(def.help, "\n"))
1446+
def.help = "";
1447+
fn = fn[0 .. pos];
1448+
}
1449+
if(fn.endsWith("\r"))
1450+
fn = fn[0..$-1];
1451+
if(fn.endsWith(":"))
1452+
fn = fn[0..$-1];
1453+
def.setType(fn);
1454+
defs ~= def;
1455+
}
1456+
}
1457+
RefreshMethodTip(defs, span);
1458+
}
1459+
1460+
int RefreshMethodTip(Definition[] defs, TextSpan span)
1461+
{
14141462
if(defs.length == 0)
14151463
return S_FALSE;
1416-
1417-
MethodData md = src.GetMethodData();
1464+
1465+
MethodData md = mCodeWinMgr.mSource.GetMethodData();
14181466
span.iEndLine = span.iStartLine;
14191467
span.iEndIndex = span.iStartIndex + 1;
1420-
md.Refresh(mView, defs, cntComma, span);
1421-
1468+
md.Refresh(mView, defs, mPendingMethodTipComma, span);
1469+
14221470
return S_OK;
14231471
}
1424-
1472+
14251473
// IVsTextViewFilter //////////////////////////////////////
14261474
override int GetWordExtent(in int iLine, in CharIndex iIndex, in uint dwFlags, /* [out] */ TextSpan *pSpan)
14271475
{
@@ -1566,13 +1614,16 @@ version(none) // quick info tooltips not good enough yet
15661614
//////////////////////////////
15671615
TextSpan mPendingSpan;
15681616
uint mPendingRequest;
1617+
int mPendingMethodTipComma;
1618+
string mPendingMethodTipWord;
15691619
TextSpan mTipSpan;
15701620
string mTipText;
15711621
uint mTipRequest;
15721622
string mLastGotoDef;
15731623

15741624
extern(D) void OnGetTipText(uint request, string filename, string text, TextSpan span)
15751625
{
1626+
text = replace(text, "\a", "\n\n");
15761627
mTipText = phobosDdocExpand(text);
15771628

15781629
mTipSpan = span;

0 commit comments

Comments
 (0)