Find a TOML project when scanning a directory, not only when named a file - #63
Merged
Merged
Conversation
…file `loadDirectory` filtered on an extension set, so the one supported file that has no distinguishing extension was invisible to it: a project converted with `matlab.project.DefinitionFiles.Toml` keeps no `.prj` and no `resources/`, and its whole definition is a file called `matlab.toml`. `loadFromPath` opened that file fine from the moment the reader landed, which is the asymmetry — point a Node consumer at the file and it reads the project, point it at the folder the file is in and the folder reads as holding nothing. The filter now asks `isTomlProjectFile` beside the extension set rather than adding `.toml` to it, which would call every `Cargo.toml` and `pyproject.toml` in a folder a MATLAB project. The predicate rather than a literal, because this is the second path over one rule: `ingest` dispatches a project on `isProjectFile`, and a scan that disagrees with it either hides a file that opens fine or lists one nothing can open. Proven not to be vacuous before being trusted: with the source change stashed, the new test fails with `expected [] to deeply equal [ 'matlab.toml' ]` — the reported symptom exactly. Its marker is MATLAB-written, copied from the parity artifact, and two decoys are written beside it so their absence from the result is the filter rejecting them and not an empty directory. Affects Node consumers of this package only; the VS Code extension discovers files through its own `findFiles` glob and never calls `loadDirectory`, so nothing downstream changes and no pin needs bumping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
loadDirectoryfiltered on an extension set, so the one supported file with no distinguishing extension was invisible to it. A project converted withmatlab.project.DefinitionFiles.Tomlkeeps no.prjand noresources/— its whole definition is a file calledmatlab.toml.loadFromPathhas opened that file since the reader landed in v1.35.0, which is the asymmetry: point a Node consumer at the file and it reads the project, point it at the folder the file is in and the folder reads as holding nothing.The filter now asks
isTomlProjectFilebeside the extension set, rather than adding.tomlto it — that would call everyCargo.tomlandpyproject.tomlin a folder a MATLAB project. The shared predicate rather than a literal, because this is the second path over one rule:ingestdispatches a project onisProjectFile, and a scan that disagrees with it either hides a file that opens fine or lists one nothing can open.Non-vacuity, checked before trusting the test: with the source change stashed it fails with
expected [] to deeply equal [ 'matlab.toml' ]— the reported symptom exactly. The marker in the fixture is MATLAB-written (copied from the parity artifact), and aCargo.tomlandpyproject.tomlare written beside it so their absence from the result is the filter rejecting them and not an empty directory.Scope: Node consumers of this package only. The VS Code extension discovers files through its own
findFilesglob and never callsloadDirectory, so nothing downstream changes and no pin bump is needed. Left untagged deliberately — it rides the next release.npm run verifygreen: typecheck, build, smoke, 175 files / 5242 tests,check:pack(dist-only, 539 files, 588.4 kB),check:leak,check:browser(148 modules).