Fixed visual hover info bugs for generics

This commit is contained in:
bigguy345 committed 2026-01-28 04:55:32 +02:00
1 parent 125a799df4
commit 969d82dff8
2 files changed
+7 -2

No files matched your search

@@ -1295,11 +1295,14 @@ public class ScriptDocument {
initStart = bodyStart + m.start(3);
int searchPos = bodyStart + m.end(3);
int depth = 0;
int angleDepth = 0;
while (searchPos < text.length()) {
char c = text.charAt(searchPos);
if (c == '(' || c == '[' || c == '{') depth++;
else if (c == ')' || c == ']' || c == '}') depth--;
else if ((c == ';' || c == ',') && depth == 0) {
else if (c == '<') angleDepth++;
else if (c == '>') angleDepth--;
else if ((c == ';' || c == ',') && depth == 0 && angleDepth == 0) {
initEnd = searchPos;
break;
}
@@ -1496,12 +1496,14 @@ public class TokenHoverInfo {
// Never add space before these closing/trailing characters
if (firstChar == '(' || firstChar == '[' || firstChar == '{' ||
firstChar == '.' || firstChar == ',' || firstChar == ';' ||
firstChar == '>' || // No space before closing angle bracket
(firstChar == ':' && lastToken.equals("?"))) {
return false;
}
// Never add space after these opening/leading characters
if (lastChar == '(' || lastChar == '[' || lastChar == '{' || lastChar == '.') {
if (lastChar == '(' || lastChar == '[' || lastChar == '{' ||
lastChar == '.' || lastChar == '<') { // No space after opening angle bracket
return false;
}