lemminx XML language server is reporting diagnostics for filetypes that it doesn't support.
bigolu opened this issue · comments
Description
lemminx XML language server is reporting diagnostics for filetypes that it doesn't support.
Steps to reproduce
- Create a new directory and initialize a git repository in it:
cd "$(mktemp --directory)"
git init
- Create the file
pip.conf
with the following contents:
[global]
disable-pip-version-check = True
- Create the file
fontconfig.conf
with the following contents:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
</fontconfig>
- Add the newly created files to the git index so they get picked up by
git ls-files
:
git add -A
- Install the lemminx XML language server. I installed it through mason.nvim.
- Open
fontconfig.conf
:
nvim fontconfig.conf
- Diagnostics will be reported by lemminx for
pip.conf
even though it doesn't contain XML. If you run:LspInfo
you'll see that lemminx is not attached topip.conf
yet it is reporting diagnostics for it.
Expected behavior
Diagnostics are only reported for fontconfig.conf.
Evaluation
Looks like this is due to detected filetypes being cached by file extension. (Section of code doing the caching)
Environment
- Neovim version: Nightly (v0.10.0-dev-4e59422)
- workspace-diagnostics version: latest (9548a0a)
I see. It's always caching, isn't it...
What do you think would be the right thing to do?
- Remove caching (might slow things down even further)
- Don't cache certain extensions (I guess this could be a new setting that would default to
{ 'conf' }
) - Something else
I'd go with not caching certain extensions since I don't think this will be an issue for most extensions and as you mentioned, removing caching altogether would slow things down.
Can you think of other examples of extensions that should be excluded from caching?