iamcco / coc-diagnostic

diagnostic-languageserver extension for coc.nvim
245 stars 22 forks source link

Wrong working directory (phpcs) #131

Closed sandrodz closed 2 years ago

sandrodz commented 2 years ago

Examine following file structure of A php project:

ProjectA

When you open some.php from root, .phpcs.xml is correctly read and applied. in fact when I check diagnostic language server logs, I see:

searching working directory: /, cwd: /ProjectA, pattern: composer.lock, matches: false

When you open src/other.php .phpcs.xml is not applied, because coc-diagostic thinks project root is src/ not / where .phpcs.xml resides. logs show:

searching working directory: /, cwd: /ProjectA/src, pattern: composer.lock, matches: false

/ProjectA/src doesn't contain .phpcs.xml file, thus its not applied correctly.

Is there any way to resolve this? Vim correctly shows /ProjectA as project root for nested files, I can check this by typing :pwd

sandrodz commented 2 years ago

huh, so apparently problem was "rootPatterns": [".something", ".git"], first item .something in the list was failing to match, and rest where not tried. This unexpected behaviour. "rootPatterns": [".git"], fixed it.