1st semantic version deployed
This commit is contained in:
+33
@@ -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;
|
||||
}
|
||||
}
|
||||
+14
@@ -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"));
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user