Skip to content

Commit e2b486c

Browse files
gselzerclaude
andcommitted
Complete via jedi-language-server
The Jedi tasks (JediClient, jedi_complete.py) give way to jedi-language-server, run from the tooling environment via code-lsp's LspClient; PythonLspClient reads its Python signatures. Tree-sitter's completions, dependency overlays and script environments stay as they were: the overlay and the environment's Python become the server's extra path and environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 526729e commit e2b486c

11 files changed

Lines changed: 659 additions & 973 deletions

File tree

‎README.md‎

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,22 @@ The Script Editor completes code in these scripts, in two layers:
143143
functions, classes, imports, parameters of the enclosing function), the
144144
script's `#@` parameters, `task`, builtins and keywords. This comes from
145145
parsing the script with [tree-sitter](https://tree-sitter.github.io/).
146-
* **With [Jedi](https://jedi.readthedocs.io/):** members of objects and
146+
* **With a language server,
147+
[jedi-language-server](https://github.com/pappasam/jedi-language-server)
148+
(built on [Jedi](https://jedi.readthedocs.io/)):** members of objects and
147149
modules, function signatures (with parameter names and types) and
148-
documentation. Jedi runs in a small environment of its own
149-
(`appose-python-completion`: Python, Jedi and Appose), which is built in
150-
the background the first time you complete code, and takes a while only
151-
then.
150+
documentation. The server runs in a small environment of its own
151+
(`appose-python-completion`: Python, jedi-language-server, Appose and uv),
152+
which is built in the background the first time you complete code, and
153+
takes a while only then. The server talks to the editor via the
154+
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
155+
(see `scijava-code-lsp`); it sees the script as plain Python, with its `#@`
156+
parameters declared. One server runs per script environment; servers
157+
unused for 10 minutes stop. Their error output goes to
158+
`appose-python-completion-server.log`, next to Appose's environments.
152159

153160
Once a script's environment is built, by running the script (in this session
154-
or an earlier one), Jedi analyzes the script against it, so that the packages
161+
or an earlier one), the server analyzes the script against it, so that the packages
155162
installed there are known too. Packages the script declares (in its
156163
`# /// script` block) but its environment lacks, e.g. a dependency you just
157164
added, are installed for completion only, into a separate directory, a moment
@@ -162,6 +169,7 @@ Completion never builds a script's environment itself, and never disturbs
162169
its worker. Script parameters are known by the Python types they have at run
163170
time, e.g. images as NumPy arrays.
164171

165-
Typing never waits for Jedi: if its answer for a word is not ready within a
166-
moment (the first answer for a package can take a few seconds), the instant
167-
completions show, and Jedi's are used once ready.
172+
Typing never waits for the server: if its answer for a word is not ready
173+
within a moment (the first answer for a package can take a few seconds), the
174+
instant completions show, and the server's are used once ready. Questions
175+
that are no longer of interest (e.g. as you type on) are cancelled.

‎pom.xml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,11 @@
115115
<artifactId>scijava-code-api</artifactId>
116116
<version>${scijava-code-api.version}</version>
117117
</dependency>
118+
<dependency>
119+
<groupId>org.scijava</groupId>
120+
<artifactId>scijava-code-lsp</artifactId>
121+
<version>${scijava-code-api.version}</version>
122+
</dependency>
118123

119124
<!-- Third-party dependencies -->
120125
<dependency>

0 commit comments

Comments
 (0)