From 9d8c11f0308fa884eaeef857268a087d5f1ed024 Mon Sep 17 00:00:00 2001 From: Myzel394 <50424412+Myzel394@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:52:45 +0200 Subject: [PATCH] fix(fstab): Improve fields --- server/handlers/gitconfig/fields/options.go | 36 ++++++++++++++----- .../gitconfig/fields/values-integer.go | 6 ++-- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/server/handlers/gitconfig/fields/options.go b/server/handlers/gitconfig/fields/options.go index 4e4d6d8..4c9a8ff 100644 --- a/server/handlers/gitconfig/fields/options.go +++ b/server/handlers/gitconfig/fields/options.go @@ -1,6 +1,9 @@ package fields -import docvalues "config-lsp/doc-values" +import ( + commondocumentation "config-lsp/common-documentation" + docvalues "config-lsp/doc-values" +) var minusOne = -1 var four = 4 @@ -220,7 +223,7 @@ completely verbatim using the -z option. The default value is true.`, Value: docvalues.StringValue{}, }, - // TODO: Add latger + // TODO: Show ignored if core.autocrlf "eol": docvalues.DocumentationValue{ Documentation: `Sets the line ending type to use in the working directory for files that are marked as text (either by having the text @@ -231,7 +234,23 @@ native line ending. The default value is native. See gitattributes[5] for more information on end-of-line conversion. Note that this value is ignored if core.autocrlf is set to true or input.`, - Value: docvalues.StringValue{}, + Value: docvalues.EnumValue{ + Values: []docvalues.EnumString{ + docvalues.CreateEnumStringWithDoc( + "lf", + "This setting forces Git to normalize line endings to LF on checkin and prevents conversion to CRLF when the file is checked out.", + ), + docvalues.CreateEnumStringWithDoc( + "crlf", + "This setting forces Git to normalize line endings for this file on checkin and convert them to CRLF when the file is checked out.", + ), + + docvalues.CreateEnumStringWithDoc( + "native", + "This uses the platform's native line ending.", + ), + }, + }, }, "safecrlf": docvalues.DocumentationValue{ Documentation: `If true, makes Git check if converting CRLF is reversible when @@ -305,13 +324,12 @@ This variable can be set to input, in which case no output conversion is performed.`, Value: BooleanField, }, - // TODO: Add later "checkroundtripencoding": docvalues.DocumentationValue{ - Documentation: `A comma and/or whitespace separated list of encodings that Git -performs UTF-8 round trip checks on if they are used in an -working-tree-encoding attribute (see gitattributes[5]). -The default value is SHIFT-JIS.`, - Value: docvalues.StringValue{}, + Documentation: "A comma and/or whitespace separated list of encodings that Git performs UTF-8 round trip checks on if they are used in an working-tree-encoding attribute (see gitattributes[5]). The default value is SHIFT-JIS.", + Value: docvalues.EnumValue{ + Values: commondocumentation.AvailableCharsets, + EnforceValues: true, + }, }, "symlinks": docvalues.DocumentationValue{ Documentation: `If false, symbolic links are checked out as small plain files that diff --git a/server/handlers/gitconfig/fields/values-integer.go b/server/handlers/gitconfig/fields/values-integer.go index 45357a6..b431704 100644 --- a/server/handlers/gitconfig/fields/values-integer.go +++ b/server/handlers/gitconfig/fields/values-integer.go @@ -68,17 +68,17 @@ func (v IntegerValue) DeprecatedFetchCompletions(line string, cursor uint32) []p protocol.CompletionItem{ Label: line + "k", Kind: &kind, - Documentation: fmt.Sprintf("scale %d by x1024", line), + Documentation: fmt.Sprintf("scale %s by x1024", line), }, protocol.CompletionItem{ Label: line + "m", Kind: &kind, - Documentation: fmt.Sprintf("scale %d by x1024x1024", line), + Documentation: fmt.Sprintf("scale %s by x1024x1024", line), }, protocol.CompletionItem{ Label: line + "g", Kind: &kind, - Documentation: fmt.Sprintf("scale %d by x1024x1024x1024", line), + Documentation: fmt.Sprintf("scale %s by x1024x1024x1024", line), }, ) }