SUMMARY The "Formatting" plugin, which is described as a plugin for formatting code, requires npm to be installed in the system. However, npm is not included in Kubuntu as a default package. So, if a Kate user enables the plugin and trigger it by saving changes, the "Output" status panel shows "[... Format Error] /bin/sh: 1: npm: not found". As far as I can find, the source of the problem is the "Formatting" plugin calls prettier_script.js[1], which can be installed by npm i prettier Although there is a line [2] that warns the user to install node and prettier [3], there was not such a warning either when I enabled the plugin or saved a file after eneabling the plugin. Note: I am not a developer and I don't know any programming language. STEPS TO REPRODUCE 1. Open a document in Kate 2. Enable Formatting plugin: Settings>Configure Kate>Plugins> Check Formatting 3. Save the file via Menu>File>Save or by CTRL+S shortcut (you don't need to change anything) OBSERVED RESULT "Output" status panel shows "[... Format Error] /bin/sh: 1: npm: not found". EXPECTED RESULT SOFTWARE/OS VERSIONS Linux/KDE Plasma: Kubuntu KDE Plasma Version: 5.27.11 KDE Frameworks Version: 5.115.0 Qt Version: 5.15.13 ADDITIONAL INFORMATION [1] https://invent.kde.org/utilities/kate/-/blob/master/addons/format/prettier_script.js?ref_type=heads [2] https://invent.kde.org/utilities/kate/-/blob/master/addons/format/Formatters.cpp?ref_type=heads#L221 [3] https://www.npmjs.com/package/prettier
Can't say what the issue is after reading the report. The plugin needs prettier to be installed either globally or locally in the repo you are working. In the next release, I have reduced the error noise so that the error will only be reported once.
(In reply to Waqar Ahmed from comment #1) > Can't say what the issue is after reading the report. The plugin needs > prettier to be installed either globally or locally in the repo you are > working. > > In the next release, I have reduced the error noise so that the error will > only be reported once. I am sorry that I didn't clearly explain myself. I think it would be much more user friendly if Kate displayed a warning or information about how to use the plugin when enabling it or when hovering over the plugin name. I mean, as an end user, I didn't know that I needed to install additional software to use this. I don't want you to reduce the "error noise". It is not a noise in my opinion. It is a bit cryptic. The first time I saw the warning, I thought that why would I need npm? Instead of printing /bin/sh: 1: npm: not found something like this might be a better warning: This plugin need prettier which can be installd by npm. Thank you for answering and for your very fast response!
In the case of prettier things are a bit complex so yeah, the error is cryptic. I will see if I can improve that :) If you would like to contribute, this sounds like a good first issue. About the error noise, I mean you don't want the same error being reported everytime you press Ctrl+S. That would be very annoying.
I indeed wanted to contribute, but I don't know where to start, and I don't know any programming language. The one thing that I could do is find the relative line where "npm: not found" is printed and change it, is what I thought. Or I could look to translation files and see if it is there. I will give it a try.
Then I would suggest spending some time learning a little C++. Thats what Kate is implemented in. https://www.learncpp.com/ is a good place to start. Once you can make some sense of the code in Kate, you will be ready to contribute. Also, try to build Kate from sources. We have a tool that can help you do that. Its called "kdesrc-build". You can ask questions on our channel in matrix. You already know which files to touch on without knowing programming, so imo you are already better than many programmers.