oxalica / nil

NIx Language server, an incremental analysis assistant for writing in Nix.
Apache License 2.0
1.38k stars 40 forks source link

Support for helix editor #32

Closed i-am-logger closed 1 year ago

i-am-logger commented 1 year ago

My current languages.toml For helix Has the following:

[[language]]
name = "nix"
scope = "source.nix"
injection-regex = "nix"
file-types = ["nix"]
shebangs = []
roots = []
auto-format = true
formatter = { command = "nixpkgs-fmt" }
comment-token = "#"
language-server = { command = "nil" }
indent = { tab-width = 2, unit = "  " }

[[grammar]]
name = "nix"
source = { git = "https://github.com/cstrahan/tree-sitter-nix", rev = "6b71a810c0acd49b980c50fc79092561f7cee307" }⏎                         snick@snick-desktop ~/C/flake (main)> 

The code completion seems to work only for what is local to the file but does not show available functions from source. Is that the expected behavior?

oxalica commented 1 year ago

but does not show available functions from source. Is that the expected behavior?

What do you mean by "available functions from source"? Any example?

If you mean to complete package names from nixpkgs, that's not supported yet.

i-am-logger commented 1 year ago

I mean intellisense/code completion … like when typing home. should expect to see the available function on the home-manager object.

i-am-logger commented 1 year ago

I seem to have issues with setting up tree-sitter on helix .. I’m using nixOS

NobbZ commented 1 year ago

I mean intellisense/code completion … like when typing home. should expect to see the available function on the home-manager object.

As Ocalica pointed out, we are not there yet. Currently you get completion on available "top level" bindings. Not its children.

There is just not enough information available.

Setting up tree sitter is completely unrelated to nil.

oxalica commented 1 year ago

when typing home. should expect to see the available function on the home-manager object.

Option completion is not implemented yet. It's kind of hard. Currently we only support completions that are "known locally in the same file".

oxalica commented 1 year ago

I'll close this issue since Helix should work out of box. But feel free to open a feature request issue for the NixOS/home-manager option completion.