Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

莫名奇妙的参数类型错误 #1

Closed
WT-Gao opened this issue Apr 9, 2024 · 7 comments
Closed

莫名奇妙的参数类型错误 #1

WT-Gao opened this issue Apr 9, 2024 · 7 comments

Comments

@WT-Gao
Copy link

WT-Gao commented Apr 9, 2024

直接复制的配置,就改了LSP目录

vim/shared.lua:305: after the second argument: expected table, got string

# stacktrace:
  - vim\shared.lua:764 _in_ **validate**
  - vim\shared.lua:305 _in_ **tbl_extend**
  - cmp-lsp-rimels\lua\rimels\init.lua:34 _in_ **update_option**
  - cmp-lsp-rimels\lua\rimels\init.lua:71 _in_ **setup**
  - lua/plugins/lsp.lua:55 _in_ **config**
  - lua/config/lazy.lua:14
  - init.lua:3

我的配置:

{
    "liubianshi/cmp-lsp-rimels",
    dependencies = {
      "neovim/nvim-lspconfig",
      "hrsh7th/nvim-cmp",
      "hrsh7th/cmp-nvim-lsp",
    },

    config = function()
      require("rimels").setup({
        keys = { start = ";f", stop = ";;", esc = "jj" },
        cmd = { "D:/user/LSP/rime-ls/rime_ls.exe" },
        rime_user_dir = "D:/user/LSP/rime-ls/Rime",
        shared_data_dir = "D:/user/Rime/weasel-0.15.1/data",
      })
    end,
  },

看样子是参数类型错误,能解决一下吗,我不是很懂lua

liubianshi added a commit that referenced this issue Apr 10, 2024
@liubianshi
Copy link
Owner

犯了一个低级错误,把相等的判断写反了,已经修复好,您更新一下,看是否还有问题

@WT-Gao
Copy link
Author

WT-Gao commented Apr 10, 2024

报了另一个错误,缺少root_dir

Warn  13:29:51 notify.warn [lspconfig] unhandled error: ...a/Local/nvim-data/lazy/neoconf.nvim/lua/neoconf/util.lua:54: attempt to call upvalue 'root_dir' (a nil value)

尝试设置root_dir仍然没用,编写mardown文本时,LSP已配置列表里有rime_ls,但是bufferLSPclient列表里没有rime_ls,使用;f进入中文模式就报这个错误。

Language client log: C:\Users\gwt\AppData\Local\nvim-data\lsp.log
 Detected filetype:   markdown
 
 1 client(s) attached to this buffer: 
 
 Client: marksman (id: 1, bufnr: [1])
 	filetypes:       markdown, markdown.mdx
 	autostart:       true
 	root directory:  Running in single file mode.
 	cmd:             C:\Users\gwt\AppData\Local\nvim-data\mason\bin\marksman.CMD server
 
 Configured servers list: neocmake, ruff_lsp, marksman, texlab, jsonls, lua_ls, rime_ls, clangd, pyright, matlab_ls

@liubianshi
Copy link
Owner

这个问题让我有点摸不着头脑,按理并不需要访问 root_dir 的值。从 LspInfo 的信息看,问题可能是 rime_ls 没能成功启动,试着运行下 :LspStart rime_ls:lua require('lspconfig').rime_ls.launch(), 看有没有报错,如果没有报错,再看看 LspInfo 的信息

@WT-Gao
Copy link
Author

WT-Gao commented Apr 10, 2024

都是报同样的错误😰。rime_ls.exe应该没问题,之前直接使用rime_ls作者的配置文件成功启动了rime_ls,可以正常使用中文打字,但是其他语言的LSP全都启动不了了😓,最终找到这个仓库,希望能够解决。

我发现几乎所有配置都是Linux下的,貌似很少是Windows的配置,难道是因为系统原因?

test

@liubianshi
Copy link
Owner

有没有可能是 neoconf.nvim 的错误呢?类似于这个 bug: nil root_dir #51

我没有 Windows 系统的电脑,也没有使用 neoconf.nvim 这个包,不太好重现这个问题。

@WT-Gao
Copy link
Author

WT-Gao commented Apr 10, 2024

非常感谢🙏,把neoconf禁用就可以了,感觉neoconf我也用不到。

@liubianshi
Copy link
Owner

不客气,问题解决了就好

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants