|
1 | | -# CalcDocs — Formula Hover & Go to Definition |
| 1 | +# 🧮 CalcDocs - Formula Hover, Definition and C/C++ Sync |
2 | 2 |
|
3 | | -Formula navigation and evaluation for YAML engineering formulas and C/C++ constants inside Visual Studio Code. |
| 3 | +Formula navigation and evaluation for YAML engineering formulas and C/C++ constants directly inside Visual Studio Code. |
4 | 4 |
|
5 | | - |
| 5 | + |
| 6 | + |
6 | 7 |
|
7 | | - |
| 8 | +CalcDocs helps firmware, embedded, and software teams keep formulas, documentation, and source constants aligned. |
8 | 9 |
|
9 | | -CalcDocs helps firmware, embedded, and software teams keep **technical formulas, documentation, and source code aligned** directly inside the editor. |
| 10 | +- GitHub project: [Calcdocs-VSCode-Extension](https://github.com/mik1981/Calcdocs-VSCode-Extension/) |
| 11 | +- Issues: [Open an issue](https://github.com/mik1981/Calcdocs-VSCode-Extension/issues) |
10 | 12 |
|
11 | | ---- |
12 | | - |
13 | | -## ✨ Features |
| 13 | +## 📑 Index |
14 | 14 |
|
15 | | -- Hover over formula symbols in **YAML, C, and C++** files |
16 | | -- **Go to Definition** for: |
17 | | - - formula keys defined in `formulas*.yaml` / `formulas*.yml` |
18 | | - - numeric `#define` and `const` symbols in C/C++ |
19 | | -- Formula expansion using known values |
20 | | -- Automatic refresh of YAML formulas |
21 | | -- Numeric evaluation when a formula can be fully resolved |
22 | | -- Automatic update of YAML fields (`dati` and `value`) |
23 | | -- Periodic background analysis of the workspace |
24 | | -- Quick refresh command available in the status bar |
| 15 | +- [Install from `.vsix` File (Quick Guide)](#install-from-vsix-file-quick-guide) |
| 16 | +- [Features](#features) |
| 17 | +- [Commands](#commands) |
| 18 | +- [Configuration](#configuration) |
| 19 | +- [File Scanning Rules](#file-scanning-rules) |
| 20 | +- [Quick Example](#quick-example) |
| 21 | +- [Contributing](#contributing) |
| 22 | +- [Sponsor](#sponsor) |
| 23 | +- [Roadmap](#roadmap) |
| 24 | +- [License](#license) |
25 | 25 |
|
26 | 26 | --- |
27 | 27 |
|
28 | | -## ⚡ Quick Example |
| 28 | +## 📦 Install from `.vsix` File (Quick Guide) |
29 | 29 |
|
30 | | -Example YAML formula file: |
| 30 | +If you already have the file `calcdocs-vscode-extension-0.1.3.vsix`, you can install it without using the Marketplace. |
31 | 31 |
|
32 | | -```yaml |
33 | | -MAX_SPEED: |
34 | | - formula: RPM * WHEEL_RADIUS * 0.10472 |
35 | | - unit: m/s |
36 | | - steps: |
37 | | - - Read RPM from sensor |
38 | | - - Convert RPM to rad/s |
39 | | - value: 12.5 |
| 32 | +**Graphical method (recommended):** |
40 | 33 |
|
41 | | -RPM: |
42 | | - value: 1000 |
| 34 | +1. Open **Visual Studio Code**. |
| 35 | +2. Go to the **Extensions** view (left sidebar icon or press `Ctrl+Shift+X`). |
| 36 | +3. Click the three dots `...` at the top of the Extensions panel. |
| 37 | +4. Select **Install from VSIX...**. |
| 38 | +5. Choose the `.vsix` file and confirm. |
| 39 | +6. Restart VS Code. |
43 | 40 |
|
44 | | -WHEEL_RADIUS: |
45 | | - value: 0.2 |
| 41 | +**Terminal method (optional):** |
| 42 | + |
| 43 | +```bash |
| 44 | +code --install-extension calcdocs-vscode-extension-0.1.3.vsix |
46 | 45 | ``` |
47 | | -When hovering on MAX_SPEED or RPM, CalcDocs provides: |
48 | | -- expanded formula |
49 | | -- current values |
50 | | -- navigation to symbol definition |
51 | 46 |
|
52 | | ---- |
| 47 | +**Verify the installation:** |
53 | 48 |
|
54 | | -## 🧠 Commands |
| 49 | +1. Open the Command Palette (`Ctrl+Shift+P`). |
| 50 | +2. Search for `CalcDocs: Forza aggiornamento formule`. |
| 51 | +3. If the command is visible, the extension has been installed correctly. |
| 52 | + |
| 53 | +--- |
55 | 54 |
|
56 | | -### Command Description |
57 | | -CalcDocs: Force formula refresh Rebuilds the formula index and updates YAML values |
58 | | -CalcDocs: Set scan interval Configures periodic background analysis |
59 | | -Status bar refresh Quick manual refresh of formulas |
| 55 | +## 🚀 Features |
| 56 | + |
| 57 | +- C/C++ source files always remain under your control; the extension only flags potential misalignments. |
| 58 | +- Hover on formula symbols in YAML files. |
| 59 | +- Optional fallback hover/definition providers for C/C++ (`calcdocs.enableCppProviders`). |
| 60 | +- Go to definition for: |
| 61 | + - keys defined in `formula*.yaml` / `formulas*.yml` |
| 62 | + - `#define` and `const` symbols found in C/C++ files |
| 63 | +- Formula expansion with known symbol values. |
| 64 | +- Numeric evaluation when expressions can be fully resolved. |
| 65 | +- Recursive resolution of complex C/C++ definitions (`#define` and `const` with dependencies). |
| 66 | +- C/C++ CodeLens for composite definitions with computed numeric values. |
| 67 | +- Mismatch detection between C/C++ constants and YAML computed values (warning lens when difference is significant). |
| 68 | +- YAML write-back of `dati` and `value` fields on refresh. |
| 69 | +- Status bar quick refresh and periodic background analysis. |
60 | 70 |
|
61 | 71 | --- |
62 | 72 |
|
63 | | -## 📂 File Scanning Rules |
| 73 | +## ⌨️ Commands |
64 | 74 |
|
65 | | -Supported formula files: |
66 | | -- formula*.yaml |
67 | | -- formulas*.yml |
| 75 | +| Command | What it does | |
| 76 | +| --- | --- | |
| 77 | +| `CalcDocs: Forza aggiornamento formule` | Rebuilds index, recalculates formulas, and writes back YAML (`dati`, `value`) | |
| 78 | +| `CalcDocs: Imposta intervallo scansione` | Sets periodic scan interval in seconds (`0` disables periodic scan/watchers) | |
| 79 | +| Status bar button `CalcDocs` | Manual quick refresh | |
68 | 80 |
|
69 | | -Supported code files: |
70 | | -- .c |
71 | | -- .h |
72 | | -- .cpp |
73 | | -- .hpp |
| 81 | +--- |
| 82 | + |
| 83 | +## ⚙️ Configuration |
| 84 | + |
| 85 | +Available workspace settings: |
74 | 86 |
|
75 | | -Customizable ignored folders |
76 | | -Extension activation occurs when opening a YAML file in the workspace. |
| 87 | +- `calcdocs.scanInterval` (number, default `0`) |
| 88 | +- `calcdocs.ignoredDirs` (string array, folders excluded from analysis) |
| 89 | +- `calcdocs.enableCppProviders` (boolean, default `false`, keeps C/C++ tools as primary) |
77 | 90 |
|
78 | 91 | --- |
79 | 92 |
|
80 | | -## 🚀 Why CalcDocs |
| 93 | +## 🔍 File Scanning Rules |
| 94 | + |
| 95 | +Formula files: |
| 96 | + |
| 97 | +- `formula*.yaml` |
| 98 | +- `formula*.yml` |
| 99 | +- `formulas*.yaml` |
| 100 | +- `formulas*.yml` |
81 | 101 |
|
82 | | -CalcDocs is useful when engineering formulas, documentation, and source code constants must stay synchronized. |
| 102 | +Code files: |
83 | 103 |
|
84 | | -It helps teams: |
85 | | -- reduce context switching |
86 | | -- quickly understand formulas |
87 | | -- navigate between documentation and code |
88 | | -- debug engineering calculations faster |
| 104 | +- `.c`, `.h`, `.cpp`, `.hpp`, `.cc`, `.hh` |
| 105 | + |
| 106 | +Activation events: |
| 107 | + |
| 108 | +- `onStartupFinished` |
| 109 | +- `onLanguage:yaml` |
89 | 110 |
|
90 | 111 | --- |
91 | 112 |
|
92 | | -## 🔎 Keywords |
| 113 | +## 🧪 Quick Example |
| 114 | + |
| 115 | +```yaml |
| 116 | +MAX_SPEED: |
| 117 | + formula: RPM * WHEEL_RADIUS * 0.10472 |
| 118 | + unit: m/s |
| 119 | + value: 12.5 |
93 | 120 |
|
94 | | -- vscode |
95 | | -- yaml formulas |
96 | | -- engineering formulas |
97 | | -- embedded development |
98 | | -- c/cpp constants |
99 | | -- formula evaluation |
100 | | -- hover documentation |
101 | | -- go to definition |
| 121 | +RPM: |
| 122 | + value: 1000 |
| 123 | + |
| 124 | +WHEEL_RADIUS: |
| 125 | + value: 0.2 |
| 126 | +``` |
| 127 | +
|
| 128 | +```c |
| 129 | +#define SPEED_LIMIT_FACTOR (RPM / 2 + 10) |
| 130 | +const int MAX_SPEED = SPEED_LIMIT_FACTOR * 2; |
| 131 | +``` |
| 132 | + |
| 133 | +CalcDocs can expand and resolve these symbols, show computed values in hover/CodeLens, and navigate to their definitions. |
102 | 134 |
|
103 | 135 | --- |
104 | 136 |
|
105 | 137 | ## 🤝 Contributing |
106 | 138 |
|
107 | 139 | Contributions are welcome, especially for: |
108 | 140 |
|
109 | | -parser improvements |
110 | | -
|
| 141 | +- parser improvements |
111 | 142 | - diagnostics |
112 | | -- testing |
| 143 | +- tests |
113 | 144 | - developer experience |
114 | 145 |
|
115 | 146 | --- |
116 | 147 |
|
117 | 148 | ## ❤️ Sponsor |
118 | 149 |
|
119 | | -If you find this extension useful, consider sponsoring the project to support its development. |
| 150 | +If you find this extension useful, consider sponsoring the project. |
120 | 151 |
|
121 | 152 | [](https://www.paypal.me/gianmichelepasinelli) |
122 | 153 |
|
123 | 154 | --- |
124 | 155 |
|
125 | | -## 📌 Roadmap |
| 156 | +## 🗺️ Roadmap |
126 | 157 |
|
127 | 158 | Planned improvements: |
| 159 | + |
128 | 160 | - YAML schema validation |
129 | | -- more robust expression parsing |
130 | | -- automated tests for YAML write-back |
| 161 | +- stronger expression parsing |
| 162 | +- more automated tests for YAML write-back |
131 | 163 | - configurable include/exclude paths |
132 | | -- improved multi-root workspace support |
133 | 164 |
|
134 | 165 | --- |
135 | 166 |
|
|
0 commit comments