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,10 +30,10 @@ func TextDocumentDidChange(
|
|||||||
return err.ToDiagnostic()
|
return err.ToDiagnostic()
|
||||||
},
|
},
|
||||||
)...)
|
)...)
|
||||||
|
} else {
|
||||||
|
diagnostics = append(diagnostics, analyzer.Analyze(document)...)
|
||||||
}
|
}
|
||||||
|
|
||||||
diagnostics = append(diagnostics, analyzer.Analyze(document)...)
|
|
||||||
|
|
||||||
if len(diagnostics) > 0 {
|
if len(diagnostics) > 0 {
|
||||||
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
||||||
}
|
}
|
||||||
|
@ -29,19 +29,19 @@ func TextDocumentDidOpen(
|
|||||||
sshconfig.DocumentParserMap[params.TextDocument.URI] = document
|
sshconfig.DocumentParserMap[params.TextDocument.URI] = document
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diagnostics := make([]protocol.Diagnostic, 0)
|
||||||
errors := document.Config.Parse(params.TextDocument.Text)
|
errors := document.Config.Parse(params.TextDocument.Text)
|
||||||
|
|
||||||
diagnostics := utils.Map(
|
if len(errors) > 0 {
|
||||||
errors,
|
diagnostics = append(diagnostics, utils.Map(
|
||||||
func(err common.LSPError) protocol.Diagnostic {
|
errors,
|
||||||
return err.ToDiagnostic()
|
func(err common.LSPError) protocol.Diagnostic {
|
||||||
},
|
return err.ToDiagnostic()
|
||||||
)
|
},
|
||||||
|
)...)
|
||||||
diagnostics = append(
|
} else {
|
||||||
diagnostics,
|
diagnostics = append(diagnostics, analyzer.Analyze(document)...)
|
||||||
analyzer.Analyze(document)...,
|
}
|
||||||
)
|
|
||||||
|
|
||||||
if len(diagnostics) > 0 {
|
if len(diagnostics) > 0 {
|
||||||
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
common.SendDiagnostics(context, params.TextDocument.URI, diagnostics)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user