Skip to content

Commit 5d79301

Browse files
authored
Merge pull request #2 from theodevelop/dev
Add grammar tools, CMake integration & UI enhancements
2 parents 5ec4b2e + cab93cb commit 5d79301

33 files changed

Lines changed: 5452 additions & 541 deletions

.github/workflows/publish-ovsx.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ jobs:
2222
run: npm ci
2323

2424
- name: Build VSIX
25-
run: |
26-
npm run package
27-
npx vsce package
25+
run: npx vsce package
2826

2927
- name: Publish to Open VSX
30-
run: npx ovsx publish *.vsix --pat ${{ secrets.OVSX_PAT }}
28+
if: ${{ secrets.OVSX_PAT != '' }}
29+
env:
30+
OVSX_PAT: ${{ secrets.OVSX_PAT }}
31+
run: npx ovsx publish *.vsix --pat "$OVSX_PAT"

.vscodeignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ node_modules/
88
.eslintrc.json
99
tests/
1010
images/icon.svg
11+
images/bison.png
12+
images/bison.svg
13+
images/reflex.png
14+
images/reflex.svg
1115
**/*.map
1216
.claude/
1317
.github/

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,47 @@
22

33
All notable changes to the **Bison/Flex Language Support** extension will be documented in this file.
44

5+
## [1.1.0] - 2026-03-18
6+
7+
### Added
8+
9+
- **Document Symbols** — Outline view (`Ctrl+Shift+O`) with collapsible sections for declarations, rules, and epilogue (Bison) or definitions, rules, and user code (Flex)
10+
- **Workspace Symbols** — Fuzzy symbol search (`Ctrl+T`) across all open Bison and Flex files (up to 200 results)
11+
- **Code Lens** — "N reference(s)" above each Bison rule and Flex start condition; "⬪ entry point" badge above the start symbol
12+
- **Inlay Hints** — Inline type annotations for `$$`, `$1`, `$2`, etc. derived from `%type`/`%token` declarations
13+
- **CMake Integration**
14+
- Diagnostic warning when a `.y`/`.l` file is not referenced in a nearby `BISON_TARGET`/`FLEX_TARGET`
15+
- New command **Bison/Flex: Add CMake Target** — appends the correct `BISON_TARGET` or `FLEX_TARGET` snippet to `CMakeLists.txt`
16+
- **Compile Commands**
17+
- **Bison: Compile** — runs `bison -d` on the current file and surfaces errors as VS Code diagnostics
18+
- **Flex: Compile** — runs `flex` on the current file and surfaces errors as VS Code diagnostics
19+
- **Grammar Tools**
20+
- **Bison: Show Parse Table** — renders the `.output` parse table in a side panel
21+
- **Bison: Show Grammar Graph** — interactive D3.js force-directed graph; click a node to navigate to the rule; detects left/right recursion
22+
- **Bison: Explain Conflict** — detailed shift/reduce conflict analysis with fix suggestions and precedence recommendations
23+
- **Bison: Generate AST Skeleton** — generates a complete C++ AST with visitor pattern, forward declarations, and node classes
24+
- **Flex: Test Rule** — interactive regex tester for the pattern on the current line
25+
- **Initialize tasks.json** — auto-generates `.vscode/tasks.json` with Bison/Flex problem matchers; auto-detects CMake and Makefile projects
26+
- **Yacc Legacy Hints** — inlay hints for legacy `%pure_parser`, `%union`, and `YYSTYPE` patterns pointing to modern Bison equivalents
27+
- **Smart Indent**`onEnterRules` for Bison and Flex that indent correctly after rule openers and `%{`/`%}`
28+
29+
### Changed
30+
31+
- README updated with all new features, configuration settings, and screenshots
32+
- Status bar shows a "Grammar Graph" shortcut button when a Bison file is active
33+
34+
### Configuration
35+
36+
Three new settings:
37+
38+
| Setting | Default | Description |
39+
|---------|---------|-------------|
40+
| `bisonFlex.showInlayHints` | `true` | Show inlay hints for `$$`/`$1`/`@$` semantic values |
41+
| `bisonFlex.enableCodeLens` | `true` | Show Code Lens reference counts and entry-point badges |
42+
| `bisonFlex.enableCmakeDiagnostics` | `true` | Warn when a `.y`/`.l` file is missing from `CMakeLists.txt` |
43+
44+
---
45+
546
## [1.0.0] - 2026-03-13
647

748
### Added

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,46 @@ Ready-to-use templates to speed up your workflow:
7979
- `string-handler` — String literal handler with escape sequences
8080
- `rule`, `rule-sc`, `%option`, `%x`, `%top`, `%class`, `eof-handler`
8181

82+
### Code Lens
83+
84+
Reference counts and entry-point indicators appear above every Bison rule and Flex start condition:
85+
86+
- **N reference(s)** — click to open Find All References at that symbol
87+
- **⬪ entry point** — marks the grammar's start symbol
88+
89+
Toggle with `bisonFlex.enableCodeLens`.
90+
91+
### Document Symbols & Workspace Search
92+
93+
- **Outline** (`Ctrl+Shift+O`): collapsible tree of declarations, rules, and epilogue for Bison; definitions, patterns, and user code for Flex
94+
- **Workspace Symbols** (`Ctrl+T`): fuzzy search across all open Bison and Flex files — tokens, rules, start conditions, abbreviations
95+
96+
### Inlay Hints
97+
98+
Inline type annotations for `$$`, `$1`, `@$`, etc. resolved from `%type` and `%token` declarations. Toggle with `bisonFlex.showInlayHints`.
99+
100+
### CMake Integration
101+
102+
The extension detects `CMakeLists.txt` files up to 6 directories above the current file:
103+
104+
- **Diagnostic warning** when a `.y`/`.l` file has no `BISON_TARGET`/`FLEX_TARGET` referencing it
105+
- **Bison/Flex: Add CMake Target** command — appends the correct CMake snippet automatically
106+
107+
Toggle with `bisonFlex.enableCmakeDiagnostics`.
108+
109+
### Grammar Tools
110+
111+
- **Bison: Show Grammar Graph** — interactive D3.js force-directed graph of the grammar; click a node to navigate to the rule; left/right recursive rules highlighted
112+
- **Bison: Show Parse Table** — displays the Bison `.output` parse table in a side panel
113+
- **Bison: Explain Conflict** — detailed shift/reduce conflict analysis with derivations and fix suggestions
114+
- **Bison: Generate AST Skeleton** — generates a complete C++ AST header with visitor pattern
115+
- **Flex: Test Rule** — interactive regex tester for the pattern on the current line
116+
117+
### Compile Integration
118+
119+
- **Bison: Compile** / **Flex: Compile** — run the compiler on the current file and surface errors as VS Code diagnostics
120+
- **Bison/Flex: Initialize tasks.json** — auto-generates `.vscode/tasks.json` with problem matchers; detects CMake and Makefile projects
121+
82122
---
83123

84124
## Screenshots
@@ -118,7 +158,7 @@ Search for **"Bison/Flex Language Support"** in the VS Code Extensions panel (`C
118158
### From VSIX
119159

120160
```bash
121-
code --install-extension bison-flex-lang-1.0.0.vsix
161+
code --install-extension bison-flex-lang-1.1.0.vsix
122162
```
123163

124164
### From Source
@@ -142,6 +182,9 @@ Then press `F5` in VS Code to launch the Extension Development Host.
142182
| `bisonFlex.maxDiagnostics` | `number` | `100` | Maximum number of diagnostics per file |
143183
| `bisonFlex.bisonPath` | `string` | `"bison"` | Path to the Bison executable (must be in PATH or absolute) |
144184
| `bisonFlex.flexPath` | `string` | `"flex"` | Path to the Flex executable (must be in PATH or absolute) |
185+
| `bisonFlex.showInlayHints` | `boolean` | `true` | Show inline type hints for `$$`/`$1`/`@$` semantic values |
186+
| `bisonFlex.enableCodeLens` | `boolean` | `true` | Show reference counts and entry-point badges above rules |
187+
| `bisonFlex.enableCmakeDiagnostics` | `boolean` | `true` | Warn when a `.y`/`.l` file is not referenced in `CMakeLists.txt` |
145188

146189
---
147190

0 commit comments

Comments
 (0)