Display signature help if avialable and not symbol info is available when pressing lsp-symbol-info (F1).

This commit is contained in:
Martín Lucas Golini
2024-08-10 21:43:32 -03:00
parent de9c2b4736
commit 42ca1900fa
2 changed files with 18 additions and 0 deletions

View File

@@ -27,6 +27,15 @@ namespace ecode {
#define LSPCLIENT_THREADED 0
#endif
static json getURIAndPositionJSON( UICodeEditor* editor ) {
json data;
auto doc = editor->getDocumentRef();
auto sel = doc->getSelection();
data["uri"] = doc->getURI().toString();
data["position"] = { { "line", sel.start().line() }, { "character", sel.start().column() } };
return data;
}
class LSPLocationModel : public Model {
public:
enum CustomInfo { URI, TextRange };
@@ -1386,6 +1395,10 @@ void LSPClientPlugin::getSymbolInfo( UICodeEditor* editor ) {
editor->getScreenPosition( editor->getDocument().getSelection().start() )
.getPosition() );
} );
} else {
json data = getURIAndPositionJSON( editor );
mManager->sendRequest( PluginMessageType::SignatureHelp, PluginMessageFormat::JSON,
&data );
}
} );
}