mirror of
https://github.com/textmate/textmate.git
synced 2026-04-06 03:01:29 -04:00
Don’t pass base environment to bundle_variables
This commit is contained in:
@@ -187,7 +187,7 @@ void run_impl (bundle_command_t const& command, ng::buffer_t const& buffer, ng::
|
||||
|
||||
if(bundles::item_ptr item = bundles::lookup(command.uuid))
|
||||
{
|
||||
baseEnv = item->bundle_variables(baseEnv);
|
||||
baseEnv << item->bundle_variables();
|
||||
|
||||
bundles::required_command_t failedRequirement;
|
||||
if(missing_requirement(item, baseEnv, &failedRequirement))
|
||||
|
||||
@@ -205,11 +205,12 @@ namespace bundles
|
||||
return NULL_STR;
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> item_t::bundle_variables (std::map<std::string, std::string> base) const
|
||||
std::map<std::string, std::string> item_t::bundle_variables () const
|
||||
{
|
||||
std::map<std::string, std::string> base;
|
||||
if(_kind != kItemTypeBundle)
|
||||
{
|
||||
base = bundle()->bundle_variables(base);
|
||||
base << bundle()->bundle_variables();
|
||||
|
||||
base["TM_BUNDLE_ITEM_NAME"] = name();
|
||||
base["TM_BUNDLE_ITEM_UUID"] = to_s(uuid());
|
||||
@@ -221,19 +222,12 @@ namespace bundles
|
||||
base["TM_BUNDLE_SUPPORT"] = bundleSupportPath;
|
||||
}
|
||||
|
||||
iterate(require, _required_bundles)
|
||||
for(auto require : _required_bundles)
|
||||
{
|
||||
auto bundles = query(kFieldName, require->_name, scope::wildcard, kItemTypeBundle, require->_uuid);
|
||||
auto bundles = query(kFieldName, require._name, scope::wildcard, kItemTypeBundle, require._uuid);
|
||||
if(bundles.size() == 1)
|
||||
{
|
||||
std::map<std::string, std::string> vars;
|
||||
vars.insert(std::make_pair("name", require->_name));
|
||||
base[format_string::expand("TM_${name/.*/\\U${0/[^a-zA-Z]+/_/g}/}_BUNDLE_SUPPORT", vars)] = (bundles.back())->support_path();
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "*** %s: unable to find required bundle: %s / %s\n", full_name().c_str(), require->_name.c_str(), to_s(require->_uuid).c_str());
|
||||
}
|
||||
base[format_string::expand("TM_${name/.*/\\U${0/[^a-zA-Z]+/_/g}/}_BUNDLE_SUPPORT", std::map<std::string, std::string>{ { "name", require._name } })] = (bundles.back())->support_path();
|
||||
else fprintf(stderr, "*** %s: unable to find required bundle: %s / %s\n", full_name().c_str(), require._name.c_str(), to_s(require._uuid).c_str());
|
||||
}
|
||||
|
||||
return base;
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace bundles
|
||||
oak::uuid_t const& uuid () const;
|
||||
oak::uuid_t bundle_uuid () const;
|
||||
scope::selector_t const& scope_selector () const;
|
||||
std::map<std::string, std::string> bundle_variables (std::map<std::string, std::string> base = string_map_t()) const;
|
||||
std::map<std::string, std::string> bundle_variables () const;
|
||||
plist::dictionary_t const& plist () const;
|
||||
kind_t kind () const;
|
||||
|
||||
|
||||
@@ -132,11 +132,11 @@ namespace bundles
|
||||
riterate(item, items)
|
||||
{
|
||||
stack.push_back(std::set<std::string>());
|
||||
citerate(pair, parse_variables(*item))
|
||||
for(auto pair : parse_variables(*item))
|
||||
{
|
||||
std::string const value = format_string::expand(pair->second, (*item)->bundle_variables(res));
|
||||
res[pair->first] = value;
|
||||
stack.back().insert(pair->first);
|
||||
auto tmp = (*item)->bundle_variables();
|
||||
res[pair.first] = format_string::expand(pair.second, tmp << res);
|
||||
stack.back().insert(pair.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +150,8 @@ namespace filter
|
||||
|
||||
void run (bundles::item_ptr filter, std::string const& path, io::bytes_ptr content, callback_ptr context)
|
||||
{
|
||||
command::runner_ptr runner = command::runner(parse_command(filter), ng::buffer_t(), ng::ranges_t(), bundles::scope_variables(file::path_attributes(path), filter->bundle_variables(file::path_variables(path))), command::delegate_ptr(new event_delegate_t(content, context)));
|
||||
std::map<std::string, std::string> variables = file::path_variables(path);
|
||||
command::runner_ptr runner = command::runner(parse_command(filter), ng::buffer_t(), ng::ranges_t(), bundles::scope_variables(file::path_attributes(path), variables << filter->bundle_variables()), command::delegate_ptr(new event_delegate_t(content, context)));
|
||||
runner->launch();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user