1st semantic version deployed

This commit is contained in:
2026-05-06 09:41:36 +01:00
parent 2994bc67a3
commit 0cafe84da0
12 changed files with 347 additions and 5 deletions
@@ -0,0 +1,33 @@
package p.studio.lsp.messages;
import java.util.Objects;
public record BaselineSemanticToken(
int line,
int startCharacter,
int length,
String semanticKey) {
public BaselineSemanticToken {
if (line < 0) {
throw new IllegalArgumentException("line must be >= 0");
}
if (startCharacter < 0) {
throw new IllegalArgumentException("startCharacter must be >= 0");
}
if (length <= 0) {
throw new IllegalArgumentException("length must be > 0");
}
semanticKey = requireText(semanticKey, "semanticKey");
}
private static String requireText(
final String value,
final String field) {
final String candidate = Objects.requireNonNull(value, field).trim();
if (candidate.isEmpty()) {
throw new IllegalArgumentException(field + " must not be blank");
}
return candidate;
}
}
@@ -0,0 +1,14 @@
package p.studio.lsp.messages;
import java.util.List;
import java.util.Objects;
public record BaselineSemanticTokens(
List<String> legend,
List<BaselineSemanticToken> tokens) {
public BaselineSemanticTokens {
legend = List.copyOf(Objects.requireNonNull(legend, "legend"));
tokens = List.copyOf(Objects.requireNonNull(tokens, "tokens"));
}
}
@@ -1,15 +1,18 @@
package p.studio.lsp.messages;
import java.util.Objects;
import java.util.List;
public record BaselineServerDescription(
String name,
String version,
boolean hoverSupported) {
boolean hoverSupported,
List<String> semanticTokenTypes) {
public BaselineServerDescription {
name = requireText(name, "name");
version = requireText(version, "version");
semanticTokenTypes = List.copyOf(Objects.requireNonNull(semanticTokenTypes, "semanticTokenTypes"));
}
private static String requireText(