https://bugs.kde.org/show_bug.cgi?id=503874

            Bug ID: 503874
           Summary: CLang Format Full File does not work on open tabs
                    which have not been saved
    Classification: Applications
           Product: kate
           Version: 25.04.0
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: kwrite-bugs-n...@kde.org
          Reporter: kdmw....@tuta.io
  Target Milestone: ---

SUMMARY
In Kate there is a tool under Tools > External Tools > Tools > CLang Format
Full File. This tool is very handy to beautify code like JSON blocks or JS code
or other pieces of code. However this requires that the code snippet be saved
as a file. Only then it works. It does not work on open tabs which have not
been saved as a file. In such tabs, i.e. open tabs which have not been saved as
a file, even selecting the code snippet and trying to run the "CLang Format
Full File" does not work

STEPS TO REPRODUCE
1.  Launch Kate. 
2.  Create a new file, by pressing the key combination CTRL+N or Selecting the
menu option File > New. It will open a new tab with the name "Untitled" or
"Untitled (2)" or "Untitled (3)" or something similar. 
3. Copy a JSON code snippet or any other C/C++ code snippet and paste it in the
tab that was opened in step number 2.
4. With the tab opened in step number 2 in focus go to the menu option Tools >
External Tools > Tools > CLang Format Full File. See the observed result and
expected result
5. With the tab opened in the step number 2 in focus select only the code
snippet that was pasted in step number 3. Do not select any other code or text.
go to the menu option Tools > External Tools > Tools > CLang Format Full File.
See the observed result and expected result

OBSERVED RESULT
The following are the results that are observed in the Output section.
[External Tools Info] Running Clang Format Full File: clang-format -i
[External Tools Warning] Data written to stderr:
                    error: cannot use -i when reading from stdin.
[External Tools Info] Running Clang Format Selected Text: clang-format
-assume-filename= with input   %{Document:Selection:Text}
[External Tools Error] Data written to stderr:
                    error: empty filenames are not allowed
                    Clang Format Selected Text finished with exit code 1


EXPECTED RESULT
The code should be beautified or formatted as per the CLang specs. 

SOFTWARE/OS VERSIONS
Windows: NA
macOS:  NA
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 6.3.4
KDE Plasma Version: 6.3.4
KDE Frameworks Version: 6.13.0
Qt Version: 6.9.0

ADDITIONAL INFORMATION

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to