Skip to content

Commit 6e1629c

Browse files
committed
release: 0.1.0 — README, CHANGELOG, LICENSE, publishable manifests, and the tag tool
The first release, and the housekeeping it needed. * **README rewritten.** What the server is, how to build it, where a project's configuration lives — no feature ledger and no history. * **`CHANGELOG.md` for 0.1.0**, and **`LICENSE`** (MIT, the same file the VS Code extension ships). * **Publishable manifests.** Every crate carries a description, license, repository, keywords and categories, and each `[workspace.dependencies]` path entry carries a `version` — without one `cargo publish` has no version to name. `cargo publish --dry-run -p cpp_parser` packages and verifies; the other two crates cannot be packaged until `cpp_parser` is on the registry, which is what the workflow does in order. * **`tools/edit_version`.** `cargo run -p edit_version -- refs/tags/v0.1.0` writes the tag's version into every crate manifest and into the workspace table, with tests for the tag forms it accepts and the ones it refuses. `build.yml` already called it. * **`upload_crates.yml` retries** each publish for up to five minutes: the registry's index lags, and `cpp_code_analysis` cannot resolve `cpp_parser` until it has caught up. * **The citations to the deleted design documents are gone** — 192 references in 78 files. Removing them a clause at a time left half-sentences behind, so each comment paragraph was joined, split into sentences, and the sentences that cited a document dropped. The three inside string literals and the one in `docs/configuration.md` were done by hand. * **The latency tests skip a debug build**, which is what their module documentation already said they measured the compiler in. `cargo test --workspace --all-features` — the command CI runs — now passes. * **Whitespace**: trailing spaces and missing final newlines removed, because the pre-commit hooks check both. The one fixture that needs a trailing space writes it as `\x20`. Suites: `cargo test --workspace --all-features`, `cargo clippy --workspace --all-targets --all-features -- -D warnings` and `cargo fmt --all -- --check` are clean.
1 parent 4065d4d commit 6e1629c

95 files changed

Lines changed: 927 additions & 1000 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/upload_crates.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,23 @@ jobs:
1818

1919
- name: Publish
2020
run: |
21+
# **In dependency order, with a wait after each.** crates.io's index lags a publish by seconds to a minute, and
22+
# `cpp_code_analysis` cannot be packaged until `cpp_parser` is resolvable from the registry — the first
23+
# release would otherwise fail on its own dependencies. Ten attempts, twenty seconds apart, is five minutes
24+
# of patience for a lag that is normally one.
2125
for dir in cpp_{parser,code_analysis,ls}; do
2226
pushd "crates/$dir"
23-
cargo publish --allow-dirty
27+
for attempt in 1 2 3 4 5 6 7 8 9 10; do
28+
if cargo publish --allow-dirty; then
29+
break
30+
fi
31+
if [ "$attempt" = "10" ]; then
32+
echo "publishing $dir failed after $attempt attempts"
33+
exit 1
34+
fi
35+
echo "attempt $attempt failed; the registry may not have the previous crate yet — waiting"
36+
sleep 20
37+
done
2438
popd
2539
done
2640
env:

‎.pre-commit-config.yaml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ repos:
1313
rev: v6.0.0
1414
hooks:
1515
- id: trailing-whitespace
16-
exclude: '^crates/emmylua_ls/std_i18n/.*\.yaml$'
1716
- id: end-of-file-fixer
18-
exclude: '^crates/emmylua_ls/std_i18n/.*\.yaml$'
1917
- id: fix-byte-order-marker
2018
- id: mixed-line-ending
2119
args: [--fix=lf]

‎.vscode/settings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{}
1+
{}

‎CHANGELOG.md‎

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Changelog
2+
3+
All notable changes to `cpp_ls` are recorded here. The format follows [Keep a Changelog](https://keepachangelog.com/),
4+
and the project adheres to [Semantic Versioning](https://semver.org/).
5+
6+
## [0.1.0] — 2026-10-29
7+
8+
The first release. A C, C++ and CUDA language server written from scratch in Rust — parser, preprocessor, semantic
9+
analysis and the protocol layer are all in this repository, with no clangd, no compiler daemon and no
10+
`compile_commands.json` requirement.
11+
12+
### Language support
13+
14+
- **Preprocessor first**: macros are expanded, conditional compilation is resolved for the branches actually in force,
15+
and `#include`s are inlined; the resulting *rendering* is what gets parsed, which is why a file that has never
16+
compiled still resolves.
17+
- **C, C++ (through C++23) and CUDA**: `.h` is C++, `.cu`/`.cuh` are CUDA, and `<<<…>>>` launch blocks are part of the
18+
grammar.
19+
- **Coroutines**: `co_await`, `co_yield` and `co_return` are parsed, typed (`co_await` answers what `await_resume`
20+
returns), hovered and exempted from the missing-return rule.
21+
22+
### Editor features
23+
24+
```
25+
completion · hover · signature help · go to definition / type definition / implementation · references
26+
document highlight · rename · call hierarchy · document and workspace symbols · folding · selection range
27+
formatting · inlay hints · semantic tokens · code actions · diagnostics · #include links
28+
```
29+
30+
- **Semantic tokens** cover names, types, keywords, doc commands, and — for VS Code, through the four contributed
31+
token types — format strings: specifiers, arguments, conversions and escapes.
32+
- **Format strings** are understood for `printf`/`std::format`-style calls: completion inside a format string,
33+
hover on a specifier, and the colouring above.
34+
- **Formatting** is clang-format-compatible in configuration (`.clang-format` and the seven presets) and works on a
35+
document or a range.
36+
- **Inlay hints**: deduced types for `auto` and structured bindings, parameter names at a call.
37+
- **Diagnostics**, pull-based (`textDocument/diagnostic`), 26 codes:
38+
39+
```
40+
errors syntax-error include-not-found macro-redefined undefined-field undefined-name redefinition
41+
argument-count param-type-check assign-type-check return-type-mismatch missing-return
42+
access-invisible concept-not-satisfied assignment-in-condition unnecessary-branch
43+
style cstyle-cast use-auto use-nullptr use-override braces-around-statements else-after-return
44+
simplify-boolean-expr macro-parentheses implicit-bool-conversion
45+
notes unused module-note
46+
```
47+
48+
### Configuration
49+
50+
- `.cppls.toml` for the project's own settings, and `compile_commands.json` for the exact compiler flags; both are
51+
documented in [`docs/configuration.md`](docs/configuration.md). None is required for a project of plain sources.
52+
- Diagnostics can be enabled and disabled by code.
53+
54+
[0.1.0]: https://github.com/CppCXY/cpp_ls/releases/tag/v0.1.0

‎Cargo.lock‎

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
resolver = "2"
33
members = [
44
"crates/*",
5+
"tools/*"
56
]
67

78
# Every entry here is used by at least one crate. The table was inherited from the Lua project this server's shell
@@ -10,9 +11,9 @@ members = [
1011
# has to check rather than trust.
1112
[workspace.dependencies]
1213
# local
13-
cpp_parser = { path = "crates/cpp_parser" }
14-
cpp_formatter = { path = "crates/cpp_formatter" }
15-
cpp_code_analysis = { path = "crates/cpp_code_analysis" }
14+
cpp_parser = { path = "crates/cpp_parser", version = "0.1.0" }
15+
cpp_formatter = { path = "crates/cpp_formatter", version = "0.1.0" }
16+
cpp_code_analysis = { path = "crates/cpp_code_analysis", version = "0.1.0" }
1617

1718
# external
1819
lsp-server = "0.10.0"

‎LICENSE‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
MIT License
2+
3+
Copyright (c) 2026 CppCxy
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.

‎README.md‎

Lines changed: 25 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,42 @@
11
# cpp_ls
22

3-
**Work in progress — under development.** There is no release, no stability promise, and the
4-
internals move. Everything below is what runs today, not what is planned.
3+
A **C, C++ and CUDA language server written in Rust**, implemented by Deepseek: parser,
4+
preprocessor, semantic analysis and the LSP layer are all in this repository, with no clangd, no compiler daemon and
5+
no `compile_commands.json` required.
56

6-
A C++ language server written in Rust. It reads a project the way a compiler does: macros are
7-
expanded, conditional compilation is resolved for the branches actually in force, `#include`s are
8-
inlined, and the resulting *rendering* is what gets parsed — because a C++ file does not mean what
9-
its characters say until a preprocessor has run.
10-
11-
## What works today
7+
It reads a project the way a compiler does — macros expanded, conditional compilation resolved for the branches in
8+
force, `#include`s inlined — and the text the preprocessor produces is what gets parsed. That is what lets completion,
9+
hover, diagnostics and the rest work in a file that has never been compiled, including a half-typed line.
1210

1311
```
14-
cargo build --release --workspace --all-targets no errors, no warnings
15-
cargo test --release --workspace green
12+
completion · hover · signature help · go to definition / type definition / implementation · references
13+
document highlight · rename · call hierarchy · document and workspace symbols · folding · selection range
14+
formatting · inlay hints · semantic tokens · code actions · diagnostics · #include links
1615
```
1716

18-
- **Parsing and rendering** of a real project: zero syntax errors over the whole MSVC standard-library
19-
closure (187 files).
20-
- **Thirteen semantic checks**, each with a `DiagnosticCode` (carried to the client as the LSP
21-
`code`), a severity and, where it applies, a tag:
22-
23-
```
24-
syntax-error include-not-found macro-redefined unused access-invisible
25-
missing-return assignment-in-condition unnecessary-branch undefined-field
26-
argument-count param-type-check assign-type-check return-type-mismatch
27-
```
28-
29-
- **Zero false positives on the standard library** — the measurement this layer is built to pass:
17+
## Building
3018

31-
```
32-
cargo run --release -p cpp_code_analysis --example checks_probe -- target/std-cook target/std-cook/assign-case.cpp
33-
assign-case.cpp:52 [assign-type-check] `x` is initialised with a value that does not convert to `std::string`
34-
--- checks over 5 file(s) --- 1 assign-type-check
35-
```
36-
37-
Exactly one true positive, nothing else. Fixtures used by that measurement live in `target/std-cook/`.
38-
39-
- **A finding is about the file being edited; the knowledge behind it is the project's.** A check
40-
reports only on what this file writes, but it may read the index's facts about any other file — so
41-
`std::string x = 123;` is judged from the parameter list of `std::string`'s constructors recorded in
42-
the index, not by parsing `<string>` again.
19+
```bash
20+
cargo build --release -p cpp_ls # one binary, LSP over stdio by default
21+
target/release/cpp_ls --help # tcp, log level, config path, std library switches
22+
```
4323

44-
- **The server side**: diagnostics, completion, signature help, go to definition, references,
45-
semantic tokens, folding, inlay hints.
24+
The VS Code client is [CppCXY/VSCode-Cppls](https://github.com/CppCXY/VSCode-Cppls); any other LSP client can be
25+
pointed at the binary directly.
4626

47-
## Where it is going
27+
## Configuring a project
4828

49-
**Configuring a project** — `compile_commands.json` and `.cppls.toml`, including the multi-target form that a
50-
real C++ project needs: [`docs/configuration.md`](docs/configuration.md).
51-
See [`docs/status.md`](docs/status.md) — one document, describing the current state, the defects that
52-
are known and measured, and the plan. (It replaces nineteen older documents that described the
53-
process rather than the state of the code, and had drifted out of date.)
29+
A `.cppls.toml` in the workspace root, or a `compile_commands.json` for the exact compiler flags — both are described
30+
in [`docs/configuration.md`](docs/configuration.md). No configuration is needed for a project of plain sources.
5431

55-
## Trying it
32+
## Working on it
5633

5734
```bash
58-
cargo run --release --workspace --bin cpp_ls # the server, speaking LSP on stdio
59-
60-
# the checks over a real project, one command
61-
cargo run --release -p cpp_code_analysis --example checks_probe -- <include-dir> <root file>
62-
63-
# one check, with the declaration facts each finding came from
64-
cargo run --release -p cpp_code_analysis --example one_check -- <include-dir> <root file> unused
35+
cargo test --workspace --all-features # tests; the latency ones only measure in --release
36+
cargo clippy --workspace --all-targets --all-features -- -D warnings
37+
cargo fmt --all
6538
```
6639

67-
## Layout
68-
69-
```
70-
crates/cpp_parser lexer and grammar; a lossless tree plus a typed AST over it
71-
crates/cpp_code_analysis preprocessing and rendering, the index, the semantic model, the checks
72-
crates/cpp_ls the language server: LSP handlers and the session they run against
73-
```
40+
## License
7441

42+
MIT. See [`LICENSE`](LICENSE).

‎crates/cpp_code_analysis/Cargo.toml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
name = "cpp_code_analysis"
33
version = "0.1.0"
44
edition = "2024"
5+
description = "The analysis layer of cpp_ls: the preprocessor, symbol scopes, type inference and the semantic checks."
6+
license = "MIT"
7+
authors = ["CppCXY"]
8+
repository = "https://github.com/CppCXY/cpp_ls"
9+
keywords = ["cpp", "language-server"]
10+
categories = ["development-tools"]
511

612
[dependencies]
713
cpp_parser.workspace = true
@@ -33,4 +39,4 @@ toml.workspace = true
3339
# allocator is holding" — cannot be answered with a different allocator underneath. Both crates are already in the
3440
# dependency graph (through `cpp_ls`), so this is an edge rather than a new download.
3541
mimalloc = { version = "0.1", default-features = false }
36-
libmimalloc-sys = "0.1"
42+
libmimalloc-sys = "0.1"

‎crates/cpp_code_analysis/src/cache/cache_db.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//! **The on-disk cache, as one embedded database** — the storage half of `docs/refactor-cache-and-startup.md`.
21
//!
32
//! The directory this replaces held **1 854 files / 160.6 MB** on a real project: 1 768 summaries (69 MB), 85 `.tu`
43
//! files (85.6 MB) and a 6 MB `sharing.bin`. Three costs came with that shape, and each is what a database removes:

0 commit comments

Comments
 (0)