@@ -24,12 +24,12 @@ use async_lsp::lsp_types::{
2424 DocumentSymbolResponse , FullDocumentDiagnosticReport ,
2525 GotoDefinitionParams , GotoDefinitionResponse , Hover , HoverParams ,
2626 HoverProviderCapability , InitializeParams , InitializeResult , Location ,
27- OneOf , PublishDiagnosticsParams , ReferenceParams ,
27+ MessageType , OneOf , PublishDiagnosticsParams , ReferenceParams ,
2828 RelatedFullDocumentDiagnosticReport , RenameParams , SaveOptions ,
2929 SelectionRange , SelectionRangeParams , SelectionRangeProviderCapability ,
3030 SemanticTokensFullOptions , SemanticTokensLegend , SemanticTokensOptions ,
3131 SemanticTokensRangeResult , SemanticTokensResult ,
32- SemanticTokensServerCapabilities , ServerCapabilities ,
32+ SemanticTokensServerCapabilities , ServerCapabilities , ShowMessageParams ,
3333 TextDocumentSyncCapability , TextDocumentSyncKind , TextDocumentSyncOptions ,
3434 TextDocumentSyncSaveOptions , TextEdit , Url , WorkspaceEdit ,
3535} ;
@@ -553,7 +553,7 @@ impl YARALanguageServer {
553553 mut client : ClientSocket ,
554554 scope_uri : Url ,
555555 ) -> Settings {
556- client
556+ let settings = client
557557 . configuration ( ConfigurationParams {
558558 items : vec ! [
559559 ConfigurationItem {
@@ -583,7 +583,20 @@ impl YARALanguageServer {
583583
584584 Settings { metadata_validation, rule_name_validation }
585585 } )
586- . unwrap_or_default ( )
586+ . unwrap_or_default ( ) ;
587+
588+ if let Some ( re) = & settings. rule_name_validation {
589+ if regex:: Regex :: new ( re) . is_err ( ) {
590+ let _ = client. show_message ( ShowMessageParams {
591+ typ : MessageType :: ERROR ,
592+ message : format ! (
593+ "YARA: wrong rule name validation regex: {re}"
594+ ) ,
595+ } ) ;
596+ }
597+ }
598+
599+ settings
587600 }
588601
589602 /// Sends diagnostics for specific document if publish model is used.
0 commit comments