|
1 | 1 | using System.Linq;
|
2 | 2 | using System.Security.Cryptography.Xml;
|
| 3 | +using System.Text.RegularExpressions; |
3 | 4 | using Microsoft.Extensions.Logging;
|
4 | 5 | using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities;
|
5 | 6 | using OmniSharp.Extensions.LanguageServer.Protocol.Document;
|
6 | 7 | using OmniSharp.Extensions.LanguageServer.Protocol.Models;
|
7 | 8 | using OmniSharp.Extensions.LanguageServer.Protocol.Server;
|
8 | 9 | using ShaderlabVS.Data;
|
9 | 10 | using ShaderLS.Management;
|
| 11 | +using static System.Net.Mime.MediaTypeNames; |
10 | 12 |
|
11 | 13 | namespace ShaderLS.Handlers
|
12 | 14 | {
|
@@ -40,15 +42,18 @@ public SignatureHelpHandler(
|
40 | 42 | if (line == null)
|
41 | 43 | return null;
|
42 | 44 |
|
43 |
| - string[] splits = line[0].Split("(", StringSplitOptions.RemoveEmptyEntries); |
| 45 | + string[] func = line[0].Split("(", StringSplitOptions.RemoveEmptyEntries); |
44 | 46 |
|
45 |
| - if (splits.Length == 0) |
| 47 | + if (func.Length == 0) |
46 | 48 | return null;
|
47 | 49 |
|
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]); |
50 | 52 |
|
51 |
| - string word = splits[splits.Length - 1]; |
| 53 | + if (funcNames.Length == 0) |
| 54 | + return null; |
| 55 | + |
| 56 | + string word = funcNames[funcNames.Length - 1]; |
52 | 57 |
|
53 | 58 | var signatures = new List<SignatureInformation>();
|
54 | 59 |
|
@@ -78,8 +83,12 @@ public SignatureHelpHandler(
|
78 | 83 | }
|
79 | 84 | });
|
80 | 85 |
|
| 86 | + string paramStr = func[func.Length - 1]; |
| 87 | + int act = Regex.Matches(paramStr, ",").Count; |
| 88 | + |
81 | 89 | return new SignatureHelp
|
82 | 90 | {
|
| 91 | + ActiveParameter = act, |
83 | 92 | Signatures = signatures
|
84 | 93 | };
|
85 | 94 | }
|
|
0 commit comments