Language server support
The LSP client was written to enable communication with language servers. A language server add several new features to the editor like code completion, hover information, document formatting, parameter hints, hierarchical structure display (Document symbols), search features...
You can find more information on how to install language servers and how to add them to your project or site in the forum Language servers (LSP)
The Delphi LSP Client code is available on GitHub LSP Client.
Code Completion
The language server provide much better completion support than the editor can provide by using syntax files.
Hover
Place the mouse over a symbol (class, object, method, property etc.) and the
server will provide detailed information about the symbol. Links with different actions are displayed
at the bottom - if the server supports them.
Diagnostic errors, warnings, info or hint is displayed as well.
Diagnostics
Display errors, warnings, information and tips while you type.
Document Symbols
Open the document symbols panel to display a hierarchical tree view of all classes, methods, properties etc. in a file or open document. Note that the file doesn't have to be opened.
Symbol Search
Similar to document symbols, but the search is project wide and may include library files as well.
References
List references for the item under the mouse cursor.
Context Menu
In the right click editor menu you'll find menu items related to LSP.
- Highlight references. Highlight all references found in the document for the identifier under the mouse cursor.
- Clear highlights. Clear the highlights.
- Code actions. List code actions the server support in the given position. Code actions are different depending on the function, class or text caret position.
- Find definition. Find the definition of the object under the mouse cursor.
- Find type definition. Find the type definition of the object under the mouse cursor.
- Find declaration. Find the declaration of the object under the mouse cursor.
- Find implementation. Find the implementation of the object under the mouse cursor.
- Find references. List all references found in the project for the item under the mouse cursor.
- Rename symbol. Rename the symbol (method, property...) under the mouse cursor project wide.
- Format document/selection. The language server may be able to format (prettify) the document or selection.
Settings
Server settings.
- Server name. Any name will do.
- Command. This usually points to the actual server. It can be a .cmd or .exe file, or maybe a .ts file...
- Command arguments. Here you can enter arguments like --stdio or --port=1234 (if you connect using sockets).
- Initial folder. Can e.g. be the server path.
- Extensions and language id. A language server may handle several source types, e.g. PHP, HTML, CSS... Connect a file extension with a language id. E.g. .css=css.
- Communication channel. State the connection type used to connect to the server.
- Source folders. Some servers only need one folder to your source files. Others may require sub folders as well.
- Initialize options. Some server may require additional options. Add them here in JSON form.
Handle all language servers used in the project or site.