mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
feat(handlers): Working on the WIP
This commit is contained in:
parent
4aa54ffcc1
commit
54c4f516fe
@ -246,15 +246,15 @@ var DefaultMountOptionsField = createMountOptionField([]docvalues.EnumString{},
|
||||
|
||||
var MountOptionsMapField = map[string]docvalues.Value{
|
||||
"adfs": createMountOptionField(
|
||||
[]docvalues.EnumString{},
|
||||
commondocumentation.AdfsDocumentationEnums,
|
||||
commondocumentation.AdfsDocumentationAssignable,
|
||||
),
|
||||
"affs": createMountOptionField(
|
||||
[]docvalues.EnumString{},
|
||||
commondocumentation.AffsDocumentationEnums,
|
||||
commondocumentation.AffsDocumentationAssignable,
|
||||
),
|
||||
"debugfs": createMountOptionField(
|
||||
[]docvalues.EnumString{},
|
||||
commondocumentation.DebugfsDocumentationEnums,
|
||||
commondocumentation.DebugfsDocumentationAssignable,
|
||||
),
|
||||
"ext2": createMountOptionField(
|
||||
|
@ -1,108 +1,20 @@
|
||||
package fstabdocumentation
|
||||
|
||||
import docvalues "config-lsp/doc-values"
|
||||
import (
|
||||
docvalues "config-lsp/doc-values"
|
||||
"config-lsp/utils"
|
||||
)
|
||||
|
||||
var FileSystemTypeField = docvalues.ArrayValue{
|
||||
Separator: ",",
|
||||
DuplicatesExtractor: &docvalues.SimpleDuplicatesExtractor,
|
||||
SubValue: docvalues.EnumValue{
|
||||
EnforceValues: false,
|
||||
Values: []docvalues.EnumString{
|
||||
{
|
||||
InsertText: "none",
|
||||
DescriptionText: "none",
|
||||
Documentation: "An entry _none_ is useful for bind or move mounts.",
|
||||
},
|
||||
{
|
||||
InsertText: "swap",
|
||||
DescriptionText: "swap",
|
||||
Documentation: "An entry _swap_ denotes a file or partition to be used for swapping, cf. swapon(8)",
|
||||
},
|
||||
{
|
||||
InsertText: "ext2",
|
||||
DescriptionText: "ext2",
|
||||
Documentation: "Mount as ext2 filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "ext3",
|
||||
DescriptionText: "ext3",
|
||||
Documentation: "Mount as ext2 filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "ext4",
|
||||
DescriptionText: "ext4",
|
||||
Documentation: "Mount as ext4 filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "xfs",
|
||||
DescriptionText: "xfs",
|
||||
Documentation: "Mount as xfs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "btrfs",
|
||||
DescriptionText: "btrfs",
|
||||
Documentation: "Mount as btrfs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "f2fs",
|
||||
DescriptionText: "f2fs",
|
||||
Documentation: "Mount as f2fs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "vfat",
|
||||
DescriptionText: "vfat",
|
||||
Documentation: "Mount as vfat filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "ntfs",
|
||||
DescriptionText: "ntfs",
|
||||
Documentation: "Mount as ntfs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "hfsplus",
|
||||
DescriptionText: "hfsplus",
|
||||
Documentation: "Mount as hfsplus filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "tmpfs",
|
||||
DescriptionText: "tmpfs",
|
||||
Documentation: "Mount as tmpfs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "sysfs",
|
||||
DescriptionText: "sysfs",
|
||||
Documentation: "Mount as sysfs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "proc",
|
||||
DescriptionText: "proc",
|
||||
Documentation: "Mount as proc filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "iso9660",
|
||||
DescriptionText: "iso9660",
|
||||
Documentation: "Mount as iso9660 filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "udf",
|
||||
DescriptionText: "udf",
|
||||
Documentation: "Mount as udf filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "squashfs",
|
||||
DescriptionText: "squashfs",
|
||||
Documentation: "Mount as squashfs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "nfs",
|
||||
DescriptionText: "nfs",
|
||||
Documentation: "Mount as nfs filesystem",
|
||||
},
|
||||
{
|
||||
InsertText: "cifs",
|
||||
DescriptionText: "cifs",
|
||||
Documentation: "Mount as cifs filesystem",
|
||||
},
|
||||
Values: utils.Map(
|
||||
utils.KeysOfMap(MountOptionsMapField),
|
||||
func(key string) docvalues.EnumString {
|
||||
return docvalues.CreateEnumString(key)
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
@ -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"
|
||||
@ -25,8 +24,6 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa
|
||||
cursor := params.Position.Character
|
||||
targetField := entry.GetFieldAtPosition(cursor - 1)
|
||||
|
||||
println("cursor at", cursor, "target field", targetField)
|
||||
|
||||
switch targetField {
|
||||
case FstabFieldSpec:
|
||||
value, cursor := GetFieldSafely(entry.Fields.Spec, cursor)
|
||||
@ -43,9 +40,7 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa
|
||||
cursor,
|
||||
), nil
|
||||
case FstabFieldFileSystemType:
|
||||
println(fmt.Sprintf("file system type: %s", entry.Fields.FilesystemType))
|
||||
value, cursor := GetFieldSafely(entry.Fields.FilesystemType, cursor)
|
||||
println("CURSOR", cursor)
|
||||
|
||||
return fstabdocumentation.FileSystemTypeField.FetchCompletions(
|
||||
value,
|
||||
@ -64,10 +59,12 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa
|
||||
|
||||
value, cursor := GetFieldSafely(entry.Fields.Options, cursor)
|
||||
|
||||
return optionsField.FetchCompletions(
|
||||
completions := optionsField.FetchCompletions(
|
||||
value,
|
||||
cursor,
|
||||
), nil
|
||||
)
|
||||
|
||||
return completions, nil
|
||||
case FstabFieldFreq:
|
||||
value, cursor := GetFieldSafely(entry.Fields.Freq, cursor)
|
||||
|
||||
|
@ -11,8 +11,6 @@ import (
|
||||
func TextDocumentDidOpen(context *glsp.Context, params *protocol.DidOpenTextDocumentParams) error {
|
||||
readBytes, err := os.ReadFile(params.TextDocument.URI[len("file://"):])
|
||||
|
||||
println("opened i la language eta", params.TextDocument.LanguageID)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user