Bug 453153 - Project plugin does not list externally created files
Summary: Project plugin does not list externally created files
Status: RESOLVED INTENTIONAL
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 22.04.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-28 16:55 UTC by Juris
Modified: 2022-05-02 12:02 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 Juris 2022-04-28 16:55:05 UTC
SUMMARY

When using Kate Project plugin and files are created externally e.g outside of comfort of kate editor, project plugin does not list those files. One must force Project refresh/reload. This is seem inconsistent since Filesystem tool view immediately detects the change and lists new file.

Also, this affect "Quick Open" in similar way e.g. new project files not showing up in file list.

STEPS TO REPRODUCE
1. Create/Open a project directory with some initial set of files
2. Externally e.g outside of kate editor (in a terminal window say do "touch new_file.txt") create a new file in project directory

OBSERVED RESULT
1. Check "Project Tool View" and see that there is no new_file.txt
2. Open "Quick Open" to search and open new_file.txt - fine is not in a list


EXPECTED RESULT

Externally created files are detected to be part of project and showing up both in "Project Tool" view and "Quick Open".

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.24.4
KDE Frameworks Version: 5.93.0
Qt Version: 5.15.3
Kernel Version: 5.17.5-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 5600G with Radeon Graphics
Memory: 13,6 GiB of RAM
Graphics Processor: AMD RENOIR

ADDITIONAL INFORMATION
Comment 1 Lothar 2022-05-01 05:01:29 UTC
I'm also not a fan of this view, but "it works as intended" . Look at https://invent.kde.org/utilities/kate and search in old issues/merge requests 

To achieve your expected behavior one would need to watch all directories and that can became quickly expensive.
Comment 2 Juris 2022-05-01 13:09:33 UTC
(In reply to Lothar from comment #1)
> I'm also not a fan of this view, but "it works as intended" . Look at
> https://invent.kde.org/utilities/kate and search in old issues/merge
> requests 
> 
> To achieve your expected behavior one would need to watch all directories
> and that can became quickly expensive.

I appreciate your comment. I did a quick look in kate's giltab, but did not find any mention of the problem (probably my search-fu was not at it's best). But I am willing to believe you.

Yet I am not entirely convinced that "watching" directory for new files is that expensive these days. Lots of editors/IDEs cope with that quite good. Also, technologies like inotify allow to solve it quite easily (albeit I recognize the challenge of doing it in platform agnostic way).
Comment 3 Lothar 2022-05-01 13:32:49 UTC
 > I did a quick look in kate's giltab, but did not find any mention of the problem

Hm, I may have remembered it a little wrongly. But this is a similar problem, and mention watching: https://invent.kde.org/utilities/kate/-/issues/55#note_420405 by the way improved in the meantime.

> Yet I am not entirely convinced that "watching" directory for new files is that expensive these days

Yeah, but expensive in a way that these inotify stuff is not unlimited available. So it's wise not to use it too careless.
Comment 4 Juris 2022-05-01 13:35:39 UTC
(In reply to Lothar from comment #3)
>  > I did a quick look in kate's giltab, but did not find any mention of the
> problem
> 
> Hm, I may have remembered it a little wrongly. But this is a similar
> problem, and mention watching:
> https://invent.kde.org/utilities/kate/-/issues/55#note_420405 by the way
> improved in the meantime.
> 
> > Yet I am not entirely convinced that "watching" directory for new files is that expensive these days
> 
> Yeah, but expensive in a way that these inotify stuff is not unlimited
> available. So it's wise not to use it too careless.

OK, fair enough. It does seems I am asking too much of the plugin. Have to keep in mind pressing that "refresh" icon if I am not seeing new files ;-)
Comment 5 Lothar 2022-05-01 14:07:01 UTC
> It does seems I am asking too much of the plugin

I don't know, I don't like it in this form either. But my ideas for changes are unpopular.

To your request: It would logical fit when there would be an "action" (button/menu) to import/add new files to  some project. Then would the plugin know it need an update and could also trigger "stage new stuff". But, yes, just keep in mind you need to reload manually is a working compromise.

Um, that reminds me, there was some other patch. When you open your new add stuff and save it, it appear then as "untracked". So, half way solved, I guess.
Comment 6 Waqar Ahmed 2022-05-02 12:02:38 UTC
Valid, but I think we haven't done this intentionally. Directory watching brings some problems with it and has little benefit. I assume people spend more time writing code / text then creating files. Even you create 10 files in an hour, clicking the refresh button is trivial.