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

complete-on-dot: do not trigger with dot in front #859

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ftplugin/python/jedi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@ if g:jedi#auto_initialization
endif

if g:jedi#completions_enabled == 1
inoremap <silent> <buffer> . .<C-R>=jedi#complete_string(1)<CR>
function! s:complete_on_dot() abort
" Do not trigger completion if there is a dot before already.
if getline('.')[-2:-2] ==# '.'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seems weird, but it is likely the best in Vimscript?!

Copy link
Owner

@davidhalter davidhalter Jul 30, 2018

Choose a reason for hiding this comment

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

This is just not working if you're not editing at the end. We probably need to also use the cursor position.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

True, good catch.. :)

return ''
endif
return jedi#complete_string(1)
endfunction
inoremap <silent> <buffer> . .<C-R>=<SID>complete_on_dot()<CR>
endif

if g:jedi#smart_auto_mappings == 1
Expand Down