Thread: [Pydev-code] Has the analyze only open editors setting ever had a meaning?
Brought to you by:
fabioz
From: Andreas P. <an...@fr...> - 2014-09-24 13:00:06
|
Hi, I recently stumbled about the 'Builder' page and its 'Analyze only open editors' setting. It sounded like disabling this would help one of our customers who wanted to get completion for functions in modules that are not yet imported. Unfortunately it turns out this preference is not being used anywhere in the codebase and looking at the existing pydev tags has never been used. I'm wondering wether I'm missing something or wether this has really been added (to the ui) and then never used (by the builder)? On a related note: Is there a way to get pydev to create completions for functions/classes in files that haven't been opened yet (after starting eclipse)? (i.e. where do I have to look into the codebase to find the starting point) Andreas -- Andreas Pakulat sq...@fr... froglogic GmbH - Automated UI and Web Testing |
From: Fabio Z. <fa...@gm...> - 2014-09-26 10:58:07
|
On Wed, Sep 24, 2014 at 9:25 AM, Andreas Pakulat <an...@fr...> wrote: > Hi, > > I recently stumbled about the 'Builder' page and its 'Analyze only open > editors' setting. It sounded like disabling this would help one of our > customers who wanted to get completion for functions in modules that are > not > yet imported. Unfortunately it turns out this preference is not being used > anywhere in the codebase and looking at the existing pydev tags has never > been used. > > I'm wondering wether I'm missing something or wether this has really been > added (to the ui) and then never used (by the builder)? > > On a related note: Is there a way to get pydev to create completions for > functions/classes in files that haven't been opened yet (after starting > eclipse)? (i.e. where do I have to look into the codebase to find the > starting point) > > Hi Andreas, Actually, that's still used... if you take a look at the code, the getter which uses the ANALYZE_ONLY_ACTIVE_EDITOR constant is org.python.pydev.builder.PyDevBuilderPrefPage.getAnalyzeOnlyActiveEditor(). What it does is that if it's unchecked, we'll analyze all the files in the workspace when they're changed (by the pydev builder) and not only if there's an editor open for that file (so, usually it's not recommended as it can be a resource hog, but if you do have CPU/RAM to spare, it's still an option). As for getting completions for functions/classes that haven't been imported, I think I don't quite follow what you mean (you do have context-insensitive code-completion which would add the import and the token -- but apparently, that's not what you meant), so, can you rephrase that to explain better your use case? Cheers, Fabio |
From: Fabio Z. <fa...@gm...> - 2014-09-26 11:00:24
|
On Fri, Sep 26, 2014 at 7:57 AM, Fabio Zadrozny <fa...@gm...> wrote: > > On Wed, Sep 24, 2014 at 9:25 AM, Andreas Pakulat <an...@fr...> > wrote: > >> Hi, >> >> I recently stumbled about the 'Builder' page and its 'Analyze only open >> editors' setting. It sounded like disabling this would help one of our >> customers who wanted to get completion for functions in modules that are >> not >> yet imported. Unfortunately it turns out this preference is not being used >> anywhere in the codebase and looking at the existing pydev tags has never >> been used. >> >> I'm wondering wether I'm missing something or wether this has really been >> added (to the ui) and then never used (by the builder)? >> >> On a related note: Is there a way to get pydev to create completions for >> functions/classes in files that haven't been opened yet (after starting >> eclipse)? (i.e. where do I have to look into the codebase to find the >> starting point) >> >> Hi Andreas, > > Actually, that's still used... if you take a look at the code, the getter > which uses the ANALYZE_ONLY_ACTIVE_EDITOR constant is > org.python.pydev.builder.PyDevBuilderPrefPage.getAnalyzeOnlyActiveEditor(). > > What it does is that if it's unchecked, we'll analyze all the files in the > workspace when they're changed (by the pydev builder) and not only if > there's an editor open for that file (so, usually it's not recommended as > it can be a resource hog, but if you do have CPU/RAM to spare, it's still > an option). > > As for getting completions for functions/classes that haven't been > imported, I think I don't quite follow what you mean (you do have > context-insensitive code-completion which would add the import and the > token -- but apparently, that's not what you meant), so, can you rephrase > that to explain better your use case? > > Cheers, > > Fabio > Re-reading I'm not sure I was clear on the analyze files... what I meant was that we do code-analysis on files that haven't been opened in an editor (the indexing is done for all files regardless of that setting -- so, if the file is under the PYTHONPATH, it should always be indexed and kept up to date with a builder). Cheers, Fabio |
From: Andreas P. <an...@fr...> - 2014-09-26 13:34:44
|
On 2014-09-26 12:57, Fabio Zadrozny wrote: > On Wed, Sep 24, 2014 at 9:25 AM, Andreas Pakulat <an...@fr...> > wrote: > >> Hi, >> >> I recently stumbled about the 'Builder' page and its 'Analyze only open >> editors' setting. It sounded like disabling this would help one of our >> customers who wanted to get completion for functions in modules that are >> not >> yet imported. Unfortunately it turns out this preference is not being used >> anywhere in the codebase and looking at the existing pydev tags has never >> been used. >> >> I'm wondering wether I'm missing something or wether this has really been >> added (to the ui) and then never used (by the builder)? >> >> On a related note: Is there a way to get pydev to create completions for >> functions/classes in files that haven't been opened yet (after starting >> eclipse)? (i.e. where do I have to look into the codebase to find the >> starting point) > > Hi Andreas, > > Actually, that's still used... if you take a look at the code, the getter > which uses the ANALYZE_ONLY_ACTIVE_EDITOR constant is > org.python.pydev.builder.PyDevBuilderPrefPage.getAnalyzeOnlyActiveEditor(). Ah, I missed the public static getter and its uses during my grep :) > As for getting completions for functions/classes that haven't been imported, > I think I don't quite follow what you mean (you do have > context-insensitive code-completion which would add the import and the token > -- but apparently, that's not what you meant), so, can you > rephrase that to explain better your use case? What I see happening is that completion does not include functions from modules that haven't been open in an editor. For example lets take this project: myproject | - module1 | | | - util.py | - module2 | - main.py util.py has just 1 function definition 'mycoolfun' and main.py is empty. After a fresh start of Eclipse I open main.py and type myc and invoke code-completion. There's no entry for mycoolfunc. If I open util.py, close it again and again invoke code-completion inside main.py the entry for 'mycoolfunc' shows up. My assumption was that this is caused by the 'analyze-only-open-editors' setting, but changing the setting from its default value did not help. Andreas PS: The project's root folder is configured as python path so that shouldn't be a problem. PPS: Tested this with the master branch as well as seeing it with the 2.8 release. -- Andreas Pakulat sq...@fr... froglogic GmbH - Automated UI and Web Testing |
From: Fabio Z. <fa...@gm...> - 2014-09-26 13:44:45
|
On Fri, Sep 26, 2014 at 10:34 AM, Andreas Pakulat <an...@fr...> wrote: > On 2014-09-26 12:57, Fabio Zadrozny wrote: > >> On Wed, Sep 24, 2014 at 9:25 AM, Andreas Pakulat <an...@fr...> >> wrote: >> >> Hi, >>> >>> I recently stumbled about the 'Builder' page and its 'Analyze only open >>> editors' setting. It sounded like disabling this would help one of our >>> customers who wanted to get completion for functions in modules that are >>> not >>> yet imported. Unfortunately it turns out this preference is not being >>> used >>> anywhere in the codebase and looking at the existing pydev tags has never >>> been used. >>> >>> I'm wondering wether I'm missing something or wether this has really been >>> added (to the ui) and then never used (by the builder)? >>> >>> On a related note: Is there a way to get pydev to create completions for >>> functions/classes in files that haven't been opened yet (after starting >>> eclipse)? (i.e. where do I have to look into the codebase to find the >>> starting point) >>> >> >> Hi Andreas, >> >> Actually, that's still used... if you take a look at the code, the getter >> which uses the ANALYZE_ONLY_ACTIVE_EDITOR constant is >> org.python.pydev.builder.PyDevBuilderPrefPage. >> getAnalyzeOnlyActiveEditor(). >> > > Ah, I missed the public static getter and its uses during my grep :) > > As for getting completions for functions/classes that haven't been >> imported, I think I don't quite follow what you mean (you do have >> context-insensitive code-completion which would add the import and the >> token -- but apparently, that's not what you meant), so, can you >> rephrase that to explain better your use case? >> > > What I see happening is that completion does not include functions from > modules that haven't been open in an editor. For example lets take this > project: > > myproject > | > - module1 > | | > | - util.py > | > - module2 > | > - main.py > > util.py has just 1 function definition 'mycoolfun' and main.py is empty. > After a fresh start of Eclipse I open main.py and type myc and invoke > code-completion. There's no entry for mycoolfunc. If I open util.py, close > it again and again invoke code-completion inside main.py the entry for > 'mycoolfunc' shows up. > > My assumption was that this is caused by the 'analyze-only-open-editors' > setting, but changing the setting from its default value did not help. > > Andreas > > PS: The project's root folder is configured as python path so that > shouldn't be a problem. > PPS: Tested this with the master branch as well as seeing it with the 2.8 > release. > > Humm... that sounds like you have disabled auto-build (project > build automatically)... if that's the case, you have to invoke the build manually for pydev to index those files (Ctrl+B)... or maybe something else became wrong and the indexing became lost (if that's the case, a manual fix would be going to the project properties > pydev-pythonpath > force restore internal info -- and it should definitely be kept up to date afterwards if auto build is turned on). Cheers, Fabio |
From: Andreas P. <an...@fr...> - 2014-09-29 10:26:38
|
Hi Fabio, On 2014-09-26 15:44, Fabio Zadrozny wrote: > On Fri, Sep 26, 2014 at 10:34 AM, Andreas Pakulat <an...@fr...> > wrote: > util.py has just 1 function definition 'mycoolfun' and main.py is empty. > After a fresh start of Eclipse I open main.py and type myc and > invoke code-completion. There's no entry for mycoolfunc. If I open util.py, > close it again and again invoke code-completion inside main.py the > entry for 'mycoolfunc' shows up. > > My assumption was that this is caused by the 'analyze-only-open-editors' > setting, but changing the setting from its default value did not > help. > > Humm... that sounds like you have disabled auto-build (project > build > automatically)... if that's the case, you have to invoke the build > manually for pydev to index those files (Ctrl+B)... or maybe something else > became wrong and the indexing became lost (if that's the case, a > manual fix would be going to the project properties > pydev-pythonpath > > force restore internal info -- and it should definitely be kept up to > date afterwards if auto build is turned on). Automatic project building is enabled, but indeed cleaning the project fixes the problem. At least until the next restart of Eclipse. It seems there's no rebuild happening immediately after starting Eclipse and hence the information for completion is not available. Andreas -- Andreas Pakulat sq...@fr... froglogic GmbH - Automated UI and Web Testing |