diff --git a/en/clice/changelog/feature-changelog.md b/en/clice/changelog/feature-changelog.md index 3c398b8..30a2442 100644 --- a/en/clice/changelog/feature-changelog.md +++ b/en/clice/changelog/feature-changelog.md @@ -27,7 +27,7 @@ v1.0 ships first as rolling beta releases (`v1.0.0-beta.1`, `beta.2`, …) for a - **Multi-process architecture.** Compilation runs in worker subprocesses coordinated by a master process, so a compiler crash on one translation unit no longer takes down the whole session — the crashed worker is respawned and its documents recover on demand. Stateful workers cap resident documents with LRU eviction, and the pool sheds background load under system memory pressure. - **Compilation contexts for headers.** Opening a header compiles it in the context of a source file that includes it: clice reconstructs the include chain into a synthesized preamble (and a synthesized suffix for X-macro/`.def` fragments), so symbols that depend on the includer's macros resolve correctly. Editors can list and switch the active context through the `clice/queryContext`, `clice/currentContext`, and `clice/switchContext` extensions — the same mechanism switches between multiple compile-database entries for one file. Self-contained headers are detected and compiled directly. -- **LSP feature surface.** Hover (definition printing, documentation, record layout with size/offset/padding, expression values, `auto`/`decltype` deduction); code completion with signature details, parameter snippets, deprecation strikethrough, and `#include`/`import` path completion; signature help; go-to definition (including on `#include` lines and module names), declaration, implementation, type definition, and find references, served from the project index; document symbols; semantic tokens with rich modifiers; inlay hints; folding ranges; document links (including inside the preamble, and `#embed`); `.clang-format`-based formatting and range formatting; call hierarchy and type hierarchy; workspace symbol search; published diagnostics; inactive-region greying for code disabled by `#if` (`clice/inactiveRegions` extension). +- **LSP feature surface.** Hover (definition printing, documentation, record layout with size/offset/padding, expression values, `auto`/`decltype` deduction); code completion with signature details, parameter snippets, deprecation strikethrough, and `#include`/`import` path completion; signature help; go-to definition (including on `#include` lines and module names), declaration, implementation, type definition, and find references, served from the project index; document symbols; semantic tokens with rich modifiers; inlay hints; folding ranges; document links (including inside the preamble, and `#embed`); `.clang-format`-based formatting and range formatting; call hierarchy and type hierarchy; workspace symbol search; published diagnostics; inactive-region dimming for code disabled by `#if`, carried on semantic tokens as the `inactive` modifier. - **Background indexing.** A persistent project-wide index powers cross-file features without opening every file. Indexing piggybacks on compilations that already happen, runs concurrently at low priority, pauses for interactive requests, reports LSP `$/progress`, and survives restarts. Two-layer staleness detection (mtime, then content hash) keeps `touch` and `git checkout` from triggering needless rebuilds. - **Out-of-band change tracking.** A stat-polling file tracker picks up changes made outside the editor — a regenerated `compile_commands.json`, a `git checkout`, code generators — without restarting the server. - **C++20 named modules.** Module interfaces are compiled on demand through a pull-based dependency graph with PCM caching; `import` completion and go-to-definition on module names included. @@ -43,6 +43,7 @@ v1.0 ships first as rolling beta releases (`v1.0.0-beta.1`, `beta.2`, …) for a - **Config key rename.** `compile_commands_dirs` is now `compile_commands_paths`; the old key is ignored. - **Upgrading from 0.x rebuilds caches.** The on-disk cache and index formats changed; the first launch after upgrading discards old artifacts and re-indexes the project once. This also retires PCHs produced by older versions whose cache key ignored compile flags — those could serve results with the wrong macro configuration. - **Toolchain baseline.** clice now builds against LLVM/Clang 21.1.8, with prebuilt release binaries for Linux, macOS, and Windows on both x64 and arm64. +- **Inactive regions moved into semantic tokens.** The `clice/inactiveRegions` push notification from earlier alpha builds is gone; tokens inside untaken `#if` branches now carry the `inactive` semantic-token modifier instead, so any editor that styles modifiers gets the dimming without a custom protocol. ### Fixed diff --git a/en/clice/design/compilation-context.md b/en/clice/design/compilation-context.md index 070ade1..2546f7f 100644 --- a/en/clice/design/compilation-context.md +++ b/en/clice/design/compilation-context.md @@ -102,7 +102,7 @@ Beyond automatic resolution, clice also provides three LSP extension requests th **`clice/switchContext`** switches to the user's chosen new context. The choice is validated: the host must actually (transitively) include the header, the occurrence must be in range, and the command hash must correspond to a real CDB entry of the file, otherwise the request fails. -Besides the requests, after every compile the server pushes a **`clice/inactiveRegions`** notification carrying the file's preprocessor-inactive regions (bodies of untaken `#if` branches) under the current compilation context. Editors render them dimmed; a context switch recompiles and flips the regions — the most immediate visual feedback of switching. +Besides the requests, the file's preprocessor-inactive regions (bodies of untaken `#if` branches) surface through semantic tokens: under the current compilation context, every token inside them carries the **`inactive`** modifier and editors render the regions dimmed. A context switch recompiles and the server requests a semantic-tokens refresh, so the client re-pulls and the dimming flips — the most immediate visual feedback of switching. ## Automatic Self-Containedness Detection diff --git a/en/clice/features/overview.md b/en/clice/features/overview.md index b113ccb..e98a0b8 100644 --- a/en/clice/features/overview.md +++ b/en/clice/features/overview.md @@ -20,7 +20,7 @@ Language Server Protocol features available when using clice as an editor backen | Signature Help | 14 supported | [signature-help](./signature-help.md) | | Code Navigation | 44 supported · 14 partial · 34 unsupported | [navigation](./navigation.md) | | Document Links | 7 supported · 1 partial · 1 unsupported | [document-links](./document-links.md) | -| Semantic Tokens | 52 supported · 4 partial · 10 unsupported | [semantic-tokens](./semantic-tokens.md) | +| Semantic Tokens | 54 supported · 4 partial · 10 unsupported | [semantic-tokens](./semantic-tokens.md) | | Inlay Hints | 31 supported · 6 partial · 4 unsupported | [inlay-hints](./inlay-hints.md) | | Folding Ranges | 13 supported · 2 partial · 6 unsupported | [folding-ranges](./folding-ranges.md) | | Document Symbols | 18 supported · 2 partial · 7 unsupported | [document-symbols](./document-symbols.md) | diff --git a/en/clice/features/semantic-tokens.md b/en/clice/features/semantic-tokens.md index 5494b5a..e9ba47c 100644 --- a/en/clice/features/semantic-tokens.md +++ b/en/clice/features/semantic-tokens.md @@ -112,6 +112,43 @@ Kinds derived from the token stream itself, independent of the AST. +- [x] Inactive regions — tokens in untaken branches keep their lexical kinds and carry the `inactive` modifier; unclassified tokens become plain `identifier` carriers, so even a lone `}` line dims + +
+ Example + + ```cpp + int before = 0; + + #if 0 + int simple = 1; + bare identifiers; + call(arg); + "string in dead code"; + // comment inside + #ifdef NESTED + int deeper = 2; + #endif + int tail = 3; + #endif + + #if defined(MISSING) + first_branch; + #elif 0 + elif_branch; + #else + int taken = 4; + #endif + + #if 0 + void edge() { + inner(5); + } + #endif + ``` + +
+ - [x] Header names — quoted and angled `#include` filenames, including the split `# include` form
@@ -127,6 +164,22 @@ Kinds derived from the token stream itself, independent of the AST.
+- [x] Inactive regions at the top of a file — untaken branches among the leading directives dim the same way + +
+ Example + + ```cpp + #define KEEP 1 + #if 0 + #define DEAD 2 + #endif + + int after = KEEP; + ``` + +
+ - [ ] Literal prefixes and suffixes — encoding prefixes, type suffixes, digit separators and UDL suffixes as distinct tokens
@@ -1397,13 +1450,19 @@ Curated issues without a fixture yet: ## Inactive Code Regions -Inactive preprocessor branches are reported through a separate channel, not -as semantic tokens. - -- [ ] Dim inactive preprocessor branches ([clangd#132](https://github.com/clangd/clangd/issues/132)) -- [ ] Correct inactive boundaries with `#elif` chains ([clangd#602](https://github.com/clangd/clangd/issues/602)) -- [ ] Preserve syntax highlighting within inactive regions ([clangd#1664](https://github.com/clangd/clangd/issues/1664)) -- [ ] Keep inactive regions distinct from comments ([clangd#1545](https://github.com/clangd/clangd/issues/1545)) +Every token inside an untaken preprocessor branch carries the `inactive` +modifier while keeping its lexical kind, so editors dim the region by +styling the modifier without losing the syntax colors underneath. Tokens +without a classification in dead code — bare identifiers and plain +punctuation — are emitted as the unstyled `identifier` type, giving the +whole region token coverage. The clice VS Code extension renders the +regions dimmed out of the box; other editors style the modifier directly +(e.g. `@lsp.mod.inactive` in Neovim). + +- [x] Dim inactive preprocessor branches ([clangd#132](https://github.com/clangd/clangd/issues/132)) +- [x] Correct inactive boundaries with `#elif` chains ([clangd#602](https://github.com/clangd/clangd/issues/602)) +- [x] Preserve syntax highlighting within inactive regions ([clangd#1664](https://github.com/clangd/clangd/issues/1664)) +- [x] Keep inactive regions distinct from comments ([clangd#1545](https://github.com/clangd/clangd/issues/1545)) - [ ] Unreachable code dimming ([clangd#1828](https://github.com/clangd/clangd/issues/1828)) ## Format String Highlighting @@ -1422,8 +1481,9 @@ as semantic tokens. ## Changelog -| Date | Change | PR | -| ---------- | ------------------------------------------------------------------------- | -------------------------------------------------- | -| 2026-08-01 | Explicit instantiation directive names pinned as unpainted until clang 23 | [#571](https://github.com/clice-io/clice/pull/571) | -| 2024-11-26 | Full document tokens (`textDocument/semanticTokens/full`) | — | -| 2024-09-16 | Initial semantic token types and modifiers | — | +| Date | Change | PR | +| ---------- | -------------------------------------------------------------------------- | -------------------------------------------------- | +| 2026-08-28 | Inactive regions carried as the `inactive` modifier; push protocol removed | [#644](https://github.com/clice-io/clice/pull/644) | +| 2026-08-01 | Explicit instantiation directive names pinned as unpainted until clang 23 | [#571](https://github.com/clice-io/clice/pull/571) | +| 2024-11-26 | Full document tokens (`textDocument/semanticTokens/full`) | — | +| 2024-09-16 | Initial semantic token types and modifiers | — |