User talk:Merritt: Difference between revisions
(Initial IDE page skeleton) |
(Fill VSCode section) |
||
Line 6: | Line 6: | ||
==VSCode== | ==Visual Studio Code (VSCode)== | ||
VSCode is a very popular cross-platform, general-purpose, open source IDE. Thanks to its powerful extensions systems it supports many languages as well as deep customization options for themes, fonts, keyboard controls, and more. | |||
===Installing=== | |||
VSCode is available as a deb, rpm, portable, and in the Arch User Repository. | |||
https://code.visualstudio.com/Download | |||
===Extensions=== | |||
Once VSCode is installed we need some extensions to enable support for the languages to work on KDE projects. | |||
# [https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools-extension-pack C/C++ Extension Pack] - Enables support for C++ and CMake. | |||
# [https://marketplace.visualstudio.com/items?itemName=tonka3000.qtvsctools Qt tools] - Enables some Qt support. | |||
# [https://marketplace.visualstudio.com/items?itemName=bbenoist.QML QML] - Enables syntax highlighting for QML. | |||
Optional: | |||
[https://zealdocs.org/ Zeal] is an application that allows browsing documentation offline. | |||
[https://marketplace.visualstudio.com/items?itemName=deerawan.vscode-dash Dash] is a VSCode extension that enables a hotkey (Ctrl + H) to instantly open the item under the cursor in Zeal. | |||
These paired together make looking up documentation while working on code very quick and easy. | |||
===Configuration=== | |||
VSCode holds settings related to specific projects in the top-level project directory, in a hidden <code>.vscode</code> folder. | |||
We will use Dolphin as an example of where to add our project configuration files: | |||
====settings.json==== | |||
This config specifies the correct build directory. | |||
Create the file <code>settings.json</code> at <code>~/kde/src/dolphin/.vscode/settings.json</code> | |||
Add the following to the new file: | |||
{{Input|1=<nowiki> | |||
{ | |||
"cmake.buildDirectory": "${workspaceFolder}/../../build/dolphin" | |||
} | |||
</nowiki>}} | |||
====c_cpp_properties.json==== | |||
This config enables the correct settings to support C++, CMake & IntelliSense. | |||
Create the file <code>c_cpp_properties.json</code> at <code>~/kde/src/dolphin/.vscode/c_cpp_properties.json</code> | |||
Add the following to the new file: | |||
{{Input|1=<nowiki> | |||
{ | |||
"configurations": [ | |||
{ | |||
"name": "Linux", | |||
"includePath": [ | |||
"${workspaceFolder}/**" | |||
], | |||
"defines": [], | |||
"compilerPath": "/usr/bin/gcc", | |||
"cStandard": "c17", | |||
"cppStandard": "c++17", | |||
"intelliSenseMode": "${default}", | |||
"compileCommands": "${workspaceFolder}/compile_commands.json" | |||
} | |||
], | |||
"version": 4 | |||
} | |||
</nowiki>}} | |||
====.kdesrc-buildrc==== | |||
Needed to enable LSP support: | |||
In <code>~/.kdesrc-buildrc</code> ensure these two options are in the global section and set to true: | |||
{{Input|1=<nowiki> | |||
compile-commands-linking true | |||
compile-commands-export true | |||
</nowiki>}} | |||
====Working on a project==== | |||
We work on a project in VSCode by opening it as a folder: | |||
* <code>File</code> -> <code>Open Folder</code> | |||
* Navigate to <code>~/kde/src/dolphin</code> and press <code>OK</code> | |||
{{Info|Along the bottom of the window are buttons to configure, build, run, debug, etc.}} |
Revision as of 15:19, 7 October 2021
Setting up an IDE for KDE Development
// Blurb about IDEs and choices
Visual Studio Code (VSCode)
VSCode is a very popular cross-platform, general-purpose, open source IDE. Thanks to its powerful extensions systems it supports many languages as well as deep customization options for themes, fonts, keyboard controls, and more.
Installing
VSCode is available as a deb, rpm, portable, and in the Arch User Repository.
https://code.visualstudio.com/Download
Extensions
Once VSCode is installed we need some extensions to enable support for the languages to work on KDE projects.
- C/C++ Extension Pack - Enables support for C++ and CMake.
- Qt tools - Enables some Qt support.
- QML - Enables syntax highlighting for QML.
Optional:
Zeal is an application that allows browsing documentation offline.
Dash is a VSCode extension that enables a hotkey (Ctrl + H) to instantly open the item under the cursor in Zeal.
These paired together make looking up documentation while working on code very quick and easy.
Configuration
VSCode holds settings related to specific projects in the top-level project directory, in a hidden .vscode
folder.
We will use Dolphin as an example of where to add our project configuration files:
settings.json
This config specifies the correct build directory.
Create the file settings.json
at ~/kde/src/dolphin/.vscode/settings.json
Add the following to the new file:
{ "cmake.buildDirectory": "${workspaceFolder}/../../build/dolphin" }
c_cpp_properties.json
This config enables the correct settings to support C++, CMake & IntelliSense.
Create the file c_cpp_properties.json
at ~/kde/src/dolphin/.vscode/c_cpp_properties.json
Add the following to the new file:
{ "configurations": [ { "name": "Linux", "includePath": [ "${workspaceFolder}/**" ], "defines": [], "compilerPath": "/usr/bin/gcc", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "${default}", "compileCommands": "${workspaceFolder}/compile_commands.json" } ], "version": 4 }
.kdesrc-buildrc
Needed to enable LSP support:
In ~/.kdesrc-buildrc
ensure these two options are in the global section and set to true:
compile-commands-linking true compile-commands-export true
Working on a project
We work on a project in VSCode by opening it as a folder:
File
->Open Folder
- Navigate to
~/kde/src/dolphin
and pressOK