artemave / workspace-diagnostics.nvim

Populate diagnostics for _all_ projects files, not just opened ones.

Home Page:https://artem.rocks/posts/workspace_diagnostics_nvim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Create a new directory and initialize a git repository in it:
cd "$(mktemp --directory)"
git init
  1. Create the file pip.conf with the following contents:
[global]
disable-pip-version-check = True
  1. Create the file fontconfig.conf with the following contents:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<fontconfig>
</fontconfig>
  1. Add the newly created files to the git index so they get picked up by git ls-files:
git add -A
  1. Install the lemminx XML language server. I installed it through mason.nvim.
  2. Open fontconfig.conf:
nvim fontconfig.conf
  1. 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 to pip.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?