Commit Graph

14 Commits

Author SHA1 Message Date
Micah Halter 5cff548d38
fix(lspconfig): add hook before and not after (#92)
## Description
A common use of `on_new_config` is to construct the `cmd` for starting
language servers based on the configuration. These language servers
require that the settings are finalized before it is run. It looks like
previous commits did use `add_hook_before` for the `lspconfig`
integration but it got moved to being `add_hook_after` when centralizing
it with the `lua_ls` and `jsonls` plugin integrations. We should revert
this back to `add_hook_before` so that the existing `on_new_config`
functions continue working.
2025-02-27 08:53:52 +01:00
Chaz 92c1a48a2d
fix(lspconfig): revert `_available_servers` (#108)
## Description

Reverts #105.

[neovim/nvim-lspconfig - PR
#3589](https://github.com/neovim/nvim-lspconfig/pull/3589) reverts
`_available_servers` back to `available_servers`.

## Related Issue(s)

Fixes #107.

## Screenshots

NA
2025-01-28 08:28:05 +01:00
Zhou Fang 9f73ae6aa6
fix(util): update deprecated methods (#106)
## Description

After updating lspconfig, there is an error when I tried to open
`neoconf.json`.

The reason is that `lspconfig.util.available_servers` has been renamed
to `lspconfig.util._available_servers`.
([link](e118ce58da))

I fixed the issue and also update the deprecated code which is also come
from lspconfig.util
([details](0e234f4cad/lua/lspconfig/util.lua (L359-L362)))

<details>
<summary>error detail</summary>

```
  Error  22:01:18 notify.error settings.nvim Failed to run client.before_init for settings/plugins/jsonls
....local/share/nvim/lazy/neoconf.nvim/lua/neoconf/util.lua:36: attempt to call field 'available_servers' (a nil value)

stack traceback:
	...nvim/lazy/neoconf.nvim/lua/neoconf/plugins/lspconfig.lua:14: in function <...nvim/lazy/neoconf.nvim/lua/neoconf/plugins/lspconfig.lua:8>
	...hare/nvim/lazy/neoconf.nvim/lua/neoconf/plugins/init.lua:14: in function 'fire'
	...hare/nvim/lazy/neoconf.nvim/lua/neoconf/plugins/init.lua:20: in function 'fire'
	...ocal/share/nvim/lazy/neoconf.nvim/lua/neoconf/schema.lua:45: in function 'get'
	...re/nvim/lazy/neoconf.nvim/lua/neoconf/plugins/jsonls.lua:22: in function 'on_config'
	....local/share/nvim/lazy/neoconf.nvim/lua/neoconf/util.lua:49: in function <....local/share/nvim/lazy/neoconf.nvim/lua/neoconf/util.lua:48>
	[C]: in function 'func'
	...al/share/nvim/lazy/nvim-lspconfig/lua/lspconfig/util.lua:53: in function <...al/share/nvim/lazy/nvim-lspconfig/lua/lspconfig/util.lua:51>
	[C]: in function 'pcall'
	...share/nvim/lazy/nvim-lspconfig/lua/lspconfig/configs.lua:217: in function 'make_config'
	...share/nvim/lazy/nvim-lspconfig/lua/lspconfig/manager.lua:160: in function 'add'
	...share/nvim/lazy/nvim-lspconfig/lua/lspconfig/manager.lua:220: in function <...share/nvim/lazy/nvim-lspconfig/lua/lspconfig/manager.lua:207>
	[C]: in function 'pcall'
	...l/share/nvim/lazy/nvim-lspconfig/lua/lspconfig/async.lua:5: in function <...l/share/nvim/lazy/nvim-lspconfig/lua/lspconfig/async.lua:4>
 ```

</details>

## Related Issue(s)

## Screenshots

![image](https://github.com/user-attachments/assets/956a59ff-1767-456a-a0bb-6ccf41d8a4bc)
2025-01-22 14:39:55 +01:00
Folke Lemaitre 7137fde498
fix(util): if lcponfig doesnt return a root dir, then also dont use the fallback. Fixes #74 2024-07-09 17:18:15 +02:00
Folke Lemaitre 197c17af57
feat(util): util.pick_root_dir 2024-07-07 07:20:30 +02:00
Folke Lemaitre cdbd1f2da8
fix: flatten 2024-07-07 00:28:10 +02:00
Michael Ziminsky (Z) 7c34c869e6
fix(util): normalize paths returned by `Util.file_patterns` (#35)
Astronvim errors while loading neoconf with neovim v0.10. The issue
appears to be the same as:
https://github.com/NvChad/NvChad/issues/1832
https://github.com/neovim/neovim/issues/22698

Normalizing the paths eliminates the error, but I haven't done much
testing beyond that.
2024-07-07 00:12:13 +02:00
Folke Lemaitre f9dcd17b95
fix(util): check that root_dir exists. Fixes #56. Closes #51 2024-07-07 00:03:25 +02:00
Will Hopkins 983a93b2b6
fix(deprecation): remove use of deprecated API functions (#59)
Removes usage of several deprecated API functions, and changes all uses
of `vim.loop` to `vim.uv`.

Now that 0.10 is released, several functions used here have been
deprecated and show warnings when they're first called.

I've updated:
- `lsp.get_active_clients()` -> `lsp.get_clients()`
- `api.nvim_buf_set_option` -> `api.nvim_set_option_value` with
buf-local scope
- `api.nvim_win_set_option` -> `api.nvim_set_option_value` with
window-local scope
- `vim.tbl_flatten` -> `vim.iter(t):flatten():totable()`
- `vim.loop.*` -> `vim.uv.*`
- `vim.islist or vim.tbl_islist` -> `vim.islist`

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2024-07-06 23:58:43 +02:00
Folke Lemaitre c6e2d969b8
fix: deprecation warnings on 0.11 2024-05-16 21:55:18 +02:00
Bryan Forbes ea175a511d
fix(jsonls): use `vim.filetype.add()` to set the filetype for neoconf.json (#25) 2023-04-17 08:23:51 +02:00
Folke Lemaitre 9214879f83
feat: better support for root_dir in monorepos. Always return longest. Fixes #14 Fixes #10 2023-03-23 10:30:53 +01:00
Folke Lemaitre eb2bdbf10f
fix: fix file_patterns for autocmd BufWritePost 2022-09-18 22:08:31 +02:00
Folke Lemaitre 8a275c6cee
refactor: changed module name from nvim-settings to neoconf 2022-09-17 18:01:54 +02:00