Skip to content

Commit cd57d60

Browse files
gselzerclaude
andcommitted
Complete Appose Python with jedi alone
The syntax-only server (tree-sitter) answered only when jedi had failed, or with names jedi had not completed: completions waited for jedi anyway. Gone with it are the merging of the two servers' answers, the fallbacks from jedi to it, and the tree-sitter dependencies. Without jedi, the plugin no longer serves Appose Python at all. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e7b97d1 commit cd57d60

8 files changed

Lines changed: 98 additions & 969 deletions

File tree

‎README.md‎

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -148,30 +148,25 @@ script's own line numbers.
148148

149149
## Code completion
150150

151-
The Script Editor completes code in these scripts with one language server
151+
The Script Editor completes code in these scripts with a language server
152152
(`ApposePythonLanguageServer`, offered to `scijava-code-lsp`'s
153153
`LanguageServerService` by `ApposePythonServerPlugin`, so any other LSP client
154-
of it gets the same), combining two sources: jedi's answers first, then the
155-
syntax-only ones for names jedi has not completed.
156-
157-
* **Instantly, with no Python needed:** names in scope (variables,
158-
functions, classes, imports, parameters of the enclosing function), the
159-
script's `#@` parameters, `task`, builtins and keywords. This comes from
160-
parsing the script with [tree-sitter](https://tree-sitter.github.io/)
161-
(`PythonSyntaxLanguageServer`).
162-
* **With a language server,
163-
[jedi-language-server](https://github.com/pappasam/jedi-language-server)
164-
(built on [Jedi](https://jedi.readthedocs.io/)):**
165-
members of objects and modules, function signatures (with parameter names
166-
and types), documentation, hover and syntax errors. The server runs in a small environment of its own
167-
(`appose-python-completion`: Python, jedi-language-server, Appose and uv),
168-
which is built in the background the first time you complete code, and
169-
takes a while only then. The server talks to the editor via the
170-
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
171-
(see `scijava-code-lsp`); it sees the script as plain Python, with its `#@`
172-
parameters declared. One server runs per script environment; servers
173-
unused for 10 minutes stop. Their error output goes to
174-
`appose-python-completion-server.log`, next to Appose's environments.
154+
of it gets the same): [jedi-language-server](https://github.com/pappasam/jedi-language-server)
155+
(built on [Jedi](https://jedi.readthedocs.io/)). It completes names in scope,
156+
the script's `#@` parameters, `task`, builtins and keywords, and members of
157+
objects and modules; and it gives function signatures (with parameter names
158+
and types), documentation, hover and syntax errors.
159+
160+
The server runs in a small environment of its own
161+
(`appose-python-completion`: Python, jedi-language-server, Appose and uv),
162+
which is built in the background the first time you complete code, and
163+
takes a while only then; until it is, there are no completions. The server
164+
talks to the editor via the
165+
[Language Server Protocol](https://microsoft.github.io/language-server-protocol/)
166+
(see `scijava-code-lsp`); it sees the script as plain Python, with its `#@`
167+
parameters declared. One server runs per script environment; servers
168+
unused for 10 minutes stop. Their error output goes to
169+
`appose-python-completion-server.log`, next to Appose's environments.
175170

176171
Once a script's environment is built, by running the script (in this session
177172
or an earlier one), the server analyzes the script against it, so that the packages
@@ -186,6 +181,6 @@ its worker. Script parameters are known by the Python types they have at run
186181
time, e.g. images as NumPy arrays.
187182

188183
Typing never waits for the server: if its answer for a word is not ready
189-
within a moment (the first answer for a package can take a few seconds), the
190-
instant completions show, and the server's are used once ready. Questions
191-
that are no longer of interest (e.g. as you type on) are cancelled.
184+
within a moment (the first answer for a package can take a few seconds), it
185+
is shown once ready. Questions that are no longer of interest (e.g. as you
186+
type on) are cancelled.

‎pom.xml‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@
9696
<scijava-common.version>2.101.0</scijava-common.version>
9797

9898
<scijava-code-lsp.version>0.1.0-SNAPSHOT</scijava-code-lsp.version>
99-
<tree-sitter.version>0.26.6</tree-sitter.version>
100-
<tree-sitter-python.version>0.25.0</tree-sitter-python.version>
10199
</properties>
102100

103101
<dependencies>
@@ -117,17 +115,6 @@
117115
</dependency>
118116

119117
<!-- Third-party dependencies -->
120-
<dependency>
121-
<!-- NB: Parses Python for code completion. -->
122-
<groupId>io.github.bonede</groupId>
123-
<artifactId>tree-sitter</artifactId>
124-
<version>${tree-sitter.version}</version>
125-
</dependency>
126-
<dependency>
127-
<groupId>io.github.bonede</groupId>
128-
<artifactId>tree-sitter-python</artifactId>
129-
<version>${tree-sitter-python.version}</version>
130-
</dependency>
131118
<dependency>
132119
<groupId>com.fasterxml.jackson.core</groupId>
133120
<artifactId>jackson-databind</artifactId>

0 commit comments

Comments
 (0)