Hi Fabio,

thanks for the hint. I think the issue is that in my example both source 
folders use the same module name, that is my project referencing the shared 
module looks like this:

user (not a source folder)
  - test1 (source folder)
  |   - test.py
  |
  - test2 (source folder)
      - test.py

And getModulesWithToken builds a treemap based on the module names. For both 
files in my example the module name is 'test' and hence the second one is 
ignored when considering which modules contain the function that is about to 
be renamed.

A quick try changing ModulesKey.compareTo to consider the path if the name is 
the same helps, but it seems the purpose of the class is to compare only 
based on the module name so I'm not sure what a proper fix for that situation 
would look like.

This is with development just updated 2 hours ago.

I've now also tried a scenario thats closer to my real-world usecase, that 
has just 1 source folder in the user project and inside that source folder 
there are two subfolders test1 and test2 each with a test.py. In this case 
the reference in neither of the two test modules is being renamed, I guess 
the fact that the two folders have no __init__.py declaring them packages 
makes PyDev ignore the modules inside?

The layout for this case is like:

user (not a source folder)
  - base (source folder)
      - test1 (not a source folder)
      |   - test.py
      |
      - test2 (not a source folder)
          - test.py

I understand that neither may be a typical setup for PyDev projects but it 
would be great if I could make at least the last one work - possibly by 
allowing some extension mechanism to help determining that case and providing 
the modules that need to be considered.

Andreas

On 2015-03-23 17:47, Fabio Zadrozny wrote:
> Hi Andreas,
> 
> I recently changed some things in that area... (so, make sure you have the 
> latest development branch before starting to check it there to
> avoid conflicts) the place which checks the modules we want to look for 
> tokens is:
> 
> com.python.pydev.analysis.additionalinfo.AbstractAdditionalDependencyInfo.getModulesWithToken(IProject,
>  
> String, IProgressMonitor), so, that'd
> be the first thing to check (if the modules are being found there in that 
> situation).
> 
> Best Regards,
> 
> Fabio
> 
> On Mon, Mar 23, 2015 at 1:32 PM, Andreas Pakulat <andr...@froglogic.com> 
> wrote:
> 
>> Hi,
>> 
>> I recently found that the renaming of functions with PyDev does not quite 
>> work as one would expect. Given the following setup there are two
>> issues I see happening with 3.9.2:
>> 
>> - 2 Projects shared and user
>> - None of the two projects has its project directory set as a pydev source 
>> folder
>> - The shared project has a linked folder that is set as a source folder
>> - the linked folder has a single python module with a single function
>> - The user project has two subfolders each is set up as a pydev source 
>> folder in that project
>> - The user project has the shared project in its project references
>> - Each of the subfolders has a test.py with a function and each imports and 
>> uses the function from the shared project's linked folder
>> 
>> Now when renaming the shared function inside either of the test.py files it 
>> is being renamed in that file and in the module in the shared
>> project, but it is not being renamed in the other test.py in the user 
>> project.
>> 
>> If the renaming is initiated in the shared functions definition module in 
>> the shared project none of the references in the user project are
>> adapted.
>> 
>> I'm attaching two zip's one containing the two project the other one 
>> containing the linked folder.
>> 
>> Since I saw several renaming tickets being in the backlog I wanted to see 
>> if I could find the culprit myself but couldn't. So I'd
>> appreciate any pointers as to where to look for the part that gathers all 
>> 'places' that need to be adjusted when when renaming a function.
>> 
>> Andreas
>> 
>> --
>> Andreas Pakulat squ...@froglogic.com
>> froglogic GmbH - Automated UI and Web Testing
>> ------------------------------------------------------------------------------
>> Dive into the World of Parallel Programming The Go Parallel Website, 
>> sponsored
>> by Intel and developed in partnership with Slashdot Media, is your hub for 
>> all
>> things parallel software development, from weekly thought leadership blogs 
>> to
>> news, videos, case studies, tutorials and more. Take a look and join the
>> conversation now. http://goparallel.sourceforge.net/ [1]
>> _______________________________________________
>> pydev-code mailing list
>> pydev-code@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/pydev-code [2]
> 
> 
> 
> Links:
> ------
> [1] http://goparallel.sourceforge.net/
> [2] https://lists.sourceforge.net/lists/listinfo/pydev-code
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming The Go Parallel Website, 
> sponsored
> by Intel and developed in partnership with Slashdot Media, is your hub for 
> all
> things parallel software development, from weekly thought leadership blogs 
> to
> news, videos, case studies, tutorials and more. Take a look and join the
> conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> pydev-code mailing list
> pydev-code@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/pydev-code

-- 
Andreas Pakulat squ...@froglogic.com
froglogic GmbH - Automated UI and Web Testing

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
pydev-code mailing list
pydev-code@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pydev-code

Reply via email to