Fix TypeScript React and JavasSript React files in LSP, they were recognized as TypeScript and JavaScript files so it was incorrectly parsed.

This commit is contained in:
Martín Lucas Golini
2024-03-21 12:55:36 -03:00
parent 82ec47b5b7
commit bdc376a1eb
4 changed files with 35 additions and 3 deletions

View File

@@ -770,6 +770,24 @@ void LSPClientPlugin::load( PluginManager* pluginManager ) {
}
}
std::unordered_map<std::string, std::unordered_map<std::string, std::string>> lspPatternsLangId;
for ( auto& lsp : lsps ) {
if ( lsp.shareProcessWithOtherDefinition && !lsp.usesLSP.empty() ) {
for ( const auto& ptrn : lsp.filePatterns )
lspPatternsLangId[lsp.usesLSP][ptrn] = lsp.language;
}
}
for ( auto& lsp : lsps ) {
auto ptrnsLangIds = lspPatternsLangId.find( lsp.name );
if ( ptrnsLangIds != lspPatternsLangId.end() ) {
lsp.languageIdsForFilePatterns.merge( ptrnsLangIds->second );
for ( const auto& ptrn : lsp.filePatterns )
lsp.languageIdsForFilePatterns[ptrn] = lsp.language;
}
}
mClientManager.load( this, pluginManager, std::move( lsps ) );
subscribeFileSystemListener();