diff --git a/handlers/sshd_config/analyzer/analyzer.go b/handlers/sshd_config/analyzer/analyzer.go index 7f93902..3bee59b 100644 --- a/handlers/sshd_config/analyzer/analyzer.go +++ b/handlers/sshd_config/analyzer/analyzer.go @@ -13,16 +13,6 @@ func Analyze( d *sshdconfig.SSHDocument, ) []protocol.Diagnostic { errors := analyzeOptionsAreValid(d) - - if len(errors) > 0 { - return utils.Map( - errors, - func(err common.LSPError) protocol.Diagnostic { - return err.ToDiagnostic() - }, - ) - } - indexes, indexErrors := indexes.CreateIndexes(*d.Config) _ = indexes diff --git a/handlers/sshd_config/lsp/text-document-completion.go b/handlers/sshd_config/lsp/text-document-completion.go index f207837..db7fc30 100644 --- a/handlers/sshd_config/lsp/text-document-completion.go +++ b/handlers/sshd_config/lsp/text-document-completion.go @@ -10,7 +10,7 @@ import ( protocol "github.com/tliron/glsp/protocol_3_16" ) -var containsSeparatorPattern = regexp.MustCompile(`\s+$`) +var isEmptyPattern = regexp.MustCompile(`^\s*$`) func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionParams) (any, error) { line := params.Position.Line @@ -28,11 +28,12 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa entry.Separator == nil || entry.Key == nil || (common.CursorToCharacterIndex(cursor)) <= entry.Key.End.Character { - // Empty line + return handlers.GetRootCompletions( d, matchBlock, - entry == nil || containsSeparatorPattern.Match([]byte(entry.Value)), + // Empty line, or currently typing a new key + entry == nil || isEmptyPattern.Match([]byte(entry.Value[cursor:])), ) }