-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validation only triggers if package.json
is in workspace root
#536
Comments
related #263 cc/ @theoludwig |
Unfortunately, this remake of the extension was completely broken. After a year of waiting for a fix for this problem, nothing happened, and it also looks abandoned. For those who looking a solution and not just workaround:
the key is the
debug will help you if something goes wrong. There are lot of messages that could help. Thats all. Now you can continue to write your nice code without pain as you are used to. |
@bigbn This is a reason why we're trying to avoid creating an extension for Unfortunately ESLint has no interest in making it easier to provide a |
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: