File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,7 @@ require('copilot').setup({
159159 copilot_node_command = ' node' , -- Node.js version must be > 20
160160 workspace_folders = {},
161161 copilot_model = " " ,
162+ disable_limit_reached_message = false , -- Set to `true` to suppress completion limit reached popup
162163 root_dir = function ()
163164 return vim .fs .dirname (vim .fs .find (" .git" , { upward = true })[1 ])
164165 end ,
Original file line number Diff line number Diff line change @@ -35,6 +35,19 @@ function M.get_handlers()
3535 })
3636 end
3737
38+ if config .disable_limit_reached_message then
39+ handlers [" window/showMessageRequest" ] = (function (overridden )
40+ return function (err , params , ctx )
41+ if params .message :match ([[ ^You've reached.*limit.*Upgrade.*$]] ) then
42+ -- ignore
43+ logger .trace (" API limited:" , params .message )
44+ return vim .NIL
45+ end
46+ return overridden (err , params , ctx )
47+ end
48+ end )(vim .lsp .handlers [" window/showMessageRequest" ])
49+ end
50+
3851 return handlers
3952end
4053
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ local logger = require("copilot.logger")
1313--- @field root_dir RootDirFuncOrString Root directory for the project , defaults to the nearest .git directory
1414--- @field should_attach ShouldAttachFunc Function to determine if Copilot should attach to the buffer
1515--- @field copilot_node_command string Path to the Node.js executable , defaults to " node"
16+ --- @field disable_limit_reached_message boolean Disable the limit reached message , defaults to false
1617
1718local initialized = false
1819
@@ -30,6 +31,7 @@ local M = {
3031 server_opts_overrides = {},
3132 copilot_model = nil ,
3233 copilot_node_command = " node" ,
34+ disable_limit_reached_message = false ,
3335}
3436
3537--- @param user_configs CopilotConfig
You can’t perform that action at this time.
0 commit comments