StephenGunn / sveltecheck.nvim

A very simple tool to run the svelte-check tool and pipe the results into neovims quick fix interface.
MIT License
7 stars 0 forks source link

Is the docs wrong? svelte-check or sveltecheck #1

Open einarpersson opened 1 week ago

einarpersson commented 1 week ago

Hi, this was exactly what i was looking for. Happy if i do not have to reinvent the wheel.

However, in the docs it says

require('svelte-check').setup({

But should it be

require('sveltecheck').setup({

?

I got an error with the former, but it ran with the latter

error

Failed to run `config` for sveltecheck.nvim

/home/einar/config/nvim/init.lua:412: module 'svelte-check' not found:
^Ino field package.preload['svelte-check']
cache_loader: module svelte-check not found
cache_loader_lib: module svelte-check not found
^Ino file './svelte-check.lua'
^Ino file '/__w/neovim/neovim/.deps/usr/share/luajit-2.1/svelte-check.lua'
^Ino file '/usr/local/share/lua/5.1/svelte-check.lua'
^Ino file '/usr/local/share/lua/5.1/svelte-check/init.lua'
^Ino file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/svelte-check.lua'
^Ino file '/__w/neovim/neovim/.deps/usr/share/lua/5.1/svelte-check/init.lua'
^Ino file './svelte-check.so'
^Ino file '/usr/local/lib/lua/5.1/svelte-check.so'
^Ino file '/__w/neovim/neovim/.deps/usr/lib/lua/5.1/svelte-check.so'
^Ino file '/usr/local/lib/lua/5.1/loadall.so'

# stacktrace:
  - ~/config/nvim/init.lua:412 _in_ **config**
  - ~/config/nvim/init.lua:94
einarpersson commented 1 week ago

I perhaps should create a new issue, but:

unfortunately, now i get it to run but it does not seem to work.

When i run npm run check in the terminal I get 7 errors, but when I do :SvelteCheck I get a "nice! no errors blalbal"

  {
    'StephenGunn/sveltecheck.nvim',
    config = function()
      require('sveltecheck').setup({
        command = "npm run check",
      })
    end,
  },
StephenGunn commented 1 week ago

So, this is my first neovim plugin. You're definitely correct on the docs, I just fixed that. I think I changed the name of the plugin during development and that is why that was wrong. I honestly can't remember.

So I have been running this on my two computers with no errors and full functionality.

you can also pass debug_mode = true in the settings to get verbose logging, I will add that to the readme, let me know if that gives you anything

StephenGunn commented 1 week ago

I have a feeling it's not running the script in the correct directory, which would mean no errors. I am working on changing it to detect where the package.json is located to make sure it runs there, and will list where it is running in debug mode..

StephenGunn commented 1 week ago

Sorry for the reply-storm! I want to make this work for you!

I just updated the plugin repo with code that will search for the package.json and run the script in that directory. If you turn on debug mode, it will also display which directory it runs the script in- which should ensure that the actual svelte check command is being run.

I use https://github.com/ahmedkhalf/project.nvim to manage projects inside of Neovim, which might've changed the way my plugin worked on my machines. If this doesn't work, please reply and maybe we can chat on Discord to try and figure out what is going on. Would love to get it to work for more people.