forked from lix-project/lix
completeInstallable: also match for already typed prefixes
This commit is contained in:
parent
70cb2ffacc
commit
3c5f69bb60
1 changed files with 8 additions and 2 deletions
|
@ -185,9 +185,12 @@ void SourceExprCommand::completeInstallable(std::string_view prefix)
|
||||||
|
|
||||||
std::string prefix_ = std::string(prefix);
|
std::string prefix_ = std::string(prefix);
|
||||||
auto sep = prefix_.rfind('.');
|
auto sep = prefix_.rfind('.');
|
||||||
|
std::string searchWord;
|
||||||
if (sep != std::string::npos) {
|
if (sep != std::string::npos) {
|
||||||
prefix_.erase(sep);
|
searchWord = prefix_.substr(sep, std::string::npos);
|
||||||
|
prefix_ = prefix_.substr(0, sep);
|
||||||
} else {
|
} else {
|
||||||
|
searchWord = prefix_;
|
||||||
prefix_ = "";
|
prefix_ = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -198,9 +201,12 @@ void SourceExprCommand::completeInstallable(std::string_view prefix)
|
||||||
|
|
||||||
if (v2.type() == nAttrs) {
|
if (v2.type() == nAttrs) {
|
||||||
for (auto & i : *v2.attrs) {
|
for (auto & i : *v2.attrs) {
|
||||||
|
std::string name = i.name;
|
||||||
|
if (name.find(searchWord) == 0) {
|
||||||
completions->add(i.name);
|
completions->add(i.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
completeFlakeRefWithFragment(
|
completeFlakeRefWithFragment(
|
||||||
getEvalState(),
|
getEvalState(),
|
||||||
|
|
Loading…
Reference in a new issue