LSP Client advances. Some LSPs are responding fine.

This commit is contained in:
Martín Lucas Golini
2022-10-31 22:14:09 -03:00
parent ab9bd56a49
commit bc5188ec28
15 changed files with 646 additions and 137 deletions

View File

@@ -35,7 +35,21 @@ void LSPClientPlugin::update( UICodeEditor* ) {
mClientManager.updateDirty();
}
void LSPClientPlugin::processNotification( PluginManager::Notification noti,
const nlohmann::json& obj ) {
switch ( noti ) {
case PluginManager::WorkspaceFolderChanged: {
mClientManager.didChangeWorkspaceFolders( obj["folder"] );
break;
}
default:
break;
}
}
void LSPClientPlugin::load( const PluginManager* pluginManager ) {
pluginManager->subscribeNotifications(
this, [&]( auto noti, auto obj ) { processNotification( noti, obj ); } );
std::vector<std::string> paths;
std::string path( pluginManager->getResourcesPath() + "plugins/lspclient.json" );
if ( FileSystem::fileExists( path ) )
@@ -107,6 +121,8 @@ void LSPClientPlugin::loadLSPConfig( std::vector<LSPDefinition>& lsps, const std
foundTlsp = true;
lsp.command = tlsp.command;
lsp.name = tlsp.name;
lsp.rootIndicationFileNames = tlsp.rootIndicationFileNames;
lsp.url = tlsp.url;
break;
}
}
@@ -130,6 +146,7 @@ void LSPClientPlugin::loadLSPConfig( std::vector<LSPDefinition>& lsps, const std
lsp.filePatterns.push_back( pattern.get<std::string>() );
if ( obj.contains( "rootIndicationFileNames" ) ) {
lsp.rootIndicationFileNames.clear();
auto fnms = obj["rootIndicationFileNames"];
for ( auto& fn : fnms )
lsp.rootIndicationFileNames.push_back( fn );