Skip to content

Add scijava-code-lsp et al - #294

Merged
gselzer merged 117 commits into
mainfrom
code-lsp
Nov 18, 2026
Merged

gselzer merged 117 commits into
mainfrom
code-lsp

Conversation

@gselzer

@gselzer gselzer commented Oct 21, 2026

Copy link
Copy Markdown
Member

This PR introduces a few new modules to the monorepo:

scijava-code-lsp wrangles LanguageServers

The central package, scijava-code-lsp is designed to assist with the management of Language Servers, following the Language Server Protocol, using lsp4j. A LanguageServerService offers the ability to launch a LanguageServer based on a desired programming language and Environment (interpreter path, module search paths, existing bindings) for general usage.

As the central use case is assisting the development of SciJava scripts, a ScriptSession class is also offered. Users provide (1) the text of a SciJava script to a ScriptSession and (2) a LanguageServerService, and can then query for autocomplete, hover info, etc. as well as listen to diagnostic feedback.

Of course, LanguageServers (can/should) not understand SciJava scripts as written, so scijava-code-lsp offers a ScriptDialect plugin describing how to convert text specific to SciJava scripts (e.g. script parameters) to headers that a language server could under stand and reason about. The scijava/scripting-X repositories are where I'm planning for these implementations to live (PRs to follow shortly)

Finally, scijava-code-lsp contains utilities common to multiple language servers, which leads us into:

scijava-code-lsp-groovy offers a GroovyLanguageServer

This language server is fully in-process and uses Groovy's compiler process to develop a typed AST that is used to answer LSP queries.

scijava-code-lsp-jedi offers a PythonLanguageServer

This language server is inter-process and uses jedi-language-server to answer LSP queries.

scijava-code-lsp-jython offers a JythonLanguageServer

This language server is inter-process and uses PythonLanguageServer indirectly. It also autogenerates type stubs to enable java types to be handled by the Python language server.

Points of Discussion

  • lsp4j is a significant dependency to bring in (~640KB) - I'd be receptive to the case that it's not worth it to use the existing work, and we could consider a scijava-code-lsp-api module, because it's unfortunate to bring this in because a library that just wants to declare a ScriptDialect implementation now gets this dependency.
  • jedi was chosen by Claude for the Python language server, but that is apparently in maintenance mode. We probably ought to choose a different server - options include ty, zuban, and pyright - should be very easy to switch.

gselzer and others added 30 commits October 21, 2026 16:15
LspServers starts language servers (one per environment scripts run in) in the background, restarts them if they stop, and stops them when idle or too many. LspClient asks them about ScriptDocuments in code-api terms: completions (the first few resolved for their signatures, the others for documentation on demand) and signature help, at positions of the original script. Answers are reused while the same question is asked, and a pending question is cancelled ($/cancelRequest) once another is asked about the same document.

code-api: CodeCompleter#closed, so completers can release what they keep for a script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
code-api: CodeCompleter#hover (what is known about the code at a position, e.g. documentation; with updates, like signature help) and CodeCompleter#diagnose (problems in a script, e.g. syntax errors, once found).

code-lsp: LspClient#hover (textDocument/hover) and LspClient#diagnose, from the diagnostics the server publishes, awaited for the version of the document sent; positions mapped back to the original script, problems in the added lines left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LspServerPlugins offer a language server for a language (e.g. jedi-language-server for Python); DefaultLspService keeps one LspServers per language, shared by the completers that want one, and stops them when the context is disposed. PythonLspClient (reading Python signatures) moves here from scripting-appose-python, for Jython's use too. Gson is declared directly, so that consumers need not resolve lsp4j's range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
SciJavaLanguageServer serves the completions, signature help, hover and diagnostics of the context's code completers over the Language Server Protocol, for editors outside SciJava (e.g. VS Code); Main runs it over standard input and output, keeping SciJava's output off the protocol's stream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every source of code intelligence becomes an lsp4j LanguageServer: in-process, or a server process (LaunchedLanguageServer, over LspServers). LanguageServerPlugins offer them per SciJava script language; LanguageServerService keeps them, one per plugin and Environment, and hands callers a MergedLanguageServer per language, which keeps each document in sync on every server for it (moving it as its environment changes) and merges their answers: completions in priority order without duplicates, slower ones as an UpdatingCompletionList; the first signature help and hover; all diagnostics. RatedSignatureInformation keeps overload fits; TransformingLanguageServer shows a server SciJava scripts as plain code (ScriptDocument).

Until each language has a server of its own, CodeCompleterServerPlugin offers code-api's CodeCompleters as one. The default completer reads live bindings from a ScriptContext too, as servers get no engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The adapter serves languages with a completer of their own (so editors can tell which are served), can serve a single completer (e.g. in tests), and looks for problems a moment after the last change, as editors send every keystroke. Merging keeps overloads: completions are the same only if they insert the same name with the same parameters (label details).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merging dropped completions inserting the same name with the same parameters even within one server's list, e.g. Groovy's each() from Iterable, Collection, List and Object. Only those duplicating an earlier server's are dropped now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ScriptLanguageServer: a base class keeping the open documents, answering requests by asking the subclass about a document and offset, resolving documentation on demand, and publishing problems a moment after each change. Callable: something to call, as a snippet completion with typed label details, or as a rated signature. Members: completions for Java classes' members, by reflection. Signatures: rating calls' arguments, on Callables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Callable.of(item) reads a callable from a completion's label details. Merging compares completions without an edit (e.g. jedi's "length") by the word before the caret, so that they match those replacing more (e.g. Jython's "s.length").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PythonCompletionServer wraps a Python language server (e.g.
jedi-language-server) as editors want it: it asks at a word's first
character and caches the answer, cancels superseded requests, filters by
the word typed, and gives the top completions their signatures.
DelegatingLanguageServer forwards everything, for such decorators.
Cancelling a completion now cancels the request it waits on, through
TransformingLanguageServer and LaunchedLanguageServer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code intelligence is now lsp4j language servers throughout. What
code-api had that servers still need moves into code-lsp: ScriptDocument,
ScriptDialect, PositionMap and ClassIndex; script parameter parsing, as
LanguageServerService.scriptParameters; and Environment in place of
EnvironmentContext. Positions replaces LspClient's offset conversions,
and Python signatures are parsed by PythonCompletionServer.

Gone: the code-api adapter, LspClient and PythonLspClient. In their
place, BindingsLanguageServer completes a running interpreter's
variables, for languages without servers. The outside-editor server
(SciJavaLanguageServer) is now a front for the service's merged servers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A ScriptSession is where a client (an editor, a REPL, a tool checking a
script) asks about a SciJava script, in terms of its text and offsets:
it keeps the servers' copy up to date, names the script (its file's URI,
or an untitled one; following Save As), and receives its problems. Each
request carries the text it is about. The LanguageServerService makes
sessions, each owning a merged server of its own; for languages no
plugin serves, a session completes a running interpreter's variables.
diagnose is now a session asked once.

Where scripts run can change without them changing (e.g. an environment
is built): plugins now say so via environmentsChanged(), which moves
open scripts to the servers of where they run now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing runs it: editors in the SciJava process ask the service for
servers directly, and none outside it has been wired to this one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It is specific to Python (completing Java members on objects a Python
server cannot see into), so it belongs with the one plugin using it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module does several things, each now in a package of its own:

- org.scijava.code.lsp: brokering between scripts and servers (the
  service, plugins, script sessions, environments), plus SciJava's
  additions to LSP (updating completion lists, rated signatures).
- .launch: running language server processes.
- .script: SciJava scripts as plain code (#@ parameters declared).
- .jvm: a toolkit for in-process servers of JVM languages.
- .impl: the implementation, not exported.

The specialized packages depend only on the base package, never on
each other. A module-info exports the four public packages; it is open,
for SciJava Common's reflection. Package infos say what each is for.

To keep the implementation internal, clients get sessions via
ScriptSession.owning, the service no longer offers its servers directly
(LanguageServerService.server), and data is no longer assumed to be
Gson's (the module no longer reads Gson).

Tests run on the classpath, not the module path, where the tests'
plugin index would shadow the module's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ScriptSession.server, language, text and uri, and setFile(File), had no
callers outside tests; nor had LanguageServerService.session(File).
Clients set a file supplier, as editors follow Save As.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop UpdatingCompletionList and RatedSignatureInformation, SciJava's
additions to LSP:

- Merged completions come once all servers have answered, as signature
  help and hover already did; clients that must not wait ask
  asynchronously.
- In-process servers still order overloads best fit first (Fit moves to
  Signatures), but signatures no longer carry their fit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop MergedLanguageServer: a language is served by the highest-priority
plugin supporting it, and a server combining several sources (e.g. an
in-process analysis and jedi) combines them itself. Each session gets a
server of its own, which it initializes (awaiting the answer, as LSP
says) and shuts down when closed. Server processes stay shared, one per
environment.

With it go the service's shared servers and diagnostics routing,
moving scripts between servers as where they run changes
(LanguageServerPlugin.environment, environmentsChanged), and waiting
for several servers' problems.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A script document maps positions between its script and its text
itself: by offset, and by LSP position and range.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A ScriptSession now transforms each script into plain code of its
language, in the dialect of the plugin offering its server
(LanguageServerPlugin#dialect), and maps positions in the server's
answers back. Servers need know nothing of SciJava scripts.

TransformingLanguageServer, which did this inside some servers, is
gone, and so is ScriptDocument's unused environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The declarations a session adds are real code: imports of the
parameters' types bind names (e.g. numpy) the script does not. A
dialect now says which name each import binds
(ScriptDialect#imported); unless the script mentions it, the session
leaves completions of it out (see ScriptDocument#added).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ScriptDialect and ScriptDocument are now part of how sessions talk to
servers (LanguageServerPlugin#dialect, ScriptSession), so they move
from org.scijava.code.lsp.script into org.scijava.code.lsp. This also
ends the cycle between the two packages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A server process is now offered by a ServerProcessPlugin, in the core
package: it starts the process for an LSP language and an environment,
and says how to initialize it (options, workspace root). The launch
package (LspServerPlugin, LspServerSpec, LspConnection) and the
separate LspService are gone; LanguageServerService#launch serves the
processes itself.

The implementation follows the new names: ServerProcesses keeps a
language's ServerProcess per environment, and a ProcessLanguageServer
shows one as an lsp4j LanguageServer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LanguageServerService.launch can now take a function from a document to
its environment, which ProcessLanguageServer consults before each
request: a document whose environment changes is closed on its old
server process and opened on its new one. Completions remember which
process answered them, so that they are resolved by it.

Also note in ScriptDialect's javadoc why a dialect describes the
translation of scripts, rather than doing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A ServerProcessPlugin for python, moved here from scripting-appose-python
so that script languages can use jedi without depending on each other
(e.g. scripting-jython). It runs jedi-language-server in a small Appose
environment of its own (code-lsp-jedi: Python 3.12, Jedi, NumPy), built
the first time it is needed, under a launcher that exits once the JVM
is gone.

JediLifecycleIntegrationTest starts a server via LanguageServerService,
asks it about a script, and checks that its process stops with the
context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LanguageServerService.launch(languageId, environment) now gets a server
for any LSP language a plugin serves, in-process or not: plugins say so
via supports(String), and supports(ScriptLanguage) for sessions. Server
processes are served by ProcessLanguageServerPlugin (internal), which
owns them and stops them when disposed; LanguageServerService also tells
whether a language is served at all, via supports(String).

Servers analyze scripts in one environment, given when created: plugins
whose scripts say where they run keep a server per environment
themselves. ProcessLanguageServer no longer moves documents.

Also:
- Rename ScriptLanguageServer to AbstractLanguageServer.
- Throw rather than return null when no plugin serves a language.
- Remove LanguageServerService.diagnose: a session does as much.
- Stop started server processes directly on shutdown, rather than via
  the starter, whose shutdown could drop the stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gselzer and others added 3 commits November 13, 2026 10:03
Test new-style (#@) lines, old-style header parameters and shebangs
separately, checking the variables they declare by name and type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Partition ServerProcessesTest: ProcessLanguageServer's tests move to a
ProcessLanguageServerTest, and the plugin's to an
AbstractProcessLanguageServerPluginTest, sharing the fake servers in
FakeServers. Split the tests covering several behaviors, document each
test's goal, and check sharing by process rather than by slot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Document each test's goal, and simplify: one fake dialect, importing
NumPy under a private alias as real dialects should; a short mapping
test in place of the exhaustive round trips; and a plain-text test
checking the fallback's language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical capability-advertising and process-lifecycle defects can disable core LSP features, leak server processes, and leave requests pending indefinitely.

9 open issues
What changed in this PR

This PR introduces SciJava’s language-server infrastructure, connecting script editing features to pluggable Groovy, Python (ty), and Jython backends.

Changes:

  • Adds language-server discovery, environment configuration, script transformation, and completion utilities.
  • Implements shared external-process management and language-specific plugin integration.
  • Adds module configuration, usage examples, and unit and integration tests.
File Description
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​server/​ServerProcessesTest.java Tests process sharing, restart, retry, and eviction.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​server/​ProcessLanguageServerTest.java Tests document synchronization, diagnostics, and closure.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​server/​FakeServers.java Provides pipe-connected test servers.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​server/​AbstractProcessLanguageServerPluginTest.java Tests plugin support and lifecycle.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​ScriptProcessingTest.java Tests script parameter preprocessing.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​ScriptDocumentTest.java Tests transformed text and position mapping.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​PositionsTest.java Tests position conversion and call detection.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​jvm/​ClassIndexTest.java Tests runtime class indexing.
scijava-code-lsp/​src/​test/​java/​org/​scijava/​code/​lsp/​CompletionItemsTest.java Tests snippets and reflected member completions.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​server/​ServerProcesses.java Manages per-environment process lifecycles.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​server/​ServerLauncher.java Defines external server launch configuration.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​server/​ProcessLanguageServer.java Proxies requests and schedules diagnostics.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​server/​package-info.java Documents external server integration.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​server/​AbstractProcessLanguageServerPlugin.java Supplies reusable process-backed plugin support.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​ScriptProcessing.java Extracts parameters and removable script lines.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​ScriptDocument.java Builds virtual documents and maps positions.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​ScriptDialect.java Defines language-specific script adaptation.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​Positions.java Provides offset and position utilities.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​package-info.java Documents the core API.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​LanguageServerService.java Defines server discovery and launch services.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​LanguageServerPlugin.java Defines the server plugin contract.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​jvm/​package-info.java Documents JVM server utilities.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​impl/​package-info.java Describes internal implementations.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​impl/​DefaultLanguageServerService.java Selects plugins and manages disposal.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​impl/​BindingsLanguageServer.java Provides interpreter-binding fallback completions.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​Environment.java Models interpreter, search paths, and live bindings.
scijava-code-lsp/​src/​main/​java/​org/​scijava/​code/​lsp/​CompletionItems.java Builds snippets and reflected member suggestions.
scijava-code-lsp/​src/​main/​java/​module-info.java Declares core module exports and dependencies.
scijava-code-lsp/​README.md Introduces server and script-session usage.
scijava-code-lsp/​pom.xml Configures core dependencies and testing.
scijava-code-lsp-ty/​src/​test/​java/​org/​scijava/​code/​lsp/​ty/​TyLifecycleIntegrationTest.java Tests real ty startup and disposal.
scijava-code-lsp-ty/​src/​test/​java/​org/​scijava/​code/​lsp/​ty/​TyLauncherTest.java Tests launch options and parent-process monitoring.
scijava-code-lsp-ty/​src/​test/​java/​org/​scijava/​code/​lsp/​ty/​TyLanguageServerIntegrationTest.java Tests Python editing features end to end.
scijava-code-lsp-ty/​src/​main/​java/​org/​scijava/​code/​lsp/​ty/​TyLauncher.java Builds ty’s environment and launches its process.
scijava-code-lsp-ty/​src/​main/​java/​org/​scijava/​code/​lsp/​ty/​TyLanguageServerPlugin.java Registers the Python backend.
scijava-code-lsp-ty/​src/​main/​java/​module-info.java Declares ty module dependencies.
scijava-code-lsp-ty/​README.md Demonstrates Python server usage.
scijava-code-lsp-ty/​pom.xml Configures ty integration dependencies and tests.
scijava-code-lsp-jython/​src/​test/​java/​org/​scijava/​code/​lsp/​jython/​JythonLanguageServerTest.java Tests Jython completions and signature help.
scijava-code-lsp-jython/​src/​test/​java/​org/​scijava/​code/​lsp/​jython/​JavaStubsTest.java Tests generated Java type stubs.
scijava-code-lsp-jython/​src/​main/​java/​org/​scijava/​code/​lsp/​jython/​JythonLanguageServerPlugin.java Registers the Jython backend.
scijava-code-lsp-jython/​src/​main/​java/​org/​scijava/​code/​lsp/​jython/​JythonImports.java Generates Java class import edits.
scijava-code-lsp-jython/​src/​main/​java/​module-info.java Declares Jython module dependencies.
scijava-code-lsp-jython/​README.md Demonstrates Jython server usage.
scijava-code-lsp-jython/​pom.xml Configures Jython and Python backend dependencies.
scijava-code-lsp-groovy/​src/​test/​java/​org/​scijava/​code/​lsp/​groovy/​GroovyServerPluginTest.java Tests Groovy plugin discovery and launch.
scijava-code-lsp-groovy/​src/​main/​java/​org/​scijava/​code/​lsp/​groovy/​Overload.java Models overloads for completions and signatures.
scijava-code-lsp-groovy/​src/​main/​java/​org/​scijava/​code/​lsp/​groovy/​GroovyServerPlugin.java Registers the Groovy backend.
scijava-code-lsp-groovy/​src/​main/​java/​module-info.java Declares Groovy module dependencies.
scijava-code-lsp-groovy/​README.md Demonstrates Groovy server usage.
scijava-code-lsp-groovy/​pom.xml Configures Groovy backend dependencies and tests.
pom.xml Adds the four modules to the reactor.

Review effort: Balanced

gselzer and others added 2 commits November 16, 2026 12:58
Tests of ScriptSession move to ScriptSessionTest, of
DefaultLanguageServerService and BindingsLanguageServer to their own
tests in the impl package, sharing fake plugins in FakeLanguageServers.
Each test has a Javadoc stating its goal, and checks one behavior;
tests of what other classes do are left to those classes' tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A launcher may start a wrapper around the actual server (e.g. ty's
Python launcher). Destroying only the wrapper, when a server fails to
initialize or does not shut down, left the server running, orphaned.
Now its descendants are destroyed as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ProcessLanguageServer answered initialize with no capabilities, so a
client following them would neither sync documents nor ask for
completion, hover or signature help. Now initializing starts the
process, and passes on its capabilities: of the features the proxy
forwards, those the process has; with documents always synced by their
whole text, as the proxy requires. If the process cannot start, no
features are claimed.

Also, tests that need a failing ServerProcesses now make their own,
rather than replacing (and, in testRetry, leaking) the one setUp made.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gselzer and others added 2 commits November 16, 2026 16:42
Requests and diagnoses wait for the process to start, which can take
long. They then synced the document as it was when they were made: so
the process could be told stale text, or a document closed meanwhile
(and so open it anew). Now they sync it only if still open at that
version, checked under its lock, which closing it takes too; skipped
requests are answered with nothing, rather than left pending. Shutting
down also cancels documents' pending diagnoses, which would otherwise
start the process anew.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ServerProcesses.shutdown() stopped the starter with shutdownNow(), which
drops queued starts without completing their futures, so whoever waited
on them waited forever. Now it fails the starts not yet done at once,
and asking for a process afterwards fails rather than throwing. A start
that finishes anyway shuts its process down itself, and a start
interrupted by the shutdown is not warned of. A failed start is noted
before its future fails, so its users wait out the retry delay from the
right time.

The fake servers' process says it has no children, so destroying it
does not throw, and the delayed fake server is shared by both tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
If we do it on `starter` then it is vulnerable to being terminated on shutdown, preventing normal shutdown completion

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
gselzer and others added 2 commits November 17, 2026 14:38
A completion's additional edits are mapped back to the script, and those
in the dialect's header dropped. But when a script has no imports yet,
Jython's server inserts a class's import at the very top, in the header,
so accepting the class lost its import. As a HACK, an insertion at the
very start of the text now goes at the start of the script.

NB: That places imports above a script's parameter block, where SciJava
scripts conventionally put them after it. Ideally new imports would go
right after the parameters at the top.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gselzer and others added 3 commits November 17, 2026 16:38
When a script's last import was its last line, without a line break,
accepting a Java class appended its import onto that line (e.g.
"from java.lang import Mathfrom java.util import ArrayList"). Now an
import inserted where no line starts goes after a line break instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Positions.offset clamped a character past a line's end to its \n, so on
a line ending in \r\n, it pointed between the \r and the \n. And it added
the character to the line's start before clamping, so a huge one (as some
clients send, for the end of the line) overflowed to a negative offset.
Now a line ends before its line break, \r\n included, and the character
is clamped before it is added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its API is the Language Server Protocol's, through and through, and its
system properties (scijava.lsp.*) and threads were named so already. The
modules become scijava-lsp, scijava-lsp-groovy, scijava-lsp-jython and
scijava-lsp-ty, and their packages and Java modules org.scijava.lsp.*.

NB: ty's environment keeps its name (code-lsp-ty), lest users' existing
environments be left behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gselzer
gselzer marked this pull request as ready for review November 18, 2026 00:56
@gselzer
gselzer merged commit 669971e into main Nov 18, 2026
1 check passed
@gselzer
gselzer deleted the code-lsp branch November 18, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants