Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle jedi-vim call signatures when looking for colon in prev line #41

Merged
merged 4 commits into from
May 12, 2015
Merged

Handle jedi-vim call signatures when looking for colon in prev line #41

merged 4 commits into from
May 12, 2015

Conversation

blueyed
Copy link
Member

@blueyed blueyed commented May 6, 2015

This adds jedi\S to s:skip_special_chars and improves the algorithm to
find the colon in the previous line in s:indent_like_previous_line.

There should be a test for this probably?!
jedi-vim's syntax setup for the (partly concealed) call signature is at https://github.com/davidhalter/jedi-vim/blob/master/after/syntax/python.vim.

@blueyed
Copy link
Member Author

blueyed commented May 6, 2015

@hynek
I'd appreciate some quick feedback on this.
I think it's good to be merged, and I'll do so after cleaning the commits up.

@hynek
Copy link
Contributor

hynek commented May 6, 2015

Could you elaborate a bit more what this does? Does it use jedi for certain tasks if it’s present?

@blueyed
Copy link
Member Author

blueyed commented May 6, 2015

jedi-vim provides call signatures, via inserting text into the buffer and then uses concealing to hide parts of it.
When you get such a call signature in a line after a colon, the colon at the end is currently not detected (because of the text that jedi-vim inserted).
This PR will ignore this text.

I will refactor this to be used in more places, e.g. to also fix #32.

endif
let colon_pos = getpos(".")[2]
" Check that everything behind is to be ignored, including jedi-vim's
" call signatures).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here’s an extra paren. maybe you could add a sentence explaining what those are?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Will do.

@blueyed
Copy link
Member Author

blueyed commented May 7, 2015

Re-based and squashed.

I've tried to set it to true by default, but it is still buggy.
 - Handle jedi-vim call signatures when looking for colon and function
   def in previous line.
   This adds `jedi\S` to s:skip_special_chars and improves the algorithm to
   find the colon in the previous line in `s:indent_like_previous_line`.
 - Add `s:match_expr_on_line` and use it for `nothing_after_opening_paren`.
 - Handle comments after opening paren (#32).

NOTE: This handles older Vim versions, where `synconcealed` behaves different
(returns an empty list for non-concealed) and `getcurpos` is not
available (Vim 7.3.429 (used on Travis)).

Fixes: #32
blueyed added a commit that referenced this pull request May 12, 2015
Handle jedi-vim call signatures when looking for colon in prev line
@blueyed blueyed merged commit 955f7c0 into Vimjas:master May 12, 2015
@blueyed blueyed deleted the fix-jedi-call-signatures branch May 12, 2015 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants