Skip to content

Commit 599b2ea

Browse files
gselzerclaude
andcommitted
code-lsp: rename ScriptDialect.runtimeType to parameterType
It gets the type a script parameter has in a running script, as written in the script's language: the name says what it is about. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 7e0363a commit 599b2ea

6 files changed

Lines changed: 13 additions & 14 deletions

File tree

‎code-lsp-groovy/src/main/java/org/scijava/code/lsp/groovy/GroovyLanguageServer.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ public String languageId() {
756756
}
757757

758758
@Override
759-
public String runtimeType(final Class<?> type) {
759+
public String parameterType(final Class<?> type) {
760760
return typeName(type);
761761
}
762762

‎code-lsp-groovy/src/test/java/org/scijava/code/lsp/groovy/GroovyLanguageServerTest.java‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
import org.scijava.code.lsp.jvm.ClassIndex;
5353

5454
/**
55-
* Tests {@link GroovyLanguageServer}: what it makes of plain Groovy, as its
56-
* clients send it.
55+
* Tests {@link GroovyLanguageServer}
5756
*
5857
* @author Gabriel Selzer
5958
*/

‎code-lsp/src/main/java/org/scijava/code/lsp/ScriptDialect.java‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,27 +94,27 @@ default Environment environment(final String text, final File file) {
9494
}
9595

9696
/**
97-
* Gets the type a script parameter of the given Java type has in a running
98-
* script, as written in this language, e.g. {@code numpy.ndarray} for an
99-
* image in CPython; or null if it has no useful type (the parameter is then
100-
* not declared).
97+
* Gets the type, as written in this language, that a script parameter of
98+
* the given Java type has in a running script, e.g. {@code numpy.ndarray}
99+
* for an image in CPython; or null if it has no useful type (the parameter
100+
* is then not declared).
101101
*/
102-
String runtimeType(Class<?> type);
102+
String parameterType(Class<?> type);
103103

104104
/**
105105
* Declares a variable, e.g. {@code image: numpy.ndarray} (Python) or
106106
* {@code net.imglib2.img.Img image;} (Groovy), without a line break.
107107
*
108108
* @param name The variable's name.
109-
* @param type Its type, as given by {@link #runtimeType}.
109+
* @param type Its type, as given by {@link #parameterType}.
110110
*/
111111
String declare(String name, String type);
112112

113113
/**
114114
* Gets statements needed before the declarations, e.g. imports of the types
115115
* they use ({@code import numpy}). The default needs none.
116116
*
117-
* @param types The types declared, as given by {@link #runtimeType}.
117+
* @param types The types declared, as given by {@link #parameterType}.
118118
*/
119119
default List<String> imports(final Collection<String> types) {
120120
return Collections.emptyList();

‎code-lsp/src/main/java/org/scijava/code/lsp/ScriptDocument.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static ScriptDocument of(final String script,
101101
final Map<String, String> types = new LinkedHashMap<>();
102102
final List<String> declarations = new ArrayList<>();
103103
for (final Map.Entry<String, Class<?>> p : parameters.entrySet()) {
104-
final String type = dialect.runtimeType(p.getValue());
104+
final String type = dialect.parameterType(p.getValue());
105105
types.put(p.getKey(), type);
106106
if (type != null) declarations.add(dialect.declare(p.getKey(), type));
107107
}

‎code-lsp/src/test/java/org/scijava/code/lsp/ScriptDocumentTest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public String languageId() {
6767
}
6868

6969
@Override
70-
public String runtimeType(final Class<?> type) {
70+
public String parameterType(final Class<?> type) {
7171
if (type.isArray()) return "numpy.ndarray";
7272
if (type == String.class) return "str";
7373
return null;
@@ -113,7 +113,7 @@ public String languageId() {
113113
}
114114

115115
@Override
116-
public String runtimeType(final Class<?> type) {
116+
public String parameterType(final Class<?> type) {
117117
return type.getName();
118118
}
119119

‎code-lsp/src/test/java/org/scijava/code/lsp/impl/LanguageServersTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ public Environment environment(final String text, final File file) {
510510
}
511511

512512
@Override
513-
public String runtimeType(final Class<?> type) {
513+
public String parameterType(final Class<?> type) {
514514
return type.getSimpleName();
515515
}
516516

0 commit comments

Comments
 (0)