diff --git a/doc/kate/plugins.docbook b/doc/kate/plugins.docbook index 9f7328afc..596ac7e48 100644 --- a/doc/kate/plugins.docbook +++ b/doc/kate/plugins.docbook @@ -1,3444 +1,3501 @@ &Anders.Lund; &Anders.Lund.mail; Working with Plugins &kate; offers several plugins. There are two types of these plugins: some are written in native C++, while others are written in the Python programming language. There are subtle differences in these, described below. You can enable any type of plugin in the configuration dialog, which also provides access to additional configuration options for plugins that require it. &kate; Application Plugins &kate; plugins are additional functions for the &kate; editor. They can add extra menus and shortcuts, and extend &kate;'s features. You can install as many or as few as you like, from within &kate;. Open &kate;'s configuration dialog with SettingsConfigure &kate;... Select ApplicationPlugins to choose the wanted plugins. The available application plugins are: Backtrace Browser - C/C++ Backtrace navigation tool view Build Plugin - Compile or Make and parse error messages Close Except/Like - Close group of documents based on a common path or file extension CTags - Look up definitions/declarations with CTags Document preview - Preview the document in the target format. Document switcher - Quick document switching with &Alt; behavior File System Browser - File system browser tool view Document Tree View - Displays the open files in a file tree &gdb; - Provides a simple &gdb; frontend Open Header - Opens the corresponding .h/[.cpp|.c] file Project Plugin - Integration with Git and other source control systems Replicode - Constructivist AI language and runtime LSP Client - LSP client providing code navigation and code completion for many languages Search & Replace - Search and replace in documents, folders, or projects Snippets tool view - Tool view embedding the snippets management SQL Plugin - Execute query on SQL databases Symbol Viewer - Extract and show reference symbols from source Terminal tool view - Have a terminal at the ready, using KDE's Konsole widget Text Filter - Process text using terminal commands &XML;Completetion - Lists &XML; elements, attributes, attribute values and entities allowed by DTD &XML; Validation- Validates &XML; files using xmllint Backtrace Browser Plugin Using the Backtrace Browser Plugin This plugin is meant for developers and probably of little use for users. It shows a backtrace delivered by gdb in a listview in a &kate; toolview. Clicking on an item opens the selected file and jumps to the correct line number. It works for backtraces generated on your own machine, but it will also work for backtraces from other people, &ie; with /home/dummy/qt-copy/…/qwidget.cpp will still be found on other machines. For that to work, you have to index the directories where the source code is located. Sometimes there are several files with the same name, ⪚ kdegraphics/okular/generators/dvi/config.h kdepim-runtime/resources/gmail/saslplugin/config.h To pick the right choice, the plugin picks the last two parts of the url, in this case this would be dvi/config.h saslplugin/config.h And then usually the plugin finds the correct one. Indexing master and a branches of course will lead to a clash. Configuration On the configuration page add the directories containing the source code. Backtrace Browser Configure Paths in Backtrace browser tool view Clicking OK will start indexing. When indexing is finished, open the toolview Backtrace Browser. Now you can load a backtrace from the clipboard (⪚, when you clicked Copy to Clipboard in DrKonqi) or from a file. Salma Sultana &TC.Hollingsworth; &TC.Hollingsworth.mail; Build Plugin Introduction The Build plugin allows you to run actions like build, clean and compile on a project. Using the Build Plugin The Build plugin adds a Build Output tool view at the bottom and a Build menu on the menubar. The tool view can be used to configure build target settings, while the menu can be used to perform build, clean and compile actions. Build Output The Build Output tool view has two tabs: Target Settings Output Target Settings tab The target settings tab can be used to configure various build targets and define targets sets. To change the names or commands double click on the entries in the table and use the dropdown box to select the active target set. Use the checkbox in front of each target to define a default. A new target set contains several configuration options: Working Directory You can set the path to the project here. Leave this empty to use the directory the current document is located in. Build This option lets you define the build command. It is set to make by default. Clean The option lets you define the clean command. It is set to make clean by default. Config This option lets you define the config command. It is set to cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr/local ../ by default. On the top this plugin has a toolbar with the following buttons : Build the selected target Add a new build target Create a new build target set Copy a command or target set Delete the current command or target set Output tab The Output tab shows the console output generated by the last command. Use the slider at the top to show or hide categories of output: Full Output, Parsed Output, Errors and Warnings or Only Errors Each line contains a message and the file name and line number if available. Clicking on the error or warning takes you to the appropriate file and places the cursor on the corresponding line number. To navigate to the previous error, press &Alt;&Shift;&Left;. To navigate to the next error, press &Alt;&Shift;&Right;. Menu Structure BuildSelect Target Select from a list of targets configured by the user. BuildBuild Default Target Builds the target defined as default in the active target set. BuildBuild Previous Target Switch to the previous target configured by the user. BuildStop Stop building a target. &Ctrl;&Alt;Left BuildPrevious Error Moves the cursor to the location of the previous error in the document. &Ctrl;&Alt;Right BuildNext Error Moves the cursor to the location of the next error in the document. Thanks and Acknowledgments The &kate; Build Plugin was written by Kåre Särs. Special thanks to Google Code-In 2011 participant Salma Sultana for writing much of this section. Close Except/Like Plugin Introduction This plugin allows you to close a group of documents based on their extension and path. Using the Close Except/Like Plugin Assumed you have these documents opened in &kate;: /tmp/subfolder/test.h /tmp/test.cpp /tmp/test.txt Then you have the following options to close documents as displayed in the screenshot: Close Except Use the checkbox in the last item of the list to enable or disable a confirmation dialog. The selected option will be applied to both close actions. Menu Structure File Close Except Close all open documents, except those which match the path or file extension selected from the submenu. File Close Like Close all open documents which match the path or file extension selected from the submenu. CTags Plugin Introduction CTags generates an index (or tag) file of language objects found in source files that allows these items to be quickly and easily located using this plugin in &kate;. A tag signifies a language object for which an index entry is available (or, alternatively, the index entry created for that object). Tag generation is supported for these programming languages. Configuration The CTags plugin uses two different database files for the index. On the CTags settings page in &kate;'s configuration you can add or remove directories containing the source code and regenerate the common CTags database. Common Index CTags Settings Configure CTags Global Database At the bottom of the settings page you can adapt the CTags command. For more information about all available options please read the CTags man page. This man page is available in &khelpcenter; and you can also enter the &URL; man/:ctags directly into &konqueror; Clicking Update will start indexing. When indexing is finished, close the dialog. Session Index To configure the session index open the CTags view. Index Targets On this tab you can add or remove directories containing the source code and manually regenerate the session specific CTags database. Database Database Settings Configure CTags Session Database Select another CTags database file, configure the CTags command or revert to the default command. Using the CTags Plugin You place the mouse cursor on the language object like function, symbol &etc; that you are interested in and then select one of the actions in the CTags menu to jump to the line and file where the object is defined or declared. By default the actions in the CTags menu have no shortcuts assigned. Use the keyboard shortcut editor to configure your own shortcuts. Alternatively use the search field on the Lookup tab of the CTags view. Entering characters into the search field will start the search and display matching names of language objects like functions, classes, symbols &etc; together with type and filename. Select an item in the list to jump to the corresponding line in the source file. Menu Structure CTags Jump back one step Navigate back in the history to the last visited tag. CTags Lookup Current Text Opens the Lookup tab of the CTags view and displays all language objects matching the current text selection in the list. CTags Go to Declaration If the cursor is in a definition object this will open the document containing the corresponding declaration if needed, activate its view and place the cursor at the start of the declaration. CTags Go to Definition If the cursor is in a declaration object this will open the document containing the corresponding definition if needed, activate its view and place the cursor at the start of the definition. Document Preview Plugin Introduction The plugin enables a live preview of the currently edited text document in the final format in the sidebar. So when editing ⪚ a Markdown text or an SVG image, the result is instantly visible next to the source text. For the display the plugin uses that KParts plugin which is currently selected as the preferred one for the &MIME; type of the document. If there is no KParts plugin for that type, no preview is possible. To change the preferred plugin open the File Associations module in the &systemsettings; and edit the Services Preference Order on the Embedding tab. Some available KParts plugins &MIME; typeKParts plugin Markdown textKMarkdownWebViewPart or OkularPart SVG imageSVGPart &Qt; UI filesKUIViewerPart Dot graph filesKGraphviewerPart
Menu Structure ViewTool Views Show Preview Toggle the display of &kate;'s Document preview in a sidebar. Interface The buttons at the top of the preview window provide these actions: Lock the preview to a given document. Selecting this option ensures that if switching the focus to the view of another document in the same &kate; window, the preview will not follow to that document, but keep previewing this document. Enable or disable updates of the preview of the current document content Manually update the preview of the current document content A dropdown menu with actions from the KParts plugin
Document Switcher Plugin Menu Structure &Ctrl; View Last Used Views &Ctrl;&Shift; View Last Used Views (Reverse) Opens a list with the last viewed documents: Last viewed documents Keep the &Ctrl; key pressed and use the key to cycle forward through the list. Additionally press the &Shift; key to reverse the direction. Keep the shortcut &Ctrl; pressed and can use the &Up;, &Down;, &Home; or &End; keys to navigate in the list. Pressing a char key consecutively will cycle through all items with the first matching in the list. If you release the shortcut keys the view will switch to the selected document in the list. File System Browser The File System Browser is a folder viewer, allowing you to open files from a displayed folder in the current frame. Menu Structure ViewTool Views Show Filesystem Browser Toggle the display of &kate;'s Filesystem Browser. Interface From the top down, the Filesystem Browser consists of the following elements: A Toolbar This contains standard navigations tool buttons: Back Causes the folder view to cd to the previously displayed folder in the history. This button is disabled, if there is no previous item. Forward Causes the folder view to cd to the next folder in the history. This button is disabled, if there is no next folder. Bookmarks Opens a submenu to edit or add bookmarks and to add a new bookmark folder. Current Document Folder This button will cause the folder view to cd to the folder of the currently active document if possible. This button is disabled, if the active document is a new, unsaved file, or the folder in which it resides can not be decided. Options Short View Displays only the filenames. Detailed View Displays Name, Date and Size of the files. Tree View Like Short View, but folders can be expanded to view their contents. Detailed Tree View This also allows folders to be expanded, but displays the additional columns available in Detailed View. Show Hidden Files Displays files normally hidden by your &OS;. Automatically synchronize with current document When this option is enabled the filesystem browser will automatically cd to the folder of the document currently open in the editing area every time it changes. A Location Entry This displays a breadcrumb navigation to the currently open folder, similarly to &dolphin;. You can click on a any folder to browse to it, or click on one of the arrows to the left of a folder to select any folders beneath it. You may also select from your list of Places by clicking the leftmost icon in the breadcrumb navigation, which displays an icon that represents your current Place. You can also click to the right of the breadcrumbs to change them to a text box where you can type the path of a folder to browse. The &URL; entry maintains a list of previously typed paths. To choose one, use the arrow button to the right of the entry. The &URL; entry has folder auto-completion. The completion method can be set using the &RMB; menu of the text entry. A Folder View This is a standard &kde; folder view. A Filter Entry The Filter entry allows you to enter a filter for the files displayed in the folder view. The filter uses standard globs; patterns must be separated by white space. Example: *.cpp *.h *.moc To display all files, enter a single asterisk *. The filter entry saves the last 10 filters entered between sessions. To use one, press the arrow button on the right of the entry and select the desired filter string. You can disable the filter by pressing the Clear text button to the left of the autocompletion arrow button. Configuration This plugin can be configured on the Filesystem Browser page of &kate;'s configuration. Toolbar Configure the buttons on the Filesystem Browser toolbar by moving the ones you want enabled to the Selected Actions list, and order them using the arrow buttons at the side of the list. The Documents List Introduction Documents list The documents list displays a list of all documents currently open in &kate;. Modified files will have a small floppy disk icon on their left to indicate that state. On the top the Documents list has a toolbar with the following buttons: Create new document Open an existing document Previous Document Next Document Save the current document Save the current document under a new name By default, the Documents list appears in Tree Mode, which displays the folder structure surrounding all currently open documents. Also available is List Mode, which displays a simple list of all open documents. You can switch modes by right-clicking on the list and selecting from the View Mode menu. If two or more files with the same name (located in different folders) are open in List Mode, the names of the second will be prepended (2) and so on. The tool-tip for the file will display its full name including the path, allowing you to choose the desired one. To display a document in the currently active frame, click the document name in the list. The context menu has some common actions from the File menu. Additionally there are filemanager actions to rename or delete the file. With Copy File Path you can copy the full path of the document to the clipboard. You can sort the list in a few different ways by right clicking the list and selecting from the Sort By menu. The options are: Document Name Lists the documents alphabetically by their name. Document Path Lists the documents alphabetically by the path to them. Opening Order Lists the documents in the order of opening. The document list will per default visualize your history by shading the entries for the most recent documents with a background color. If the document was edited, an extra color is blended in. The most recent document has the strongest color, so that you can easily find the documents you are working on. This feature can be disabled in the Documents page of the configuration dialog. The default location of the document list in the &kate; window is to the left of the editing area. Menu Structure &Alt;&Up; View Previous Document Opens the document displayed above the currently open document in the Documents list. &Alt;&Down; View Next Document Opens the document displayed below the currently open document in the Documents list. View Show Active Displays the currently open document in the Documents list. Configuration Background Shading This section allows you to enable or disable the background shading visualization of your recent activity, and choose which colors to use if enabled. Sort By Set how you want the document list sorted. This can be set from the &RMB; menu in the document list as well. View Mode This provides two options that effect the display of the Documents tool view. The Tree View option will display the documents in a tree underneath the folders they are in, while the List View option will display a flat list of documents. Show Full Path When Tree View and this option are enabled, the folder entries displayed in the Documents tool view will display the full filesystem path to the folder in addition to the name of the folder. It has no effect in List View. Martin Gergov &TC.Hollingsworth; &TC.Hollingsworth.mail; &gdb; Plugin Introduction &kate;'s &gdb; plugin provides a simple frontend to the popular &GNU; Project Debugger. Previous experience with &gdb; is strongly recommended. For more information on using &gdb;, visit the &gdb; website. You can enable the &gdb; plugin in the Plugins section of &kate;'s configuration. For the plugin to work properly, you must have a source file (of any type supported by &gdb;) and an executable. If you compile using &gcc;/g++ you might want to use the -ggdb command line argument. After these preparations are made, open the source file in &kate;, enter the path to the executable in the Settings tab of the Debug View tool view, and select DebugStart Debugging from the menu to get started. Menu and Toolbar Structure All of these options are available in &kate;'s menus, and many are available on the Debug toolbar as well. ViewTool ViewShow Debug View Shows a tool view containing &gdb; output, the &gdb; command line used, and other settings. ViewTool ViewShow Locals and Stack Shows a list of all currently loaded variables and their values and a &gdb; backtrace. DebugTargets A submenu containing a list of targets (executables). DebugStart Debugging Starts &gdb; with a target. DebugKill / Stop Debugging Stops &gdb;. DebugRestart Debugging Restarts &gdb;. DebugToggle Breakpoint / Break Set a breakpoint at the current cursor position. DebugStep In Execute the present statement (function call will be debugged). DebugStep Over Execute the present statement (function call will not be debugged). DebugStep Out Resumes execution until the program that is executing terminates. DebugMove PC Move program counter (next execution). DebugRun To Cursor Runs the program until it reaches current cursor position. DebugContinue Ignores any breakpoints and executes program until it terminates (successfully or not). DebugPrint Value Prints the value of the variable that the cursor is currently pointing to. SettingsToolbars Shown&gdb; Plugin Display the debugging toolbar. Debug View The Debug View tool view consists of several tabs: &gdb; Output Contains output from &gdb; and a &gdb; command line. The Output Tab The Output tab. The Output tab displaying the output from a debugging session. Settings Executable Path to the target (executable) for debugging. Working Directory The current working directory provided to the target. Arguments Arguments passed to the program. Keep focus Keeps focus on the &gdb; command line. Redirect IO Opens a new IO tab in the Debug View where you can view output and provide input to the running program. The Settings dialog The Settings dialog The Settings dialog displaying the configuration of a debugging session. IO Contains an area that displays output from the running program and a command line where you may provide input to it. The IO Tab The IO tab. The IO tab displaying output from a simple test program. Call Stack and Locals The Call Stack tool view contains a list of the formatted backtrace returned from &gdb;. The &gdb; Call Stack Tool View The Call Stack tool view. The &gdb; Plugin's Call Stack tool view. The Locals tool view contains a list of all currently loaded variables from the program and their corresponding values. The &gdb; Locals Tool View The Locals tool view. The &gdb; Plugin's Locals tool view. Thanks and Acknowledgments Special thanks to Google Code-In 2011 participant Martin Gergov for writing much of this section. Open Header Plugin Using the Open Header Plugin When editing C or C++ code, this command will switch between a header file and its corresponding C/C++ file or vice versa. For example, if you are editing myclass.cpp, this action will change to myclass.h if this file is available in the same folder. Pairs of the following filename extensions will work: Header files: h, H, hh, hpp Source files: c, cpp, cc, cp, cxx Menu Structure F12 File Open .h/.cpp/.c Open the corresponding header or source files for the active document. Project Plugin Introduction The basic idea of the Project plugin is to have a structured list of files belonging to the project with the following properties: Provide a structured view of the files Make it easy and very fast to open and switch projects Support search and replace for a project Provide simple auto completion Make it simple to quickly open files in the project Support for building the project Structured View of the Files Once the Project plugin is loaded in the &kate; configuration page, open a file in a project and a sidebar appears that lists all projects as well as the project files as follows: Project View As you can see, the currently active project is Kate, and its contents is listed in the tree view. Clicking on files in the tree view opens the file in the editor. Further, a context menu is provided with which you can open files with other applications, such as a .ui file with Qt Designer. You can filter the items by typing parts of the file name you are looking for into the search bar at the bottom of the list. Switching Projects The idea is that you never have to open a project manually, this is even not supported at all. Hence, what happens if you open a file, the Project plugin quickly scans the folder and its parent folders for a .kateproject file. If found, the project is automatically loaded. Furthermore, if you open another document in &kate;, that belongs to another project, the Project plugin automatically switches the current project. So intuitively, always the correct project is active. Of course, you can also switch the currently active project using the combo box. Search and Replace in Projects &kate; has a Search and Replace plugin that shows up in the bottom sidebar. If a project is loaded, open the Search and Replace sidebar, and switch to the mode to search and replace in the current project: Search in Projects Simple Auto Completion With the knowledge of all files belonging to a project, the Project plugin provides simple auto completion facilities based on CTags. If a project is initially opened, CTags parses all project files in a background thread and saves the CTags information to /tmp. This file then is used to populate the auto completion popup in &kate;. In contrast, without this auto completion, &kate; is only capable of showing auto completion items based on the words in the current file. So the auto completion provided by the Project plugin is much more powerful. Completion in Projects If CTags is missing, a passive popup warns you about this issue. It is also noteworthy, that the CTags file in /tmp is cleaned up when &kate; exits, so the plugin does not pollute any folder with unwanted files. Quick Opening Files As clicking on files in the tree view is not the fastest way to open a file, &kate; provides a built-in quick open mechanism you can activate with &Ctrl;&Alt;O. What you the get is a list like this: Quick Open You can filter by typing parts of the file name you are looking for, and you can also navigate with the arrow keys and page up/down through the list. Hitting &Enter; activates the selected file, while &Esc; hides the quick open view again. Further, the quick open remembers the previous file. So when you change to the quick open view the previously activated file is automatically selected and you just need to hit &Enter;, which comes very handy at times. Support for Building the Project Another feature is to have support for the Build Plugin, so that it automatically is configured correctly. Creating Projects Loading Projects Automatically The Project plugin has an auto-loading feature. You can read the file list from the version control system. To this end, auto-loading for the respective version control system needs to be enabled in the settings (enabled by default): Project Plugin Configuration Creating Projects Manually You just have to create a .kateproject file in the root folder of the project. For instance, the Kate .kateproject file looks like this: { "name": "Kate" , "files": [ { "git": 1 } ] } The file content is written in JSON syntax. The project name is Kate, and the files contained in should be read from git. Also supported instead of git is subversion through svn and mercurial through hg. If you do not want to read from a version control system, you can tell it to recursively load files from directories as follows: { "name": "Kate" , "files": [ { "directory": "kate", "filters": ["*.cpp", "*.h", "*.ui", "CMakeLists.txt", "Find*.cmake"], "recursive": 1 } ] } Here, subfolders and filters define what’s part of the project. You can also mix version control and files based on filters. If you want to add support for the Build plugin, you could write a .kateproject like this: { "name": "Kate" , "files": [ { "git": 1 } ] , "build": { "directory": "build" , "build": "make all" , "clean": "make clean" , "install": "make install" } } Current Project Using &Alt;1 ProjectsGo To you can open the Current Project view at the bottom of the editor window with four tabs: Current Project Terminal A Terminal emulator starting in the root folder of the project. Code Index Entering characters into the search bar will start the search and display matching names of functions, classes, symbols &etc; together with kind, filename and line number. Select an item in the list to jump to the corresponding line in the source file. Code Analysis Click Start Analysis to run a static code analysis for the C and C++ using cppcheck and to generate a report showing filename, line number, severity (style, warning &etc;) and the issue found. Select an item in the list to jump to the corresponding line in the source file. Notes Text entered in this tab will be saved in the file projectname.kateproject.notes. The Projects Menu The Projects menu allows you to switch between currently open projects. It is displayed by the Project plugin. &Ctrl;&Alt;&Left; Projects Back Switch to the previous project. &Ctrl;&Alt;&Right; Projects Forward Switch to the next project. &Alt;1 ProjectsGo To Open the Current Project view at the bottom of the editor window. LSP Client Plugin The LSP Client plugin provides many language features such as code completion, code navigation or finding references based on the Language Server Protocol. Once you have enabled the LSP Client in the plugin page, a new page called LSP Client will appear in your &kate; configuration dialog. Menu Structure If appropriate, a corresponding LSP command is also mentioned in the explanation below, the documentation of which may then provide additional background and interpretation, though it may vary depending on the actual language. The phrase 'current symbol' refers to the symbol corresponding to the current cursor position, as so determined by the language and server implementation. LSP Client Go to Definition [textDocument/definition] Go to current symbol definition. LSP Client Go to Declaration [textDocument/declaration] Go to current symbol declaration. LSP Client Find References [textDocument/references] Find references to current symbol. LSP Client Highlight [textDocument/documentHighlight] Highlight current symbol references in current document. LSP Client Hover [textDocument/hover] Hover info for current symbol. LSP Client Format [textDocument/formatting] [textDocument/rangeFormatting] Format the current document or current selection. LSP Client Rename [textDocument/rename] Rename current symbol. LSP Client Show selected completion documentation Show documentation for a selected item in the completion list. LSP Client Include declaration in references Request to include a symbol's declaration when requesting references. LSP Client Show hover information Show hover information upon (mouse cursor) hover. Regardless of this setting, the request can always be manually initiated. LSP Client Format on typing [document/onTypeFormatting] Format parts of document when typing certain trigger characters. For example, this might apply indentation upon newline, or as otherwise determined by LSP Server. Note that editor indentation scripts might be trying to do the same (depending on the mode) and so it may not be advisable to have both enabled at the same time. LSP Client Incremental document synchronization Send partial document edits to update the server rather than whole document text (if supported). LSP Client Show diagnostics notifications [textDocument/publishDiagnostics] Process and show diagnostics notifications sent by server. LSP Client Show diagnostics highlights Add text highlights for ranges indicated in diagnostics. LSP Client Show diagnostics marks Add document marks for lines indicated in diagnostics. LSP Client Switch to diagnostic tab Switch to the diagnostic tab in the plugin toolview. LSP Client Close all non-diagnostics tabs Close all non-diagnostics (e.g. references) tabs in plugin toolview. LSP Client Restart LSP Server Restart current document's LSP Server. LSP Client Restart all LSP Servers Stop all LSP Servers which will then be (re)started as needed. Configuration The plugin's configuration page mostly allows for persistent configuration of some of the above menu items. However, there is one additional entry to specify the Server Configuration file. This is a JSON file that can be used to specify the LSP server to start (and then to communicate with over stdin/stdout). For convenience, the following default configuration is included (though alternative server implementation are equally valid and possible): { "servers": { "bibtex": { "use": "latex", "highlightingModeRegex": "^BibTeX$" }, "c": { "command": ["clangd", "-log=error", "--background-index"], "commandDebug": ["clangd", "-log=verbose", "--background-index"], "url": "https://clang.llvm.org/extra/clangd/", "highlightingModeRegex": "^(C|ANSI C89|Objective-C)$" }, "cpp": { "use": "c", "highlightingModeRegex": "^(C\\+\\+|ISO C\\+\\+|Objective-C\\+\\+)$" }, "d": { "command": ["dls", "--stdio"], "url": "https://github.com/d-language-server/dls", "highlightingModeRegex": "^D$" }, "fortran": { "command": ["fortls"], "rootIndicationFileNames": [".fortls"], "url": "https://github.com/hansec/fortran-language-server", "highlightingModeRegex": "^Fortran.*$" }, "latex": { "command": ["texlab"], "url": "https://texlab.netlify.com/", "highlightingModeRegex": "^LaTeX$" }, "go": { "command": ["go-langserver"], "commandDebug": ["go-langserver", "-trace"], "url": "https://github.com/sourcegraph/go-langserver", "highlightingModeRegex": "^Go$" }, "python": { "command": ["python3", "-m", "pyls", "--check-parent-process"], "url": "https://github.com/palantir/python-language-server", "highlightingModeRegex": "^Python$" }, "rust": { "command": ["rls"], "rootIndicationFileNames": ["Cargo.lock", "Cargo.toml"], "url": "https://github.com/rust-lang/rls", "highlightingModeRegex": "^Rust$" }, "ocaml": { "command": ["ocamlmerlin-lsp"], "url": "https://github.com/ocaml/merlin", "highlightingModeRegex": "^Objective Caml.*$" } } } Note that each "command" may be an array or a string (in which case it is split into an array). Also, a top-level "global" entry (next to "server") is considered as well (see further below). The "highlightingModeRegex" is used to map the highlighting mode as used by Kate to the language id of the server. If no regular expression is given, the language id itself is used. From the above example, the gist is presumably clear. In addition, each server entry object may also have an "initializationOptions" entry, which is passed along to the server as part of the 'initialize' method. +If present, a "settings" entry is passed to the server by means of the +'workspace/didChangeConfiguration' notification. Various stages of override/merge are applied; user configuration (loaded from file) overrides (internal) default configuration "lspclient" entry in .kateproject project configuration overrides the above the resulting "global" entry is used to supplement (not override) any server entry One server instance is used per (root, servertype) combination. If "root" is specified as an absolute path, then it used as-is, otherwise it is relative to the projectBase (as determined by the Project plugin). If not specified and "rootIndicationFileNames" is an array as filenames, then a parent directory of current document containing such a file is selected. As a last fallback, the home directory is selected as "root". For any document, the resulting "root" then determines whether or not a separate instance is needed. If so, the "root" is passed as rootUri/rootPath. In general, it is recommended to leave root unspecified, as it is not that important for a server (your mileage may vary though). Fewer server instances are obviously more efficient, and they also have a 'wider' view than the view of many separate instances. + +LSP Server Configuration + + + +Each particular LSP server has its own way of customization and may use +language/tool specific means for configuration, e.g. +tox.ini (a.o. for python), +.clang-format for C++ style format. Such configuration may +then also be used by other (non-LSP) tools (such as then +tox or clang-format). On +top of that, some LSP servers also load configuration from custom files (e.g. +.ccls). Furthermore, custom server configuration can also +be passed through LSP (protocol), see the aforementioned +"initializationOptions" and "settings" entries in server configuration. + + + + +Since various level of override/merge are applied, the following example +of user specified client configuration tweaks some python-language-server +configuration. + + + +{ + "servers": { + "python": { + "settings": { + "pyls": { + "plugins": { + "pylint": { + "enable": true + } + } + } + } + } + } +} + + + +Unfortunately, LSP server configuration/customization is often not so well +documented, in ways that only examining the source code shows configuration +approaches and the set of available configuration options. In particular, +the above example's server supports many more options in "settings". +See +another LSP client's documentation for various other language server +examples and corresponding settings, which can easily and readily be +transformed to the JSON configuration that is used here and outlined above. + + + + &TC.Hollingsworth; &TC.Hollingsworth.mail; Search & Replace Introduction &kate;'s Search & Replace plugin allows you to search for text or regular expressions in many different files at once. You can search all open files, all the files in one directory and optionally its subdirectories, or in the active file. You can even filter by filename, for instance searching only files that end with a particular file extension. Interface Search Query The following options are always displayed at the top of the Search in Files tool view: You can have as many searches as you want open at the same time. Simply click the new tab button at the top-left corner of the Search tool view and a new results tab will open permitting you to perform another search. The button in the top right-corner of the Search in Files tool view will toggle the bottom half of the tool view between displaying additional options for the Search in Folder mode and the results of your search. Find This is where you type in what you want to find. You may enter standard text, or a regular expression if enabled. Replace (text box) Replacement text that will be added to file(s) in place of the text in the Find text box. Search When you've finished configuring everything, just press the Search button to perform your search. You may also press &Enter; in the Find text box to do the same. Replace When you've finished configuring everything, just press the Replace button to replace the text entered in the Find text box with that of the Replace text box. You may also press &Enter; in the Replace text box to do the same. Next Go to the next match of your search query, switching files if necessary. Replace Checked The same as Replace, but will only perform replacements in files that are checked in the pane below. Search in Folder Options These options are displayed below the aforementioned query options. If search results are being displayed instead, press the button to display them. Search in This has three options. Select Open Files to search all files currently open in &kate;. Select Folder to search inside a folder and optionally its subfolders. Select Current File to search only in the active file. If the Projects plugin is loaded, you can also search in the Current Project or in All Open Projects. Match case Restricts search results to only those that have the exact same combination of upper and lower case letters as your search query. Regular expressions Permits you to use regular expressions instead of simple text as your search query. Expand results Display all the results found in each file, instead of just a list of files that contain the search query. Folder You may enter the path of the folder you wish to search. For instance, you might enter ~/development/kde/kate/ if you wished to search the &kate; source code. This option is only available when using in Folder mode. Open file dialog Press this button to locate the folder in your desktop's folder browser. This button only works when using Folder mode. Press this button to change Folder to the parent of the currently selected folder. This button only works when using Folder mode. This button will set the Folder entry to the folder in which the currently open document is located. This button only works when using Folder mode. Filter This permits you to only search filenames that match a particular pattern. For instance, to only search files written in C++, change it to *.cpp. To search only files beginning with kate, change it to kate*. You can enter multiple filters separated with a comma (,). This option is not available when using Open files mode. Exclude The opposite of Filter, this prevents &kate; from searching files that match the specified patterns. As with Filter, you can enter multiple patterns separated with a comma (,). This option is not available when using Open files mode. Recursive If this option is enabled, &kate; will also search in all subfolders of the selected folder. This option is only available when using Folder mode. Include hidden If this option is enabled, &kate; will also search in files or folders that are typically hidden by your &OS;. This option is only available when using Folder mode. Follow symbolic links The Search in Files plugin typically does not follow symbolic links. When this option is enabled, the plugin will follow them instead and search inside the files or folders they reference. This option is only available when using Folder mode. It's possible for symbolic links to reference a folder that is the parent of the folder currently being searched, or other folders that contain symbolic links to their parent. If there is such a link in the folder being searched and this option is enabled, &kate; will repeatedly follow the link and search the folder, and the search will never complete. Include binary files If enabled, &kate; will also search in files that do not appear to be text files. Search Results The results of your search are displayed below the query options. If options for Search in Folder mode are displayed, simply press the button to display them. They will also automatically be displayed as soon as a search is performed. The search results display a list of files that contains text that matches your search query, followed by the number of matches found in that file. To see a list of matches in that file, simply click the expansion arrow to the left of the file name. (If you selected the Expand results option, this will already be done for you.) The line number each match is found on will be displayed, followed by the contents of that line, with your search query indicated in bold text. To open the file your result was found in, simply double-click it. &kate; will open the file if needed. You can also move the cursor to the location of a particular match by double-clicking on its listing instead of the file name. Menu Structure &Ctrl;&Alt;F Edit Search in Files Launches the Search and Replace tool view. Edit Go to Next Match Go to the next match in a search performed by the Search and Replace plugin. Edit Go to Previous Match Go to the previous match in a search performed by the Search and Replace plugin. ViewTool Views Show Search and Replace Toggle the display of &kate;'s Search and Replace tool. Martin Gergov &TC.Hollingsworth; &TC.Hollingsworth.mail; Kate Snippets Introduction Kate Snippets is a plugin used to save you some time by adding support for so-called snippets (re-usable source code, machine code or text). The plugin also supports code completion and JavaScript. Menu Structure ViewTool Views Show Snippets Shows snippets panel containing all snippets in your repository that are for the currently opened file type. Tools Create Snippet Create a new snippet, which is a reusable chunk of text you may insert in any part of any document. Snippets panel Kate Snippets Panel The &kate; snippets panel. The panel for &kate; Snippets. In the panel you should see a list of snippet repositories, along with options to create your own, get them from the Internet or load them from a local file. Each repository has a checkbox that can be used to activate or deactivate it. There are also buttons to edit and delete existing repositories. Loading Snippet Repository Files You can download snippet repositories from the Internet. Just click Get New Snippets and a window with a list of snippet repositories will open. After downloading the desired snippet, make sure that you have activated it. Creating and Editing Repositories To create a new snippet repository, click Add Repository. You should now see a dialog that asks for the name of the snippet file, license and author. After choosing the desired options, click OK. Snippet Editor The repository editor. The repository editor interface. The snippet repository editor contains the following options: Name Appears in the list of snippets in the tool view and is also searched when using the code completion feature. Namespace Prefix used while using code completion. License Select the license for you snippet repository. Authors Enter the name(s) of the author(s) of the snippet file. File types Select the file type(s) you want the snippet repository to apply to. It is set to by default, so the repository applies to all files. You can change it to something like C++ for instance, or select from a list by clicking on the items. You can specify more than one file type pressing the &Shift; while adding types. Creating and Editing Snippets Snippet Editor The snippet editor. The snippet editor interface. Name The name will be shown in the completion list. Shortcut Pressing this shortcut will insert the snippet into the document. Snippets The text your snippet will insert into the document. A snippet can contain editable fields. They can be cycled by pressing . The following expressions can be used in the template text to create fields: ${field_name} creates a simple, editable field. All subsequent occurrences of the same field_name create fields which mirror the contents of the first during editing. ${field_name=default} can be used to specify a default value for the field. default can be any JavaScript expression. Use ${field_name=text} to specify a fixed string as default value. ${func(other_field1, other_field2, ...)} can be used to create a field which evaluates a JavaScript function on each edit and contains its contents. See the Scripts tab for more information. ${cursor} can be used to mark the end position of the cursor after everything else was filled in. Scripts JavaScript helper functions to use in your snippets. All JavaScript functions should return the contents you want to place in a template field as a string. Functions are called in a scope which contains the contents of all editable template fields as local variables. For example in a snippet containing ${field}, a variable called field will be present which contains the up-to-date contents of the template field. Those variables can either be used in the function statically or passed as arguments, by using the ${func(field)} or ${field2=func(field)} syntax in the snippet string. You can use the &kate; scripting API to get the selected text, full text, file name and more by using the appropriate methods of the document and view objects. Refer to the scripting API documentation for more information Using Snippets Kate Snippets in Action Accessing &kate; Snippets from a tool view and a drop down menu. Selecting from a list of snippets. You can call snippets in two ways: By choosing the snippet from the tool view. While writing, you can press &Ctrl; Space, which will display all the snippets in a convenient window from which you can choose. This key combination provides functionality similar to code completion. If the snippet contains variables (besides ${cursor}) the cursor will automatically go to the first occurrence of a variable and will wait for you to write something. When you are done, you can press to move to the next variable, and so on. Thanks and Acknowledgments &kate; Snippets was written by Joseph Wenninger. Special thanks to Google Code-In 2011 participant Martin Gergov for writing much of this section. Ömer Faruk ORUÇ &TC.Hollingsworth; &TC.Hollingsworth.mail; SQL Plugin Introduction The Structured Query Language (SQL) is a specialized language for updating, deleting, and requesting information from databases. The &kate; SQL Plugin allows you to: Create a database Connect to existing databases Insert and delete data in the database Execute queries Display results in a table Connecting to a Database Select Add Connection from the SQL menu or toolbar, and then select the Qt database driver you want to use (including QSQLITE, QMYSQL3, QMYSQL, QODBC3, QODBC, QPSQL7, and QPSQL). If you can't see the desired driver, you need to install it. Then, press Next. If the database you selected uses a file, simply indicate the database's location and press the Next button. If it requires connecting to a server, you must enter the hostname of the server, your username and password, and any other information that particular driver may require. Then press Next. Finally, give a name to your connection, and press Finish. Running Queries INSERT/DELETE/UPDATE You can insert, delete, and update data using the SQL plugin just as you would from the command line or from within a program. Simply enter a query and press the Run query button in the toolbar or use SQLRun query (&Ctrl;E). Some Example Queries INSERT INSERT INTO table_name ("feature1", "feature2", "feature3", "feature4", "feature5") VALUES ("value1", "value2", "value3", "value4", "value5" ) DELETE DELETE FROM table_name WHERE name = "text" UPDATE UPDATE table_name SET "feature1" = "text", "feature2" = "text", "feature3" = "text", "feature4" = "text", "feature5" = "text" SELECT After running a SELECT query, you can view the results as a table that will appear in the SQL Data Output tool view at the bottom of &kate;, or as text in the SQL Text Output. If there is an error, you can see it in the text output. Example <command>SELECT</command> Query SELECT * FROM table_name In the SQL Data Output tool view, there are several buttons: Resize columns to contents Changes the size of columns to fit their contents. Resize rows to contents Changes the size of rows to fit their contents. Copy Selects all of the table contents and copies it to the clipboard buffer. Export Exports all of the table contents to a file, the clipboard, or the current document in the Comma Separated Values format. Clear Removes everything from the table view You can now change the colors displayed in the table in the SQL section of SettingsConfigure &kate; . Browsing You can browse your database using the Database schema browser tool view on the left. The information displayed varies depending on which database driver you are using. To refresh this list, right-click anywhere in the tool view and select Refresh. To generate a query on any entry in the list, right-click on an entry, select Generate, and select the query type (SELECT, UPDATE, INSERT, or DELETE) from the submenu that appears. Menu Structure SQLAdd connection... Adds a new connection using any database driver. SQLRemove connection Removes the selected connection. SQLEdit connection... Edits the current connection's settings. Connections All database connections you have created are listed between the Edit connection and Run query menu items. Select one to run queries or make modifications to it. &Ctrl;E SQLRun query Runs your query. Thanks and Acknowledgments The SQL Plugin was written by Marco Mentasti. Special thanks to Google Code-In 2011 participant Ömer Faruk ORUÇ for writing much of this section. Symbol Viewer Plugin Using the Close Except/Like Plugin It allows developers to view symbols (functions, macros and structures) from source code. By clicking the parsed information you can easily browse the code. At the moment the following languages are supported: C/C++, Java, Perl, PHP, Python, Ruby, XSLT, Tcl/Tk, Fortran Feature list: List/Tree mode Enable/disable sorting Hide/Show Functions Parameters Expand/collapse tree mode Auto-update on document change Code parsing is based on the Syntax-Highlighting framework from &kde-frameworks; Menu Structure &Ctrl;\ View Tool Views Show Symbol List Toggle the display of &kate;'s Symbol List displaying Functions, Macros and Structures of the source code in the active document. Configuration Symbol Viewer Choose the default parser options Terminal Tool View Plugin Terminal emulator The built in Terminal Emulator is a copy of the &kde; &konsole; terminal application, for your convenience. It is available from the ViewTool Views Show Terminal menu item and will get the focus whenever displayed. Additionally, if the Automatically synchronize the terminal with the current document when possible option is enabled, it will change to the directory of the current document if possible when it is displayed, or when the current document changes. The default location in the &kate; window is at the bottom, below the editing area. You can configure the &konsole; using its &RMB; menu, for more information, see the &konsole; manual. The built-in terminal emulator is provided by the Terminal Tool View plugin. Menu Structure ViewTool Views Show Terminal Toggles the display of the built-in terminal emulator. When activated for the first time, the terminal will be created. When the terminal emulator is displayed, it will get the focus, so that you can start typing in commands immediately. If the Automatically synchronize the terminal with the current document when possible option is enabled in the Terminal page of the Main configuration dialog the shell session will change to the directory of the active document, if it is a local file. ToolsPipe to Terminal Feed the currently selected text into the built-in terminal emulator. No newline is added after the text. Tools Synchronize Terminal with Current Document This will cause the built-in Terminal to cd into the directory of the active document. Alternatively, you can configure &kate; to always keep the terminal in sync with the current document. See for more information. Tools Focus/Defocus Terminal Switch the focus from the current document to the terminal and vice versa. Configuration You can configure the Terminal Tool View plugin on the Terminal page of the configuration dialog. The following options are available: Automatically synchronize the terminal with the current document when possible This will cause the built-in terminal to cd into the directory of the active document when launched and when a new document gets the focus. If not enabled, you have to do all your navigation in the terminal on your own. Set EDITOR environment variable to 'kate -b' This sets the EDITOR environment variable so programs run in the built-in terminal that automatically open a file in an editor will open them in &kate; instead of the default editor configured in your shell. You will not be able to continue using the terminal until you have closed the file in &kate;, so the calling program is aware you have finished editing the file. Text Filter Plugin Using the Text Filter Plugin You can use this plugin to process selected text using terminal commands. The selection will be used as input for the command, and the output will either replace the selection or be copied to the clipboard, depending on the user's preference. Examples: less /etc/fstab - paste the contents of this file or copy it to the clipboard wc - count lines, words and characters of the selection and paste this into the document or copy it to the clipboard sort - sort lines of the selection and paste the result into the document or copy it to the clipboard Menu Structure &Ctrl;\ Tools Filter Text Opens the Text Filter dialog: Text Filter dialog Enter the shell command into the combobox or select a previous command from the history. Copy the result instead of pasting it Copy the result to clipboard leaving a document unchanged. Merge STDOUT and STDERR If checked, an output from STDOUT and STDERR will be merged and no errors will be reported. Otherwise, STDERR will be displayed as a passive message. &Daniel.Naber; &Daniel.Naber.mail; &XML; Validation This plugin checks &XML; files for validity and being well-formed. This plugin checks the current file. A list of warnings and errors will appear at the bottom of &kate;'s main window. You can click on an error message to jump to the corresponding place in the file. If the file has a DOCTYPE the DTD given with this doctype will be used to check the file for validity. The DTD is expected at a position relative to the current file, ⪚ if the doctype refers to DTD/xhtml1-transitional.dtd and the file is /home/peter/test.xml the DTD is expected to be located at /home/peter/DTD/xhtml1-transitional.dtd. However, remote DTDs specified via http are supported. If the file has no doctype it will be checked for being well-formed. To learn more about &XML; check out the official W3C &XML; pages. Internally this plugin calls the external command xmllint, which is part of libxml2. If this command is not correctly installed on your system, the plugin will not work. To load this plugin open &kate;'s configuration dialog under Settings Configure &kate;.... Then select &XML; Validation which will appear in the Application / Plugins section and close the dialog. Menu Structure &XML; Validate &XML; This will start the check, as described above. Thanks and Acknowledgments &kate; Plugin &XML; Validation copyright 2002 &Daniel.Naber; &Daniel.Naber.mail;. Documentation copyright 2002 &Daniel.Naber; &Daniel.Naber; &Daniel.Naber.mail; &XML; Completion This plugin gives hints about what is allowed at a certain position in an &XML; file, according to the file's DTD. It will list possible elements, attributes, attribute values or entities, depending on the cursor position (⪚ all entities are listed if the character on the left of the cursor is &). It's also possible to close the nearest open tag on the left. The DTD must exist in &XML; format, as produced by the Perl program dtdparse. We will call a DTD in this format meta DTD. Some meta DTDs are supplied. They are installed in katexmltools/ in qtpaths , which is also the default folder when you choose Assign Meta DTD.... To produce your own meta DTDs, get dtdparse from http://dtdparse.sourceforge.net. How to Use Start &kate; and open the configuration dialog under Settings Configure &kate;.... Then select &XML; Completion which will appear in the Application Plugins page and close the dialog. After that, select &XML;Assign Meta DTD.... If your document contains no DOCTYPE or the doctype is unknown, you will have to select a meta DTD from the file system. Otherwise the meta DTD that matches the current document's DOCTYPE will be loaded automatically. You can now use the plugin while typing your text: < (less than key) This will trigger a list of possible elements unless the cursor is inside a tag already. Note that you currently cannot use this to insert the top level element (⪚ <html>). </(less than key + slash) Entering these characters will offer to close the current element (nearest open one to the left of the cursor). Press &Enter; to accept the suggestion. Unlike the Close Element menu item, this works only with a DTD assigned. " (quote key) The quote key will trigger a list of possible attribute values (if there are any) if you are inside a tag.   (space key) This key will trigger a list of possible attributes for the current element if you are inside a tag. & (ampersand key) This key will trigger a list of named entities. Features and Limitations You can test all functions and limitations by loading katexmltools/testcases.xml in qtpaths into &kate; and following the instructions. Menu Structure &Ctrl;&Enter; &XML; Insert Element... This will open a dialog that lets you insert an &XML; element. The <, > characters and the closing tag will be inserted automatically. If you have selected text when this menu item is selected, the selected text will be surrounded by the opening and the closing tag. The dialog also offers completion of all elements that may be inserted at the current cursor position if you have assigned a meta DTD by using Assign Meta DTD.... &Ctrl;< &XML; Close Element This will search your text for a tag that is not yet closed and will close it by inserting the corresponding closing tag. The search starts at the cursor position and goes left. If it cannot find an open tag nothing will happen. &XML; Assign Meta DTD... This will tell the plugin which meta DTD to use for the current document. Note that this assignment will not be saved. You will have to repeat it when you start &kate; the next time. Thanks and Acknowledgments &kate; Plugin &XML; Completion copyright 2001,2002 &Daniel.Naber; &Daniel.Naber.mail;. KDE SC 4 version copyright 2010 Tomáš Trnka Documentation copyright 2001,2002 &Daniel.Naber;