Get Involved/development/IDE configuration/Kate: Difference between revisions

From KDE Community Wiki
(Build, debugger)
(With the".kateproject" file)
Line 1: Line 1:
Kate is the feature-packed text editor from KDE.
Kate is the feature-packed text editor from KDE.
==kdesrc-build==
Make sure kdesrc-build works correctly. Make sure ~/.config/kdesrc-buildrc contains the lines:
{{Input|1=<nowiki>
cmake-options -G "Kate - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
stop-on-failure false
directory-layout invent
# Build with LSP support for everything that supports it
compile-commands-linking true
compile-commands-export true
</nowiki>}}
Using kdesrc-build build a module. E.g.
{{Input|1=<nowiki>
kdesrc-build kcalc
</nowiki>}}
==kate==


See the web page "Building Kate from Sources on Linux" https://kate-editor.org/build-it/  
See the web page "Building Kate from Sources on Linux" https://kate-editor.org/build-it/  
Line 5: Line 25:
The web page talks about how to build kate using kdesrc-build and how to configure kate.
The web page talks about how to build kate using kdesrc-build and how to configure kate.


Configure the kate text editor in order to program/develop C++ source code projects:
In kate enable the plugins: Project Plugin, LSP Client, Build Plugin, GDB.
* Configure kdesrc-build to generate .kateproject project files.
* Configure kdesrc-build to generate the file compile_commands.json used by the clangd C++ LSP server.
* Enable the kate plugins: Project Plugin, LSP Client, Build Plugin, GDB.


Some of the features available in kate:
Some of the features available in kate:
* Build. kate main menu > Build > Select Target... > Target Set > Working Directory should be "~/kde/build/utilities/kcalc" > OK button. "Build Output" tool view > "Output" is shown. Change to tab "Target Settings" from tool view "Build Output" > double click on cell "Dir:" > select "~/kde/build/utilities/kcalc", press Enter. kate main menu > Build > Build Default Target.
 
* Debugger. Using the "GDB" plugin. kate main menu > Debug > Targets > Target 1. kate main menu > View > Tool Views > Show Debug View > Settings tab > Executable > select "~/kde/build/utilities/kcalc/bin/kcalc". Click on source code line, from kate main menu > Debug > Toggle Breakpoint. kate main menu > Debug > Start Debugging. kate main menu > Debug > Continue/ Step Over/ Step In/ Step Out.
* LSP Client Symbol Outline
* LSP Client Symbol Outline
* Right click in text editor on a C++ identifier > LSP Client > Go to Declaration/Find References/ Switch Source Header F12/ Symbol Info/ Search and Go to Symbol Ctrl+Alt+P/ Format/ Rename/ Switch to diagnostics tab/ Quickfix This menu is also available from kate main menu > LSP Client.
* Right click in text editor on a C++ identifier > LSP Client > Go to Declaration/Find References/ Switch Source Header F12/ Symbol Info/ Search and Go to Symbol Ctrl+Alt+P/ Format/ Rename/ Switch to diagnostics tab/ Quickfix This menu is also available from kate main menu > LSP Client.
* kate main menu > Tools > External Tools > Git > git blame/ gitk
* kate main menu > Tools > External Tools > Git > git blame/ gitk
* kate main menu > Tools > External Tools > Tools > Clang Format Full File/ Search KDE/Qt API/ JSON/XML Format Full File.
* kate main menu > Tools > External Tools > Tools > Clang Format Full File/ Search KDE/Qt API/ JSON/XML Format Full File.
===Build and debug===
====With the ".kateproject" file====
{{Input|1=<nowiki>
cd ~/kde/src/utilities/kcalc
ln -s ~/kde/build/utilities/kcalc/.kateproject ~/kde/src/utilities/kcalc/.kateproject
kate . &
</nowiki>}}
* Build. kate main menu > Build > Select Target... > Target Set > Working Directory should be "~/kde/build/utilities/kcalc", all of the CMake targets should be listed, > OK button. "Build Output" tool view > "Output" is shown. kate main menu > Build > Build Default Target.
* Debugger. kate main menu > Debug > Targets > Target 1. kate main menu > View > Tool Views > Show Debug View > Settings tab > Executable > select "~/kde/build/utilities/kcalc/bin/kcalc". Click on source code line, from kate main menu > Debug > Toggle Breakpoint. kate main menu > Debug > Start Debugging. kate main menu > Debug > Continue/ Step Over/ Step In/ Step Out.
====Without the ".kateproject" file====
If we do not have a ".kateproject" file. Then:
* Build. kate main menu > Build > Select Target... > Target Set > Working Directory should be "~/kde/build/utilities/kcalc" > OK button. "Build Output" tool view > "Output" is shown. Change to tab "Target Settings" from tool view "Build Output" > double click on cell "Dir:" > select "~/kde/build/utilities/kcalc", press Enter. kate main menu > Build > Build Default Target.
* Debugger. kate main menu > Debug > Targets > Target 1. kate main menu > View > Tool Views > Show Debug View > Settings tab > Executable > select "~/kde/build/utilities/kcalc/bin/kcalc". Click on source code line, from kate main menu > Debug > Toggle Breakpoint. kate main menu > Debug > Start Debugging. kate main menu > Debug > Continue/ Step Over/ Step In/ Step Out.

Revision as of 19:17, 11 September 2022

Kate is the feature-packed text editor from KDE.

kdesrc-build

Make sure kdesrc-build works correctly. Make sure ~/.config/kdesrc-buildrc contains the lines:

cmake-options -G "Kate - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug
stop-on-failure false
directory-layout invent
# Build with LSP support for everything that supports it
compile-commands-linking true
compile-commands-export true

Using kdesrc-build build a module. E.g.

kdesrc-build kcalc

kate

See the web page "Building Kate from Sources on Linux" https://kate-editor.org/build-it/

The web page talks about how to build kate using kdesrc-build and how to configure kate.

In kate enable the plugins: Project Plugin, LSP Client, Build Plugin, GDB.

Some of the features available in kate:

  • LSP Client Symbol Outline
  • Right click in text editor on a C++ identifier > LSP Client > Go to Declaration/Find References/ Switch Source Header F12/ Symbol Info/ Search and Go to Symbol Ctrl+Alt+P/ Format/ Rename/ Switch to diagnostics tab/ Quickfix This menu is also available from kate main menu > LSP Client.
  • kate main menu > Tools > External Tools > Git > git blame/ gitk
  • kate main menu > Tools > External Tools > Tools > Clang Format Full File/ Search KDE/Qt API/ JSON/XML Format Full File.

Build and debug

With the ".kateproject" file

cd ~/kde/src/utilities/kcalc
ln -s ~/kde/build/utilities/kcalc/.kateproject ~/kde/src/utilities/kcalc/.kateproject
kate . &
  • Build. kate main menu > Build > Select Target... > Target Set > Working Directory should be "~/kde/build/utilities/kcalc", all of the CMake targets should be listed, > OK button. "Build Output" tool view > "Output" is shown. kate main menu > Build > Build Default Target.
  • Debugger. kate main menu > Debug > Targets > Target 1. kate main menu > View > Tool Views > Show Debug View > Settings tab > Executable > select "~/kde/build/utilities/kcalc/bin/kcalc". Click on source code line, from kate main menu > Debug > Toggle Breakpoint. kate main menu > Debug > Start Debugging. kate main menu > Debug > Continue/ Step Over/ Step In/ Step Out.

Without the ".kateproject" file

If we do not have a ".kateproject" file. Then:

  • Build. kate main menu > Build > Select Target... > Target Set > Working Directory should be "~/kde/build/utilities/kcalc" > OK button. "Build Output" tool view > "Output" is shown. Change to tab "Target Settings" from tool view "Build Output" > double click on cell "Dir:" > select "~/kde/build/utilities/kcalc", press Enter. kate main menu > Build > Build Default Target.
  • Debugger. kate main menu > Debug > Targets > Target 1. kate main menu > View > Tool Views > Show Debug View > Settings tab > Executable > select "~/kde/build/utilities/kcalc/bin/kcalc". Click on source code line, from kate main menu > Debug > Toggle Breakpoint. kate main menu > Debug > Start Debugging. kate main menu > Debug > Continue/ Step Over/ Step In/ Step Out.