fix: Overall improvements

This commit is contained in:
Myzel394 2024-08-10 17:23:58 +02:00
parent 1a909a6d2d
commit 04fe0d2dc8
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
3 changed files with 23 additions and 1 deletions

View File

@ -114,6 +114,7 @@ func (v KeyEnumAssignmentValue) FetchEnumCompletions() []protocol.CompletionItem
kind := protocol.CompletionItemKindField
val := v.Values[enumKey]
description := val.GetTypeDescription()
insertText := enumKey.InsertText + v.Separator
var documentation string
@ -125,6 +126,7 @@ func (v KeyEnumAssignmentValue) FetchEnumCompletions() []protocol.CompletionItem
completions = append(completions, protocol.CompletionItem{
Label: enumKey.InsertText,
InsertText: &insertText,
InsertTextFormat: &textFormat,
Kind: &kind,
Documentation: documentation,

View File

@ -211,6 +211,11 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error {
case 6:
value := fields[5]
start := uint32(strings.Index(line, value))
if start == 0 {
start = uint32(len(line))
}
pass = &Field{
Value: fields[5],
Start: start,
@ -221,6 +226,10 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error {
value := fields[4]
start := uint32(strings.Index(line, value))
if start == 0 {
start = uint32(len(line))
}
freq = &Field{
Value: value,
Start: start,
@ -231,6 +240,10 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error {
value := fields[3]
start := uint32(strings.Index(line, value))
if start == 0 {
start = uint32(len(line))
}
options = &Field{
Value: value,
Start: start,
@ -241,6 +254,10 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error {
value := fields[2]
start := uint32(strings.Index(line, value))
if start == 0 {
start = uint32(len(line))
}
filesystemType = &Field{
Value: value,
Start: start,
@ -251,6 +268,10 @@ func (p *FstabParser) AddLine(line string, lineNumber int) error {
value := fields[1]
start := uint32(strings.Index(line, value))
if start == 0 {
start = uint32(len(line))
}
mountPoint = &Field{
Value: value,
Start: start,

View File

@ -3,7 +3,6 @@ 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"