LuaPattern::matchesAny.
Markdown syntax highlighting improvements.
ecode: Added OmniSharp support.
This commit is contained in:
Martín Lucas Golini
2023-02-04 03:28:37 -03:00
parent 567423bf96
commit 389131b2b6
7 changed files with 46 additions and 10 deletions

View File

@@ -270,12 +270,18 @@ void LSPClientPlugin::loadLSPConfig( std::vector<LSPDefinition>& lsps, const std
}
}
// Allow setting user command paramaters for an already declared LSP
if ( obj.contains( "name" ) && obj.contains( "command_parameters" ) &&
obj.at( "command_parameters" ).is_string() ) {
// Allow overriding the command for already defined LSP
// And allow adding parameters to the already defined LSP
if ( obj.contains( "name" ) &&
( ( obj.contains( "command" ) && obj.at( "command" ).is_string() ) ||
( obj.contains( "command_parameters" ) &&
obj.at( "command_parameters" ).is_string() ) ) ) {
for ( auto& lsp : lsps ) {
if ( lsp.name == obj["name"] ) {
lsp.commandParameters = obj.value( "command_parameters", "" );
if ( !obj.value( "command", "" ).empty() )
lsp.command = obj.value( "command", "" );
if ( !obj.value( "command_parameters", "" ).empty() )
lsp.commandParameters = obj.value( "command_parameters", "" );
break;
}
}

View File

@@ -257,7 +257,7 @@ static void fromJson( LSPDocumentOnTypeFormattingOptions& options, const json& j
static void fromJson( LSPWorkspaceFoldersServerCapabilities& options, const json& json ) {
if ( json.is_object() ) {
auto ob = json;
options.supported = ob["supported"].get<bool>();
options.supported = ob.value( "supported", false );
if ( ob["changeNotifications"].is_boolean() ) {
options.changeNotifications = ob["changeNotifications"].get<bool>();
} else if ( ob["changeNotifications"].is_string() ) {
@@ -891,7 +891,8 @@ LSPClientServer::~LSPClientServer() {
}
bool LSPClientServer::start() {
bool ret = mProcess.create( mLSP.command, Process::getDefaultOptions(), {}, mRootPath );
bool ret = mProcess.create( mLSP.command + mLSP.commandParameters, Process::getDefaultOptions(),
{}, mRootPath );
if ( ret && mProcess.isAlive() ) {
mProcess.startAsyncRead(
[this]( const char* bytes, size_t n ) { readStdOut( bytes, n ); },

View File

@@ -59,10 +59,15 @@ std::string LSPClientServerManager::findRootPath( const LSPDefinition& lsp,
FileSystem::dirAddSlashAtEnd( rootPath );
while ( rootPath != lRootPath ) {
for ( const auto& fileName : lsp.rootIndicationFileNames )
for ( const auto& fileName : lsp.rootIndicationFileNames ) {
if ( FileSystem::fileExists( rootPath + fileName ) )
return rootPath;
if ( fileName.find_first_of( "$%" ) != std::string::npos &&
!LuaPattern::matchesAny( FileSystem::filesGetInPath( rootPath ), fileName )
.empty() )
return rootPath;
}
lRootPath = rootPath;
rootPath = FileSystem::removeLastFolderFromPath( rootPath );
}