You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a two-level directory structure: parent -> example
What I expected to happen
I expected validation to be enabled when my package.json was not in the root of the Workspace.
What seems to have happened
It works if I remove the parent directory such that the package.json is now in the Workspace root.
It doesn't work when the package.json is nested below the root.
Enabling "standard.enableGlobally": true allows the two-level directory structure to be validated.
This isn't acceptable in my situation as, even though I have only one top-level directory, only some of my second-level directories follow this style guide and I can't enable it for all those directories.
Suggested Fix
Instead of assuming that the package.json file is in the root of the Workspace it might be better to 'walk down' the textDocument.path until a directory with a package.json file is found (in the same way npm walks down until it finds the module root).
Closing notes
There is some code which mandates that workspace only has one top-level directory (Workspace.workspaceFolders?.length === 1), this is actually unrelated to this issue, since I do only have one top-level directory in my example.
The text was updated successfully, but these errors were encountered:
Here's what I did
Create a two-level directory structure:
parent -> example
What I expected to happen
I expected validation to be enabled when my
package.json
was not in the root of theWorkspace
.What seems to have happened
It works if I remove the
parent
directory such that thepackage.json
is now in theWorkspace
root.It doesn't work when the
package.json
is nested below the root.ie. this directory layout works:
Explanation
This is the coded behaviour here:
vscode-standard/client/src/extension.ts
Lines 226 to 232 in 7736794
Possible Workaround
Enabling
"standard.enableGlobally": true
allows the two-level directory structure to be validated.This isn't acceptable in my situation as, even though I have only one top-level directory, only some of my second-level directories follow this style guide and I can't enable it for all those directories.
Suggested Fix
Instead of assuming that the
package.json
file is in the root of theWorkspace
it might be better to 'walk down' thetextDocument.path
until a directory with apackage.json
file is found (in the same waynpm
walks down until it finds the module root).Closing notes
There is some code which mandates that workspace only has one top-level directory (
Workspace.workspaceFolders?.length === 1
), this is actually unrelated to this issue, since I do only have one top-level directory in my example.The text was updated successfully, but these errors were encountered: