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

Omnicomplete writes to disk when selecting suggestion - plays badly with YCM #91

Open
maackle opened this issue Aug 5, 2017 · 5 comments

Comments

@maackle
Copy link
Contributor

maackle commented Aug 5, 2017

I'm not sure if this is intended or not, and I'm new to vim so I'm not sure if this is a common or even unavoidable thing, but: when omnicompleting, the buffer gets written to disk whenever selecting an omnicomplete suggestion. This is bad in its own right, but it also plays really badly with YouCompleteMe, since in that case, it writes to disk every time a character is typed which caused an autocomplete suggestion.

I'd like to try to fix this but I would first like to know the rationale for writing to disk in the first place with omnicomplete, so I can get some direction.

@coot
Copy link
Collaborator

coot commented Aug 6, 2017

That's a valid issue. It should not happen. We used to save when importing identifiers, but now it happens through vim rather than letting purs ide change files in place. I cannot reproduce it.

@maackle
Copy link
Contributor Author

maackle commented Aug 6, 2017

That seems to be related, and still an issue for me. Here's a few lines from the message log (g:psc_ide_log_level == 3) where the writing happens. This was just from using autocomplete, not even calling importIdentifier.

purescript#ide#callSync: command: {"params":{"options":{"groupReexports":true},"currentModule":"App.View.Homepage","matcher":{"params":{"search":"ul"},"matche
r":"flex"},"filters":[{"filter":"prefix","params":{"search":"ul"}}]},"command":"complete"}
purescript#ide#callSync: trying to reach server again
s:callFn: response: <MANY LINES OF DATA>
...
PSCIDEimportIdentifier
ident: ul
"frontend/src/App/View/Homepage.purs" 73L, 2529C written

Rather than wonder if importIdentifier should be called during autocomplete, I'll ask about the fact that importIdentifier makes a call to purescript#ide#utils#update() here, which calls update which should write the buffer, right?

@coot
Copy link
Collaborator

coot commented Aug 6, 2017

Yes, but we might not need this call any more. importIdentifier is called on CompleteDone event and you can disable it with let ide_import_on_comletion = v:false.

There are various other places where we save the buffer. For example when :Prebuild runs. But that could also be avoided by saving the file to a temporary file and sending that file to recompile.

@ChrisPenner
Copy link

ChrisPenner commented Oct 12, 2017

I'm suffering from this issue too; kinda making psc-ide unusable tbh.

Setting let g:ide_import_on_completion = v:false helps a lot 👍 ; I'd still love to see a more permanent fix though!

EDIT: Looks like some sort of automation is also automatically saving when I exit insert mode?? This whole hijacking my editor thing doesn't really work with my workflow. I'd much rather set up any autocmds that I need myself (though I understand that good defaults are nice)

@dakom
Copy link

dakom commented Jul 17, 2018

I'm also having major trouble with this and YCM ... was driving me nuts for hours since the bug was something like, editing non-purescript files (like typescript) would trigger a webpack reload when various keys are pressed in insert mode. Yeah, really...

Was going to open a separate issue but it sounds highly related to this

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

No branches or pull requests

4 participants