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:
+8
-8
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user