SUMMARY "Open folder" in Kate does not work: - in context menu of Dolphin - from terminal "kate /home/user/test - from Kate menu "File -> Open Folder..." Kate opens users home folder (~) instead. Only folders containing .git/ subfolder could be opened in Kate. WORKAROUND 1. In a folder to be opened in Kate create .kateproject file with following content: { "name": "demo", "files": [ { "directory": ".", "filters": [ "*" ], "recursive": 1 } ] } 2. Now this folder could be opened in Kate. SOFTWARE/OS VERSIONS Operating System: TUXEDO OS KDE Plasma Version: 6.3.2 KDE Frameworks Version: 6.11.0 Qt Version: 6.8.2 Kernel Version: 6.11.0-109019-tuxedo (64-bit)
> Kate opens users home folder (~) instead. Does your home directory contain a `.kateproject file? Or Is your home directory a git repo maybe? maybe it has .git directory? This is a heavily tested/used feature so I doubt the bug is in Kate.
(In reply to Waqar Ahmed from comment #1) > Does your home directory contain a `.kateproject file? Or Is your home > directory a git repo maybe? maybe it has .git directory? Thanks for the hint, I have checked my home directory: There is no .kateproject and no .git/ inside.
I have made further investigations and I think I have found the root cause for the issue. Scenario 1: ----------- Preparations: mkdir somefolder000 mkdir somefolder000/somesubfolder01 mkdir somefolder000/anothersubfolder02 Works fine: kate somefolder000/somesubfolder01 kate somefolder000/anothersubfolder02 kate somefolder000 Scenario 2: ----------- Preparations: mkdir anotherfolder001 mkdir anotherfolder001/somesubfolder03 mkdir anotherfolder001/anothersubfolder04 Works fine: kate anotherfolder001 Does not work as expected, Kate opens anotherfolder001 instead of its subfolders: kate anotherfolder001/somesubfolder03 kate anotherfolder001/anothersubfolder04 Investigations: --------------------- Kate stores information about previously "opened folders" in /home/$USER/.local/share/kate/anonymous.katesession file. Under [Plugin:kateprojectplugin:] information about previously opened projects and folders stored. From previous 2 examples following information is stored (newline added for readability): {"data":{"files":[{"directory":"./"}]\\,"name":"somesubfolder01"}\\,"path":"/home/someuser/somefolder000/somesubfolder01"}, {"data":{"files":[{"directory":"./"}]\\,"name":"anothersubfolder02"}\\,"path":"/home/someuser/somefolder000/anothersubfolder02"}, {"data":{"files":[{"directory":"./"}]\\,"name":"somefolder000"}\\,"path":"/home/someuser/somefolder000"}, {"data":{"files":[{"directory":"./"}]\\,"name":"anotherfolder001"}\\,"path":"/home/someuser/anotherfolder001"} In Scenario 1 first subfolders were opened in Kate, then the belonging root folder "somefolder000" => This have worked. In Scenario 2 first root folder "anotherfolder001" was opened in Kate. Trial to open any subfolder of anotherfolder001 will not work then. Conclusion: I suppose the issue is that Kate (or kateprojectplugin) searches for matching path string or sub-string in anonymous.katesession under [Plugin:kateprojectplugin:] and opens first matching path (which could be only a sub-string). This is why /home/someuser/anotherfolder001 will be opened in Scenario 2 instead of /home/someuser/anotherfolder001/somesubfolder03.
If you don't want that, I think you need to disable session restore for the project plugin.
(In reply to Christoph Cullmann from comment #4) > If you don't want that, I think you need to disable session restore for the > project plugin. Thanks for the hint! I have deactivated "session restore" and retried with "Scenario 2" from my "Comment 2" https://bugs.kde.org/show_bug.cgi?id=502384#c3 Now "Open Folder" works in Kate as expected, folder and sub-folders will be opened independent from opening order. Looking into anonymous.katesession I can see that kateprojectplugin section is empty now: [Plugin:kateprojectplugin:] projects= Conclusion: "Session restore" and "Open Folder" are not working together...
They work together, but we group projects by dir nesting if there are no explicit project files. If the restore restores the top level project, the open of the subfolder will just activate that project that already got restored by session restore. Altering that behavor or the restore order will just lead to other variants not working.
(In reply to Christoph Cullmann from comment #6) > If the restore restores the top level project, the open of the subfolder > will just activate that project that already got restored by session restore. > Altering that behavor or the restore order will just lead to other variants > not working. Thanks for clarification, I can live with deactivated "restore session" since stored sessions could be opened from Kate menu. Idea for "Open Folder" in Kate with activated "restore session" feature: If there is a collision between "open project" and "restore session" Kate could ask user in a dialog to choose which folder to open, top level from "restore session" or sub-folder from "open project" action.