Create an "Outline View"
Open, Needs TriagePublic

Description

Currently we have the "Symbol Viewer" plugin. It could be better named, e.g. "Outline View". Or - depending of the code quality - a new plugin could be created.

Ideas for outlining:

Markdown
See here: https://bugs.kde.org/show_bug.cgi?id=402216, see also https://github.com/loh-tar/KatePlugin-IndexView ("A fork from Kate's plugin SymbolViewer with a couple of improvements"). (@loh.tar: Thanks for the hint, I havn't tried it yet but I will! "Index View" is not the best name because it could refer to a code index etc.).

CMake

The outline could be

  • add_library and add_executable lines
  • links to other CMake files (add_directory calls). This would put the requirement on the Outline View to also be able to link to other files.
  • Deeper inspection: Show a list of all files which will be compiled but do not reside in the source tree (because they were auto-generated, like moc files), this list can be retrieved by compile_commands.json. This can be helpful to get an overview over new/unknown projects and for debugging. (Maybe this could be another plugin with a separate view)

With the VariableInterface one could set a variable "CMAKE_BINARY_DIR" once which could be picked up by the OutlineView. The variable points to the build root from where one could read CMakeCache files and then:

  • Display a list of currently used variables in the CMakeLists.txt along with their actual value
  • Display other variables found in CMakeCache
gregormi created this task.Jan 6 2019, 11:56 PM
gregormi updated the task description. (Show Details)Jan 7 2019, 12:01 AM
gregormi added a subscriber: loh.tar.
gregormi updated the task description. (Show Details)Jan 7 2019, 12:05 AM
gregormi updated the task description. (Show Details)
gregormi added a subscriber: dhaumann.

Yes, my English is bad. But "Outline View" sound to me less fitting than my "Index View". But when I look at your notes below CMake you seems to have in mind to traverse the directory and search some stuff. Obviously similar to the CTag plugin, which I have never tested. (Ha, only noted recently what it is due to its odd description in the Kate config page). So then may your name indeed fit better.

CMake files: After recently looking at some CMake stuff I have note the need for that ;-) Guess will add it in the (near) future to my plugin.

Code quality: I notice also recently that I have sadly based my plugin on the old QRegExp *hmpf*

Yes, my English is bad. But "Outline View" sound to me less fitting than my "Index View".

Hmm. I discussed this name ("Outline View") with someone else and it should be fine. See for example https://code.visualstudio.com/updates/v1_24#_outline-view.

Code quality: I notice also recently that I have sadly based my plugin on the old QRegExp *hmpf*

Nothing that can't be changed :-)

What about renaming your Plugin to "Outline View" and integrate it in the Kate source code. This way we can keep the original "Symbol View" while we add features to "Outline View" until the other one can be switched off.

I discussed this name ("Outline View") with someone else and it should be fine. See for example...

Alright, it seems to fit. Microsoft never fails.

I like my name more, in German I give it the name "Stichwortansicht" which is somehow a variation of "Stichwortverzeichnis", just only to fit all the "view" naming. And this name fit perfect to my intention/imagination.

What about renaming your Plugin to "Outline View" and integrate it in the Kate source code.

What is going into official Kate tree is not my authority. Feel free to do what ever you like with my plugin. To rename it should be one of the first things when you intend to do things with it I may reject as PR.

Code quality: I notice also recently that I have sadly based my plugin on the old QRegExp *hmpf*

Nothing that can't be changed :-)

Patch is welcome ;-)

My feeling is that some of the plugins are not much "loved", only "tolerated" and kept due to "history reasons".

The "Symbol View" is in very bad condition, I did almost a complete rewrite not for no reason. Almost finished, I got more and more doubts if it was my best decision to spend so much time for it. The concept is the same as the orig one. Before I started was already the idea to write such plugin based on the highlight stuff, but I had no idea how to start. Then I came across CTag and got a light why "Symbol View" is not improved for so long time. It's somehow obsolete. Hacker didn't use it anymore.

I didn't look at the CTag plugin but I guess it is much closer to your goals then "Symbol View" or my fork.

Sometimes I think such "look up functionality" (to jump outside the current file) would be really handy, but how to add it to my plugin I have no idea. CTag seems to work with some local generated database, too much effort for my taste.

Last note: Do you ever try KDevelop? Me only a couple of years ago, can't remember what was wrong with it, why I didn't kept to use it. But I noticed that it is here often noted, so it's obviously heavy used and should be good nowadays.

gregormi updated the task description. (Show Details)Jan 14 2019, 8:26 PM

My feeling is that some of the plugins are not much "loved", only "tolerated" and kept due to "history reasons".

Yes, indeed. Caretakers are needed.

The "Symbol View" is in very bad condition, I did almost a complete rewrite not for no reason. Almost finished, I got more and more doubts if it was my best decision to spend so much time for it. The concept is the same as the orig one. Before I started was already the idea to write such plugin based on the highlight stuff, but I had no idea how to start. Then I came across CTag and got a light why "Symbol View" is not improved for so long time. It's somehow obsolete. Hacker didn't use it anymore.

A kind of Outline View (or Index View) for the current file is always a good thing. CTags and the like have another scope; code navigation in the whole project.

For me, an additional benefit would be with Markdown file navigation and CMake introspection.

I didn't look at the CTag plugin but I guess it is much closer to your goals then "Symbol View" or my fork.

As said, it is a different scope. Acutally, I currently don't use Symbol View much for programming but I indent to use it for the other things I said.

Sometimes I think such "look up functionality" (to jump outside the current file) would be really handy, but how to add it to my plugin I have no idea. CTag seems to work with some local generated database, too much effort for my taste.

Just give it the project root in the path list and you get - not perfect - but helpful code navigation.

Last note: Do you ever try KDevelop? Me only a couple of years ago, can't remember what was wrong with it, why I didn't kept to use it. But I noticed that it is here often noted, so it's obviously heavy used and should be good nowadays.

Yes, I use it for KDE development. It uses libclang to do very good code completion and navigation. At work, I cannot use it because libclang has a bug which is triggered by our project and so KDevelop crashes.

Plus points from my perspective:

  • Great code navigation and completion (also for Python) including documentation popups (for C++ and CMake)
  • Integrated Debugger
  • Well-known Kate as editor
  • Jump to compile error
  • Unit Test Integration

Minus points that come to my mind:

  • Compiler output is a listbox (it has a reason I forgot) instead of textbox which hinders copying more than one line
  • Some parts are not polished but there are plans to clean things up and concentrate on key features.
  • Can currently crash on certain projects
  • Not everything is intuitive. Someone has to show you how things are supposed to be used (but this applies to other programs, too).
  • The integrated Konsole is not synced with current directory (or I just don't know how to make use of the current settings better)

Display other variables found in CMakeCache

This, and the other similar requests, looks to me out of the scope from (at least my IndexView). That stuff sounds to be related to the Build- or Project-Plugin.

For me, an additional benefit would be with Markdown file navigation

Not sure what "file navigation" mean. When "click on a link follow them", that's not supported by my plugin. Jump around inside the current file it is. Here a shot how it looks with the KTextEditor README.

A kind of Outline View (or Index View) for the current file is always a good thing. CTags and the like have another scope; code navigation in the whole project.

Did it not support to jump around in the current file?

Sometimes I think such "look up functionality" (to jump outside the current file) would be really handy,

Just give it the project root in the path list and you get - not perfect - but helpful code navigation.

Na, not so easy with my plugin. But it may possible to improve it similar, when e.g. the header is open/loaded to jump to the declaration from some other file. Currently is the shown tree not saved, always deleted and new raised on each view/document switch. So keep track of some stuff may work.

Yes, I use it for KDE development...

Thanks for the explanations.

I ask me why there is a need for an extra KDevelop application. Obviously has Kate some plugins which work not so nice as the functionality in KDevelop.

So, why is the nice stuff from KDevelop not only a plugin to Kate?
Or, why there a plugins in Kate which suggest to use Kate as IDE when KDevelop is much better for that?

The same applies to Kile...hmm...but there is not so much overlapping.

dhaumann moved this task from Backlog to Done on the Kate board.Oct 10 2019, 8:37 AM

I believe work should be invested into the LSP client, since it provides an outline as well. Over time, the language servers will get better and better, so you'll get all this for free.