Skip to content

Commit

Permalink
feat(commands): add option to silence flutter errors (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
akinsho authored Apr 20, 2023
1 parent 8d7cb14 commit bafdc2c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ require("flutter-tools").setup {
},
dev_log = {
enabled = true,
notify_errors = false, -- if there is an error whilst running then notify the user
open_cmd = "tabedit", -- command to use to open the log buffer
},
dev_tools = {
Expand Down
4 changes: 2 additions & 2 deletions lua/flutter-tools/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ end
---Handle output from flutter run command
---@param is_err boolean if this is stdout or stderr
local function on_run_data(is_err, data)
if is_err then ui.notify(data, ui.ERROR, { timeout = 5000 }) end
if is_err and config.dev_log.notify_errors then ui.notify(data, ui.ERROR, { timeout = 5000 }) end
dev_log.log(data, config.dev_log)
end

local function shutdown()
if runner ~= nil then runner:cleanup() end
if runner then runner:cleanup() end
runner = nil
current_device = nil
utils.emit_event(utils.events.PROJECT_CONFIG_CHANGED)
Expand Down
3 changes: 2 additions & 1 deletion lua/flutter-tools/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ local config = {
}),
dev_log = setmetatable({
enabled = true,
notify_errors = false,
}, {
__index = function(_, k) return k == "open_cmd" and get_split_cmd(0.4, 50) or nil end,
}),
Expand Down Expand Up @@ -159,7 +160,7 @@ function M.set(user_config)
for key, value in pairs(user_config) do
handle_deprecation(key, value, user_config)
end
config = require("flutter-tools.utils").merge(config, user_config)
config = vim.tbl_deep_extend("force", config, user_config)
return config
end

Expand Down

0 comments on commit bafdc2c

Please sign in to comment.