language_server_protocol.md: Status Bar Integration, code snippet

This commit is contained in:
Yann Cébron 2024-03-04 17:41:41 +01:00
parent ef342fa2b1
commit b63f23c0da

View File

@ -119,6 +119,13 @@ private class FooLspServerDescriptor(project: Project) : ProjectWideLspServerDes
Since 2024.1, a dedicated <control>Language Services</control> status bar widget is available to monitor the status of all LSP servers.
Override `LspServerSupportProvider.createLspServerWidgetItem()` to provide a custom icon and link to [Settings](settings.md) page (if available).
```kotlin
override fun getLspServerWidgetItem(lspServer: LspServer,
currentFile: VirtualFile?) =
LspServerWidgetItem(lspServer, currentFile,
FooIcons.PluginIcon, FooConfigurable::class.java)
```
If there are configuration problems preventing from starting an LSP server, the plugin can provide a widget item
with an error and give the user a hint how to fix the problem.