diff options
| author | ruki <[email protected]> | 2018-02-03 17:19:54 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-02-03 17:19:54 +0800 |
| commit | 59c54d54023e4bf9f47095dada02497747f5e0a7 (patch) | |
| tree | e96923da43aa29162959a3fb2a58e8b2fbb5a454 | |
| parent | 5b201819dfc59ecc516f2d3b812b6a782d6244fd (diff) | |
add sourceinfo to search results
| -rw-r--r-- | xmake/actions/config/menuconf.lua | 14 | ||||
| -rw-r--r-- | xmake/core/ui/mconfdialog.lua | 6 |
2 files changed, 16 insertions, 4 deletions
diff --git a/xmake/actions/config/menuconf.lua b/xmake/actions/config/menuconf.lua index 9e044347d..7a071cdff 100644 --- a/xmake/actions/config/menuconf.lua +++ b/xmake/actions/config/menuconf.lua @@ -170,11 +170,11 @@ function app:_make_configs_by_category(root, options_by_category, cache, get_opt -- insert config before all sub-menus if info.kind == "string" then - table.insert(subconfigs, menu_index, menuconf.string {name = info.name, value = value, default = info.default, path = config_path, description = info.description}) + table.insert(subconfigs, menu_index, menuconf.string {name = info.name, value = value, default = info.default, path = config_path, description = info.description, sourceinfo = info.sourceinfo}) elseif info.kind == "boolean" then - table.insert(subconfigs, menu_index, menuconf.boolean {name = info.name, value = value, default = info.default, path = config_path, description = info.description}) + table.insert(subconfigs, menu_index, menuconf.boolean {name = info.name, value = value, default = info.default, path = config_path, description = info.description, sourceinfo = info.sourceinfo}) elseif info.kind == "choice" then - table.insert(subconfigs, menu_index, menuconf.choice {name = info.name, value = value, default = info.default, path = config_path, values = info.values, description = info.description}) + table.insert(subconfigs, menu_index, menuconf.choice {name = info.name, value = value, default = info.default, path = config_path, values = info.values, description = info.description, sourceinfo = info.sourceinfo}) end end end @@ -288,6 +288,12 @@ function app:_project_configs(cache) -- get kind local kind = (type(default) == "string") and "string" or "boolean" + -- get description + local description = opt:get("description") + + -- get source info + local sourceinfo = (opt:get("__sourceinfo_description") or {})[type(description) == "table" and description[1] or description] + -- choice option? local values = opt:get("values") if values then @@ -299,7 +305,7 @@ function app:_project_configs(cache) end end end - return {name = opt:name(), kind = kind, default = default, values = values, description = opt:get("description")} + return {name = opt:name(), kind = kind, default = default, values = values, description = description, sourceinfo = sourceinfo} end) return self._PROJECT_CONFIGS end diff --git a/xmake/core/ui/mconfdialog.lua b/xmake/core/ui/mconfdialog.lua index 92b7a1f59..fdd82565d 100644 --- a/xmake/core/ui/mconfdialog.lua +++ b/xmake/core/ui/mconfdialog.lua @@ -197,6 +197,9 @@ function mconfdialog:searchdialog() if config.path then results = results .. "\npath: " .. config.path end + if config.sourceinfo then + results = results .. "\nposition: " .. (config.sourceinfo.file or "") .. ":" .. (config.sourceinfo.line or "-1") + end results = results .. "\n" end self:show_result(results) @@ -259,6 +262,9 @@ function mconfdialog:show_help() if config.path then text = text .. "\npath: " .. config.path end + if config.sourceinfo then + text = text .. "\nposition: " .. (config.sourceinfo.file or "") .. ":" .. (config.sourceinfo.line or "-1") + end self:helpdialog():text():text_set(text) -- show help |
