Closed jerojasro closed 6 years ago
Please give an example.
This exemplifies the issue:
class AccountViewTestCase(BaseTestCase):
def test_new_account(self):
name = 'John' # cfi#get_func_name() works fine when the cursor is here
phone_number = '3551122333' # cfi#get_func_name() doesn't show anything when the cursor is here
In addition to my review, in your example, at line 2,
cfi#get_func_name()
returns empty string.
But it should be AccountViewTestCase
(same as line 3).
Can you fix this?
I made changes to:
I still haven't thought of a way of solving this situation:
class Blah:
# cursor here, asume it's an empty line; cfi should say "Blah", but thinks it is not inside any function
pass
I'll give it some more thought today.
In addition to my review, in your example, at line 2,
cfi#get_func_name()
returns empty string. But it should beAccountViewTestCase
(same as line 3). Can you fix this?
Fixed. I think it's ready for you to have another look.
class Blah:
# cursor here, asume it's an empty line; cfi should say "Blah", but thinks it is not inside any function
pass
For such case, cfi.vim must inspect if the line is a comment or not. I don't want to inspect source code deeply, because there should be many corner cases.
And in this code, it seems to work fine. I think it is enough.
class Blah:
# cursor here, has indent; cfi says "Blah"
pass
Thanks! 🎉
The previous implementation did not work properly when there were empty lines between blocks of code inside a function.
I reimplemented it so:
Now the output returned shows the fully qualified function name (MyClass.my_function) if it applies