A project's packages, and diagnostics at their column
A file in a project is checked against the packages bjo fetched for it: the server installs the project's .bjo/roots, .bjo/frameworks and .bjo/nuget/root before its first check, through the compiler's ProjectInputs, so imports from packages check and definition, hover and completion reach them. A server serves one project, the first file's; a warning on a file's first line says when it cannot serve one as bjo would: packages not fetched, the roots changed since it started, or another project. The server no longer has the old Microsoft.Extensions.DependencyInjection .Abstractions next to it. The compiler excludes it, the exclusion does not pass through a project reference, and with it there every ASP.NET type failed to load, so bjoweb did not check. A diagnostic marks the form at the line and column the compiler names now: an atom or a string whole, a bracketed form to its closing bracket, and one over several lines as far as its head. The build no longer asks git for Source Link, which fails on this repository's SHA-256 objects. 🤖 Generated with [ECA](https://eca.dev) (anthropic/claude-opus-5-5) Co-Authored-By: eca-agent <git@eca.dev>
This commit is contained in:
parent
77b8a92e03
commit
cc62a8a360
6 changed files with 362 additions and 15 deletions
36
README.md
36
README.md
|
|
@ -1,12 +1,16 @@
|
|||
# BjolangLsp
|
||||
|
||||
A language server for Bjolang. It does five things:
|
||||
A language server for Bjolang. It checks a file against its project's
|
||||
packages (see "Projects"), and it does five things:
|
||||
|
||||
- Diagnostics: it checks a file with the compiler's frontend, as
|
||||
`bjolang --check` does, and sends the errors and warnings to the editor.
|
||||
It checks the editor's text, saved or not: when a file is opened or
|
||||
saved, and 400 ms after typing pauses. Every open file is read from its
|
||||
buffer, so an unsaved include or `.bjodoc` counts too.
|
||||
buffer, so an unsaved include or `.bjodoc` counts too. A diagnostic marks
|
||||
the form at the line and column the compiler names: an atom or a string
|
||||
whole, a bracketed form to its closing bracket, and one over several lines
|
||||
as far as its head, `(defun` or `(match`.
|
||||
- An outline (`textDocument/documentSymbol`): the file's top-level
|
||||
definitions, with a type's constructors or fields, a trait's methods and an
|
||||
`impl`'s functions under them.
|
||||
|
|
@ -66,6 +70,27 @@ The server is `bin/Release/net10.0/BjolangLsp.dll`, started as
|
|||
`dotnet bin/Release/net10.0/BjolangLsp.dll`. It talks LSP on stdin and
|
||||
stdout, and logs to stderr.
|
||||
|
||||
## Projects
|
||||
|
||||
A file in a project, a directory with a `manifest.bjodat` at or above it, is
|
||||
checked against the project's packages, as `bjo` compiles it: the roots file
|
||||
`.bjo/roots` that says where each package is, `.bjo/frameworks` for the .NET
|
||||
shared frameworks the packages declared, and `.bjo/nuget/root` for restored
|
||||
NuGet packages. `bjo` writes them; `bjo fetch` is enough. Imports from the
|
||||
packages then check, and go to definition, hover and completion reach them.
|
||||
|
||||
A compiler process serves one roots file, so a server serves the project of
|
||||
the first file it is asked about, from start to exit. A warning on the first
|
||||
line of a file says when it cannot serve that file as the command line
|
||||
would:
|
||||
|
||||
- the project's packages are not fetched yet: run `bjo fetch`, then restart
|
||||
the server;
|
||||
- the roots file changed after the server started, as `bjo fetch` after a
|
||||
change to the manifest does: restart the server;
|
||||
- the file is in another project than the one the server serves: open it in
|
||||
a server of its own, which lsp-mode and eglot do per project root.
|
||||
|
||||
## How it finds things
|
||||
|
||||
- The standard library and the runtime: through the checkout path baked in
|
||||
|
|
@ -116,7 +141,9 @@ With eglot instead:
|
|||
|
||||
## What it does not do yet
|
||||
|
||||
- Columns. Most diagnostics carry only a line, and the whole line is marked.
|
||||
- Exact ends. The compiler says where a diagnostic starts, and the form that
|
||||
starts there is marked, as far as its head when it spans several lines.
|
||||
That is the form the message is about in most cases, not in all.
|
||||
- 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.
|
||||
|
|
@ -136,6 +163,7 @@ With eglot instead:
|
|||
`import`, or of keyword arguments. A string that began on an earlier line
|
||||
is not seen as one, so a multi-line string gets completions.
|
||||
- Find references, rename.
|
||||
- Packages: no `--roots` is passed, so only the standard library resolves.
|
||||
- More than one project. A server serves the project of the first file it is
|
||||
asked about; see "Projects" above.
|
||||
- Stale imports are built by the installed compiler, which was tested only
|
||||
for the standard library being current, not for a stale import.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue