I couldn't find a good term to describe the program I'm looking for so here is a description.
The problem:
If I write some documentation for a program it eventually gets outdated when the code changes. So there are invisible connections/relations between documentation and code fragments.
E.g. today I read through the changelog of visual studio code (version 1.19.2) and the editor.lineNumbers option has changed. Before there were just 3 possible values for this option now there are 4 possibilities.
But the documentation (in this case a source code comment) mentions only 3 of them (at least in German).
My idea to solve this is to annotate the documentation to reference the relevant code fragments for this particular section of documentation. E.g.
in code.ts
...
500 //could also be a switch case
501 if (editor.lineNumbers === "on") {
502 ...
503 } else if (editor.lineNumbers === "off") {
504 ...
505 }
506
...
in doc.md
<!-- watch code.ts 500-506 -->
editor.lineNumbers controls the line numbers...
From a previous run the program knows that there are only 2 options (on/off). After changing the code e.g. adding a 3rd option and running the program again it detects that the lines between 500-506 have changed and outputs a warning.
I'm not looking for a tool to generate documentation from source code.
The tool should run on Windows or Mac.
So my question is: Is there such a program or something similar?
If not: are there any reasons against such a program?