Handling of displaying comment data on functions
This commit is contained in:
parent
4efc452dd2
commit
6aeb95c289
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JsonRpc.Standard.Contracts;
|
using JsonRpc.Standard.Contracts;
|
||||||
|
@ -6,6 +7,7 @@ using LanguageServer.VsCode;
|
||||||
using LanguageServer.VsCode.Contracts;
|
using LanguageServer.VsCode.Contracts;
|
||||||
using LanguageServer.VsCode.Server;
|
using LanguageServer.VsCode.Server;
|
||||||
using Upsilon.Binder;
|
using Upsilon.Binder;
|
||||||
|
using Upsilon.Parser;
|
||||||
|
|
||||||
namespace UpsilonLanguageServer.Services
|
namespace UpsilonLanguageServer.Services
|
||||||
{
|
{
|
||||||
|
@ -25,15 +27,23 @@ namespace UpsilonLanguageServer.Services
|
||||||
var findNode = doc.Bound.GetNodeAtPosition(linePos + position.Character);
|
var findNode = doc.Bound.GetNodeAtPosition(linePos + position.Character);
|
||||||
if (findNode != null)
|
if (findNode != null)
|
||||||
{
|
{
|
||||||
var contents = $"Kind: {findNode.Kind}";
|
var contents = new StringBuilder($"Kind: {findNode.Kind}");
|
||||||
if (findNode is BoundExpression expression)
|
if (findNode is BoundExpression expression)
|
||||||
{
|
{
|
||||||
contents += $"\n\nType: {expression.Type}";
|
contents.Append($"\n\nType: {expression.Type}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (findNode is BoundVariableSymbol varSymbol)
|
||||||
|
{
|
||||||
|
if (varSymbol.VariableSymbol.CommentValue != null)
|
||||||
|
{
|
||||||
|
contents.Append($"\n\n{string.Join(" \n", varSymbol.VariableSymbol.CommentValue)}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Hover()
|
return new Hover()
|
||||||
{
|
{
|
||||||
Contents = contents
|
Contents = contents.ToString()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue