Skip to content

Commit 4fbc5cd

Browse files
committed
docs: add Fix-it Hints, #line navigation, and missing settings to README
1 parent 753e73a commit 4fbc5cd

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,44 @@ Real-time error detection as you type:
3939
| Shift/reduce conflict heuristic | |
4040
| Unknown/invalid directive | |
4141

42+
Every diagnostic carries a **source** field (`bison` / `flex`), a **code slug** (e.g. `bison/unused-token`), and where available a **link** to the GNU documentation — rendered as a clickable `[bison/unused-token]` link in the Problems panel. Unused symbols are rendered greyed-out via `DiagnosticTag.Unnecessary`.
43+
44+
### Fix-it Hints (Quick Fixes)
45+
46+
22 code actions available via the lightbulb (`Ctrl+.`) or directly from the Problems panel:
47+
48+
**Bison** (11 fixes):
49+
- Insert missing `%%` separator
50+
- Declare undeclared `%token`
51+
- Insert `%empty` for empty production
52+
- Remove unused token declaration
53+
- Remove unknown directive
54+
- Add rule stub for missing non-terminal
55+
- Add `%type <todo>` declaration
56+
- Remove invalid `%start` / Add `%start` directive
57+
- Close unclosed `%{` block
58+
- Migrate Yacc legacy directives (`%error-verbose``%define parse.error verbose`, `%name-prefix`, `%pure-parser`, `%binary`)
59+
60+
**Flex** (11 fixes):
61+
- Insert missing `%%` separator
62+
- Define abbreviation stub
63+
- Remove unused abbreviation
64+
- Remove unused start condition
65+
- Remove unknown directive
66+
- Declare `%x SC_NAME` for undefined start condition
67+
- Remove unused `%option`
68+
- Remove duplicate `<<EOF>>` rule
69+
- Add `%option noyywrap`
70+
- Close unclosed `%{` block
71+
- Remove inaccessible rule
72+
73+
### Source ↔ Generated File Navigation
74+
75+
Jump between Bison/Flex grammar sources and their generated C files using `#line` directives:
76+
77+
- **Bison/Flex: Show in Source** — from a generated `.tab.c` / `lex.yy.c` file, reads the nearest `#line N "file.y"` directive above the cursor and opens the grammar source at the correct line. Appears in the context menu only when a generated file is detected.
78+
- **Bison/Flex: Show in Generated File** — from a `.y` / `.l` source, locates the generated file and navigates to the matching line. Searches `bisonFlex.buildDirectory`, then CMake/Makefile detection, then the same directory, then a workspace-wide scan. A QuickPick is shown when multiple candidates are found.
79+
4280
### Autocompletion
4381

4482
Context-aware suggestions triggered as you type:
@@ -185,6 +223,10 @@ Then press `F5` in VS Code to launch the Extension Development Host.
185223
| `bisonFlex.showInlayHints` | `boolean` | `true` | Show inline type hints for `$$`/`$1`/`@$` semantic values |
186224
| `bisonFlex.enableCodeLens` | `boolean` | `true` | Show reference counts and entry-point badges above rules |
187225
| `bisonFlex.enableCmakeDiagnostics` | `boolean` | `true` | Warn when a `.y`/`.l` file is not referenced in `CMakeLists.txt` |
226+
| `bisonFlex.minVersionBison` | `string` | `""` | Suppress checks that require a newer Bison version (e.g. `"3.0"`). Fires `bison/feature-requires-version` when a `%define` feature exceeds this version. |
227+
| `bisonFlex.minVersionFlex` | `string` | `""` | Same as above for Flex. |
228+
| `bisonFlex.disabledChecks` | `array` | `[]` | Diagnostic code slugs to suppress entirely (e.g. `["bison/shift-reduce", "flex/missing-yywrap"]`). |
229+
| `bisonFlex.buildDirectory` | `string` | `""` | Path to the build output directory. Used by **Show in Generated File** to locate `.tab.c` / `lex.yy.c` when they are not next to the source. |
188230

189231
---
190232

0 commit comments

Comments
 (0)