diff --git a/doc-values/value-or.go b/doc-values/value-or.go index 0e9a6e5..ef4d6a6 100644 --- a/doc-values/value-or.go +++ b/doc-values/value-or.go @@ -60,7 +60,6 @@ func (v OrValue) FetchCompletions(line string, cursor uint32) []protocol.Complet // the values of the KeyEnumAssignment keyEnumValue := v.Values[0].(KeyEnumAssignmentValue) - println("line eta cursor", line, cursor) _, found := utils.FindPreviousCharacter(line, keyEnumValue.Separator, int(cursor-1)) if found { diff --git a/handlers/fstab/documentation/documentation-mountoptions.go b/handlers/fstab/documentation/documentation-mountoptions.go index e40556b..c595ca6 100644 --- a/handlers/fstab/documentation/documentation-mountoptions.go +++ b/handlers/fstab/documentation/documentation-mountoptions.go @@ -1,7 +1,7 @@ package fstabdocumentation import ( - commondocumentation "config-lsp/common-documentation/filesystems/mountoptions" + commondocumentation "config-lsp/common-documentation" docvalues "config-lsp/doc-values" "strings" ) diff --git a/handlers/fstab/parser.go b/handlers/fstab/parser.go index ff81d55..5ca9a5d 100644 --- a/handlers/fstab/parser.go +++ b/handlers/fstab/parser.go @@ -28,7 +28,7 @@ type Field struct { } func (f Field) String() string { - return f.Value + return fmt.Sprintf("%v [%v-%v]", f.Value, f.Start, f.End) } func (f *Field) CreateRange(fieldLine uint32) protocol.Range { @@ -65,7 +65,15 @@ type FstabFields struct { } func (f FstabFields) String() string { - return fmt.Sprintf("Spec: %s, MountPoint: %s, FilesystemType: %s, Options: %s, Freq: %s, Pass: %s", f.Spec, f.MountPoint, f.FilesystemType, f.Options, f.Freq, f.Pass) + return fmt.Sprintf( + "Spec: %s, MountPoint: %s, FilesystemType: %s, Options: %s, Freq: %s, Pass: %s", + f.Spec, + f.MountPoint, + f.FilesystemType, + f.Options, + f.Freq, + f.Pass, + ) } type FstabEntry struct { @@ -206,7 +214,7 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error { pass = &Field{ Value: fields[5], Start: start, - End: start + uint32(len(value)) - 1, + End: start + uint32(len(value)), } fallthrough case 5: @@ -216,7 +224,7 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error { freq = &Field{ Value: value, Start: start, - End: start + uint32(len(value)) - 1, + End: start + uint32(len(value)), } fallthrough case 4: @@ -226,7 +234,7 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error { options = &Field{ Value: value, Start: start, - End: start + uint32(len(value)) - 1, + End: start + uint32(len(value)), } fallthrough case 3: @@ -236,7 +244,7 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error { filesystemType = &Field{ Value: value, Start: start, - End: start + uint32(len(value)) - 1, + End: start + uint32(len(value)), } fallthrough case 2: @@ -246,7 +254,7 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error { mountPoint = &Field{ Value: value, Start: start, - End: start + uint32(len(value)) - 1, + End: start + uint32(len(value)), } fallthrough case 1: @@ -256,7 +264,7 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error { spec = &Field{ Value: value, Start: start, - End: start + uint32(len(value)) - 1, + End: start + uint32(len(value)), } } diff --git a/handlers/fstab/text-document-completion.go b/handlers/fstab/text-document-completion.go index 0378f68..7cec50f 100644 --- a/handlers/fstab/text-document-completion.go +++ b/handlers/fstab/text-document-completion.go @@ -3,6 +3,7 @@ package fstab import ( docvalues "config-lsp/doc-values" fstabdocumentation "config-lsp/handlers/fstab/documentation" + "fmt" "github.com/tliron/glsp" protocol "github.com/tliron/glsp/protocol_3_16" @@ -22,7 +23,7 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa } cursor := params.Position.Character - targetField := entry.GetFieldAtPosition(cursor - 1) + targetField := entry.GetFieldAtPosition(cursor) switch targetField { case FstabFieldSpec: