Coder Social home page Coder Social logo

rnix-lsp's Introduction

rnix-lsp Crates.io Chat on Matrix Build status

A syntax-checking language server using rnix.

  • Syntax-checking diagnostics
  • Basic completion
  • Basic renaming
  • Basic goto definition
  • Expand selection proposal
  • Formatting using nixpkgs-fmt

This is beta-level quality at best - I didn't expect maintaining a language server when writing rnix, the goal was that others would flock around the parser and write a bunch of editor tooling :)

Breakages are expected. No semver compatibility before 1.x.y.

Turn on logging with RUST_LOG=trace, and redirect stderr to a file.

bash -c "env RUST_LOG=trace rnix-lsp 2> /tmp/rnix-lsp.log"

Support for Mac OS is not guaranteed (see PR #61).

Install

nix-env -i -f https://github.com/nix-community/rnix-lsp/archive/master.tar.gz

Integrate with your editor

These instructions are not fully tested - see issue #3. Please raise an issue and/or send a PR if a config below didn't work out of the box.

Vim/Neovim

{
  "languageserver": {
    "nix": {
      "command": "rnix-lsp",
      "filetypes": [
        "nix"
      ]
    }
  }
}
let g:LanguageClient_serverCommands = {
    \ 'nix': ['rnix-lsp']
\ }
if executable('rnix-lsp')
    au User lsp_setup call lsp#register_server({
        \ 'name': 'rnix-lsp',
        \ 'cmd': {server_info->[&shell, &shellcmdflag, 'rnix-lsp']},
        \ 'whitelist': ['nix'],
        \ })
endif

Emacs

For eglot use (lsp +eglot)

;; init.el
(doom! :tools
       lsp
       
       :lang
       (nix +lsp))
(add-to-list 'lsp-language-id-configuration '(nix-mode . "nix"))
(lsp-register-client
 (make-lsp-client :new-connection (lsp-stdio-connection '("rnix-lsp"))
                  :major-modes '(nix-mode)
                  :server-id 'nix))
(add-to-list 'eglot-server-programs '(nix-mode . ("rnix-lsp")))

Kakoune

kak-lsp has builtin configuration since version v9.0.0:

[language.nix]
filetypes = ["nix"]
roots = ["flake.nix", "shell.nix", ".git"]
command = "rnix-lsp"

If you run into an issue regarding "missing roots" see this issue.

VSCode

{
    "nix.enableLanguageServer": true
}

RIP jd91mzm2

Sadly, the original author of this project, @jD91mZM2 has passed away. His online presence was anonymous and what we have left is his code. This is but one of his many repos that he contributed to.

rnix-lsp's People

Contributors

ma27 avatar jd91mzm2 avatar dependabot[bot] avatar aaronjanse avatar mic92 avatar artturin avatar antifuchs avatar peterbecich avatar zimbatm avatar symphorien avatar wikku avatar mtoohey31 avatar milahu avatar jgarte avatar xanderificnl avatar selaux avatar arjuns500 avatar jnoortheen avatar lord-valen avatar lf- avatar ivanbakel avatar gvolpe avatar matklad avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.