mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
fix(ssh_config): Only run analyzer if parser had no errors
This commit is contained in:
parent
631de7c33c
commit
f5aa4ae7cc
@ -30,9 +30,9 @@ func TextDocumentDidChange(
|
||||
return err.ToDiagnostic()
|
||||
},
|
||||
)...)
|
||||
}
|
||||
|
||||
} else {
|
||||
diagnostics = append(diagnostics, analyzer.Analyze(document)...)
|
||||
}
|
||||
|
||||
if len(diagnostics) > 0 {
|
||||
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
||||
|
@ -29,19 +29,19 @@ func TextDocumentDidOpen(
|
||||
sshconfig.DocumentParserMap[params.TextDocument.URI] = document
|
||||
}
|
||||
|
||||
diagnostics := make([]protocol.Diagnostic, 0)
|
||||
errors := document.Config.Parse(params.TextDocument.Text)
|
||||
|
||||
diagnostics := utils.Map(
|
||||
if len(errors) > 0 {
|
||||
diagnostics = append(diagnostics, utils.Map(
|
||||
errors,
|
||||
func(err common.LSPError) protocol.Diagnostic {
|
||||
return err.ToDiagnostic()
|
||||
},
|
||||
)
|
||||
|
||||
diagnostics = append(
|
||||
diagnostics,
|
||||
analyzer.Analyze(document)...,
|
||||
)
|
||||
)...)
|
||||
} else {
|
||||
diagnostics = append(diagnostics, analyzer.Analyze(document)...)
|
||||
}
|
||||
|
||||
if len(diagnostics) > 0 {
|
||||
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
||||
|
Loading…
x
Reference in New Issue
Block a user