Skip to content

Commit

Permalink
fix: config validation fails if server.settings option is a table (#57
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mrcjkb authored Nov 13, 2023
1 parent 998f1bd commit a3798bd
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 16 deletions.
65 changes: 50 additions & 15 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,87 @@
<!-- markdownlint-disable -->
<!-- markdownlint-disable MD024 -->
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.5.1] - 2023-11-13

### Fixed

- Config validation fails if `server.settings` option is a table [[#56](https://github.com/mrcjkb/rustaceanvim/issues/56)].

## [3.5.0] - 2023-11-11

## Added
### Added

- Ability to load rust-analyzer settings from project-local JSON files.

## [3.4.2] - 2023-11-11

## Fixed
### Fixed

- Open external docs broken in Neovim 0.9 [[#50](https://github.com/mrcjkb/rustaceanvim/issues/50)].

## [3.4.1] - 2023-11-10

## Fixed
### Fixed

- Command completion broken in Neovim 0.9 [[#47](https://github.com/mrcjkb/rustaceanvim/issues/47)].

## [3.4.0] - 2023-11-01

## Added
### Added

- Auto-create `codelldb` configurations.

## Fixed
### Fixed

- DAP: Support `codelldb` configurations [[#40](https://github.com/mrcjkb/rustaceanvim/issues/40)].
- DAP: Don't pass in an empty source map table if the
- DAP: Don't pass in an empty source map table if the
`auto_generate_source_map` setting evaluates to `false`.

## [3.3.3] - 2023-10-31

### Fixed

- Default rust-analyzer configuration [[#37](https://github.com/mrcjkb/rustaceanvim/issues/37)].
Thanks again, [@eero-lehtinen](https://github.com/eero-lehtinen)!

## [3.3.2] - 2023-10-31
## Fixed

### Fixed

- Cargo workspace reload using removed command [[#36](https://github.com/mrcjkb/rustaceanvim/pull/36)].
Thanks [@eero-lehtinen](https://github.com/eero-lehtinen)!

## [3.3.1] - 2023-10-31

## Fixed
### Fixed

- Neovim 0.9 compatibility layer: Missing `nil` checks [[#32](https://github.com/mrcjkb/rustaceanvim/issues/32)].

## [3.3.0] - 2023-10-30

### Added

- DAP: Auto-generate source map, to allow stepping into `std`.

## [3.2.1] - 2023-10-29

### Fixed

- `dap`/`quickfix` executor: Fix setting `cwd` for shell commands.

## [3.2.0] - 2023-10-29

### Added

- Completions for `:RustLsp` subcommands' arguments.

### Changed

- Removed `plenary.nvim` dependency (`dap` and `quickfix` executor).
This plugin now has no `plenary.nvim` dependencies left.
NOTE: As this does **not** lead to a bump in the minimal requirements,
Expand All @@ -71,47 +90,56 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.1.1] - 2023-10-28

### Fixed
- Remove accidental use of Neovim nightly API (`dap`, `crateGraph`, `explainError`) [[#26](https://github.com/mrcjkb/rustaceanvim/issues/26)].

- Remove accidental use of Neovim nightly API
(`dap`, `crateGraph`, `explainError`) [[#26](https://github.com/mrcjkb/rustaceanvim/issues/26)].
- Add static type checking for Neovim stable API.

## [3.1.0] - 2023-10-28

### Added

- `:RustLsp explainError` command, uses `rustc --explain` on error diagnostics with
an error code.
- `:RustLsp rebuildProcMacros` command.

### Fixed

- Health check got stuck if `lldb-vscode` was installed.

## [3.0.4] - 2023-10-25

### Fixed

- Allow `:RustLsp hover range` to accept a range.
- Fix `:RustLsp crateGraph` passing arguments as list.

## [3.0.3] - 2023-10-25

### Fixed

- Potential attempt to index `nil` upvalue when sending `workspace/didChangeWorkspaceFolders`
to LSP server [[#22](https://github.com/mrcjkb/rustaceanvim/issues/22)].

## [3.0.2] - 2023-10-23

### Fixed
- Hover actions: Tree-sitter syntax highlighting

- Hover actions: Tree-sitter syntax highlighting
in Neovim 0.9 [[#20](https://github.com/mrcjkb/rustaceanvim/issues/20)].

## [3.0.1] - 2023-10-23

### Fixed

- Add support for `workspace/didChangeWorkspaceFolders` to prevent more than one
rust-analyzer server from spawning per Neovim instance [[#7](https://github.com/mrcjkb/rustaceanvim/issues/7)].
- Neovim 0.9 compatibility [[#9](https://github.com/mrcjkb/rustaceanvim/issues/9)].

## [3.0.0] - 2023-10-22

### Changed

- Renamed this plugin to `rustaceanvim`,
to avoid potential clashes with [`vxpm/ferris.nvim`](https://github.com/vxpm/ferris.nvim),
`vxpm/ferris.nvim` was created just before I renamed my fork
Expand All @@ -120,6 +148,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2.1.1] - 2023-10-22

### Fixed

- Open external docs: Use `xdg-open` or `open` (MacOS) by default
and fall back to `netrw`.
Remove redundant URL encoding.
Expand All @@ -142,22 +171,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2.0.0] - 2023-10-21

### Breaking changes

- Don't pollute the command space:
Use a single command with subcommands and completions.
- `RustAnalyzer [start|stop]`
- `RustAnalyzer [start|stop]`
(always available in Rust projects)
- `RustLsp [subcommand]`
- `RustLsp [subcommand]`
(available when the LSP client is running)
e.g. `RustLsp moveItem [up|down]`

## [1.0.1] - 2023-10-21

### Fixed

- Hover actions + command cache: module requires.

## [1.0.0] - 2023-10-21

### Added

- Initial release of `rustaceanvim`.
- `:RustSyntaxTree` and `:RustFlyCheck` commands.
- `:RustAnalyzerStart` and `:RustAnalyzerStop` commands.
Expand All @@ -170,18 +202,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Minimal config for troubleshooting.

### Internal

- Added type annotations.
- Nix CI and linting infrastructure and static type checking.
- Lazy load command modules.

### Fixed

- Numerous potential bugs encountered during rewrite.
- Erroneous semantic token highlights.
- Make sure we only send LSP requests to the correct client.

### Breaking changes compared to `rust-tools.nvim`
- [Removed the `setup` function](https://mrcjkb.dev/posts/2023-08-22-setup.html) and revamped the architecture
to be less prone to type errors.

- [Removed the `setup` function](https://mrcjkb.dev/posts/2023-08-22-setup.html)
and revamped the architecture to be less prone to type errors.
This plugin is a filetype plugin and works out of the box.
The default configuration should work for most people,
but it can be configured with a `vim.g.rustaceanvim` table.
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/config/check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function M.validate(cfg)
ok, err = validate('server', {
cmd = { server.cmd, { 'function', 'table' } },
standalone = { server.standalone, 'boolean' },
settings = { server.settings, 'function', 'table', true },
settings = { server.settings, { 'function', 'table' }, true },
})
if not ok then
return false, err
Expand Down
28 changes: 28 additions & 0 deletions spec/56_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
local stub = require('luassert.stub')
local notify = stub(vim, 'notify')

describe('#56-non-regression: server.settings is table', function()
vim.g.rustaceanvim = {
server = {
settings = {
['rust-analyzer'] = {
cargo = { allFeatures = true },
checkOnSave = true,
check = {
enable = true,
command = 'clippy',
features = 'all',
},
procMacro = {
enable = true,
},
},
},
},
}
it('No errors or warning on config initialization', function()
local ok, err = pcall(require, 'rustaceanvim.config.internal')
assert(ok, 'Error on initialization: ' .. vim.inspect(err))
assert.stub(notify).was_not_called()
end)
end)

0 comments on commit a3798bd

Please sign in to comment.