Bug 232520 - Kdevelop doesn't behave well when renaming opened files from IDE
Summary: Kdevelop doesn't behave well when renaming opened files from IDE
Status: CLOSED FIXED
Alias: None
Product: kdevplatform
Classification: Developer tools
Component: shell (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-28 23:57 UTC by Valentyn Pavliuchenko
Modified: 2011-08-08 20:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Valentyn Pavliuchenko 2010-03-28 23:57:46 UTC
Version:           3.9.99 + svn1107505 (using KDE 4.4.1)
Compiler:          4.4.3 20100108 
OS:                Linux
Installed from:    Debian testing/unstable Packages

If I have a file in a project, that is opened in editor and I rename it in IDE (it works well and renames references in cmake build system also) the caption of opened file doesn't change and when going back to editor it says that the file was deleted.

Steps to reproduce: create a simple project, open some code file in editor and try to rename it in the "projects" sidebar.

Expected behaviour: opened documents are renamed without need to reopen them.
Comment 1 Valentyn Pavliuchenko 2010-03-29 08:04:26 UTC
As for me, it's rather a bug than a wish.
Comment 2 Andreas Pakulat 2010-03-29 09:11:36 UTC
From the technical point of view it is a new feature.
Comment 3 Valentyn Pavliuchenko 2010-03-29 10:18:26 UTC
Sorry, but it's just incomplete rename functionality. This is part of "rename" functionality.
Comment 4 Andreas Pakulat 2010-03-29 11:01:45 UTC
No its not, "rename file xyz to foo" works as it should, renaming works.

Anyway, wether this is listed as bug or wish doesn't increase its priority in any way, so it won't be fixed sooner if listed as bug.
Comment 5 Niko Sams 2010-03-29 20:09:17 UTC
Well, it is a difference as we are in feature freeze...
And I want to implement this. Should I wait for after 4.0?
Comment 6 Andreas Pakulat 2010-03-29 20:41:59 UTC
Yes. And it should work no matter wether the rename happens inside kdevelop or outside of it (for a plain rename, not a move)
Comment 7 Valentyn Pavliuchenko 2010-03-29 20:52:27 UTC
Yes, I was talking about bug/with status because of feature freeze.
I've asked few people around me, shown them a problem and they all said that it's definitely a bug.

>And it should work no matter wether the rename happens inside kdevelop or
outside of it

It would be good, but it's not as necessary as renaming inside IDE.
Comment 8 Andreas Pakulat 2010-03-29 21:17:27 UTC
(In reply to comment #7)
> >And it should work no matter wether the rename happens inside kdevelop or
> outside of it
> 
> It would be good, but it's not as necessary as renaming inside IDE.

The implementation needs to be independent of the IDE doing the renaming or the same happening on the filesystem. Else we'll be getting the same bugreport 2 weeks after fixing because somebody does an svn up or git merge and that renames something. Thats not an option, if this is implemented it needs to be done right.
Comment 9 Niko Sams 2010-03-29 21:21:05 UTC
Can we detect a move outside kdevelop? Including the location it was moved to?
Comment 10 Andreas Pakulat 2010-03-29 21:59:45 UTC
(In reply to comment #9)
> Can we detect a move outside kdevelop? Including the location it was moved to?

Hmm, looks like we can't, I thought this was available via KDirWatch, but that one only knows deleted/created/changed signals.

Ok, so only renaming inside the IDE will be supported. Niko, can you look into how much changes this needs? I'm willing to take it as bug instead of feature if the change is not too intrusive/big.
Comment 11 Niko Sams 2010-03-29 22:13:41 UTC
(In reply to comment #10)
> Niko, can you look into
> how much changes this needs? I'm willing to take it as bug instead of feature
> if the change is not too intrusive/big.
Listening to IProjectFileManager::fileRenamed signal in DocumentController and closing and opening the renamed file. But afaics this signal is never emitted?
Comment 12 Valentyn Pavliuchenko 2010-03-29 22:34:36 UTC
Guys, of course you are developers and you know better, but can it be done without closing/opening?
Comment 13 Andreas Pakulat 2010-03-29 23:50:57 UTC
(In reply to comment #12)
> Guys, of course you are developers and you know better, but can it be done
> without closing/opening?

Not without changing Kate, so thats definetly something for KDevelop4.1 (which then would need to depend on KDE 4.5 - if this is done inside Kate for kde4.5)
Comment 14 Andreas Pakulat 2010-03-29 23:53:04 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > Niko, can you look into
> > how much changes this needs? I'm willing to take it as bug instead of feature
> > if the change is not too intrusive/big.
> Listening to IProjectFileManager::fileRenamed signal in DocumentController and
> closing and opening the renamed file. But afaics this signal is never emitted?

Yeap, its never emitted, however that really is a bugfix.

That solution sounds simple enough, so changing this to bug to allow it being for 4.0
Comment 15 Valentyn Pavliuchenko 2010-03-29 23:53:37 UTC
Can you fill a wish for Kate? Better to record this idea:)
Comment 16 Aleix Pol 2011-08-07 13:38:50 UTC
Git commit 38ab0d0878e027777608c437980a28ba7bb53208 by Aleix Pol.
Committed on 07/08/2011 at 15:36.
Pushed by apol into branch 'master'.

Make the document controller to listen to the project's so that whenever
an open file is renamed, that file should be closed and reopened with the new name.

BUG: 232520

M  +23   -0    shell/documentcontroller.cpp
M  +4    -1    shell/documentcontroller.h

http://commits.kde.org/kdevplatform/38ab0d0878e027777608c437980a28ba7bb53208
Comment 17 Valentyn Pavliuchenko 2011-08-07 19:18:07 UTC
Just compiled sources (this fix included).

Renaming modified file causes loosing unsaved changes without any notice. So I'm reopening this because of incorrect behavior.

This is the place where reopening just sucks. Please find a way to do it without closing/opening document (kate kpart changes, etc). Every normal IDE just renames a tab.
Comment 18 Aleix Pol 2011-08-08 08:12:17 UTC
I just fixed the discard thing, so that you don't lose any changes.

The other complaint should be reported in a new bug report.
Comment 19 Valentyn Pavliuchenko 2011-08-08 20:09:19 UTC
Verified - fine now. Thanks.