You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Implement comprehensive LSP server and watch mode
- Add LSP server with Doxygen tag auto-completion and quick fixes
- Introduce native file watching for watch mode using inotify for Linux
- Implement polling-based file watching for other platforms
- Add ignore patterns to watch mode configuration
- Refactor `stig check` to `stig lsp` for explicit LSP server startup
- Implement multi-line tag continuation for Doxygen docstring parser
- Support escaped `@@` and `\\` characters in docstrings
- Extract `@ref` from all relevant tag content in docstrings (brief, details, params, returns, etc.)
- Add `@defgroup` and `@addtogroup` support for documentation grouping
- Implement duplicate `@param` and `@tparam` detection in linter
- Add checks for empty `@param`, `@tparam`, and `@return` descriptions
- Enable per-rule severity configuration in `stig.toml` for linting rules
- Add parsing for C++ `union` types
- Extract `requires` clause from C++ template declarations
- Extract `override`, `final`, and `pure virtual` specifiers for C++ methods
- Support multiple comment styles for snippet markers (e.g., `# [anchor]`, `/* [anchor] */`, `<!-- [anchor] -->`)
- Implement incremental document sync for LSP `textDocument/didChange`
- Provide code actions for generating documentation stubs for undocumented entities
- Provide code actions for adding missing `@param` and `@return` tags
- Provide code actions for fixing mismatched parameter names in `@param` tags
- Remove HTML output format generator
- Extend CLI argument parsing to support dedicated `lsp` subcommand help
- Update README with detailed feature list and usage examples for new features
@@ -4,18 +4,82 @@ Tree-sitter based C and C++ documentation generator focused on header files and
4
4
5
5
## Overview
6
6
7
-
Stig parses C and C++ headers with Tree-sitter, extracts Doxygen-style documentation, and produces Markdown, mdBook, HTML, or JSON output. Documentation checks and linting help enforce coverage requirements, and an LSP mode provides real-time diagnostics in editors. Implementation files (`.cpp`, `.cc`, `.cxx`) are skipped automatically so documentation stays with declarations in headers (`.h`, `.hpp`, `.hxx`, `.hh`, `.H`).
7
+
Stig parses C and C++ headers with Tree-sitter, extracts Doxygen-style documentation, and produces Markdown, mdBook, or JSON output. Documentation checks and linting help enforce coverage requirements, and an LSP mode provides real-time diagnostics in editors. Implementation files (`.cpp`, `.cc`, `.cxx`) are skipped automatically so documentation stays with declarations in headers (`.h`, `.hpp`, `.hxx`, `.hh`, `.H`).
8
8
9
9
## Features
10
10
11
-
- Header-first parsing with Tree-sitter (no libclang dependency)
# Start the LSP server for editor integration (stdin/stdout)
59
-
stig check
122
+
# Start the LSP server for editor integration
123
+
stig lsp
60
124
```
61
125
62
126
> Stig only processes header files. Any `.cpp`, `.cc`, or `.cxx` file is reported as skipped so that documentation remains in headers alongside declarations.
@@ -72,9 +136,9 @@ stig [OPTIONS] <INPUT_FILES>... # generate is the default subcommand
72
136
73
137
Common options:
74
138
75
-
-`-o, --output <PATH>`: Output file or directory (default: stdout for Markdown/HTML/JSON)
76
-
-`-f, --format <FMT>`: `markdown`, `mdbook`, `json`, or `html` (default: `markdown`)
77
-
-`--title <TITLE>`: Document title for mdBook/HTML output
139
+
-`-o, --output <PATH>`: Output file or directory (default: stdout for Markdown/JSON)
140
+
-`-f, --format <FMT>`: `markdown`, `mdbook`, or `json` (default: `markdown`)
141
+
-`--title <TITLE>`: Document title for mdBook output
-`2`: Coverage below threshold or warnings present when `--strict` is set
103
167
104
-
### Language Server Protocol (LSP)
168
+
### Language Server Protocol (`stig lsp`)
105
169
106
-
Running `stig check` with no additional arguments starts the Language Server Protocol server over standard input/output. The server reuses the same coverage and lint engines that power the CLI, so the thresholds and toggles in `stig.toml` immediately affect editor diagnostics. Only header files are analyzed; when an implementation file is opened Stig clears diagnostics to avoid false positives.
170
+
```
171
+
stig lsp
172
+
```
173
+
174
+
Starts the Language Server Protocol server over standard input/output. The server provides:
107
175
108
-
Use any editor that supports stdio-based LSP servers. Configure it to execute `stig check` in the project root (or a directory containing `stig.toml`).
176
+
-**Real-time diagnostics** for documentation issues
177
+
-**Auto-completion** for Doxygen tags (`@brief`, `@param`, etc.) with snippet support
-**Incremental document sync** for efficient updates
180
+
181
+
The server reuses the same coverage and lint engines that power the CLI, so thresholds and toggles in `stig.toml` immediately affect editor diagnostics.
@@ -186,21 +287,104 @@ See `config.zig` for all supported keys, including module grouping, external doc
186
287
187
288
## Doc comment support
188
289
189
-
Stig understands standard Doxygen-style tags such as `@brief`, `@details`, `@param`, `@tparam`, `@return`, `@throws`, `@see`, `@note`, `@warning`, `@deprecated`, `@since`, `@example`, and `@code`/`@endcode`. Both `@tag` and `\tag` forms are accepted. Additional commands include `@ref` for cross references, `@snippet` for embedding external code blocks, `@copydoc`, `@group`, `@page`, `@mainpage`, and `@mermaid`/`@endmermaid` for diagrams.
290
+
Stig understands standard Doxygen-style tags:
291
+
292
+
### Basic Tags
293
+
-`@brief` / `@short`: Brief description
294
+
-`@details`: Detailed description
295
+
-`@param` / `@p`: Parameter documentation
296
+
-`@tparam`: Template parameter documentation
297
+
-`@return` / `@returns`: Return value documentation
-`@copydoc`: Copy documentation from another symbol
326
+
327
+
### Grouping Tags
328
+
-`@defgroup`: Define a documentation group
329
+
-`@addtogroup`: Add to an existing group
330
+
-`@ingroup`: Mark entity as belonging to a group
331
+
-`@{` / `@}`: Group member markers
332
+
333
+
### Code Tags
334
+
-`@code` / `@endcode`: Code blocks
335
+
-`@snippet`: Include code from external file
336
+
-`@mermaid` / `@endmermaid`: Mermaid diagrams
337
+
-`@example`: Example code
338
+
339
+
### Other Tags
340
+
-`@file`: File-level documentation
341
+
-`@page` / `@mainpage`: Page documentation
342
+
-`@exclude`: Exclude from documentation
343
+
-`@synopsis`: Custom synopsis override
344
+
-`@unique_name`: Custom anchor name
345
+
346
+
Both `@tag` and `\tag` forms are accepted. Multi-line continuation is supported by indentation.
190
347
191
348
## Watch mode and incremental builds
192
349
193
350
When generating mdBook output without `--force`, Stig caches file contents and parsed modules in `.stig-cache`. Only changed headers are reparsed, which keeps watch-mode rebuilds fast. Use `--force` to ignore the cache.
194
351
352
+
Watch mode features:
353
+
-**Native file watching** using inotify on Linux for instant change detection
354
+
-**Polling fallback** on other platforms (200ms interval)
355
+
-**Ignore patterns** to filter out build artifacts and VCS directories
356
+
-**Debouncing** to coalesce rapid changes
357
+
-**Include dependency tracking** to rebuild when included headers change
358
+
195
359
## Linting and coverage
196
360
197
361
`stig check` combines coverage analysis and linting:
198
362
199
-
- Coverage tracks documented versus undocumented entities by type and reports missing parameter, template parameter, and return documentation.
200
-
- Linting validates comment quality (brief length, missing sections, broken references). Enable strict mode to treat warnings as build failures.
363
+
-**Coverage** tracks documented versus undocumented entities by type and reports missing parameter, template parameter, and return documentation.
364
+
-**Linting** validates comment quality:
365
+
- Brief length limits
366
+
- Missing required sections
367
+
- Duplicate parameter documentation
368
+
- Empty descriptions
369
+
- Broken cross-references
370
+
- Parameter name mismatches
201
371
202
372
The compiler-style format (`-f compiler`) is suitable for CI systems that expect `file:line:col: severity: message` diagnostics.
0 commit comments