don't use full Pos for findPackageFilename/editorFor

only file and line of the returned position were ever used, it wasn't actually
used a position. as such we may as well use a path+int pair for only those two
values and remove a use of Pos that would not work well with a position table.
This commit is contained in:
pennae
2022-04-21 21:25:18 +02:00
parent 38de79fcf7
commit 39df15fb8e
6 changed files with 29 additions and 31 deletions
+8 -8
View File
@@ -30,17 +30,17 @@ struct CmdEdit : InstallableCommand
auto [v, pos] = installable->toValue(*state);
try {
pos = findPackageFilename(*state, *v, installable->what());
} catch (NoPositionInfo &) {
}
if (pos == noPos)
throw Error("cannot find position information for '%s", installable->what());
const auto [file, line] = [&] {
try {
return findPackageFilename(*state, *v, installable->what());
} catch (NoPositionInfo &) {
throw Error("cannot find position information for '%s", installable->what());
}
}();
stopProgressBar();
auto args = editorFor(pos);
auto args = editorFor(file, line);
restoreProcessContext();