Skip to content

Commit 3bcfa36

Browse files
committed
Done
1 parent 2e982ff commit 3bcfa36

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

Server/Handlers/SignatureHelpHandler.cs

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
using System.Linq;
22
using System.Security.Cryptography.Xml;
3+
using System.Text.RegularExpressions;
34
using Microsoft.Extensions.Logging;
45
using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
56
using OmniSharp.Extensions.LanguageServer.Protocol.Document;
67
using OmniSharp.Extensions.LanguageServer.Protocol.Models;
78
using OmniSharp.Extensions.LanguageServer.Protocol.Server;
89
using ShaderlabVS.Data;
910
using ShaderLS.Management;
11+
using static System.Net.Mime.MediaTypeNames;
1012

1113
namespace ShaderLS.Handlers
1214
{
@@ -40,15 +42,18 @@ public SignatureHelpHandler(
4042
if (line == null)
4143
return null;
4244

43-
string[] splits = line[0].Split("(", StringSplitOptions.RemoveEmptyEntries);
45+
string[] func = line[0].Split("(", StringSplitOptions.RemoveEmptyEntries);
4446

45-
if (splits.Length == 0)
47+
if (func.Length == 0)
4648
return null;
4749

48-
int min = Math.Max(splits.Length - 2, 0);
49-
splits = splits[min].Split(new char[] { '.', ' ' });
50+
int max = Math.Max(func.Length - 2, 0);
51+
string[] funcNames = Helpers.GetWords(func[max]);
5052

51-
string word = splits[splits.Length - 1];
53+
if (funcNames.Length == 0)
54+
return null;
55+
56+
string word = funcNames[funcNames.Length - 1];
5257

5358
var signatures = new List<SignatureInformation>();
5459

@@ -78,8 +83,12 @@ public SignatureHelpHandler(
7883
}
7984
});
8085

86+
string paramStr = func[func.Length - 1];
87+
int act = Regex.Matches(paramStr, ",").Count;
88+
8189
return new SignatureHelp
8290
{
91+
ActiveParameter = act,
8392
Signatures = signatures
8493
};
8594
}

0 commit comments

Comments
 (0)