Git Product home page Git Product logo

nu-ls.nvim's People

Contributors

amtoine avatar zioroboco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

amtoine

nu-ls.nvim's Issues

Help text for commands doesn't render correctly in hovers

As of nu v0.79 having been released (and before, but I wasn't sure how far along this feature was), the markdown-like return value from nu --ide-hover isn't being rendered correctly in hovers. Currently the text returned from nu is just being displayed verbatim in neovim (which works well enough, but it's not pretty).

The syntax is a bit funny with lots of code fences that I can't quite make sense of (and neither can neovim's markdown rendering functions under vim.lsp). This might be a known format for returning LSP hover text, I simply haven't read the docs closely enough yet.

Here is a dump of the output from running this on the let command, for me (or anyone) to have a think about how to correctly parse and render this:

```
### Signature
```
  let {flags} <var_name> <initial_value>
```

### Parameters

  `var_name: any` - variable name
\
  `initial_value: any` - equals sign followed by value


### Flags

  `-h`, `--help` - Display the help message for this command

### Input/output

```
  nothing | nothing

```
### Usage
  Create a variable and give it a value.

### Extra usage:
  This command is a parser keyword. For details, check:
  https://www.nushell.sh/book/thinking_in_nu.html
### Example(s)
```
```
  Set a variable to a value
```
  let x = 10

```
  Set a variable to the result of an expression
```
  let x = 10 + 100

```
  Set a variable based on the condition
```
  let x = if false { -1 } else { 1 }

Missing a CI pipeline

Currently:

  • unit tests are running in a headless instance of my local neovim (including config)
  • the type checks depend on finding things at specific paths on my filesystem

With these made more generic (somehow), we could start running checks in GitHub actions.

(raised in #7)

Add docs: "why null-ls?" (see issue)

In lieu of actually writing this up in the readme, some quick thoughts:

There isn't currently a stand-alone nushell language server โ€” the one in the vscode extension is more or less coupled to the implementation of that extension, and after poking around a bit, I concluded that there are probably better uses of time than trying to extract it (see also: nushell/vscode-nushell-lang#117)

Maintaining a null-ls.nvim source in the meantime (i.e. this repo) means essentially maintaining another language server implementation (one which runs directly within the neovim process).

This is a small duplication of effort between neovim and vscode, but it seems like a fine way to bridge this gap for the moment. It's based on the same features of the nushell binary that the vscode extension is using, so most of the heavy lifting was already done. But this split focus obviously isn't ideal.

Since there's basically a reference implementation for the LSP methods in nushell/nushell already, I think writing a stand-alone language server in rust doesn't seem outrageously difficult, but I'll keep this repo going in the meantime.

Completing a subcommand re-inserts the parent command

Completing str tr results in str str trim (for example).

Instead, it should be removing any already-inserted partial match (i.e. the thing that the completion was generated against) from the result before inserting. I'm not sure if this is possible from the perspective of a null-ls completion source, because we're just returning lists of strings and not actually writing them to the buffer. ๐Ÿค”

We could remove the partially completed parent command from the completion list as well, but I think that would make the actual command being suggested less obvious. Not sure if there's another option, though.

Race condition in async completions with debounce

Since the introduction of the debounce timer for completions in #7, typing quickly can sometimes cause nu to return an error like the following:

thread 'main' panicked at 'assertion failed: self.is_char_boundary(idx)', /rustc/90743e7298aca107ddaa0c202a4d3604e29bfeb6/library/alloc/src/string.rs:1532:9

This looks similar to errors I've seen before when asking nu to generate completions for a cursor position beyond the end of the file.

I suspect this might be caused by a race condition, likely from differences between the temporary file that nu's being asked to generate completions against and the cursor position reported by null-ls.

`nu-ls.nvim` appears to be quite slow :thinking:

hello there ๐Ÿ‘‹ ๐Ÿ˜‹

i've been trying nu-ls.nvim on and off for a few days now and it looks a bit slow to me...
neovim hangs a tiny little on each character change ๐Ÿค”

did you notice the same behaviour @zioroboco? ๐Ÿ˜ข

here are the changes i use in my kickstart.nvim config to enable it ๐Ÿ‘

diff --git a/lua/custom/plugins/null-ls.lua b/lua/custom/plugins/null-ls.lua
new file mode 100644
index 0000000..fcaaa45
--- /dev/null
+++ b/lua/custom/plugins/null-ls.lua
@@ -0,0 +1,10 @@
+return {
+  "jose-elias-alvarez/null-ls.nvim",
+  config = function ()
+    require("null-ls").setup {
+      sources = {
+        require("nu-ls"),
+      },
+    }
+  end
+}

how to install the plugin?

hello there ๐Ÿ‘‹ ๐Ÿ˜‹

i wanted to install this plugin to try it out and give you some feedback, but i'm having some trouble ๐Ÿ˜ฎ

i've tried to use the snippet you give in the README, i.e.

return {
  "jose-elias-alvarez/null-ls.nvim",
  config = function ()
    require("null-ls").setup {
      sources = {
        require("nu-ls"),
      },
    }
  end
}

in my lua/custom/plugins/null-ls.lua (my config is based on the kickstart framework for neovim)

i've also tried

return {
  "jose-elias-alvarez/null-ls.nvim",
  config = function ()
    require("null-ls").setup {
      sources = {
        require("zioroboco/nu-ls.nvim"),
      },
    }
  end
}

but i get the same error

Failed to run `config` for null-ls.nvim
/home/amtoine/.config/nvim/lua/custom/plugins/null-ls.lua:6: module 'nu-ls' not found:
^Ino field package.preload['nu-ls']
cache_loader: module nu-ls not found
cache_loader_lib: module nu-ls not found
^Ino file './nu-ls.lua'
^Ino file '/usr/share/luajit-2.1.0-beta3/nu-ls.lua'
^Ino file '/usr/local/share/lua/5.1/nu-ls.lua'
^Ino file '/usr/local/share/lua/5.1/nu-ls/init.lua'
^Ino file '/usr/share/lua/5.1/nu-ls.lua'
^Ino file '/usr/share/lua/5.1/nu-ls/init.lua'
^Ino file './nu-ls.so'
^Ino file '/usr/local/lib/lua/5.1/nu-ls.so'
^Ino file '/usr/lib/lua/5.1/nu-ls.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'
# stacktrace:
  - ~/.config/nvim/lua/custom/plugins/null-ls.lua:6 _in_ **config**

i probably just don't know and understand how to install a null-ls plugin, but am i missing something?

cheers โœจ

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.