mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
fix: Improvements
This commit is contained in:
parent
2433974c25
commit
c6f8e87986
@ -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 {
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user