Behaviour SwRS-MDOKFSTUDIO-FMSCHEMA-055
A filename stem resolves when exactly one file matches
When a link annotation has the resolution `filename-stem`, the extension SHALL look the stem up among the Markdown files under the workspace folders and the bundle root and accept it when exactly one file matches, reporting the E10 error "is ambiguous" or "was not found" for several files or none and the warning W15 for an unreadable candidate.
Another outcome at step 2 of path 1 in StRS-MDOKFSTUDIO-FMSCHEMA-014, in the state “The link target is checked against the files”.
Scenarios 6
The situations the tests check; open one to read it.
nominalUnique stem
| Value | Setup | Outcome |
|---|---|---|
| t | One file t.md below the workspace | The link is valid |
| t#h | The same file | The link is valid and keeps the fragment h |
| t | A file t.md created in a workspace folder after the stem was not found | The link is valid when the document is analysed again (the stem index is rebuilt) |
refusalAmbiguous or unknown stem
| Value | Setup | Outcome |
|---|---|---|
| same | Files docs/a/same.md and docs/b/same.md | [E10] filename stem 'same' is ambiguous at 'ref'; label Several files match |
| zzz | No such file | [E10] filename stem 'zzz' was not found at 'ref'; label File not found |
| same | A file Same.md only (stems are case-sensitive) | The stem is not found |
refusalUnreadable candidate
Givena symbolic link ghost.md that points to a missing file and the value ghost
Whenthe document is analysed
Thenthe field carries [W15] Skipped file-link check at 'ref': filename stem 'ghost' could not be resolved because the workspace may be unavailable and the label reads Link unavailable
nominalCandidate becomes readable
Giventhe target of the symbolic link ghost.md is created
Whenthe document is analysed again
Thenthe link is valid
boundaryFolders and files that the stem index covers
| Input | Outcome |
|---|---|
| Files named like stems inside node_modules, dist, out, output, _build, .venv, .git or a hidden folder (name starting with a dot) | None of them is found; the exclusion applies at every depth |
| A file in an ordinary folder | Its stem is found |
| A file whose name does not end in lowercase `.md`, or a symbolic link to a folder | Not indexed; symbolic links to folders are not entered |
nominalIndex follows the workspace
| Event | Outcome |
|---|---|
| A Markdown file is created, changed or deleted in a workspace folder | The filename-stem index is rebuilt (one Markdown watcher per workspace root invalidates the cached index of that root) |
| A workspace folder is added | It is followed by a new watcher |
| A workspace folder is removed | The watcher of that folder is disposed |
Implemented in 3
Tested by 6
Known limits (1)
- a bundle root outside the workspace folders is not watched: its index refreshes only when the root folder's own modification time changes, so new files in its sub-folders can be missed.
Replaces
SwRS-MDOKFSTUDIO-FMSCHEMA-056An ambiguous or unknown stem is an error superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-055 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-057An unreadable stem candidate gives a warning superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-055 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-058The stem index skips build and hidden folders superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-055 Markdown file
SwRS-MDOKFSTUDIO-FMSCHEMA-059The stem index is rebuilt when a Markdown file changes superseded superseded by SwRS-MDOKFSTUDIO-FMSCHEMA-055 Markdown file