LionHeart123 / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

Partial indents confuse code completion and hints #673

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Enter the following example
2. Hover over 'myvar' on the two lines where it appears and see that they are 
both correctly identified as a local variable of function meth
3. Add a single space to the blank line after the comment "# space below"
4. Hover over the second occurrence of myvar. Pyscripter now thinks it is a 
class var!

What is the expected output? What do you see instead?
Inconsequential whitespace should not affect code parsing / scopes.

What version of the product are you using? On what operating system?
PyScripter 2.5.3.0 (x86) on Windows 7

Please provide any additional information below.

It seems that if a lines is either completely blank, or has the same indent as 
the surrounding code, all is well.  But a line containing any other amount of 
whitespace has the potential to confuse the parser concerning what scope the 
following code is actually in.

Original issue reported on code.google.com by AgentFri...@gmail.com on 13 Jul 2012 at 7:56

GoogleCodeExporter commented 9 years ago
The example seems to be missing.  Could you please add it.

Original comment by pyscripter on 14 Jul 2012 at 9:53

GoogleCodeExporter commented 9 years ago
Sorry about that...  Here it is:

class myclass:
    def meth():
        myvar = '  test  '
        # space below

        myvar = myvar.str()

Original comment by AgentFri...@gmail.com on 16 Jul 2012 at 9:07

GoogleCodeExporter commented 9 years ago
Fixed in version control. 

In the meantime you can avoid the issue by having the editor option "Trim 
trailing spaces" on.

Original comment by pyscripter on 17 Aug 2012 at 11:16