NotAShelf / nvf

A highly modular, extensible and distro-agnostic Neovim configuration framework for Nix/NixOS.
https://notashelf.github.io/nvf/
MIT License
158 stars 26 forks source link

plugins/lsp: filter out null mappings #287

Closed FrothyMarrow closed 4 months ago

FrothyMarrow commented 4 months ago

Adds a check to filter out null mappings in local function mkBinding.

It is only an issue with the LSP module because it doesn't use genMaps to generate the mappings and therefore doesn't filter them out automatically.

Fixes #281

NotAShelf commented 4 months ago

If I understand correctly, passing null to the mkBinding function will still create a binding - but it will be an empty string, and not an actual mapping. We should probably write conditionally. Null should mean don't write, and not write empty string.

FrothyMarrow commented 4 months ago

I can use filterAttrs on mappings to filter out null mappings.

The issue is that it will generate missing attribute errors when trying to add an action (using mkBinding) to the filtered out mapping option.

To resolve that, it will require toLuaObject magic to convert mappings list to actual mappings.