diff --git a/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc b/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc index 3fe99abfdf6..1910f0f62dd 100644 --- a/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc +++ b/doc/qtcreator/src/cmake/creator-projects-cmake.qdoc @@ -247,7 +247,7 @@ \title Complete CMake code - \QC uses \l{Generic Highlighting}{generic highlighting} to provide + \QC uses \l{Download highlight definitions}{generic highlighting} to provide code completion specific arguments for the CMake commands. For example, only source file properties are suggested for the \l {CMake: set_source_files_properties command}, not the test or diff --git a/doc/qtcreator/src/editors/creator-editors-options.qdoc b/doc/qtcreator/src/editors/creator-editors-options.qdoc index fa1ee7df04c..31987c8a073 100644 --- a/doc/qtcreator/src/editors/creator-editors-options.qdoc +++ b/doc/qtcreator/src/editors/creator-editors-options.qdoc @@ -35,16 +35,16 @@ \li Set the \l{Font & Colors}{font preferences and apply color schemes} for syntax highlighting in \uicontrol {Font & Colors}. - \li Specify \l{Generic Highlighting} + \li Specify \l{Download highlight definitions} {definition files for syntax highlighting} for other types of files than C++ or QML in \uicontrol {Generic Highlighter}. \li Set \l{Indent text or code}{tabs, indentation, the handling of whitespace, and mouse operations} in \uicontrol Behavior. - \li Set various display properties, such as \l{Highlighting Blocks} - {highlighting} or \l{Folding Blocks}{folding} blocks or text - wrapping in \uicontrol Display. + \li Set various display properties, such as \l{Highlight code blocks} + {highlighting} or folding code blocks and text wrapping in + \uicontrol Display. \li Add, modify, and remove \l{Snippets}{code snippets} in \uicontrol Snippets. diff --git a/doc/qtcreator/src/editors/creator-editors-writing-code.qdoc b/doc/qtcreator/src/editors/creator-editors-writing-code.qdoc index 1e7ce512236..6330d575d94 100644 --- a/doc/qtcreator/src/editors/creator-editors-writing-code.qdoc +++ b/doc/qtcreator/src/editors/creator-editors-writing-code.qdoc @@ -23,12 +23,6 @@ in-line error indicators while you are typing. \list - \li \l{Semantic Highlighting} - - \QC enables you to write well formatted code by highlighting - code elements and blocks. You can use syntax highlighting - also for other types of files than C++ or QML. - \li \l{Checking Code Syntax} \QC checks for errors when you write code and displays inline diff --git a/doc/qtcreator/src/editors/creator-semantic-highlighting.qdoc b/doc/qtcreator/src/editors/creator-semantic-highlighting.qdoc index f3043383c33..44c3364c8fd 100644 --- a/doc/qtcreator/src/editors/creator-semantic-highlighting.qdoc +++ b/doc/qtcreator/src/editors/creator-semantic-highlighting.qdoc @@ -4,125 +4,138 @@ /*! \page creator-highlighting.html \if defined(qtdesignstudio) - \previouspage creator-editor-functions.html + \previouspage qtquick-text-editor.html \else - \previouspage creator-coding-navigating.html + \previouspage creator-how-tos.html \endif - \nextpage creator-checking-code-syntax.html - \title Semantic Highlighting + \ingroup creator-how-to-edit - \QC understands the C++, QML, and JavaScript languages as code, not as plain - text. It reads the source code, analyzes it, and highlights it based on the - semantic checks that it does for the following code elements: + \title Download highlight definitions - \list - \li Types (such as classes, structs, and type definitions) - \li Local variables - \li Class fields - \li Virtual functions - \endlist - - To specify the color scheme to use for semantic highlighting, select - \preferences > \uicontrol {Text Editor} > \uicontrol {Font & Colors}. - - \QC supports syntax highlighting also for other types of files than C++, - QML, or JavaScript. - - \section1 Generic Highlighting - - \QC uses - \l{https://api.kde.org/frameworks/syntax-highlighting/html/index.html} - {KSyntaxHighlighting}, which is the syntax highlighting engine for Kate - syntax definitions. \QC comes with most of the commonly used syntax files, - and you can download additional files. For more information about the - definition files, see - \l{https://docs.kde.org/trunk5/en/kate/katepart/highlight.html} + \QC uses the \l{https://api.kde.org/frameworks/syntax-highlighting/html/index.html} + {KSyntaxHighlighting} syntax highlighting engine with Kate syntax definitions. + It comes with most of the commonly used Kate definitions, and you can download + more definitions. For more information about the definition files, see + \l{https://docs.kde.org/stable5/en/kate/katepart/highlight.html} {Working with Syntax Highlighting}. Font attributes that a syntax definition file explicitly specifies, such as bold, italic, underline, or strike through, are applied. Colors are applied if they are readable with \QC themes. + \section2 Remember preferred definitions + If more than one highlight definition is available for the file that you - open for editing, the editor asks you to select the one to use. To save - the selection, select \uicontrol {Remember My Choice}. To reset the - remembered definitions, select \preferences > - \uicontrol {Text Editor} > \uicontrol {Generic Highlighter} > + open for editing, the editor asks you to select the one to use. + + To save the selection, select \uicontrol {Remember My Choice}. + + To reset the remembered definitions, go to \preferences > + \uicontrol {Text Editor} > \uicontrol {Generic Highlighter} and select \uicontrol {Reset Remembered Definitions}. + \image qtcreator-syntax-highlighter.png {Generic Highlighter preferences} + + \section2 Download definitions + If the editor cannot find the highlight definition for a file that you open for editing, it prompts you to download additional highlight definition files. Select \uicontrol {Download Definitions} to download the files. + To view information about the downloaded files, open the \l{View output} {General Messages} view. - To suppress the message for a particular file pattern, select \preferences > + \section2 Ignore file patterns + + To suppress the message for a particular file pattern, go to \preferences > \uicontrol {Text Editor} > \uicontrol {Generic Highlighter} and add the - pattern to the \uicontrol {Ignored file patterns} field. + pattern to \uicontrol {Ignored file patterns}. - \image qtcreator-syntax-highlighter.png "Generic Highlighter preferences" + \section2 Add your own definitions - If you have written your own syntax definition files, you - can add a definition search path in the - \uicontrol {User Highlight Definition Files} field. To - apply the changes you make to the definition files, select + If you have written your own syntax definition files, add a definition search + path in \uicontrol {User Highlight Definition Files}. + + To apply the changes you make to the definition files, select \uicontrol {Reload Definitions}. - \section1 Highlighting Blocks + \if defined(qtdesignstudio) + \sa Code + \else + \sa {Edit Code}{How To: Edit Code}, {Edit Mode} + \endif +*/ - Use block highlighting to visually separate parts of the code that belong - together. For example, when you place the cursor within the braces, the code +/*! + \page creator-how-to-use-code-blocks.html + + \if defined(qtdesignstudio) + \previouspage qtquick-text-editor.html + \else + \previouspage creator-how-tos.html + \endif + + \ingroup creator-how-to-edit + + \title Highlight code blocks + + Block highlighting visually separates parts of the code that belong together. + For example, when you place the cursor within a set of braces, the code enclosed in braces is highlighted. - \image qtcreator-blockhighlighting.png + \image qtcreator-blockhighlighting.png {A code block highlighted in the editor} - To enable block highlighting, select \preferences > \uicontrol {Text Editor} - > \uicontrol Display > \uicontrol {Highlight blocks}. + To enable block highlighting, go to \preferences > \uicontrol {Text Editor} + > \uicontrol Display and select \uicontrol {Highlight blocks}. - \section1 Folding Blocks + \section1 Fold code blocks - Use the folding markers to collapse and expand blocks of code within braces. - Click the folding marker to collapse or expand a block. In the figure above, - the folding markers are located between the line number and the text pane. + Select the folding markers to collapse and expand blocks of code within braces. + In the image above, the folding markers are located between the line number + and the text pane. - To show the folding markers, select \preferences > - \uicontrol {Text Editor} > \uicontrol Display > + To show the folding markers, go to \preferences > + \uicontrol {Text Editor} > \uicontrol Display and select \uicontrol {Display folding markers}. This option is enabled by default. - \image qtcreator-options-text-editor-display.png "Text Editor Display preferences" + \image qtcreator-options-text-editor-display.png {Text Editor Display preferences} - \section2 Folding All Comment Blocks + \if defined(qtcreator) + \section1 Fold all comment blocks - To fold all comment blocks, select \uicontrol Tools > \uicontrol C++ > - \uicontrol {Fold All Comment Blocks}. To unfold all comment blocks, select - \uicontrol {Unfold All Comment Blocks}. + To fold all comment blocks, go to \uicontrol Tools > \uicontrol C++ > + \uicontrol {Fold All Comment Blocks}. - \section1 Animating Matching Braces + To unfold all comment blocks, select \uicontrol {Unfold All Comment Blocks}. + \endif + + \section1 Animate matching braces When the cursor is on a brace, the matching brace is animated by default. - To turn off the animation and just highlight the block and the braces, select - \preferences > \uicontrol {Text Editor} > \uicontrol Display and deselect + To turn off the animation and just highlight the block and the braces, go to + \preferences > \uicontrol {Text Editor} > \uicontrol Display and clear \uicontrol {Animate matching parentheses}. - \section1 Moving Between Blocks + \if defined(qtcreator) + \section1 Move between code blocks - You can use keyboard shortcuts to move within and between blocks. To go to - block end, press \key {Ctrl+]} and to go to block start, press - \key {Ctrl+[}. To also select the lines from the cursor position to the end + Use keyboard shortcuts to move within and between code blocks: + + \list + \li To go to block end, press \key {Ctrl+]}. + \li To go to block start, press \key {Ctrl+[}. + \endlist + + To also select the lines from the cursor position to the end or beginning of the block, press \key {Ctrl+Shift+]} and \key {Ctrl+Shift+[}, respectively. + \endif - \section1 Selecting the Current Block - - To select the current block, press \key Ctrl+U. A second key press extends - the selection to the parent block. To undo the last selection, press - \key {Ctrl+Alt+Shift+U}. - - To enable smart block selection, select \preferences - > \uicontrol {Text Editor} > \uicontrol Behavior > - \uicontrol {Enable smart selection changing}. - - \image qtcreator-preferences-texteditor-behavior.webp "Text Editor Behavior preferences" + \if defined(qtdesignstudio) + \sa Code + \else + \sa {Edit Code}{How To: Edit Code}, {Edit Mode} + \endif */ diff --git a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc index 07459d9a9bc..11adddb54db 100644 --- a/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc +++ b/doc/qtcreator/src/howto/creator-only/creator-how-tos.qdoc @@ -55,10 +55,16 @@ \section1 Edit Code + The code editor offers useful features, such as semantic highlighting, + checking code syntax, code completion, and refactoring actions. + \generatelist creator-how-to-edit \section2 Configure Editors + Configure the code and text editor to suit your specific needs by + changing the fonts, colors, highlighting, and indentation. + \generatelist creator-how-to-configure-editors \section2 Manage Language Servers @@ -449,9 +455,22 @@ \ingroup creator-how-to-edit - \title Select the enclosing block in C++ + \title Select the current code block - Press \key {Ctrl+U}. + To select the current block of C++ code in the code editor, press + \key Ctrl+U. + + Press \key Ctrl+U a second time to extend the selection to the parent block. + + To undo the last selection, press \key {Ctrl+Alt+Shift+U}. + + \section1 Turn on smart block selection + + To turn on smart block selection, go to \preferences + > \uicontrol {Text Editor} > \uicontrol Behavior and select + \uicontrol {Enable smart selection changing}. + + \image qtcreator-preferences-texteditor-behavior.webp {Text Editor Behavior preferences} \sa {Edit Code}{How To: Edit Code}, {Edit Mode} */ diff --git a/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc b/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc index 6cdcab2b7de..85dd8f84adf 100644 --- a/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc +++ b/doc/qtcreator/src/overview/creator-only/creator-configuring.qdoc @@ -111,7 +111,7 @@ To download and use highlight definition files, select \preferences > \uicontrol {Text Editor} > \uicontrol {Generic Highlighter}. - For more information, see \l{Generic Highlighting}. + For more information, see \l{Download highlight definitions}. \section1 Adding Your Own Code Snippets diff --git a/doc/qtcreator/src/overview/creator-only/creator-overview.qdoc b/doc/qtcreator/src/overview/creator-only/creator-overview.qdoc index 3a74a671e24..675b8884c69 100644 --- a/doc/qtcreator/src/overview/creator-only/creator-overview.qdoc +++ b/doc/qtcreator/src/overview/creator-only/creator-overview.qdoc @@ -116,6 +116,30 @@ such as Python, for which a \e {language server} is available that provides information about the code to IDEs. + \section2 Semantic Highlighting + + To help you write well formatted code, \QC highlights code elements and + blocks. It understands the C++, QML, and JavaScript languages as code, not + as plain text, so it reads the source code, analyzes it, and highlights it + based on the semantic checks that it does for code elements, such as: + + \list + \li Types (such as classes, structs, and type definitions) + \li Local variables + \li Class fields + \li Virtual functions + \endlist + + You can select the color scheme to use for semantic highlighting in the text + editor preferences. + + \QC supports syntax highlighting also for other types of files than C++, + QML, or JavaScript. It uses the + \l{https://api.kde.org/frameworks/syntax-highlighting/html/index.html} + {KSyntaxHighlighting} syntax highlighting engine with Kate syntax + definitions. It comes with most of the commonly used Kate definitions, + and you can download more definitions in the text editor preferences. + \section2 Finding Use the incremental and advanced search to search in currently open projects @@ -145,7 +169,8 @@ If you are used to the Vim editor, run the main editor in the \l {FakeVim Modes and Commands}{FakeVim mode}. - For more information, see \l{Edit Code}{How To: Edit Code} and \l{Editors}. + For more information, see \l{Edit Code}{How To: Edit Code}, \l{Editors}, + and \l{Text Editor}. \section1 Building, Deploying, and Running Applications diff --git a/doc/qtcreator/src/qtcreator-toc.qdoc b/doc/qtcreator/src/qtcreator-toc.qdoc index 12a893a34f2..0f9984b3c93 100644 --- a/doc/qtcreator/src/qtcreator-toc.qdoc +++ b/doc/qtcreator/src/qtcreator-toc.qdoc @@ -29,7 +29,6 @@ \list \li \l{Writing Code} \list - \li \l{Semantic Highlighting} \li \l{Checking Code Syntax} \endlist \li \l{Configuring the Editor} diff --git a/doc/qtcreatordev/src/qtcreator-dev.qdoc b/doc/qtcreatordev/src/qtcreator-dev.qdoc index 5116b907667..368298b31f0 100644 --- a/doc/qtcreatordev/src/qtcreator-dev.qdoc +++ b/doc/qtcreatordev/src/qtcreator-dev.qdoc @@ -98,7 +98,7 @@ \list \li \l{https://doc.qt.io/qtcreator/creator-highlighting.html#generic-highlighting} - {Generic Highlighting} + {Download highlight definitions} \li \l{https://docs.kde.org/stable5/en/applications/katepart/highlight.html} {Working with Syntax Highlighting} \endlist diff --git a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc index a335853428c..7d4b5d2521e 100644 --- a/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc +++ b/doc/qtdesignstudio/src/qtdesignstudio-toc.qdoc @@ -201,7 +201,6 @@ \list \li \l{Writing Code} \list - \li \l{Semantic Highlighting} \li \l{Checking Code Syntax} \li \l{Indent text or code} \li \l{Behavior} diff --git a/doc/qtdesignstudio/src/views/qtquick-text-editor.qdoc b/doc/qtdesignstudio/src/views/qtquick-text-editor.qdoc index b7b4bdf823b..291553f6097 100644 --- a/doc/qtdesignstudio/src/views/qtquick-text-editor.qdoc +++ b/doc/qtdesignstudio/src/views/qtquick-text-editor.qdoc @@ -20,13 +20,21 @@ The view offers the following features: \list - \li \l{Semantic Highlighting} \li \l{Checking Code Syntax} \li \l{Complete code} \li \l{Indent text or code} \li \l{Edit properties of QML types} \endlist + \section1 Semantic Highlighting + + To help you write well formatted code, the \uicontrol Code view highlights + code elements and blocks. \QDS reads the source code, analyzes it, and + highlights it based on semantic checks. + + To select the color scheme for semantic highlighting, go to + \preferences > \uicontrol {Text Editor} > \uicontrol {Font & Colors}. + \section1 Refactoring Code Code refactoring is the process of improving and simplifying code without @@ -44,5 +52,6 @@ \li Select \key Ctrl + \key {F} (or \key Cmd + \key F on \macos). \endlist - \sa {Finding}, {Apply quick fixes}, {QML Quick Fixes} + \sa {Finding}, {Apply quick fixes}, {Download highlight definitions}, + {Highlight code blocks}, {QML Quick Fixes} */