Skip to content

Commit ae27804

Browse files
gselzerclaude
andcommitted
Serve the script language by its name, as code-lsp now asks
code-lsp's sessions ask for the LSP language named as the script's language, in lower case, so the plugin no longer declares the script language it serves separately. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent fca039d commit ae27804

2 files changed

Lines changed: 2 additions & 14 deletions

File tree

‎src/main/java/org/scijava/plugins/scripting/jython/completion/JythonServerPlugin.java‎

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
import org.scijava.code.lsp.ScriptDialect;
3939
import org.scijava.plugin.Parameter;
4040
import org.scijava.plugin.Plugin;
41-
import org.scijava.script.ScriptLanguage;
4241

4342
/**
4443
* Offers Jython's in-process language server (see
@@ -57,14 +56,10 @@ public class JythonServerPlugin implements LanguageServerPlugin {
5756

5857
private JavaStubs stubs;
5958

60-
@Override
61-
public boolean supports(final ScriptLanguage language) {
62-
return isJython(language);
63-
}
64-
6559
@Override
6660
public boolean supports(final String languageId) {
67-
// NB: Not "python", which this builds on (see PythonCompanion).
61+
// NB: Jython scripts too, by their language's name. Not "python", which
62+
// this builds on (see PythonCompanion).
6863
return "jython".equals(languageId);
6964
}
7065

@@ -97,10 +92,4 @@ synchronized JavaStubs stubs() {
9792
return stubs;
9893
}
9994

100-
/** Matches "Jython" and "Python (Jython)", without claiming CPython. */
101-
static boolean isJython(final ScriptLanguage language) {
102-
if (language == null) return false;
103-
final String name = language.getLanguageName();
104-
return name != null && name.toLowerCase().contains("jython");
105-
}
10695
}

‎src/test/java/org/scijava/plugins/scripting/jython/completion/JythonServerCompletionTest.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,5 @@ public void testDeclarations() {
137137
"import net.imglib2.img"), dialect.imports(Arrays.asList(
138138
"net.imglib2.img.Img", "str", "java.util.Map$Entry", "array.array")));
139139
assertEquals("net", dialect.imported("import net.imglib2.img"));
140-
assertTrue(JythonServerPlugin.isJython(jython));
141140
}
142141
}

0 commit comments

Comments
 (0)