-
Notifications
You must be signed in to change notification settings - Fork 2.2k
.oxlintrc.json not found (because insert_package_json() searchs breadth-first instead of depth-first) #3818
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
Comments
the new config, unlike the old one, checks for a Line 27 in 4643407
always show the exact code sample. wastes time to just describe things vaguely. if you did this:
then that isn't valid. |
Ah yeah I must have mixed them up.
I assumed this would be correct since this is what the previous config used and because the name is the same, but now I realize the return signature is different. The same issue remains though. Because if, like in my case, oxlint is indeed in the local package.json file but the .oxlintrc.json is in an upper path, the callback won't be called and the lsp won't attach. Personally, I think it would be better to revert to the previous approach of searching directly for a .oxlintrc.json because that's more accurate. |
that would allow the use of wdyt @maximtrp |
Actually, I can't reproduce this issue. Whether I remove @Rick-Phoenix Could you please share the output of @justinmk Removing |
I actually found out that the lsp attachment issue was due to a mismatch of version between my global oxlint package managed by mason and the local one used in the project. The real issue is rather that if the .oxlintrc.json file is outside of the package's root, it does not get detected correctly. So this is what the file tree looks like for my project. If instead I change the root_dir function to one that looks upwards until it can find a .oxlintrc.json file, the root directory is correctly identified and my settings are reflected in the diagnostic messages. |
This comment has been minimized.
This comment has been minimized.
Like I said, do what the older config did and look for a .oxlintrc.json file rather from the file's directory upwards rarther than an oxlint entry in the package.json file.
monorepo-starter, which is the folder where the first .oxlintrc.json file is found from that buffer's directory upwards |
I understand now.
but looking at the logic of nvim-lspconfig/lua/lspconfig/util.lua Line 47 in 4643407
monorepo-starter/packages/hono-starter/ if it found a package.json file with the expected field.
and even then, here Line 27 in 4643407
so all ancestors should be searched for so i don't see how your problem can occur |
@justinmk Yeah, exactly. This is what I am struggling to understand now. I have reproduced this case locally. And the LS is attached to the folder where The table returned by: local root_markers = util.insert_package_json({ '.oxlintrc.json' }, 'oxlint', fname)
vim.fs.find(root_markers, { path = fname, upward = true }) contains just the path to the root directory of |
@justinmk Could it be that |
@justinmk Yeah, thank you, I have just dived in there. It returns the first found directory for one of the root markers (in-order) before going upwards. So, it will never find |
oh good point. that's wrong. it's contrary to the behavior of so to avoid confusion, we should change the behavior of |
Description
I tried switching to the new oxlint lsp config, but there is an issue.
In my monorepo, I have just one .oxlintrc.json file at the root of the repo. The older config with lspconfig.oxlint.setup() was able to correctly identify the root directory and the server would attach. But with the new version, that is not the case, even if I manually replace the new root_dir function with the older one.
The text was updated successfully, but these errors were encountered: