Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visuals/fidget: migrate to new configuration #211

Merged
merged 6 commits into from
Feb 19, 2024

Conversation

FrothyMarrow
Copy link
Contributor

Updates fidget.nvim to use the rewritten configuration options. Also uses #181.

Opening it up as a draft PR because I still need to figure out how to handle the commented out options.

@FrothyMarrow FrothyMarrow mentioned this pull request Feb 11, 2024
@NotAShelf NotAShelf linked an issue Feb 11, 2024 that may be closed by this pull request
@FrothyMarrow FrothyMarrow force-pushed the fidget-rewrite branch 3 times, most recently from 04dab9c to 78425d0 Compare February 18, 2024 19:33
@FrothyMarrow FrothyMarrow marked this pull request as ready for review February 18, 2024 19:36
@FrothyMarrow
Copy link
Contributor Author

Diff:

a.lua
{
  progress = {
    poll_rate = 0,
    suppress_on_insert = false,
    ignore_done_already = false,
    ignore_empty_message = false,
    clear_on_detach =
      function(client_id)
        local client = vim.lsp.get_client_by_id(client_id)
        return client and client.name or nil
      end,
    notification_group =
      function(msg) return msg.lsp_client.name end,
    ignore = {},

    display = {
      render_limit = 16,
      done_ttl = 3,
      done_icon = "",
      done_style = "Constant",
      progress_ttl = math.huge,
      progress_icon =
        { pattern = "dots", period = 1 },
      progress_style =
        "WarningMsg",
      group_style = "Title",
      icon_style = "Question",
      priority = 30,
      skip_history = true,
      format_message =
        require("fidget.progress.display").default_format_message,
      format_annote =
        function(msg) return msg.title end,
      format_group_name =
        function(group) return tostring(group) end,
      overrides = {
        rust_analyzer = { name = "rust-analyzer" },
      },
    },

    lsp = {
      progress_ringbuf_size = 0,
      log_handler = false,
    },
  },

  notification = {
    poll_rate = 10,
    filter = vim.log.levels.INFO,
    history_size = 128,
    override_vim_notify = false,
    configs =
      { default = require("fidget.notification").default_config },
    redirect =
      function(msg, level, opts)
        if opts and opts.on_open then
          return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
        end
      end,


    view = {
      stack_upwards = true,
      icon_separator = " ",
      group_separator = "---",
      group_separator_hl =
        "Comment",
      render_message =
        function(msg, cnt)
          return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
        end,
    },

    window = {
      normal_hl = "Comment",
      winblend = 100,
      border = "none",
      zindex = 45,
      max_width = 0,
      max_height = 0,
      x_padding = 1,
      y_padding = 0,
      align = "bottom",
      relative = "editor",
    },
  },

  integration = {
    ["nvim-tree"] = {
      enable = true,
    },
    ["xcodebuild-nvim"] = {
      enable = true,
    },
  },

  logger = {
    level = vim.log.levels.WARN,
    max_size = 10000,
    float_precision = 0.01,
    path =
      string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache")),
  },
}
b.lua
{
    ["integration"] = {
        ["nvim-tree"] = {["enable"] = true},
        ["xcodebuild-nvim"] = {["enable"] = true}
    },
    ["logger"] = {
        ["float_precision"] = 0.010000,
        ["level"] = vim.log.levels.WARN,
        ["max_size"] = 10000,
        ["path"] = string.format("%s/fidget.nvim.log", vim.fn.stdpath("cache"))
    },
    ["notification"] = {
        ["configs"] = {
            ["default"] = require("fidget.notification").default_config
        },
        ["filter"] = vim.log.levels.INFO,
        ["history_size"] = 128,
        ["override_vim_notify"] = false,
        ["poll_rate"] = 10,
        ["redirect"] = function(msg, level, opts)
            if opts and opts.on_open then
                return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
            end
        end,
        ["view"] = {
            ["group_separator"] = "---",
            ["group_separator_hl"] = "Comment",
            ["icon_separator"] = " ",
            ["render_message"] = function(msg, cnt)
                return cnt == 1 and msg or string.format("(%dx) %s", cnt, msg)
            end,
            ["stack_upwards"] = true
        },
        ["window"] = {
            ["align"] = "bottom",
            ["border"] = "none",
            ["max_height"] = 0,
            ["max_width"] = 0,
            ["normal_hl"] = "Comment",
            ["relative"] = "editor",
            ["winblend"] = 100,
            ["x_padding"] = 1,
            ["y_padding"] = 0,
            ["zindex"] = 45
        }
    },
    ["progress"] = {
        ["clear_on_detach"] = function(client_id)
            local client = vim.lsp.get_client_by_id(client_id)
            return client and client.name or nil
        end,
        ["display"] = {
            ["done_icon"] = "",
            ["done_style"] = "Constant",
            ["done_ttl"] = 3,
            ["format_annote"] = function(msg)
                return msg.title
            end,
            ["format_group_name"] = function(group)
                return tostring(group)
            end,
            ["format_message"] = require("fidget.progress.display").default_format_message,
            ["group_style"] = "Title",
            ["icon_style"] = "Question",
            ["overrides"] = {["rust_analyzer"] = {name = "rust-analyzer"}},
            ["priority"] = 30,
            ["progress_icon"] = {
                ["pattern"] = "dots",
                ["period"] = 1
            },
            ["progress_style"] = "WarningMsg",
            ["progress_ttl"] = 99999,
            ["render_limit"] = 16,
            ["skip_history"] = true
        },
        ["ignore_done_already"] = false,
        ["ignore_empty_message"] = false,
        ["lsp"] = {["log_handler"] = false, ["progress_ringbuf_size"] = 100},
        ["notification_group"] = function(msg)
            return msg.lsp_client.name
        end,
        ["poll_rate"] = 0,
        ["suppress_on_insert"] = false
    }
}

@NotAShelf
Copy link
Owner

NotAShelf commented Feb 19, 2024

Looks good, still overlaps with the statusline (I was hoping the refactor would fix that) and I'd like to avoid merging until we figure out why that's happening.

Was not caused by fidget.

Copy link
Owner

@NotAShelf NotAShelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@NotAShelf NotAShelf changed the base branch from main to v0.6 February 19, 2024 06:38
@FrothyMarrow
Copy link
Contributor Author

Added missing docs entry. Should be good now.

@NotAShelf
Copy link
Owner

Could you use mkRemovedOptionModule to document the removal ofvim.fidget-nvim.align.right as well as mkRenamedOptionModulefor vim.fidget-nvim.align.bottom to handle deprecation more gracefully?

@horriblename
Copy link
Collaborator

pushed a commit to use mkRenamedOptionModule where possible.


I'm planning to add a custom rawLua type, which would allow users to use rawLua for setupOpts not specified by us, but haven't figured out an elegant solution

right now what I'm thinking is something like:

some_option = mkOption {
  type = nvim.types.rawLua;
  default = nvim.types.newRawLua ''function() return 1 end'';
}

config.some_option = nvim.types.newRawLua ''function() return 2 end'';

it's a bit clunky though so I'm open to other ideas

@FrothyMarrow
Copy link
Contributor Author

The reason I did not use mkRenamedOptionModule is because it is not exactly a rename. They have different types, because the user has to change the configuration regardless, I preferred throwing an error instead.

@NotAShelf NotAShelf merged commit 60b0b40 into NotAShelf:v0.6 Feb 19, 2024
7 checks passed
@FrothyMarrow FrothyMarrow deleted the fidget-rewrite branch February 20, 2024 00:18
bloxx12 pushed a commit to bloxx12/nvf that referenced this pull request Sep 29, 2024
visuals/fidget: migrate to new configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update fidget.vim
3 participants