Skip to content

Latest commit

 

History

History
108 lines (88 loc) · 3.92 KB

features.md

File metadata and controls

108 lines (88 loc) · 3.92 KB

Features

This incomplete list tracks noteble features currently implemented or planned.

  • Goto definition. textDocument/definition

    • References to parameters, let and rec {} bindings.
    • Relative paths.
  • Find references. textDocument/reference

    • Parameters, let and rec {} bindings.
    • With expression.
  • Highlight related. textDocument/documentHighlight.

    • Highlight definitions and references when cursor's on identifiers.
    • Highlight all (attribute) references when cursor's on with.
    • Highlight all effective withs when cursor's on attributes from with.
  • Links. textDocument/documentLink

    • Links for relative and absolute paths.
    • Links for search paths like <nixpkgs>.
    • Links for URLs like "https://...", "http://..." and etc.
    • Links for flake references like "github:NixOS/nixpkgs".

    ⚠️ Due to an issue in coc.nvim, a lot of links can cause performance issue for coc.nvim, especially when editing all-packages.nix. You could apply this patch to mitigate.

  • Code actions. textDocument/codeAction

    • Convert name = name; bindings to inherit.

    • Pack multiple bindings into one Attrset binding.

      { foo.bar = 1; foo.baz = 2; } => { foo = { bar = 1; baz = 2; }; }

    • Flatten Attrset into outer level bindings.

      { foo = { bar = 1; baz = 2; }; } => { foo.bar = 1; foo.baz = 2; }

  • Completion. textDocument/completion

    • Builtin names.
      • With documentations.
    • Local bindings and rec-attrset fields.
    • Keywords.
    • Attrset fields.
  • Diagnostics. textDocument/publishDiagnostics

    • Syntax errors.
    • Hard semantic errors reported as parse errors by Nix, like duplicated keys in attrsets.
    • Undefiend names.
    • Warnings of legacy syntax.
    • Warnings of unnecessary syntax.
    • Warnings of unused bindings, with and rec.
    • Client pulled diagnostics.
    • Custom filter on kinds.
    • Exclude files.

    You can disable some diagnostic kinds or for some (generated) files via LSP configuration. See docs/configuration.md for more information.

  • Expand selection. textDocument/selectionRange

  • Renaming. textDocument/renamme, textDocument/prepareRename

    • Identifiers in parameters and bindings, from let, rec and non-rec attrsets.
    • Static string literal bindings.
    • Merged path-value binding names.
    • Names introduced by inherit.
    • Names used by inherit.
    • Conflict detection.
    • Rename to string literals.
  • Semantic highlighting. textDocument/semanticTokens/{range,full}

    • Delta response. textDocument/semanticTokens/full/delta

    Note: coc.nvim doesn't enable semantic highlighting by default. You need to manually enable it in settings.

    // coc-settings.json
    {
      "semanticTokens": { "filetypes": ["nix"] }
    }
  • Hover text. textDocument/hover.

    • Show kind of names.
    • Documentation for builtin names.
  • File symbols with hierarchy (aka. outline). textDocument/documentSymbol

  • File formatting.

    • Whole file formatting.
    • Range formatting.
    • On-type formatting.
    • External formatter.

    External formatter must be manually configured to work. See docs/configuration.md for more information.

    When formatter is configured, you can also enable format-on-save in your editor. Like, for coc.nvim,

    // coc-settings.json
    {
      "coc.preferences.formatOnSaveFiletypes": ["nix"]
    }
  • Cross-file analysis.

  • Multi-threaded.

    • Request cancellation. $/cancelRequest