Skip to content

Commit 9413b08

Browse files
gselzerclaude
andcommitted
Test signature order, not fit
code-lsp's signatures no longer carry their fit; the best fits still come first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f724d7f commit 9413b08

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎src/test/java/org/scijava/plugins/scripting/jython/JythonCompletionTest.java‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import org.scijava.code.lsp.jvm.ClassIndex;
4949
import org.scijava.code.lsp.LanguageServerService;
5050
import org.scijava.code.lsp.ScriptSession;
51-
import org.scijava.code.lsp.RatedSignatureInformation;
5251
import org.scijava.script.ScriptLanguage;
5352
import org.scijava.script.ScriptService;
5453

@@ -227,17 +226,15 @@ public void testSignatureHelp() {
227226
final SignatureHelp max = help("from java.lang import Math\n" +
228227
"Math.max(1.5, ");
229228
assertEquals(Integer.valueOf(1), max.getActiveParameter());
230-
assertEquals("[double:MATCH, float:MATCH, int:MISMATCH, long:MISMATCH]",
231-
describe(max));
229+
assertEquals("[double, float, int, long]", describe(max));
232230
// A Python int fits the integral ones, and converts to the others.
233-
assertEquals("[int:MATCH, long:MATCH, double:CONVERSION, " +
234-
"float:CONVERSION]", describe(help("from java.lang import Math\n" +
235-
"Math.max(1, 2")));
231+
assertEquals("[int, long, double, float]", describe(help(
232+
"from java.lang import Math\nMath.max(1, 2")));
236233
// Arguments' types come from the analysis, e.g. of variables.
237234
final SignatureHelp indexOf = help("s = 'abc'\nc = 'b'\n" +
238235
"s.indexOf(c, ");
239236
assertTrue(describe(indexOf), describe(indexOf).startsWith(
240-
"[java.lang.String:MATCH"));
237+
"[java.lang.String"));
241238
// Constructors.
242239
assertTrue(describe(help("from java.util import ArrayList\n" +
243240
"ArrayList(")).contains("java.util.Collection"));
@@ -268,14 +265,14 @@ private static SignatureHelp help(final String code) {
268265
}
269266
}
270267

271-
/** Each signature's first parameter type and fit, in order. */
268+
/** Each signature's first parameter type, in order. */
272269
private static String describe(final SignatureHelp help) {
273270
return help.getSignatures().stream().map(s -> {
274271
final String first = s.getParameters().isEmpty() ? "()" : s
275272
.getParameters().get(0).getLabel().getLeft();
276273
final String type = first.contains(" ") ? first.substring(0, first
277274
.lastIndexOf(' ')) : first;
278-
return type + ":" + RatedSignatureInformation.fitOf(s);
275+
return type;
279276
}).collect(Collectors.toList()).toString();
280277
}
281278

0 commit comments

Comments
 (0)