Skip to content

fix: Harden public entry-point contracts#32

Merged
mhiro2 merged 2 commits intomainfrom
fix/setup-input-and-lsp-callback
Apr 26, 2026
Merged

fix: Harden public entry-point contracts#32
mhiro2 merged 2 commits intomainfrom
fix/setup-input-and-lsp-callback

Conversation

@mhiro2
Copy link
Copy Markdown
Owner

@mhiro2 mhiro2 commented Apr 26, 2026

Summary

  • Prevent setup(opts) from crashing on non-table inputs by falling back to defaults with a warning
  • Ensure the LSP provider always satisfies its callback contract, even when no clients are attached

Changes

  • 9402146 : fix(config): handle non-table setup opts gracefully
    • Guard setup(opts) against truthy non-table values (booleans, strings, numbers) that previously crashed vim.tbl_deep_extend, falling back to defaults with a warning
    • Cover boolean / string / number inputs in tests/config_spec.lua
  • 56fc38a : fix(providers): always invoke lsp request callback
    • Invoke cb({}) when no LSP clients are attached or when vim.lsp.get_clients returns nil, so consumers can rely on the provider contract
    • Add empty-client and nil-client coverage in tests/lsp_provider_spec.lua

mhiro2 added 2 commits April 26, 2026 19:18
Warn and fall back to defaults when setup() receives a non-table
value, preventing vim.tbl_deep_extend from raising on truthy
scalars like booleans or strings.
Call cb({}) when no LSP clients are attached or when
vim.lsp.get_clients returns nil so consumers can rely on
the provider contract.
@mhiro2 mhiro2 self-assigned this Apr 26, 2026
@mhiro2 mhiro2 added the bug Something isn't working label Apr 26, 2026
@mhiro2 mhiro2 merged commit 1b1f405 into main Apr 26, 2026
3 checks passed
@mhiro2 mhiro2 deleted the fix/setup-input-and-lsp-callback branch April 26, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant