From 3abfb9430a6bfcb8e3e7d1406566b81044ef6f58 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Sat, 10 Aug 2024 22:43:47 +0200 Subject: [PATCH] fix: Fix openssh --- handlers/openssh/documentation.go | 6 +++--- handlers/openssh/value-data-amount-value.go | 14 ++++++++++++-- handlers/openssh/value-time-format.go | 14 ++++++++++++-- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/handlers/openssh/documentation.go b/handlers/openssh/documentation.go index c254a09..9226464 100644 --- a/handlers/openssh/documentation.go +++ b/handlers/openssh/documentation.go @@ -307,7 +307,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256 The list of available signature algorithms may also be obtained using "ssh -Q HostbasedAcceptedAlgorithms". This was formerly named HostbasedAcceptedKeyTypes.`, docvalues.CustomValue{ - FetchValue: func() docvalues.Value { + FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { options, err := QueryOpenSSHOptions("HostbasedAcceptedAlgorithms") if err != nil { @@ -354,7 +354,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256 The list of available signature algorithms may also be obtained using "ssh -Q HostKeyAlgorithms".`, docvalues.CustomValue{ - FetchValue: func() docvalues.Value { + FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { options, _ := QueryOpenSSHOptions("HostKeyAlgorithms") return PrefixPlusMinusCaret(options) @@ -736,7 +736,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256 The list of available signature algorithms may also be obtained using "ssh -Q PubkeyAcceptedAlgorithms".`, docvalues.CustomValue{ - FetchValue: func() docvalues.Value { + FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { options, _ := QueryOpenSSHOptions("PubkeyAcceptedAlgorithms") return PrefixPlusMinusCaret(options) diff --git a/handlers/openssh/value-data-amount-value.go b/handlers/openssh/value-data-amount-value.go index 933e3da..8a26356 100644 --- a/handlers/openssh/value-data-amount-value.go +++ b/handlers/openssh/value-data-amount-value.go @@ -23,9 +23,15 @@ func (v DataAmountValue) GetTypeDescription() []string { return []string{"Data amount"} } -func (v DataAmountValue) CheckIsValid(value string) error { +func (v DataAmountValue) CheckIsValid(value string) []*docvalues.InvalidValue { if !dataAmountCheckPattern.MatchString(value) { - return InvalidDataAmountError{} + return []*docvalues.InvalidValue{ + { + Err: InvalidDataAmountError{}, + Start: 0, + End: uint32(len(value)), + }, + } } return nil @@ -85,3 +91,7 @@ func (v DataAmountValue) FetchCompletions(line string, cursor uint32) []protocol return completions } + +func (v DataAmountValue) FetchHoverInfo(line string, cursor uint32) []string { + return []string{} +} diff --git a/handlers/openssh/value-time-format.go b/handlers/openssh/value-time-format.go index b6d63b9..87c8c5f 100644 --- a/handlers/openssh/value-time-format.go +++ b/handlers/openssh/value-time-format.go @@ -25,9 +25,15 @@ func (v TimeFormatValue) GetTypeDescription() []string { return []string{"Time value"} } -func (v TimeFormatValue) CheckIsValid(value string) error { +func (v TimeFormatValue) CheckIsValid(value string) []*docvalues.InvalidValue { if !timeFormatCheckPattern.MatchString(value) { - return InvalidTimeFormatError{} + return []*docvalues.InvalidValue{ + { + Err: InvalidTimeFormatError{}, + Start: 0, + End: uint32(len(value)), + }, + } } return nil @@ -99,3 +105,7 @@ func (v TimeFormatValue) FetchCompletions(line string, cursor uint32) []protocol return completions } + +func (v TimeFormatValue) FetchHoverInfo(line string, cursor uint32) []string { + return []string{} +}