Patch for eclim to make it not to save file at every autocomplete

185 views
Skip to first unread message

dimonomid

unread,
Dec 15, 2011, 7:17:36 AM12/15/11
to eclim-dev
Hello all.

I just started using eclim, and this is very useful.
Unfortunately, there's some issues and caveats. The most annoying
thing i found is that vim saves current file every time i call
autocompletion <C-X><C-U> .

I have made a patch to workaround with it.
What the patch does:

There's a new variable g:EclimJavaCompleteTmpFile (default: 0)
By default behavior is the same as without this patch.
But if user let g:EclimJavaCompleteTmpFile = 1 , then at every
autocomplete Eclim will save temporary file instead of a real file,
and eclipse will work with temp file. After this, Vim deletes this
temp file.

If gvim is running embedded, then Vim also will do :ProjectRefresh,
because of this temp file appears in project tree while Eclipse does
autocompletion.

Here's a patch: http://goo.gl/D3iD5

--

There is just one little issue: when Eclim does autocompletion in
embedded gvim, in the Eclipse's project tree appears temp filename for
a little time (~ 0.5 sec at my machine). But, for me, this is very
little issue, compared to undesirable file save. REALLY!

---

P.S. I think i found a little bug (misprint) while i've been looking
how to find out is gvim embedded or not:
in the file "eclim/plugin/project.vim", line 60:

if g:EclimProjectRefreshFiles || has('netbeans_intg')

you should check 'netbeans_enabled' instead of 'netbeans_intg'. Please
read :help feature-list :

netbeans_intg Compiled with support for |netbeans|.
netbeans_enabled Compiled with support for |netbeans| and connected.

Eric Van Dewoestine

unread,
Dec 19, 2011, 10:18:27 AM12/19/11
to ecli...@googlegroups.com
On 2011-12-15 04:17:36, dimonomid wrote:
> Hello all.
>
> I just started using eclim, and this is very useful.
> Unfortunately, there's some issues and caveats. The most annoying
> thing i found is that vim saves current file every time i call
> autocompletion <C-X><C-U> .
>
> I have made a patch to workaround with it.
> What the patch does:
>
> There's a new variable g:EclimJavaCompleteTmpFile (default: 0)
> By default behavior is the same as without this patch.
> But if user let g:EclimJavaCompleteTmpFile = 1 , then at every
> autocomplete Eclim will save temporary file instead of a real file,
> and eclipse will work with temp file. After this, Vim deletes this
> temp file.
>
> If gvim is running embedded, then Vim also will do :ProjectRefresh,
> because of this temp file appears in project tree while Eclipse does
> autocompletion.
>
> Here's a patch: http://goo.gl/D3iD5

Overall the patch looks good and I plan to apply it, but I just
haven't had the time to give it a thorough testing.

I'm also thinking of expanding it to:
- perhaps make it a part of eclim#java#util#SilentUpdate so that other
java features that have to write the file can benefit from this.
- pushing eclim#java#util#SilentUpdate into eclim#lang so the other
languages support can make use of this as well.
- make the cleanup block a part of the server side via either a new
command line option or just detecting temp files based on name
(probably the latter).

> --
>
> There is just one little issue: when Eclim does autocompletion in
> embedded gvim, in the Eclipse's project tree appears temp filename for
> a little time (~ 0.5 sec at my machine). But, for me, this is very
> little issue, compared to undesirable file save. REALLY!

Did you try prefixing the file with a '.' to see if that prevents it
from showing up in the project tree? I was thinking of trying that and
if that doesn't work perhaps looking into project filter settings.

> ---
>
> P.S. I think i found a little bug (misprint) while i've been looking
> how to find out is gvim embedded or not:
> in the file "eclim/plugin/project.vim", line 60:
>
> if g:EclimProjectRefreshFiles || has('netbeans_intg')
>
> you should check 'netbeans_enabled' instead of 'netbeans_intg'. Please
> read :help feature-list :
>
> netbeans_intg Compiled with support for |netbeans|.
> netbeans_enabled Compiled with support for |netbeans| and connected.

Thanks for spotting that. I've fixed that as well as one other
occurrence that should have been 'netbeans_enabled'.

--
eric

Дмитрий Франк

unread,
Dec 19, 2011, 10:47:15 AM12/19/11
to ecli...@googlegroups.com


19.12.2011 19:18 пользователь "Eric Van Dewoestine" <erva...@gmail.com> написал:

Yes, I tried to prefix file with a dot, but Eclipse don't work with dotfiles, unfortunately. About project filter settings: I don't know about it (I'm new in Eclipse), so maybe it will do the trick. Anyway, project tree refreshes fast, so it does not annoy me :)

Thanks for your answer and for agreement to apply my patches! I'm happy to participate in developing of such useful project.

Have a nice day.

Dmitry.



> > ---
> >
> > P.S. I think i found a little bug (misprint) while i've been looking
> > how to find out is gvim embedded or not:
> > in the file "eclim/plugin/project.vim", line 60:
> >
> > if g:EclimProjectRefreshFiles || has('netbeans_intg')
> >
> > you should check 'netbeans_enabled' instead of 'netbeans_intg'. Please
> > read :help feature-list :
> >
> > netbeans_intg         Compiled with support for |netbeans|.
> > netbeans_enabled      Compiled with support for |netbeans| and connected.
>
> Thanks for spotting that. I've fixed that as well as one other
> occurrence that should have been 'netbeans_enabled'.
>
> --
> eric
>

> --
> You received this message because you are subscribed to the Google Groups "eclim-dev" group.
> To post to this group, send email to ecli...@googlegroups.com.
> To unsubscribe from this group, send email to eclim-dev+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/eclim-dev?hl=en.
>

Eric Van Dewoestine

unread,
Jan 15, 2012, 11:00:36 AM1/15/12
to ecli...@googlegroups.com

FYI, I finally committed[1] a version of this patch.

Thanks again for submitting this :)

[1] https://github.com/ervandew/eclim/commit/10799b684a99602115b362d2a6812027b3db54a8

--
eric

Дмитрий Франк

unread,
Jan 15, 2012, 12:46:33 PM1/15/12
to ecli...@googlegroups.com
Glad to know this, thanks!

15 января 2012 г. 20:00 пользователь Eric Van Dewoestine <erva...@gmail.com> написал:

--
eric

Dmitry Frank

unread,
Mar 25, 2016, 2:21:57 AM3/25/16
to ecli...@googlegroups.com
Hi Eric.

I just tried latest Eclim 2.5.0 for Eclipse Mars, and I'm very disappointed to find out that this version, again, saves my java source file every time I invoke autocompletion, instead of using temporary file. Unfortunately I completely don't remember how did I fix this 4 years ago, and the link is already broken.

Can we have it fixed again, please?

--
Regards,
Dmitry

Dmitry Frank

unread,
Mar 25, 2016, 2:52:00 AM3/25/16
to ecli...@googlegroups.com
Hi Eric,

I finally found out that the default value of g:EclimTempFilesEnable has changed from 1 to 0. So I set it up explicitly in my vimrc, and it works fine.

Just curious: why have you decided to change the default?

--
Regards,
Dmitry


Reply all
Reply to author
Forward
0 new messages