Bug 397563

Summary: Menu of "most recently/frequently used" modes
Product: [Applications] kate Reporter: Mark <mpictor>
Component: syntaxAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WAITINGFORINFO    
Severity: wishlist CC: a.samirh78, christoph, nate
Priority: NOR    
Version: 18.04.3   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Mark 2018-08-17 21:26:07 UTC
I frequently open files where Kate chooses "Normal" mode because it fails to guess. I generally want to set the mode so that I get some sort of syntax highlighting, even if it isn't perfect.

The desired syntaxes are often in the middle of the _huge_ list of choices, and if I'm hasty with the mouse it can take several tries to get the right one. I'd like to have a menu that shows things that have been used recently, or that I've used most frequently, or a user-defined list where I can add things like Bash, Python, INI, Groovy, Jinja2/YAML, etc.

If the user-defined list is the option that's implemented, adding to it could be achieved by allowing the user to right-click and pin/favorite syntaxes, or with something like "Configure toolbars..." where spacers can be inserted and ordering can be controlled.
Comment 1 Nate Graham 2018-08-21 20:33:19 UTC
Would the need for this go away if Kate was better about choosing a syntax highlighting mode in the first place? What are the ones that it's not so good at?
Comment 2 Mark 2018-08-27 22:46:56 UTC
(In reply to Nate Graham from comment #1)
> Would the need for this go away if Kate was better about choosing a syntax
> highlighting mode in the first place? What are the ones that it's not so
> good at?

I do not think it's possible for it to get good enough on this. Some of the file types I work with don't have a mime type and/or lack an extension, so I don't think detection is feasible. Even if 100% were detected, would we really want mime type X to be mapped to something that's _kinda_ like it, say python? That might not bother me or you short term, but I think it'd become a problem sooner or later.

Types it isn't good at include:

* Starlark (formerly skylark), file names BUILD, BUILD.bazel, *.BUILD, *.bzl. Quite similar to python; for this one I simply added the extensions to kate's python highlighter.

* Jinja2 templates. The underlying content can be practically anything text-based: C++, bash, python, html, ansible, other yaml, etc etc. In some cases I prefer to use Jinja2 highlighting (making template items more visible) and in others I prefer to switch to highlighting of the underlying content. I've installed a set of highlighters for Jinja2 with common underlying formats, which is helpful - but
  a) this doesn't cover every underlying format, and
  b) even when the underlying format _is_ detected, I still desire to switch highlight modes at times.

* ERB templates, golang's templates, etc. Similar issues as with Jinja2.

* Various outdated (or proprietary) formats that I use from time to time.

* Plus there's at least one extension that's used for two drastically different things; *.bas springs to mind though I don't recall what would use that other than some dialect of BASIC.
Comment 3 Nate Graham 2018-08-28 21:26:26 UTC
All right, thanks for the information! I'll let the Kate devs take it from here.
Comment 4 Christoph Cullmann 2018-08-28 21:33:47 UTC
Would a solution be that we just collect "which highlightings got set by the user" and have some "Recent" menu that shows the XX most used ones? That way this would naturally populate after some time with the "right ones" and one needs no ui to configure it at all?
Comment 5 Mark 2018-11-06 02:02:37 UTC
(In reply to Christoph Cullmann from comment #4)
> Would a solution be that we just collect "which highlightings got set by the
> user" and have some "Recent" menu that shows the XX most used ones? That way
> this would naturally populate after some time with the "right ones" and one
> needs no ui to configure it at all?

Sorry I didn't respond faster. A "Recent" menu would absolutely fix this!
Comment 6 Ahmad Samir 2019-06-23 17:39:33 UTC
I think this was sort of fixed by: https://phabricator.kde.org/D20958
Comment 7 Nate Graham 2019-06-23 17:42:47 UTC
Not quite. That patch made the syntax highlighting radically better for sure, but it didn't add a "recently used" or "frequently used" view.
Comment 8 Christoph Cullmann 2023-04-16 16:41:42 UTC
Dear user, this wish list item is now closed, as it wasn't touched in the last two years and no contributor stepped up to implement it.

The Kate/KTextEditor team is small and we can just try to keep up with fixing bugs.

Therefore wishes that show no activity for a years or more will be closed from now on to keep at least a bit overview about 'current' wishs of the users.
If you want your feature to be implemented, please step up to provide some patch for it.

If you think it is really needed, you can reopen your request, but keep in mind,
if no new good arguments are made and no people get attracted to help out to implement it,
it will expire in a year again.

We have a nice website https://kate-editor.org that provides all the information needed to contribute, please make use of it.

e.g. see the information at https://kate-editor.org/join-us/ for details

Greetings
Christoph Cullmann