dpayne / CodeGPT.nvim

CodeGPT is a plugin for neovim that provides commands to interact with ChatGPT.
GNU General Public License v3.0
764 stars 50 forks source link

Attempt at loading status.. #16

Closed roobert closed 1 year ago

roobert commented 1 year ago

Apologies for the formatting change - if you let me know which formatter/settings you use I can reformat the file!

00sapo commented 1 year ago

Tested, and I needed to change all the require('CodeGPT') to require('codegpt')

My config:

  {
    "roobert/CodeGPT.nvim",
    branch = 'loading-status',
    config = function()
      -- optional configuration
      vim.g["codegpt_hooks"] = {
        request_started = function()
          print("CodeGPT is loading..")
        end,
        request_finished = function()
          print("CodeGPT has finished")
        end
      }
      lvim.builtin.lualine.on_config_done = function(lualine)
        local config = lualine.get_config()
        table.insert(config.sections.lualine_x, 1, { require("codegpt").status })
        lualine.setup(config)
      end
    end,
    -- lazy = false,
    -- priority = 1000,
    dependencies = {
      { "MunifTanjim/nui.nvim" },
      { "nvim-lua/plenary.nvim" },
      { "nvim-telescope/telescope.nvim" }
    }

  }

I'm not sure about the lazy and priority options...

dpayne commented 1 year ago

@roobert sorry for the delay, I really liked the idea but wanted to refactor it a bit. I pulled in your changes then add some changes on top here https://github.com/dpayne/CodeGPT.nvim/pull/20/files?w=1. Do you mind reviewing it to make sure it still covers your usecase and for any improvements you would want?

roobert commented 1 year ago

@roobert sorry for the delay, I really liked the idea but wanted to refactor it a bit. I pulled in your changes then add some changes on top here https://github.com/dpayne/CodeGPT.nvim/pull/20/files?w=1. Do you mind reviewing it to make sure it still covers your usecase and for any improvements you would want?

@dpayne - nice one, looks good! The reason for the unique IDs was if you wanted to have individual loading statuses for different requests but in retrospect I think it's probably overkill and your solution is much nicer. 👍

id-b3 commented 1 year ago

Is the loading status now implemented? I installed the plugin and it works well, but I don't see any loading/spinner status.

dpayne commented 1 year ago

you need to implement the hooks or use something like this https://github.com/dpayne/codegpt.nvim#lualine-status-component