Skip to content

Commit a8e04a5

Browse files
gselzerclaude
andcommitted
Unify Environment's search paths and classpath
Both are ordered places imports are resolved from; each server reads them as its language does. Nothing read the classpath. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d011a25 commit a8e04a5

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎src/main/java/org/scijava/plugins/scripting/appose/python/ApposePythonEnvironments.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ org.scijava.code.lsp.Environment environment(final String text,
137137
final String python = scriptPython(text, path);
138138
final String overlay = overlay(text, path, python, settled);
139139
return new org.scijava.code.lsp.Environment(python, overlay == null ? null
140-
: Collections.singletonList(overlay), null, null);
140+
: Collections.singletonList(overlay), null);
141141
}
142142

143143
/**

‎src/main/java/org/scijava/plugins/scripting/appose/python/completion/JediLanguageServerSpec.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public Object initializationOptions(final Environment env) {
126126
if (env.interpreter() != null) {
127127
workspaceOptions.put("environmentPath", env.interpreter());
128128
}
129-
workspaceOptions.put("extraPaths", env.searchPaths());
129+
workspaceOptions.put("extraPaths", env.paths());
130130
final Map<String, Object> options = new LinkedHashMap<>();
131131
options.put("workspace", workspaceOptions);
132132
// NB: Jedi's diagnostics are syntax errors, found as the script changes.

‎src/test/java/org/scijava/plugins/scripting/appose/python/ApposePythonLanguageServerTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private ApposePythonLanguageServer server(
202202
{
203203
final ApposePythonLanguageServer s = new ApposePythonLanguageServer(syntax,
204204
doc -> new Environment(doc.getText().contains("#env=B") ? "B"
205-
: fallback, null, null, null), jedi, null);
205+
: fallback, null, null), jedi, null);
206206
s.connect(new Client());
207207
s.initialize(new InitializeParams());
208208
return s;

‎src/test/java/org/scijava/plugins/scripting/appose/python/ApposePythonServersTest.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public void testEnvironmentWithoutOne() {
137137
final Environment env = plugin.environment(new TextDocumentItem(
138138
"untitled:/a.py", "appose-python", 2, "import os\nos.pa"));
139139
assertNull(env.interpreter());
140-
assertTrue(env.searchPaths().isEmpty());
140+
assertTrue(env.paths().isEmpty());
141141
}
142142

143143
@Test
@@ -161,7 +161,7 @@ public void testOverlay() throws Exception {
161161
assertEquals(Collections.singletonList(Collections.singletonList(
162162
"tifffile")), installed);
163163
assertEquals(Collections.singletonList("/overlays/blur"), plugin.environment(
164-
doc).searchPaths());
164+
doc).paths());
165165
}
166166

167167
@Test
@@ -291,7 +291,7 @@ public void testServerOptions() {
291291
assertEquals("{workspace={environmentPath=/env/bin/python, " +
292292
"extraPaths=[/overlay]}, " + diagnostics + "}", String.valueOf(spec
293293
.initializationOptions(new Environment(
294-
"/env/bin/python", Collections.singletonList("/overlay"), null, null))));
294+
"/env/bin/python", Collections.singletonList("/overlay"), null))));
295295
// Without a script environment: the server's own.
296296
assertEquals("{workspace={extraPaths=[]}, " + diagnostics + "}", String
297297
.valueOf(spec.initializationOptions(

0 commit comments

Comments
 (0)