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

Commit 6ba6b56 breaks DelimitMate 'delimitMateBackspace' plugin functionality #2696

Closed
6 of 12 tasks
davidsierradz opened this issue Jun 28, 2017 · 10 comments
Closed
6 of 12 tasks

Comments

@davidsierradz
Copy link

Issue Prelude

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:

  • I have read and understood YCM's [CONTRIBUTING][cont] document.
  • I have read and understood YCM's [CODE_OF_CONDUCT][code] document.
  • I have read and understood YCM's [README][readme], especially the
    [Frequently Asked Questions][faq] section.
  • I have searched YCM's issue tracker to find issues similar to the one I'm
    about to report and couldn't find an answer to my problem. ([Example Google
    search.][search])
  • If filing a bug report, I have included the output of vim --version.
  • If filing a bug report, I have included the output of :YcmDebugInfo.
  • If filing a bug report, I have attached the contents of the logfiles using
    the :YcmToggleLogs command.
  • If filing a bug report, I have included which OS (including specific OS
    version) I am using.
  • If filing a bug report, I have included a minimal test case that reproduces
    my issue, including what I expected to happen and what actually happened.
  • If filing a installation failure report, I have included the entire output
    of install.py (or cmake/make/ninja) including its invocation
  • I understand this is an open-source project staffed by volunteers and
    that any help I receive is a selfless, heartfelt gift of their free time. I
    know I am not entitled to anything and will be polite and courteous.
  • I understand my issue may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.

Issue Details

By the 'delimitMateBackspace' functionality when we delete an opening delimiter with "<BS>" the matching pair is also deleted, but last commit in YCM breaks this.

Running the :DelimitMateTest with and without YCM plugin activated we see the remapping of "<BS>" :

without YCM:
i "<BS>" @delimitMateBS
Last set from ~/.vim/bundle/delimitMate/plugin/delimitMate.vim

with YCM:
i "<BS>" * 98_OnDeleteChar( "<BS>" )
Last set from ~/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim

  • What did you do?

Include steps to reproduce here.

Have https://github.com/Raimondi/delimitMate plugin and YouCompleteMe plugin active, for example open a PHP file.

  • What did you expect to happen?

write:

function test ( | )

then press "<BS>"

function test |

  • What actually happened?

write:

function test ( | )

then press "<BS>"

function test (|

I think its this line of code added on last commit

https://github.com/Valloric/YouCompleteMe/blob/master/autoload/youcompleteme.vim#L252

Maybe have an option to add or remove keys to this functionality?

Thanks in advance, sorry for bad English.

@vheon
Copy link
Contributor

vheon commented Jun 28, 2017

@micbou I think we should do something like https://github.com/tpope/vim-endwise/blob/master/plugin/endwise.vim#L113-L116 where if the key is already mapped we just concatenate the actions and do both of them; and maybe we should also check if pumvisible?

@micbou
Copy link
Collaborator

micbou commented Jun 28, 2017

@vheon Thanks for the link. I implemented a similar approach in this branch. It seems to work fine with the DelimitMate plugin. @davidsierradz Could you try it out?

@bstaletic
Copy link
Collaborator

@davidsierradz As a workaround you could try using auto-pairs. I'm using it and didn't stumble upon this problem.

@davidsierradz
Copy link
Author

@micbou, downloaded and tested the branch, I think its working good, thanks.

@davidsierradz
Copy link
Author

@micbou Any advances in merging this fix to upstream?

@vivektiwary
Copy link

vivektiwary commented Oct 3, 2017

Anybody who wanted to use this feature can just

  1. clone the repo locally,
  2. switch to the branch which has fixed the problem and
  3. merge that branch locally and
  4. then push it to their remote and
  5. use than in .vimrc

@micbou
Copy link
Collaborator

micbou commented Oct 5, 2017

Sorry for the lack of answer. I am not really satisfied with the solution because it adds the OnDeleteChar function to the <BS> key even if the user remapped it to something that have nothing to do with deleting characters in insert mode. I think a better approach would be to expose the OnDeleteChar function through a mapping and let users remap the <BS> key as follows:

imap <BS> <Plug>YcmOnDeleteChar<Plug>delimiteMateBS

where <Plug>YcmOnDeleteChar is the mapping exposing OnDeleteChar. This would be mentioned in the FAQ. Thoughts?

In the meantime, a workaround is to add the following to your vimrc:

imap <silent> <BS> <C-R>=YcmOnDeleteChar()<CR><Plug>delimitMateBS

function! YcmOnDeleteChar()
  if pumvisible()
    return "\<C-y>"
  endif
  return "" 
endfunction

p-herbert pushed a commit to p-herbert/vim-settings that referenced this issue Mar 12, 2018
arumoy-shome pushed a commit to arumoy-shome/dotfiles that referenced this issue Jun 5, 2019
DelimitMate with YCM does not work properly, for example <BS> does not
delete the closing parenthesis. See
ycm-core/YouCompleteMe#2696 for more details.
@puremourning
Copy link
Member

@davidsierradz we've changed the YCM completion implementation in #3645 could you try that PR and see if it resolves this issue ? I don't use any of these plugins delimit plugins.

@john-pt
Copy link

john-pt commented Apr 17, 2020

@puremourning I arrived here because of this issue. I updated YouCompleteMe and looks like delimitMate backspace works as intended without work arounds.

@puremourning
Copy link
Member

Great thanks.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants