doom-neovim / doom-nvim

A Neovim configuration for the advanced martian hacker
GNU General Public License v2.0
1.01k stars 107 forks source link

[BUG] (next) user custom langs doesn't work #339

Closed NextAlone closed 2 years ago

NextAlone commented 2 years ago

Current Behavior:

with files

lua/user/modules/langs
├── fish
│  └── init.lua
└── groovy
   └── init.lua

and modules.lua as mentioned in f0fa800b57b5c1ccda1d57ffcf737003530e4799

return {
  features = {
    -- ignored
  },
  langs = {
    -- Scripts
    "lua",
    -- ignored
    "fish",
    "groovy"
  },
}
[ERROR Sun 15 May 2022 08:38:33 PM CST] /home/nextalone/.config/nvim/lua/doom/core/config.lua:97: There was an error loading module 'langs.groovy'. Traceback:
module 'doom.modules.langs.groovy' not found:
    no field package.preload['doom.modules.langs.groovy']
    no file './doom/modules/langs/groovy.lua'
    no file '/usr/share/luajit-2.1.0-beta3/doom/modules/langs/groovy.lua'
    no file '/usr/local/share/lua/5.1/doom/modules/langs/groovy.lua'
    no file '/usr/local/share/lua/5.1/doom/modules/langs/groovy/init.lua'
    no file '/usr/share/lua/5.1/doom/modules/langs/groovy.lua'
    no file '/usr/share/lua/5.1/doom/modules/langs/groovy/init.lua'
    no file './doom/modules/langs/groovy.so'
    no file '/usr/local/lib/lua/5.1/doom/modules/langs/groovy.so'
    no file '/usr/lib/lua/5.1/doom/modules/langs/groovy.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file './doom.so'
    no file '/usr/local/lib/lua/5.1/doom.so'
    no file '/usr/lib/lua/5.1/doom.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: at 0x7fa91151a940
    [C]: in function 'xpcall'
    /home/nextalone/.config/nvim/lua/doom/core/config.lua:88: in function 'load'
    /home/nextalone/.config/nvim/lua/doom/core/init.lua:18: in main chunk
    [C]: in function 'require'
    /home/nextalone/.dotfiles/nvim/.config/nvim/init.lua:16: in main chunk
[ERROR Sun 15 May 2022 08:38:33 PM CST] /home/nextalone/.config/nvim/lua/doom/core/config.lua:97: There was an error loading module 'langs.fish'. Traceback:
module 'doom.modules.langs.fish' not found:
    no field package.preload['doom.modules.langs.fish']
    no file './doom/modules/langs/fish.lua'
    no file '/usr/share/luajit-2.1.0-beta3/doom/modules/langs/fish.lua'
    no file '/usr/local/share/lua/5.1/doom/modules/langs/fish.lua'
    no file '/usr/local/share/lua/5.1/doom/modules/langs/fish/init.lua'
    no file '/usr/share/lua/5.1/doom/modules/langs/fish.lua'
    no file '/usr/share/lua/5.1/doom/modules/langs/fish/init.lua'
    no file './doom/modules/langs/fish.so'
    no file '/usr/local/lib/lua/5.1/doom/modules/langs/fish.so'
    no file '/usr/lib/lua/5.1/doom/modules/langs/fish.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
    no file './doom.so'
    no file '/usr/local/lib/lua/5.1/doom.so'
    no file '/usr/lib/lua/5.1/doom.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: at 0x7fa91151a940
    [C]: in function 'xpcall'
    /home/nextalone/.config/nvim/lua/doom/core/config.lua:88: in function 'load'
    /home/nextalone/.config/nvim/lua/doom/core/init.lua:18: in main chunk
    [C]: in function 'require'
    /home/nextalone/.dotfiles/nvim/.config/nvim/init.lua:16: in main chunk

Expected Behavior:

Steps To Reproduce:

Logs

Check Health Output
Doom Report Output

Anything else:

connorgmeehan commented 2 years ago

This looks good to me, can you post your branch so I can have a look?

NextAlone commented 2 years ago

This looks good to me, can you post your branch so I can have a look?

https://github.com/NextAlone/doom-nvim/commit/dbad74013830cbfc5c152a56a7824a47d5b9c995

connorgmeehan commented 2 years ago

Hmmm I just copied your lua/user/modules/langs/fish/init.lua to my config and added fish to the modules.lua langs field and it's working for me.

Your folders structure looks correct, here's mine for reference.

❯ find . -type d | grep langs
./lua/user/modules/langs
./lua/user/modules/langs/cc
./lua/user/modules/langs/fish
./lua/doom/modules/langs
./lua/doom/modules/langs/terraform
./lua/doom/modules/langs/svelte
./lua/doom/modules/langs/go
./lua/doom/modules/langs/c_sharp
./lua/doom/modules/langs/python
./lua/doom/modules/langs/css
./lua/doom/modules/langs/config
./lua/doom/modules/langs/markdown
./lua/doom/modules/langs/typescript
./lua/doom/modules/langs/vue
./lua/doom/modules/langs/rust
./lua/doom/modules/langs/java
./lua/doom/modules/langs/kotlin
./lua/doom/modules/langs/haskell
./lua/doom/modules/langs/lua
./lua/doom/modules/langs/bash
./lua/doom/modules/langs/glsl
./lua/doom/modules/langs/teal
./lua/doom/modules/langs/javascript
./lua/doom/modules/langs/tailwindcss

Some things to try:

  1. Manually perform the require to see if anything is breaking I like to use https://github.com/rafcamlet/nvim-luapad for testing stuff like this, make a new repl/luapad and try

    print(vim.inspect(require("user.modules.langs.fish"))

    Result: Screen Shot 2022-05-25 at 1 57 14 am

  2. I just realised that doom-nvim ignores all errors in user modues and assumes that if t

here's an error then the file doesn't exist. That might be what's happening here, point 1 should help confirm this.

NextAlone commented 2 years ago

it shows this

image

connorgmeehan commented 2 years ago

Hmmmm, that looks correct to me, can you :LuaCacheClear?

NextAlone commented 2 years ago
print(vim.inspect(require("user.modules.langs.fish"))

done that, but no diff,

I saw that, null-ls loaded, but fish formatter doesn't work

connorgmeehan commented 2 years ago

Very strange, I'll checkout your branch tomorrow and test what's going on. It's pretty late here in aus.

NextAlone commented 2 years ago

Very strange, I'll checkout your branch tomorrow and test what's going on. It's pretty late here in aus.

Thanks, and sorry for taking up your time

connorgmeehan commented 2 years ago

Sorry I forgot to follow up. I did test this on my end at it seemed to be working fine for me. Can you try the latest origin/next commit to see if it works?

NextAlone commented 2 years ago

Sorry I forgot to follow up. I did test this on my end at it seemed to be working fine for me. Can you try the latest origin/next commit to see if it works?

It means that fish can use <SPC>cf to use formatter? image

connorgmeehan commented 2 years ago

Oops, I changed linter to avoid using deprecated api but I just pushed a new fix that adds backwards compatibility. Can you try it again now?

NextAlone commented 2 years ago

No error, but formatter even can't be called by lua vim.lsp.buf.formating_sync().

Can you call fish formatter fish_indent

NextAlone commented 2 years ago

groovy lsp works fine image

connorgmeehan commented 2 years ago

Ok that's good that groovy LSP is working. I just pushed a new commit with support for fish_indent + diagnostics via fish. Does it work for you? (Note: you'll have to delete lua/user/modules/langs/fish/init.lua if it exists, otherwise it will override my config).

NextAlone commented 2 years ago

Ok that's good that groovy LSP is working. I just pushed a new commit with support for fish_indent + diagnostics via fish. Does it work for you? (Note: you'll have to delete lua/user/modules/langs/fish/init.lua if it exists, otherwise it will override my config).

If it works, null-ls should be loaded? It not loaded now

NextAlone commented 2 years ago

And, i see changes in this commit

image

but vim.lsp.buf.format() doesn't exist

connorgmeehan commented 2 years ago

I pushed 2 new commits, 3f95e48681157be941683eb798859943fe2a36fc fixes the format vs formatting_sync issue by adding backwards compatibility. c708c4e84c947e95384baf1056737f91126aafb5 Adds support for fish scripting language. Can you see these changes?

connorgmeehan commented 2 years ago

But yes, null-ls should be loaded. Can you delete packer_compiled ~/.local/share/nvim/plugin/packer_compiled.lua, re-open nvim and run :PackerCompile, and then open a .fish file and try running <leader>cf?

NextAlone commented 2 years ago

yes, there is

NextAlone commented 2 years ago

But yes, null-ls should be loaded. Can you delete packer_compiled ~/.local/share/nvim/plugin/packer_compiled.lua, re-open nvim and run :PackerCompile, and then open a .fish file and try running <leader>cf?

Other error, module 'nvim-web-devicons' not found: and Dashboard cant be install.

NextAlone commented 2 years ago

Ok, formatter works now, but what diffs from my config except diagnoise

But null-ls not loaded, is this correct?

NextAlone commented 2 years ago

failed today

"~/.config/fish/config.fish" 13L, 368B
Error detected while processing BufWinEnter Autocommands for "*.fish":
E5108: Error executing lua ...talone/.config/nvim/lua/doom/modules/langs/fish/init.lua:15: module 'null-ls' not found:
        no field package.preload['null-ls']
        no file './null-ls.lua'
        no file '/usr/share/luajit-2.1.0-beta3/null-ls.lua'
        no file '/usr/local/share/lua/5.1/null-ls.lua'
        no file '/usr/local/share/lua/5.1/null-ls/init.lua'
        no file '/usr/share/lua/5.1/null-ls.lua'
        no file '/usr/share/lua/5.1/null-ls/init.lua'
        no file '/home/nextalone/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/null-ls.lua'
        no file '/home/nextalone/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/null-ls/init.lua'
        no file '/home/nextalone/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/null-ls.lua'
        no file '/home/nextalone/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/null-ls/init.lua'
        no file './null-ls.so'
        no file '/usr/local/lib/lua/5.1/null-ls.so'
        no file '/usr/lib/lua/5.1/null-ls.so'
        no file '/usr/local/lib/lua/5.1/loadall.so'
        no file '/home/nextalone/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/null-ls.so'
stack traceback:
        [C]: in function 'require'
        ...talone/.config/nvim/lua/doom/modules/langs/fish/init.lua:15: in function <...talone/.config/nvim/lua/doom/modules/langs/fish/init.lua:10>
        [string ":lua"]:1: in main chunk
connorgmeehan commented 2 years ago

I've made some more changes that means that Doom should autoinstall everything from a fresh install. There will be some runtime errors but once :PackerSync is finished (automatic) you just need to restart doom-nvim. (There is also a message to tell you to restart).

NextAlone commented 2 years ago

I've made some more changes that means that Doom should autoinstall everything from a fresh install. There will be some runtime errors but once :PackerSync is finished (automatic) you just need to restart doom-nvim. (There is also a message to tell you to restart).

Yes, but no use, just the same error as mentioned, and only in *.fish

NextAlone commented 2 years ago

Fixed by install another null-ls to my arch by pacman.

connorgmeehan commented 2 years ago

Great glad you got this resolved! I need to change imports in these config files to use pcall so they can fail safely. I'll make a new issue for this.

NextAlone commented 2 years ago

Great glad you got this resolved! I need to change imports in these config files to use pcall so they can fail safely. I'll make a new issue for this.

It works fine here.