Bug 457709 - Formatters for All Major Languages
Summary: Formatters for All Major Languages
Status: RESOLVED NOT A BUG
Alias: None
Product: kate
Classification: Applications
Component: application (other bugs)
Version First Reported In: 21.12.3
Platform: Other Other
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-08-10 08:40 UTC by rbharathkumar
Modified: 2022-08-12 08:54 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rbharathkumar 2022-08-10 08:40:27 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Open Kate
2. Select documents of various languages - SQL
3. Same process for JSON, HTML, Python, Scala
4. Try to format.

OBSERVED RESULT
No Formatting options available.
Currently only available for JSON, Rust have formatting options available.

EXPECTED RESULT
Provide a formatter option for commonly used languages that would not only adjust the indentation, but actually format the code. e.g. Poor Man's Formatter for SQL or Prettier format. This would enhance the effectiveness of the Editor many fold.
I have seen some options that this can be enabled via External Tools, but would be nice if they were available to everyone as a button to toggle instead of setting up several unknown packages.

SOFTWARE/OS VERSIONS
Windows: Windows 10
macOS: 
Linux/KDE Plasma: Fedora (Dual Boot)
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 5.91
Qt Version: 5.15.2

ADDITIONAL INFORMATION
On a side note, the external tools option in Windows is extremely buggy. The options do not show up consistently. Sometimes they are available, sometimes they become invisible. Also cause editor to crash occasionally.
Comment 1 Waqar Ahmed 2022-08-11 06:10:15 UTC
Please consider providing the list of formatters that are available for the language including how to run it etc. It is unlikely anyone on the team will do this research on your behalf unless they want the formatter themselves.

We will not implement formatters ourselves, you will need to install the tool and kate will just run it. This is not going to change. We do not have resources to do otherwise.

> On a side note, the external tools option in Windows is extremely buggy. The options do not show up consistently. Sometimes they are available, sometimes they become invisible. Also cause editor to crash occasionally.

Consider filing a bug with proper details like which tool was missing and what document you had opened. Similarly, how did kate crash etc. Sidenotes will get ignored otherwise.

Thanks
Comment 2 Nate Graham 2022-08-11 17:58:18 UTC
> Formatters for All Major Languages
This is a little like saying, "fix all the bugs;" it's too broad a thing to ask for within the scope of a single bug report. Feel free to file individual bug reports that each request a specific thing. In the future, see https://community.kde.org/Get_Involved/Issue_Reporting#Step_6:_File_a_high-quality_Bugzilla_ticket.

Thanks!
Comment 3 rbharathkumar 2022-08-12 08:17:41 UTC
Thank you for your time in responding to my wishlist (Not a Bug)

My apologies that the title was generic.

I was merely looking at scenarios where I switch from Kate and do some action online or in some other editor. I had create a couple of bugs on similar workflow items.

I know the wishlist item is closed, but just wanted to provide more information in case it would be taken up sometime in the future. Even if it is not taken up it is fine.

1. When I had mentioned all languages, I was asking for the most common languages only. Considering that new languages keep popping up everyday, it is totally not possible to include everything.  But what can be possible would have been for implementation for few languages (two already available) based on which whoever is in need, can follow similar design language and work flow. I was imagining a menu option similar to Highlighter or Align which would lead to a sub menu group based on Database or Language or the like. My bad, should have been better communicated from my end.

2. This would lead to question which are the commonly used languages.
Maybe top 5 or 10 from the below link ? Not the most accurate representation, but it is all I could dig up....
https://survey.stackoverflow.co/2022/#most-loved-dreaded-and-wanted-language-love-dread
Top 10 - Rust, Elixir, Clojure, TypeScript, Julia, Python, Delphi, Go, SQL, C#

3. Then again on the question on code formatters, I researched and found this github link. Not sure if it helps.
https://github.com/rishirdua/awesome-code-formatters

4. Some common websites for formatters I could find.
SQL - https://poorsql.com
Scala - https://scastie.scala-lang.org (scalafmt is a well known formatter)
Python - https://black.vercel.app/?version=stable&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4AB8AFNdAD2IimZxl1N_WmOQqEcOUylVl9cqZbQ4uBvFQ0nANM57aPrxr0q2x4fz4RV-p4nWwwvbE_pgK-kFfyeTgOgOubomPq7DCINxEUZPd9b1bCPYP6sAAAAP0pB7xKIAaAABb33Cz1fsH7bzfQEAAAAABFla

5. Options to Consider:
1. Format on Save
2. Format Selected Range

I agree that there aren't enough resources to take up something that is not a bug and cosmetic mostly. But someday....
I am not technically knowledgeable to implement the same.

Thanks for all the hard work. Truly appreciate it. 
Sorry if I had wasted your time...Cheers...Have a nice day...
Comment 4 Waqar Ahmed 2022-08-12 08:54:44 UTC
You do need to be technically knowledgable to add these. Consider creating a PR for every tool you want to add. It's easy to add a tool, Go to External Tools and click Add. Add your desired tool, submit it to Kate so that everyone else can use it.