nix-community / nixd

Nix language server, based on nix libraries [maintainer=@inclyc,@Aleksanaa]
https://github.com/nix-community/nixd
GNU Lesser General Public License v3.0
824 stars 26 forks source link

official NixOS wiki page `Zsh` suggests confusing URL literal for zplug #547

Closed AchmadFathoni closed 2 months ago

AchmadFathoni commented 2 months ago

Describe the bug The nixd gives "unexpected text" error indication on as:theme depth:1 given this example config from official NixOS Zsh Wiki

{ config, pkgs, lib, ... }:
{
  programs.zsh = {
    enable = true;
    zplug = {
      enable = true;
      plugins = [
        { name = "romkatv/powerlevel10k"; tags = [ as:theme depth:1 ]; }  # unexpected text (fix available)
      ];
    };
  };
}

Logs (Required)

[START][2024-07-21 19:35:00] LSP logging initiated
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.319] 61339: <-- initialize(1)\nI[19:35:00.319] 61339: --> reply:initialize(1)\nI[19:35:00.320] 61339: --> call window/workDoneProgress/create(1)\nI[19:35:00.320] 61339: --> notify $/progress\nI[19:35:00.320] 61339: --> call attrset/evalExpr(1)\nI[19:35:00.320] 61339: --> call window/workDoneProgress/create(2)\nI[19:35:00.320] 61339: --> notify $/progress\nI[19:35:00.320] 61339: --> call attrset/evalExpr(1)\nI[19:35:00.320] 61339: --> call workspace/configuration(3)\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.338] 61339: <-- initialized\nI[19:35:00.338] 61339: <-- textDocument/didOpen\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.338] 61339: --> notify textDocument/publishDiagnostics\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.338] 61339: <-- reply(1)\nI[19:35:00.338] 61339: <-- reply(2)\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.338] 61339: "
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "<-- reply(3)\nE[19:35:00.338] 61339: workspace/configuration: parse error expected object\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.340] 61339: <-- textDocument/semanticTokens/full(2)\nI[19:35:00.340] 61339: --> reply:textDocument/semanticTokens/full(2)\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.458] 61339: <-- reply(1)\nI[19:35:00.458] 61339: --> notify $/progress\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.773] 61339: <-- reply(1)\n"
[ERROR][2024-07-21 19:35:00] .../vim/lsp/rpc.lua:734    "rpc"   "/etc/profiles/per-user/toni/bin/nixd"  "stderr"    "I[19:35:00.773] 61339: --> notify $/progress\n"

Configuration

Using nixd within nivm-lspconfig

Expected behavior This legal syntax should not be marked as error.

inclyc commented 2 months ago

as:theme syntax was recognized by nix as URL literal. It is currently deprecated and the correct fix is quote it with double quotes.

I suppose you are using a outdated version of nixd, because latest stable release will suggest you the correct fix:

截屏2024-07-21 22 50 25
AchmadFathoni commented 2 months ago

I use nixd 2.1.2 from NixOS 24.05. Double quote works, thank you @inclyc

inclyc commented 2 months ago

I use nixd 2.1.2 from NixOS 24.05. Double quote works, thank you @inclyc

URL literal diagnostic was introduced in 2.2.0.