Slow LSP syntax highlighting with simple config #1159
-
|
Syntax highlighting has a noticeable lag when using a language server. See below for an MRE. flake.nix{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
nvf.url = "github:notashelf/nvf";
};
outputs =
inputs:
let
system = "x86_64-linux";
in
{
packages."${system}" = inputs.nvf.lib.neovimConfiguration {
pkgs = inputs.nixpkgs.legacyPackages."${system}";
modules = [
{
vim = {
lsp = {
enable = true;
formatOnSave = true;
};
languages.nix.enable = true;
};
}
];
};
};
}flake.lock{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1751685974,
"narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=",
"ref": "refs/heads/main",
"rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1",
"revCount": 92,
"type": "git",
"url": "https://git.lix.systems/lix-project/flake-compat.git"
},
"original": {
"type": "git",
"url": "https://git.lix.systems/lix-project/flake-compat.git"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nvf",
"nixpkgs"
]
},
"locked": {
"lastModified": 1756770412,
"narHash": "sha256-+uWLQZccFHwqpGqr2Yt5VsW/PbeJVTn9Dk6SHWhNRPw=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "4524271976b625a4a605beefd893f270620fd751",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"mnw": {
"locked": {
"lastModified": 1756659871,
"narHash": "sha256-v6Rh4aQ6RKjM2N02kK9Usn0Ix7+OY66vNpeklc1MnGE=",
"owner": "Gerg-L",
"repo": "mnw",
"rev": "ed6cc3e48557ba18266e598a5ebb6602499ada16",
"type": "github"
},
"original": {
"owner": "Gerg-L",
"repo": "mnw",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1758690382,
"narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e643668fd71b949c53f8626614b21ff71a07379d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1756696532,
"narHash": "sha256-6FWagzm0b7I/IGigOv9pr6LL7NQ86mextfE8g8Q6HBg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "58dcbf1ec551914c3756c267b8b9c8c86baa1b2f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nvf": {
"inputs": {
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"mnw": "mnw",
"nixpkgs": "nixpkgs_2",
"systems": "systems"
},
"locked": {
"lastModified": 1758271661,
"narHash": "sha256-ENqd2/33uP5vB44ClDjjAV+J78oF8q1er4QUZuT8Z7g=",
"owner": "notashelf",
"repo": "nvf",
"rev": "b7571df4d6e9ac08506a738ddceeec0b141751b0",
"type": "github"
},
"original": {
"owner": "notashelf",
"repo": "nvf",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"nvf": "nvf"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}When I e.g. comment out a line from I'm coming from Helix where highlighting is instant even with language servers configured (including If I add How can I run treesitter and a language server without highlighting having this lag? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
|
I vaguely recall seeing nil or nixd having slow semantic highlighting, which is proabbly the cause disabling semantic tokena should fix that, but I forgot how, I'll check again tomorrow |
Beta Was this translation helpful? Give feedback.
-
|
Coming back to this, just to document how exactly to get it working in case someone else stumbles on this, it's looking like the following works: vim.lsp.servers.nil.on_attach = lib.generators.mkLuaInline ''
function(client, _)
client.server_capabilities.semanticTokensProvider = nil
end
''; |
Beta Was this translation helpful? Give feedback.
apparently there is a distinction between client and server capabilities. The above code was supposed to be set on server capabilities. I'm not really sure what the new code is but this is what people used to do:
you can probably translate this code to into something
vim.lsp.servers.nil.on_attachaccepts.I think
get_client_by_idmight be deprecated so if you get a warning follow it i guess