Calculates all the external dependencies the given Tree has.
Calculates all the external dependencies the given Tree has.
Compared to neededImports
, this function might also return
trees that don't need to be explicitly imported, for example
because they are defined in the same compilation unit.
Finds the last "visible" (with a range position) select in some tree selection.
Finds the last "visible" (with a range position) select in some tree selection.
Selects are usually only partly written down in source code (except when we write down the full name to some identifier), so there exists a select at which the tree turns from being visible to being invisible. We need to find this tree to determine whether we need do make an import with the minimally required path.
This function also already filters trees that we don't need to import, e.g. from the Predef or the scala package.
Helper function to filter out trees that we don't need to import, for example because they come from Predef.
Locate the smallest tree that encloses position.
Locate the smallest tree that encloses position.
The tree in which to search pos
The position to look for
An additional condition to be satisfied by the resulting tree
The innermost enclosing tree for which p is true, or EmptyTree
if the position could not be found.
Calculates a list of all needed imports for the given Tree.