nvim-flutter / flutter-tools.nvim

Tools to help create flutter apps in neovim using the native lsp
MIT License
1.07k stars 83 forks source link

[Bug]: flutter-tools setup fails with Normal hl-group bg color set to "none" #127

Closed imelinonkaneko closed 2 years ago

imelinonkaneko commented 2 years ago

Describe the bug My colorscheme sets the Normal background color to "none", which makes the vim.api.nvim_get_hl_by_name("Normal", true)["background"] call in your config script (config.lua:100) return nil. The config script then fails when it tries to do something with this color.

Error message: packer.nvim: Error running config for flutter-tools.nvim: ...flutter-tools.nvim/lua/flutter-tools/lsp/color/utils.lua:66: bad argument #1 to 'rshift' (number expected, got nil)

To Reproduce Steps to reproduce the behavior:

  1. Choose a colorscheme with background color of "Normal" highlight group set to "none"
  2. require"flutter-tools".setup{} in your config

Expected behavior Flutter-tools should start without errors and use a transparent background color.

Screenshots

System information

Additional context

akinsho commented 2 years ago

@Sympel thanks for reporting this I always forget that some people use transparent terminals so background colors can't be depended on consistently. I'll have a look at that as soon as I get a chance.

akinsho commented 2 years ago

@Sympel I've deactivated the logic for LSP colours in transparent backgrounds for now and removed the background logic from the configuration module. I have absolutely no idea how to make the logic work for transparent backgrounds, as I was not the original author of the code. This way, at least you won't be blocked from using the plugin.

akinsho commented 2 years ago

I guess you could always specify a config.lsp.color.background_color yourself if you want it to work despite having a transparent terminal.