Skip to content

Commit

Permalink
feat(config): add ability to set web-browser-flag (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
sidlatau authored Nov 13, 2024
1 parent 7e6d861 commit 80770c6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ require('flutter-tools').setup_project({
name = 'Web',
device = 'chrome',
flavor = 'WebApp',
web_port = 4000
web_port = "4000",
web_browser_flag = "--disable-web-security",
},
{
name = 'Profile',
Expand Down
3 changes: 2 additions & 1 deletion doc/flutter-tools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ _conceptually_ to vscode’s `launch.json` file.
name = 'Web',
device = 'chrome',
flavor = 'WebApp',
web_port = 4000
web_port = "4000",
web_browser_flag = "--disable-web-security",
},
{
name = 'Profile',
Expand Down
2 changes: 2 additions & 0 deletions lua/flutter-tools/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ local function get_run_args(opts, conf)
local flutter_mode = conf and conf.flutter_mode
local web_port = conf and conf.web_port
local dev_url = dev_tools.get_url()
local web_browser_flag = conf and conf.web_browser_flag

if not use_debugger_runner() then vim.list_extend(args, { "run" }) end
if not cmd_args and device then vim.list_extend(args, { "-d", device }) end
Expand All @@ -158,6 +159,7 @@ local function get_run_args(opts, conf)
end -- else default to debug
end
if dev_url then vim.list_extend(args, { "--devtools-server-address", dev_url }) end
if web_browser_flag then vim.list_extend(args, { "--web-browser-flag", web_browser_flag }) end
return args
end

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 @@ -12,8 +12,9 @@ local utils = lazy.require("flutter-tools.utils") ---@module "flutter-tools.util
---@field dart_define? {[string]: string}
---@field dart_define_from_file? string
---@field flutter_mode? string
---@field web_port? number
---@field web_port? string
---@field cwd? string full path of current working directory, defaults to LSP root
---@field web_browser_flag? string e.g. --web-browser-flag "--disable-web-security"

local M = {}

Expand Down

0 comments on commit 80770c6

Please sign in to comment.