Checks run on a thread of their own
A check held up every request, because the compiler could run one compilation at a time. It can now run each in a context of its own. - A check runs on a checking thread, in Compilation.inNew. The thread reports a check to the thread that serves requests, which writes to the client. - The outline, definitions, references, completion, signature help and formatting are answered while a check runs. - A hover, a code action and bjolang/expandMacro are answered when the check of their file ends, with the results of the text as it stands. Other requests are served meanwhile. - A file that changes again before its check starts is checked once. - The tables that a check writes are concurrent dictionaries. - Standard output is the protocol's; the console's output goes to standard error. - smoke: with a check of 1.6 s running, an outline is answered in 0.1 s. Needs the compiler at its commit "Diagnostics.captured collects the output of its own context". Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
c5acafd5dd
commit
5e4ac7d9aa
6 changed files with 273 additions and 49 deletions
33
README.md
33
README.md
|
|
@ -199,6 +199,33 @@ step: the clauses' bodies are holes, and each says what it has to be. The
|
|||
actions are of the file's last check, which a check that is due replaces
|
||||
first, as for a hover, and only of text that is still what it checked.
|
||||
|
||||
## Checks in the background
|
||||
|
||||
A check runs on a thread of its own, in a context of the compiler's own
|
||||
(`Compilation.inNew`), so that the thread which serves requests is free
|
||||
while it runs:
|
||||
|
||||
- The outline, go to definition, references, completion, signature help and
|
||||
formatting read only as far as the reader, and are answered at once, also
|
||||
while a check runs. With a check of 1.6 s running, the smoke test gets an
|
||||
outline in 0.1 s.
|
||||
- A hover, a code action and `bjolang/expandMacro` need the results of the
|
||||
file's check. Asked while a check of the file is due or running, each is
|
||||
answered when the check ends, with the results of the text as it stands;
|
||||
a check that waits for typing to pause starts at once. Other requests are
|
||||
served meanwhile.
|
||||
- Inlay hints are answered from the last check, as before, and the client
|
||||
is asked to ask again when a check ends.
|
||||
- A file that changes again before its check starts is checked once, as its
|
||||
newest text.
|
||||
- Rename checks the renamed text itself, on the thread that serves
|
||||
requests, as before.
|
||||
|
||||
All that is written to the client is written by the thread that serves
|
||||
requests: the checking thread reports a check to it. Standard output is the
|
||||
protocol's; whatever else the process writes to the console goes to
|
||||
standard error.
|
||||
|
||||
## Building
|
||||
|
||||
It expects the Bjolang checkout beside this one, at `../Bjolang`, and runs
|
||||
|
|
@ -292,9 +319,9 @@ With eglot instead:
|
|||
## What it does not do yet
|
||||
|
||||
- A range over several lines is marked as far as its head only.
|
||||
- A check of a large file waits for the requests before it, and they for it:
|
||||
everything that touches the compiler runs on one thread, because the
|
||||
compiler's state is global.
|
||||
- One check at a time. Checks run on a thread of their own (see "Checks in
|
||||
the background"), one after another. A check that has started runs to its
|
||||
end, also when its text is no longer the newest.
|
||||
- Names a macro binds, at top level or locally. A loop variable is taken to
|
||||
be in scope across its whole loop, which is wider than the loop allows.
|
||||
- Which definition. A name defined in two imported modules goes to the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue