refactor: Rename Value -> DeprecatedValue

This commit is contained in:
Myzel394 2024-09-28 12:07:18 +02:00
parent 6ab293d84e
commit b7e786810e
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
73 changed files with 287 additions and 286 deletions

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var AdfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var AdfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"uid", "uid",
"Set the owner of the files in the filesystem (default: uid=0).", "Set the owner of the files in the filesystem (default: uid=0).",

View File

@ -4,7 +4,7 @@ import docvalues "config-lsp/doc-values"
var prefixMaxLength = uint32(30) var prefixMaxLength = uint32(30)
var AffsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var AffsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"uid", "uid",
"Set the owner and group of the root of the filesystem (default: uid=gid=0, but with option uid or gid without specified value, the UID and GID of the current process are taken).", "Set the owner and group of the root of the filesystem (default: uid=gid=0, but with option uid or gid without specified value, the UID and GID of the current process are taken).",

View File

@ -4,7 +4,7 @@ import docvalues "config-lsp/doc-values"
var maxInlineMin = 2048 var maxInlineMin = 2048
var BtrfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var BtrfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"check_int_print_mask", "check_int_print_mask",
"These debugging options control the behavior of the integrity checking module (the BTRFS_FS_CHECK_INTEGRITY config option required). The main goal is to verify that all blocks from a given transaction period are properly linked.", "These debugging options control the behavior of the integrity checking module (the BTRFS_FS_CHECK_INTEGRITY config option required). The main goal is to verify that all blocks from a given transaction period are properly linked.",
@ -71,7 +71,7 @@ var BtrfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
"max_inline", "max_inline",
"Specify the maximum amount of space, that can be inlined in a metadata b-tree leaf. The value is specified in bytes, optionally with a K suffix (case insensitive). In practice, this value is limited by the filesystem block size (named sectorsize at mkfs time), and memory page size of the system. In case of sectorsize limit, there's some space unavailable due to leaf headers. For example, a 4Ki", "Specify the maximum amount of space, that can be inlined in a metadata b-tree leaf. The value is specified in bytes, optionally with a K suffix (case insensitive). In practice, this value is limited by the filesystem block size (named sectorsize at mkfs time), and memory page size of the system. In case of sectorsize limit, there's some space unavailable due to leaf headers. For example, a 4Ki",
): docvalues.OrValue{ ): docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: true, EnforceValues: true,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var DebugfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var DebugfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"uid", "uid",
"Set the owner of the mountpoint.", "Set the owner of the mountpoint.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var DevptsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var DevptsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"uid", "uid",
"This sets the owner or the group of newly created pseudo terminals to the specified values. When nothing is specified, they will be set to the UID and GID of the creating process. For example, if there is a tty group with GID 5, then gid=5 will cause newly created pseudo terminals to belong to the tty group.", "This sets the owner or the group of newly created pseudo terminals to the specified values. When nothing is specified, they will be set to the UID and GID of the creating process. For example, if there is a tty group with GID 5, then gid=5 will cause newly created pseudo terminals to belong to the tty group.",

View File

@ -3,7 +3,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var Ext2DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var Ext2DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"none", "none",
"No checking is done at mount time. This is the default. This is fast. It is wise to invoke e2fsck(8) every now and then, e.g. at boot time. The non-default behavior is unsupported (check=normal and check=strict options have been removed). Note that these mount options don't have to be supported if ext4 kernel driver is used for ext2 and ext3 file systems.", "No checking is done at mount time. This is the default. This is fast. It is wise to invoke e2fsck(8) every now and then, e.g. at boot time. The non-default behavior is unsupported (check=normal and check=strict options have been removed). Note that these mount options don't have to be supported if ext4 kernel driver is used for ext2 and ext3 file systems.",

View File

@ -5,7 +5,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var Ext3DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var Ext3DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"journal_dev", "journal_dev",
"When the external journal device's major/minor numbers have changed, these options allow the user to specify the new journal location. The journal device is identified either through its new major/minor numbers encoded in devnum, or via a path to the device.", "When the external journal device's major/minor numbers have changed, these options allow the user to specify the new journal location. The journal device is identified either through its new major/minor numbers encoded in devnum, or via a path to the device.",

View File

@ -5,7 +5,7 @@ import docvalues "config-lsp/doc-values"
var zero = 0 var zero = 0
var maxJournalIOPrio = 7 var maxJournalIOPrio = 7
var Ext4DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var Ext4DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"inode_readahead_blks", "inode_readahead_blks",
"This tuning parameter controls the maximum number of inode table blocks that ext4's inode table readahead algorithm will pre-read into the buffer cache. The value must be a power of 2. The default value is 32 blocks.", "This tuning parameter controls the maximum number of inode table blocks that ext4's inode table readahead algorithm will pre-read into the buffer cache. The value must be a power of 2. The default value is 32 blocks.",

View File

@ -4,7 +4,7 @@ import (
docvalues "config-lsp/doc-values" docvalues "config-lsp/doc-values"
) )
var FatDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var FatDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"blocksize", "blocksize",
"Set blocksize (default 512). This option is obsolete.", "Set blocksize (default 512). This option is obsolete.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var HfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var HfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"creator", "creator",
"Set the creator/type values as shown by the MacOS finder used for creating new files. Default values: '????'.", "Set the creator/type values as shown by the MacOS finder used for creating new files. Default values: '????'.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var HpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var HpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"uid", "uid",
"Set the owner and group of all files. (Default: the UID and GID of the current process.)", "Set the owner and group of all files. (Default: the UID and GID of the current process.)",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var Iso9660DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var Iso9660DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"check", "check",
"With check=relaxed, a filename is first converted to lower case before doing the lookup. This is probably only meaningful together with norock and map=normal. (Default: check=strict.)", "With check=relaxed, a filename is first converted to lower case before doing the lookup. This is probably only meaningful together with norock and map=normal. (Default: check=strict.)",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var JfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var JfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"iocharset", "iocharset",
"Character set to use for converting from Unicode to ASCII. The default is to do no conversion. Use iocharset=utf8 for UTF8 translations. This requires CONFIG_NLS_UTF8 to be set in the kernel .config file.", "Character set to use for converting from Unicode to ASCII. The default is to do no conversion. Use iocharset=utf8 for UTF8 translations. This requires CONFIG_NLS_UTF8 to be set in the kernel .config file.",

View File

@ -2,6 +2,6 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var NcpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{} var NcpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{}
var NcpfsDocumentationEnums = []docvalues.EnumString{} var NcpfsDocumentationEnums = []docvalues.EnumString{}

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var NtfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var NtfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"iocharset", "iocharset",
"Character set to use when returning file names. Unlike VFAT, NTFS suppresses names that contain nonconvertible characters. Deprecated.", "Character set to use when returning file names. Unlike VFAT, NTFS suppresses names that contain nonconvertible characters. Deprecated.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var OverlayDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var OverlayDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"lowerdir", "lowerdir",
"Any filesystem, does not need to be on a writable filesystem.", "Any filesystem, does not need to be on a writable filesystem.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var ReiserfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var ReiserfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"hash", "hash",
"Choose which hash function reiserfs will use to find files within directories.", "Choose which hash function reiserfs will use to find files within directories.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var UbifsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var UbifsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"compr", "compr",
"Select the default compressor which is used when new files are written. It is still possible to read compressed files if mounted with the none option.", "Select the default compressor which is used when new files are written. It is still possible to read compressed files if mounted with the none option.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var UdfDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var UdfDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"uid", "uid",
"Make all files in the filesystem belong to the given user. uid=forget can be specified independently of (or usually in addition to) uid=<user> and results in UDF not storing uids to the media. In fact the recorded uid is the 32-bit overflow uid -1 as defined by the UDF standard. The value is given as either <user> which is a valid user name or the corresponding decimal user id, or the special string 'forget'.", "Make all files in the filesystem belong to the given user. uid=forget can be specified independently of (or usually in addition to) uid=<user> and results in UDF not storing uids to the media. In fact the recorded uid is the 32-bit overflow uid -1 as defined by the UDF standard. The value is given as either <user> which is a valid user name or the corresponding decimal user id, or the special string 'forget'.",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var UfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{ var UfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"ufstype", "ufstype",
"UFS is a filesystem widely used in different operating systems. The problem are differences among implementations. Features of some implementations are undocumented, so its hard to recognize the type of ufs automatically. Thats why the user must specify the type of ufs by mount option.", "UFS is a filesystem widely used in different operating systems. The problem are differences among implementations. Features of some implementations are undocumented, so its hard to recognize the type of ufs automatically. Thats why the user must specify the type of ufs by mount option.",

View File

@ -5,7 +5,7 @@ import (
"config-lsp/utils" "config-lsp/utils"
) )
var UmsdosDocumentationAssignable = utils.FilterMap(MsdosDocumentationAssignable, func(key docvalues.EnumString, value docvalues.Value) bool { var UmsdosDocumentationAssignable = utils.FilterMap(MsdosDocumentationAssignable, func(key docvalues.EnumString, value docvalues.DeprecatedValue) bool {
// `dotsOK` is explicitly not supported // `dotsOK` is explicitly not supported
if key.InsertText == "dotsOK" { if key.InsertText == "dotsOK" {
return false return false

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var UsbfsDocumentationAssignable = docvalues.MergeKeyEnumAssignmentMaps(FatDocumentationAssignable, map[docvalues.EnumString]docvalues.Value{ var UsbfsDocumentationAssignable = docvalues.MergeKeyEnumAssignmentMaps(FatDocumentationAssignable, map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"devuid", "devuid",
"Set the owner of the device files in the usbfs filesystem (default: uid=gid=0)", "Set the owner of the device files in the usbfs filesystem (default: uid=gid=0)",

View File

@ -2,7 +2,7 @@ package commondocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var VfatDocumentationAssignable = docvalues.MergeKeyEnumAssignmentMaps(FatDocumentationAssignable, map[docvalues.EnumString]docvalues.Value{ var VfatDocumentationAssignable = docvalues.MergeKeyEnumAssignmentMaps(FatDocumentationAssignable, map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"shortname", "shortname",
"Defines the behavior for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be the preferred one for display", "Defines the behavior for creation and display of filenames which fit into 8.3 characters. If a long name for a file exists, it will always be the preferred one for display",

View File

@ -5,11 +5,11 @@ import (
protocol "github.com/tliron/glsp/protocol_3_16" protocol "github.com/tliron/glsp/protocol_3_16"
) )
type Value interface { type DeprecatedValue interface {
GetTypeDescription() []string GetTypeDescription() []string
CheckIsValid(value string) []*InvalidValue DeprecatedCheckIsValid(value string) []*InvalidValue
FetchCompletions(line string, cursor uint32) []protocol.CompletionItem DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem
FetchHoverInfo(line string, cursor uint32) []string DeprecatedFetchHoverInfo(line string, cursor uint32) []string
} }
type InvalidValue struct { type InvalidValue struct {

View File

@ -68,7 +68,7 @@ func (e ValueError) GetPublishDiagnosticsParams() protocol.Diagnostic {
} }
} }
func (e ValueError) Error() string { func (e ValueError) Error() string {
return "Value error" return "DeprecatedValue error"
} }
type OptionAlreadyExistsError struct { type OptionAlreadyExistsError struct {

View File

@ -6,11 +6,11 @@ import (
"regexp" "regexp"
) )
// UserValue returns a Value that fetches user names from /etc/passwd // UserValue returns a DeprecatedValue that fetches user names from /etc/passwd
// if `separatorForMultiple` is not empty, it will return an ArrayValue // if `separatorForMultiple` is not empty, it will return an ArrayValue
func UserValue(separatorForMultiple string, enforceValues bool) Value { func UserValue(separatorForMultiple string, enforceValues bool) DeprecatedValue {
return CustomValue{ return CustomValue{
FetchValue: func(context CustomValueContext) Value { FetchValue: func(context CustomValueContext) DeprecatedValue {
infos, err := common.FetchPasswdInfo() infos, err := common.FetchPasswdInfo()
if err != nil { if err != nil {
@ -37,9 +37,9 @@ func UserValue(separatorForMultiple string, enforceValues bool) Value {
} }
} }
func GroupValue(separatorForMultiple string, enforceValues bool) Value { func GroupValue(separatorForMultiple string, enforceValues bool) DeprecatedValue {
return CustomValue{ return CustomValue{
FetchValue: func(context CustomValueContext) Value { FetchValue: func(context CustomValueContext) DeprecatedValue {
infos, err := common.FetchGroupInfo() infos, err := common.FetchGroupInfo()
if err != nil { if err != nil {
@ -66,14 +66,14 @@ func GroupValue(separatorForMultiple string, enforceValues bool) Value {
} }
} }
func PositiveNumberValue() Value { func PositiveNumberValue() DeprecatedValue {
zero := 0 zero := 0
return NumberValue{ return NumberValue{
Min: &zero, Min: &zero,
} }
} }
func MaskValue() Value { func MaskValue() DeprecatedValue {
min := 0 min := 0
max := 777 max := 777
return NumberValue{Min: &min, Max: &max} return NumberValue{Min: &min, Max: &max}
@ -88,7 +88,7 @@ func SingleEnumValue(value string) EnumValue {
} }
} }
func DomainValue() Value { func DomainValue() DeprecatedValue {
return RegexValue{ return RegexValue{
Regex: *regexp.MustCompile(`^.+?\..+$`), Regex: *regexp.MustCompile(`^.+?\..+$`),
} }

View File

@ -20,9 +20,9 @@ func GenerateBase10Completions(prefix string) []protocol.CompletionItem {
) )
} }
func MergeKeyEnumAssignmentMaps(maps ...map[EnumString]Value) map[EnumString]Value { func MergeKeyEnumAssignmentMaps(maps ...map[EnumString]DeprecatedValue) map[EnumString]DeprecatedValue {
existingEnums := make(map[string]interface{}) existingEnums := make(map[string]interface{})
result := make(map[EnumString]Value) result := make(map[EnumString]DeprecatedValue)
slices.Reverse(maps) slices.Reverse(maps)

View File

@ -35,7 +35,7 @@ var ExtractKeyDuplicatesExtractor = func(separator string) func(string) string {
var DuplicatesAllowedExtractor func(string) string = nil var DuplicatesAllowedExtractor func(string) string = nil
type ArrayValue struct { type ArrayValue struct {
SubValue Value SubValue DeprecatedValue
Separator string Separator string
// If this function is nil, no duplicate check is done. // If this function is nil, no duplicate check is done.
// (value) => Extracted value // (value) => Extracted value
@ -45,7 +45,7 @@ type ArrayValue struct {
} }
func (v ArrayValue) GetTypeDescription() []string { func (v ArrayValue) GetTypeDescription() []string {
subValue := v.SubValue.(Value) subValue := v.SubValue.(DeprecatedValue)
return append( return append(
[]string{fmt.Sprintf("An Array separated by '%s' of:", v.Separator)}, []string{fmt.Sprintf("An Array separated by '%s' of:", v.Separator)},
@ -53,7 +53,7 @@ func (v ArrayValue) GetTypeDescription() []string {
) )
} }
func (v ArrayValue) CheckIsValid(value string) []*InvalidValue { func (v ArrayValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
errors := []*InvalidValue{} errors := []*InvalidValue{}
values := strings.Split(value, v.Separator) values := strings.Split(value, v.Separator)
@ -100,7 +100,7 @@ func (v ArrayValue) CheckIsValid(value string) []*InvalidValue {
currentIndex := uint32(0) currentIndex := uint32(0)
for _, subValue := range values { for _, subValue := range values {
newErrors := v.SubValue.CheckIsValid(subValue) newErrors := v.SubValue.DeprecatedCheckIsValid(subValue)
if len(newErrors) > 0 { if len(newErrors) > 0 {
ShiftInvalidValues(currentIndex, newErrors) ShiftInvalidValues(currentIndex, newErrors)
@ -173,15 +173,15 @@ func (v ArrayValue) getCurrentValue(line string, cursor uint32) (string, uint32)
return line[start : end+1], cursor - start return line[start : end+1], cursor - start
} }
func (v ArrayValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v ArrayValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
value, cursor := v.getCurrentValue(line, cursor) value, cursor := v.getCurrentValue(line, cursor)
println("after array", value, cursor) println("after array", value, cursor)
return v.SubValue.FetchCompletions(value, cursor) return v.SubValue.DeprecatedFetchCompletions(value, cursor)
} }
func (v ArrayValue) FetchHoverInfo(line string, cursor uint32) []string { func (v ArrayValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
value, cursor := v.getCurrentValue(line, cursor) value, cursor := v.getCurrentValue(line, cursor)
return v.SubValue.FetchHoverInfo(value, cursor) return v.SubValue.DeprecatedFetchHoverInfo(value, cursor)
} }

View File

@ -17,21 +17,21 @@ func (EmptyValueContext) GetIsContext() bool {
var EmptyValueContextInstance = EmptyValueContext{} var EmptyValueContextInstance = EmptyValueContext{}
type CustomValue struct { type CustomValue struct {
FetchValue func(context CustomValueContext) Value FetchValue func(context CustomValueContext) DeprecatedValue
} }
func (v CustomValue) GetTypeDescription() []string { func (v CustomValue) GetTypeDescription() []string {
return v.FetchValue(EmptyValueContextInstance).GetTypeDescription() return v.FetchValue(EmptyValueContextInstance).GetTypeDescription()
} }
func (v CustomValue) CheckIsValid(value string) []*InvalidValue { func (v CustomValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
return v.FetchValue(EmptyValueContextInstance).CheckIsValid(value) return v.FetchValue(EmptyValueContextInstance).DeprecatedCheckIsValid(value)
} }
func (v CustomValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v CustomValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return v.FetchValue(EmptyValueContextInstance).FetchCompletions(line, cursor) return v.FetchValue(EmptyValueContextInstance).DeprecatedFetchCompletions(line, cursor)
} }
func (v CustomValue) FetchHoverInfo(line string, cursor uint32) []string { func (v CustomValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return v.FetchValue(EmptyValueContextInstance).FetchHoverInfo(line, cursor) return v.FetchValue(EmptyValueContextInstance).DeprecatedFetchHoverInfo(line, cursor)
} }

View File

@ -22,7 +22,7 @@ func (v DataAmountValue) GetTypeDescription() []string {
return []string{"Data amount"} return []string{"Data amount"}
} }
func (v DataAmountValue) CheckIsValid(value string) []*InvalidValue { func (v DataAmountValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if !dataAmountCheckPattern.MatchString(value) { if !dataAmountCheckPattern.MatchString(value) {
return []*InvalidValue{ return []*InvalidValue{
{ {
@ -55,7 +55,7 @@ func calculateLineToKilobyte(value string, unit string) string {
} }
} }
func (v DataAmountValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v DataAmountValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
completions := make([]protocol.CompletionItem, 0) completions := make([]protocol.CompletionItem, 0)
if line != "" && !dataAmountCheckPattern.MatchString(line) { if line != "" && !dataAmountCheckPattern.MatchString(line) {
@ -91,6 +91,6 @@ func (v DataAmountValue) FetchCompletions(line string, cursor uint32) []protocol
return completions return completions
} }
func (v DataAmountValue) FetchHoverInfo(line string, cursor uint32) []string { func (v DataAmountValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{} return []string{}
} }

View File

@ -8,21 +8,21 @@ import (
type DocumentationValue struct { type DocumentationValue struct {
Documentation string Documentation string
Value Value Value DeprecatedValue
} }
func (v DocumentationValue) GetTypeDescription() []string { func (v DocumentationValue) GetTypeDescription() []string {
return v.Value.GetTypeDescription() return v.Value.GetTypeDescription()
} }
func (v DocumentationValue) CheckIsValid(value string) []*InvalidValue { func (v DocumentationValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
return v.Value.CheckIsValid(value) return v.Value.DeprecatedCheckIsValid(value)
} }
func (v DocumentationValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v DocumentationValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return v.Value.FetchCompletions(line, cursor) return v.Value.DeprecatedFetchCompletions(line, cursor)
} }
func (v DocumentationValue) FetchHoverInfo(line string, cursor uint32) []string { func (v DocumentationValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return strings.Split(v.Documentation, "\n") return strings.Split(v.Documentation, "\n")
} }

View File

@ -78,7 +78,7 @@ func (v EnumValue) GetTypeDescription() []string {
return lines return lines
} }
func (v EnumValue) CheckIsValid(value string) []*InvalidValue { func (v EnumValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if !v.EnforceValues { if !v.EnforceValues {
return nil return nil
} }
@ -101,7 +101,7 @@ func (v EnumValue) CheckIsValid(value string) []*InvalidValue {
}, },
} }
} }
func (v EnumValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v EnumValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
completions := make([]protocol.CompletionItem, len(v.Values)) completions := make([]protocol.CompletionItem, len(v.Values))
for index, value := range v.Values { for index, value := range v.Values {
@ -118,7 +118,7 @@ func (v EnumValue) FetchCompletions(line string, cursor uint32) []protocol.Compl
return completions return completions
} }
func (v EnumValue) FetchHoverInfo(line string, cursor uint32) []string { func (v EnumValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
for _, value := range v.Values { for _, value := range v.Values {
if value.InsertText == line { if value.InsertText == line {
return []string{ return []string{

View File

@ -35,7 +35,7 @@ func (v GIDValue) GetTypeDescription() []string {
return []string{"Group ID"} return []string{"Group ID"}
} }
func (v GIDValue) CheckIsValid(value string) []*InvalidValue { func (v GIDValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
uid, err := strconv.Atoi(value) uid, err := strconv.Atoi(value)
if err != nil { if err != nil {
@ -90,7 +90,7 @@ var defaultGIDsExplanation = []EnumString{
}, },
} }
func (v GIDValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v GIDValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
infos, err := common.FetchGroupInfo() infos, err := common.FetchGroupInfo()
if err != nil { if err != nil {
@ -128,7 +128,7 @@ func (v GIDValue) FetchCompletions(line string, cursor uint32) []protocol.Comple
return completions return completions
} }
func (v GIDValue) FetchHoverInfo(line string, cursor uint32) []string { func (v GIDValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
uid, err := strconv.Atoi(line) uid, err := strconv.Atoi(line)
if err != nil { if err != nil {

View File

@ -66,7 +66,7 @@ func (v IPAddressValue) GetTypeDescription() []string {
return []string{"An IP Address"} return []string{"An IP Address"}
} }
func (v IPAddressValue) CheckIsValid(value string) []*InvalidValue { func (v IPAddressValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
var ip net.Prefix var ip net.Prefix
if v.AllowRange { if v.AllowRange {
@ -151,7 +151,7 @@ func (v IPAddressValue) CheckIsValid(value string) []*InvalidValue {
} }
} }
func (v IPAddressValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v IPAddressValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
if v.AllowedIPs != nil && len(*v.AllowedIPs) != 0 { if v.AllowedIPs != nil && len(*v.AllowedIPs) != 0 {
kind := protocol.CompletionItemKindValue kind := protocol.CompletionItemKindValue
@ -184,7 +184,7 @@ func (v IPAddressValue) FetchCompletions(line string, cursor uint32) []protocol.
return []protocol.CompletionItem{} return []protocol.CompletionItem{}
} }
func (v IPAddressValue) FetchHoverInfo(line string, cursor uint32) []string { func (v IPAddressValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
if v.AllowRange { if v.AllowRange {
ip, err := net.ParsePrefix(line) ip, err := net.ParsePrefix(line)

View File

@ -9,7 +9,7 @@ import (
) )
type KeyEnumAssignmentValue struct { type KeyEnumAssignmentValue struct {
Values map[EnumString]Value Values map[EnumString]DeprecatedValue
Separator string Separator string
ValueIsOptional bool ValueIsOptional bool
} }
@ -21,7 +21,7 @@ func (v KeyEnumAssignmentValue) GetTypeDescription() []string {
if len(valueDescription) == 1 { if len(valueDescription) == 1 {
return []string{ return []string{
fmt.Sprintf("Key-Value pair in form of '<%s>%s<%s>'", firstKey.DescriptionText, v.Separator, valueDescription[0]), fmt.Sprintf("Key-DeprecatedValue pair in form of '<%s>%s<%s>'", firstKey.DescriptionText, v.Separator, valueDescription[0]),
} }
} }
} }
@ -33,11 +33,11 @@ func (v KeyEnumAssignmentValue) GetTypeDescription() []string {
} }
return append([]string{ return append([]string{
"Key-Value pair in form of 'key%svalue'", v.Separator, "Key-DeprecatedValue pair in form of 'key%svalue'", v.Separator,
}, result...) }, result...)
} }
func (v KeyEnumAssignmentValue) getValue(findKey string) (*Value, bool) { func (v KeyEnumAssignmentValue) getValue(findKey string) (*DeprecatedValue, bool) {
for key, value := range v.Values { for key, value := range v.Values {
if key.InsertText == findKey { if key.InsertText == findKey {
switch value.(type) { switch value.(type) {
@ -59,7 +59,7 @@ func (v KeyEnumAssignmentValue) getValue(findKey string) (*Value, bool) {
return nil, false return nil, false
} }
func (v KeyEnumAssignmentValue) CheckIsValid(value string) []*InvalidValue { func (v KeyEnumAssignmentValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
parts := strings.Split(value, v.Separator) parts := strings.Split(value, v.Separator)
if len(parts) == 0 || parts[0] == "" { if len(parts) == 0 || parts[0] == "" {
@ -96,7 +96,7 @@ func (v KeyEnumAssignmentValue) CheckIsValid(value string) []*InvalidValue {
} }
} }
errors := (*checkValue).CheckIsValid(parts[1]) errors := (*checkValue).DeprecatedCheckIsValid(parts[1])
if len(errors) > 0 { if len(errors) > 0 {
ShiftInvalidValues(uint32(len(parts[0])+len(v.Separator)), errors) ShiftInvalidValues(uint32(len(parts[0])+len(v.Separator)), errors)
@ -147,7 +147,7 @@ func (v KeyEnumAssignmentValue) getValueAtCursor(line string, cursor uint32) (st
relativePosition, found := utils.FindPreviousCharacter(line, v.Separator, int(cursor)) relativePosition, found := utils.FindPreviousCharacter(line, v.Separator, int(cursor))
if found { if found {
// Value found // DeprecatedValue found
selected := valueSelected selected := valueSelected
return line[uint32(relativePosition+1):], &selected, cursor - uint32(relativePosition) return line[uint32(relativePosition+1):], &selected, cursor - uint32(relativePosition)
} }
@ -165,7 +165,7 @@ func (v KeyEnumAssignmentValue) getValueAtCursor(line string, cursor uint32) (st
return line, &selected, cursor return line, &selected, cursor
} }
func (v KeyEnumAssignmentValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v KeyEnumAssignmentValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
if cursor == 0 { if cursor == 0 {
return v.FetchEnumCompletions() return v.FetchEnumCompletions()
} }
@ -188,14 +188,14 @@ func (v KeyEnumAssignmentValue) FetchCompletions(line string, cursor uint32) []p
return v.FetchEnumCompletions() return v.FetchEnumCompletions()
} }
return (*keyValue).FetchCompletions(line, cursor) return (*keyValue).DeprecatedFetchCompletions(line, cursor)
} else { } else {
return v.FetchEnumCompletions() return v.FetchEnumCompletions()
} }
} }
func (v KeyEnumAssignmentValue) FetchHoverInfo(line string, cursor uint32) []string { func (v KeyEnumAssignmentValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
if len(v.CheckIsValid(line)) != 0 { if len(v.DeprecatedCheckIsValid(line)) != 0 {
return []string{} return []string{}
} }
@ -228,7 +228,7 @@ func (v KeyEnumAssignmentValue) FetchHoverInfo(line string, cursor uint32) []str
return []string{} return []string{}
} }
info := (*checkValue).FetchHoverInfo(value, cursor) info := (*checkValue).DeprecatedFetchHoverInfo(value, cursor)
return append( return append(
[]string{ []string{

View File

@ -23,9 +23,9 @@ func (KeyValueAssignmentContext) GetIsContext() bool {
} }
type KeyValueAssignmentValue struct { type KeyValueAssignmentValue struct {
Key Value Key DeprecatedValue
// If this is a `CustomValue`, it will receive a `KeyValueAssignmentContext` // If this is a `CustomValue`, it will receive a `KeyValueAssignmentContext`
Value Value Value DeprecatedValue
ValueIsOptional bool ValueIsOptional bool
Separator string Separator string
} }
@ -36,18 +36,18 @@ func (v KeyValueAssignmentValue) GetTypeDescription() []string {
if len(keyDescription) == 1 && len(valueDescription) == 1 { if len(keyDescription) == 1 && len(valueDescription) == 1 {
return []string{ return []string{
fmt.Sprintf("Key-Value pair in form of '<%s>%s<%s>'", keyDescription[0], v.Separator, valueDescription[0]), fmt.Sprintf("Key-DeprecatedValue pair in form of '<%s>%s<%s>'", keyDescription[0], v.Separator, valueDescription[0]),
} }
} else { } else {
return []string{ return []string{
fmt.Sprintf("Key-Value pair in form of 'key%svalue'", v.Separator), fmt.Sprintf("Key-DeprecatedValue pair in form of 'key%svalue'", v.Separator),
fmt.Sprintf("#### Key\n%s", strings.Join(v.Key.GetTypeDescription(), "\n")), fmt.Sprintf("#### Key\n%s", strings.Join(v.Key.GetTypeDescription(), "\n")),
fmt.Sprintf("#### Value:\n%s", strings.Join(v.Value.GetTypeDescription(), "\n")), fmt.Sprintf("#### DeprecatedValue:\n%s", strings.Join(v.Value.GetTypeDescription(), "\n")),
} }
} }
} }
func (v KeyValueAssignmentValue) getValue(selectedKey string) Value { func (v KeyValueAssignmentValue) getValue(selectedKey string) DeprecatedValue {
switch v.Value.(type) { switch v.Value.(type) {
case CustomValue: case CustomValue:
{ {
@ -65,7 +65,7 @@ func (v KeyValueAssignmentValue) getValue(selectedKey string) Value {
} }
} }
func (v KeyValueAssignmentValue) CheckIsValid(value string) []*InvalidValue { func (v KeyValueAssignmentValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
parts := strings.Split(value, v.Separator) parts := strings.Split(value, v.Separator)
if len(parts) == 0 || parts[0] == "" { if len(parts) == 0 || parts[0] == "" {
@ -73,7 +73,7 @@ func (v KeyValueAssignmentValue) CheckIsValid(value string) []*InvalidValue {
return nil return nil
} }
err := v.Key.CheckIsValid(parts[0]) err := v.Key.DeprecatedCheckIsValid(parts[0])
if err != nil { if err != nil {
return err return err
@ -93,7 +93,7 @@ func (v KeyValueAssignmentValue) CheckIsValid(value string) []*InvalidValue {
} }
} }
errors := v.getValue(parts[0]).CheckIsValid(parts[1]) errors := v.getValue(parts[0]).DeprecatedCheckIsValid(parts[1])
if len(errors) > 0 { if len(errors) > 0 {
ShiftInvalidValues(uint32(len(parts[0])+len(v.Separator)), errors) ShiftInvalidValues(uint32(len(parts[0])+len(v.Separator)), errors)
@ -103,9 +103,9 @@ func (v KeyValueAssignmentValue) CheckIsValid(value string) []*InvalidValue {
return nil return nil
} }
func (v KeyValueAssignmentValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v KeyValueAssignmentValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
if cursor == 0 || line == "" { if cursor == 0 || line == "" {
return v.Key.FetchCompletions(line, cursor) return v.Key.DeprecatedFetchCompletions(line, cursor)
} }
relativePosition, found := utils.FindPreviousCharacter( relativePosition, found := utils.FindPreviousCharacter(
@ -119,9 +119,9 @@ func (v KeyValueAssignmentValue) FetchCompletions(line string, cursor uint32) []
line = line[uint32(relativePosition+len(v.Separator)):] line = line[uint32(relativePosition+len(v.Separator)):]
cursor -= uint32(relativePosition) cursor -= uint32(relativePosition)
return v.getValue(selectedKey).FetchCompletions(line, cursor) return v.getValue(selectedKey).DeprecatedFetchCompletions(line, cursor)
} else { } else {
return v.Key.FetchCompletions(line, cursor) return v.Key.DeprecatedFetchCompletions(line, cursor)
} }
} }
@ -129,7 +129,7 @@ func (v KeyValueAssignmentValue) getValueAtCursor(line string, cursor uint32) (s
relativePosition, found := utils.FindPreviousCharacter(line, v.Separator, int(cursor)) relativePosition, found := utils.FindPreviousCharacter(line, v.Separator, int(cursor))
if found { if found {
// Value found // DeprecatedValue found
selected := valueSelected selected := valueSelected
return line[:uint32(relativePosition)], &selected, cursor - uint32(relativePosition) return line[:uint32(relativePosition)], &selected, cursor - uint32(relativePosition)
} }
@ -147,8 +147,8 @@ func (v KeyValueAssignmentValue) getValueAtCursor(line string, cursor uint32) (s
return line, &selected, cursor return line, &selected, cursor
} }
func (v KeyValueAssignmentValue) FetchHoverInfo(line string, cursor uint32) []string { func (v KeyValueAssignmentValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
if len(v.CheckIsValid(line)) != 0 { if len(v.DeprecatedCheckIsValid(line)) != 0 {
return []string{} return []string{}
} }
@ -160,12 +160,12 @@ func (v KeyValueAssignmentValue) FetchHoverInfo(line string, cursor uint32) []st
if *selected == keySelected { if *selected == keySelected {
// Get key documentation // Get key documentation
return v.Key.FetchHoverInfo(value, cursor) return v.Key.DeprecatedFetchHoverInfo(value, cursor)
} else if *selected == valueSelected { } else if *selected == valueSelected {
// Get for value documentation // Get for value documentation
key := strings.SplitN(line, v.Separator, 2)[0] key := strings.SplitN(line, v.Separator, 2)[0]
return v.getValue(key).FetchHoverInfo(value, cursor) return v.getValue(key).DeprecatedFetchHoverInfo(value, cursor)
} }
return []string{} return []string{}

View File

@ -29,7 +29,7 @@ func (v MaskModeValue) GetTypeDescription() []string {
var maskModePattern = regexp.MustCompile("^[0-7]{4}$") var maskModePattern = regexp.MustCompile("^[0-7]{4}$")
func (v MaskModeValue) CheckIsValid(value string) []*InvalidValue { func (v MaskModeValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if !maskModePattern.MatchString(value) { if !maskModePattern.MatchString(value) {
return []*InvalidValue{{ return []*InvalidValue{{
Err: MaskModeInvalidError{}, Err: MaskModeInvalidError{},
@ -41,7 +41,7 @@ func (v MaskModeValue) CheckIsValid(value string) []*InvalidValue {
return []*InvalidValue{} return []*InvalidValue{}
} }
func (v MaskModeValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v MaskModeValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
kind := protocol.CompletionItemKindValue kind := protocol.CompletionItemKindValue
perm0644 := "0644" perm0644 := "0644"
@ -147,7 +147,7 @@ func getMaskRepresentation(digit uint8) string {
return "" return ""
} }
func (v MaskModeValue) FetchHoverInfo(line string, cursor uint32) []string { func (v MaskModeValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
if !maskModePattern.MatchString(line) { if !maskModePattern.MatchString(line) {
return []string{} return []string{}
} }

View File

@ -48,7 +48,7 @@ func (v NumberValue) GetTypeDescription() []string {
return []string{"A number"} return []string{"A number"}
} }
func (v NumberValue) CheckIsValid(value string) []*InvalidValue { func (v NumberValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
number, err := strconv.Atoi(value) number, err := strconv.Atoi(value)
if err != nil { if err != nil {
@ -73,10 +73,10 @@ func (v NumberValue) CheckIsValid(value string) []*InvalidValue {
return nil return nil
} }
func (v NumberValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v NumberValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return []protocol.CompletionItem{} return []protocol.CompletionItem{}
} }
func (v NumberValue) FetchHoverInfo(line string, cursor uint32) []string { func (v NumberValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{} return []string{}
} }

View File

@ -8,14 +8,14 @@ import (
) )
type OrValue struct { type OrValue struct {
Values []Value Values []DeprecatedValue
} }
func (v OrValue) GetTypeDescription() []string { func (v OrValue) GetTypeDescription() []string {
lines := make([]string, 0) lines := make([]string, 0)
for _, subValueRaw := range v.Values { for _, subValueRaw := range v.Values {
subValue := subValueRaw.(Value) subValue := subValueRaw.(DeprecatedValue)
subLines := subValue.GetTypeDescription() subLines := subValue.GetTypeDescription()
for index, line := range subLines { for index, line := range subLines {
@ -34,11 +34,11 @@ func (v OrValue) GetTypeDescription() []string {
lines..., lines...,
) )
} }
func (v OrValue) CheckIsValid(value string) []*InvalidValue { func (v OrValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
errors := make([]*InvalidValue, 0) errors := make([]*InvalidValue, 0)
for _, subValue := range v.Values { for _, subValue := range v.Values {
valueErrors := subValue.CheckIsValid(value) valueErrors := subValue.DeprecatedCheckIsValid(value)
if len(valueErrors) == 0 { if len(valueErrors) == 0 {
return nil return nil
@ -49,7 +49,7 @@ func (v OrValue) CheckIsValid(value string) []*InvalidValue {
return errors return errors
} }
func (v OrValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v OrValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
// Check for special cases // Check for special cases
if len(v.Values) == 2 { if len(v.Values) == 2 {
switch v.Values[0].(type) { switch v.Values[0].(type) {
@ -67,7 +67,7 @@ func (v OrValue) FetchCompletions(line string, cursor uint32) []protocol.Complet
) )
if found { if found {
return keyEnumValue.FetchCompletions(line, cursor) return keyEnumValue.DeprecatedFetchCompletions(line, cursor)
} }
} }
} }
@ -76,19 +76,19 @@ func (v OrValue) FetchCompletions(line string, cursor uint32) []protocol.Complet
completions := make([]protocol.CompletionItem, 0) completions := make([]protocol.CompletionItem, 0)
for _, subValue := range v.Values { for _, subValue := range v.Values {
completions = append(completions, subValue.FetchCompletions(line, cursor)...) completions = append(completions, subValue.DeprecatedFetchCompletions(line, cursor)...)
} }
return completions return completions
} }
func (v OrValue) FetchHoverInfo(line string, cursor uint32) []string { func (v OrValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
for _, subValue := range v.Values { for _, subValue := range v.Values {
valueErrors := subValue.CheckIsValid(line) valueErrors := subValue.DeprecatedCheckIsValid(line)
if len(valueErrors) == 0 { if len(valueErrors) == 0 {
// Found // Found
return subValue.FetchHoverInfo(line, cursor) return subValue.DeprecatedFetchHoverInfo(line, cursor)
} }
} }

View File

@ -46,7 +46,7 @@ func (v PathValue) GetTypeDescription() []string {
return []string{strings.Join(hints, ", ")} return []string{strings.Join(hints, ", ")}
} }
func (v PathValue) CheckIsValid(value string) []*InvalidValue { func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if !utils.DoesPathExist(value) { if !utils.DoesPathExist(value) {
return []*InvalidValue{{ return []*InvalidValue{{
Err: PathDoesNotExistError{}, Err: PathDoesNotExistError{},
@ -78,10 +78,10 @@ func (v PathValue) CheckIsValid(value string) []*InvalidValue {
} }
} }
func (v PathValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v PathValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return []protocol.CompletionItem{} return []protocol.CompletionItem{}
} }
func (v PathValue) FetchHoverInfo(line string, cursor uint32) []string { func (v PathValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{} return []string{}
} }

View File

@ -34,7 +34,7 @@ func isPowerOfTwo(number int) bool {
return true return true
} }
func (v PowerOfTwoValue) CheckIsValid(value string) []*InvalidValue { func (v PowerOfTwoValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
number, err := strconv.Atoi(value) number, err := strconv.Atoi(value)
if err != nil { if err != nil {
@ -60,7 +60,7 @@ func (v PowerOfTwoValue) CheckIsValid(value string) []*InvalidValue {
var powers = []int{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536} var powers = []int{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536}
func (v PowerOfTwoValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v PowerOfTwoValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
textFormat := protocol.InsertTextFormatPlainText textFormat := protocol.InsertTextFormatPlainText
kind := protocol.CompletionItemKindValue kind := protocol.CompletionItemKindValue
@ -76,6 +76,6 @@ func (v PowerOfTwoValue) FetchCompletions(line string, cursor uint32) []protocol
) )
} }
func (v PowerOfTwoValue) FetchHoverInfo(line string, cursor uint32) []string { func (v PowerOfTwoValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{} return []string{}
} }

View File

@ -14,7 +14,7 @@ type Prefix struct {
} }
type PrefixWithMeaningValue struct { type PrefixWithMeaningValue struct {
Prefixes []Prefix Prefixes []Prefix
SubValue Value SubValue DeprecatedValue
} }
func (v PrefixWithMeaningValue) GetTypeDescription() []string { func (v PrefixWithMeaningValue) GetTypeDescription() []string {
@ -32,17 +32,17 @@ func (v PrefixWithMeaningValue) GetTypeDescription() []string {
) )
} }
func (v PrefixWithMeaningValue) CheckIsValid(value string) []*InvalidValue { func (v PrefixWithMeaningValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
for _, prefix := range v.Prefixes { for _, prefix := range v.Prefixes {
if strings.HasPrefix(value, prefix.Prefix) { if strings.HasPrefix(value, prefix.Prefix) {
return v.SubValue.CheckIsValid(value[len(prefix.Prefix):]) return v.SubValue.DeprecatedCheckIsValid(value[len(prefix.Prefix):])
} }
} }
return v.SubValue.CheckIsValid(value) return v.SubValue.DeprecatedCheckIsValid(value)
} }
func (v PrefixWithMeaningValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v PrefixWithMeaningValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
textFormat := protocol.InsertTextFormatPlainText textFormat := protocol.InsertTextFormatPlainText
kind := protocol.CompletionItemKindText kind := protocol.CompletionItemKindText
@ -67,19 +67,19 @@ func (v PrefixWithMeaningValue) FetchCompletions(line string, cursor uint32) []p
}) })
} }
return append(prefixCompletions, v.SubValue.FetchCompletions(line, cursor)...) return append(prefixCompletions, v.SubValue.DeprecatedFetchCompletions(line, cursor)...)
} }
func (v PrefixWithMeaningValue) FetchHoverInfo(line string, cursor uint32) []string { func (v PrefixWithMeaningValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
for _, prefix := range v.Prefixes { for _, prefix := range v.Prefixes {
if strings.HasPrefix(line, prefix.Prefix) { if strings.HasPrefix(line, prefix.Prefix) {
return append([]string{ return append([]string{
fmt.Sprintf("Prefix: _%s_ -> %s", prefix.Prefix, prefix.Meaning), fmt.Sprintf("Prefix: _%s_ -> %s", prefix.Prefix, prefix.Meaning),
}, },
v.SubValue.FetchHoverInfo(line[1:], cursor)..., v.SubValue.DeprecatedFetchHoverInfo(line[1:], cursor)...,
) )
} }
} }
return v.SubValue.FetchHoverInfo(line[1:], cursor) return v.SubValue.DeprecatedFetchHoverInfo(line[1:], cursor)
} }

View File

@ -25,7 +25,7 @@ func (v RegexValue) GetTypeDescription() []string {
} }
} }
func (v RegexValue) CheckIsValid(value string) []*InvalidValue { func (v RegexValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if !v.Regex.MatchString(value) { if !v.Regex.MatchString(value) {
return []*InvalidValue{{ return []*InvalidValue{{
Err: RegexInvalidError{Regex: v.Regex.String()}, Err: RegexInvalidError{Regex: v.Regex.String()},
@ -37,11 +37,11 @@ func (v RegexValue) CheckIsValid(value string) []*InvalidValue {
return []*InvalidValue{} return []*InvalidValue{}
} }
func (v RegexValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v RegexValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return []protocol.CompletionItem{} return []protocol.CompletionItem{}
} }
func (v RegexValue) FetchHoverInfo(line string, cursor uint32) []string { func (v RegexValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{ return []string{
fmt.Sprintf("Pattern: `%s`", v.Regex.String()), fmt.Sprintf("Pattern: `%s`", v.Regex.String()),
} }

View File

@ -24,7 +24,7 @@ func (v StringValue) GetTypeDescription() []string {
return []string{"String"} return []string{"String"}
} }
func (v StringValue) CheckIsValid(value string) []*InvalidValue { func (v StringValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if value == "" { if value == "" {
return []*InvalidValue{{ return []*InvalidValue{{
Err: EmptyStringError{}, Err: EmptyStringError{},
@ -45,10 +45,10 @@ func (v StringValue) CheckIsValid(value string) []*InvalidValue {
return nil return nil
} }
func (v StringValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v StringValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return []protocol.CompletionItem{} return []protocol.CompletionItem{}
} }
func (v StringValue) FetchHoverInfo(line string, cursor uint32) []string { func (v StringValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{} return []string{}
} }

View File

@ -15,7 +15,7 @@ type Suffix struct {
type SuffixWithMeaningValue struct { type SuffixWithMeaningValue struct {
Suffixes []Suffix Suffixes []Suffix
SubValue Value SubValue DeprecatedValue
} }
func (v SuffixWithMeaningValue) GetTypeDescription() []string { func (v SuffixWithMeaningValue) GetTypeDescription() []string {
@ -33,17 +33,17 @@ func (v SuffixWithMeaningValue) GetTypeDescription() []string {
) )
} }
func (v SuffixWithMeaningValue) CheckIsValid(value string) []*InvalidValue { func (v SuffixWithMeaningValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
for _, suffix := range v.Suffixes { for _, suffix := range v.Suffixes {
if strings.HasSuffix(value, suffix.Suffix) { if strings.HasSuffix(value, suffix.Suffix) {
return v.SubValue.CheckIsValid(value[:len(value)-len(suffix.Suffix)]) return v.SubValue.DeprecatedCheckIsValid(value[:len(value)-len(suffix.Suffix)])
} }
} }
return v.SubValue.CheckIsValid(value) return v.SubValue.DeprecatedCheckIsValid(value)
} }
func (v SuffixWithMeaningValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v SuffixWithMeaningValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
textFormat := protocol.InsertTextFormatPlainText textFormat := protocol.InsertTextFormatPlainText
kind := protocol.CompletionItemKindText kind := protocol.CompletionItemKindText
@ -56,19 +56,19 @@ func (v SuffixWithMeaningValue) FetchCompletions(line string, cursor uint32) []p
} }
}) })
return append(suffixCompletions, v.SubValue.FetchCompletions(line, cursor)...) return append(suffixCompletions, v.SubValue.DeprecatedFetchCompletions(line, cursor)...)
} }
func (v SuffixWithMeaningValue) FetchHoverInfo(line string, cursor uint32) []string { func (v SuffixWithMeaningValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
for _, suffix := range v.Suffixes { for _, suffix := range v.Suffixes {
if strings.HasSuffix(line, suffix.Suffix) { if strings.HasSuffix(line, suffix.Suffix) {
return append([]string{ return append([]string{
fmt.Sprintf("Suffix: _%s_ -> %s", suffix.Suffix, suffix.Meaning), fmt.Sprintf("Suffix: _%s_ -> %s", suffix.Suffix, suffix.Meaning),
}, },
v.SubValue.FetchHoverInfo(line[:len(line)-len(suffix.Suffix)], cursor)..., v.SubValue.DeprecatedFetchHoverInfo(line[:len(line)-len(suffix.Suffix)], cursor)...,
) )
} }
} }
return v.SubValue.FetchHoverInfo(line, cursor) return v.SubValue.DeprecatedFetchHoverInfo(line, cursor)
} }

View File

@ -25,7 +25,7 @@ func (v TimeFormatValue) GetTypeDescription() []string {
return []string{"Time value"} return []string{"Time value"}
} }
func (v TimeFormatValue) CheckIsValid(value string) []*InvalidValue { func (v TimeFormatValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if !timeFormatCheckPattern.MatchString(value) { if !timeFormatCheckPattern.MatchString(value) {
return []*InvalidValue{ return []*InvalidValue{
{ {
@ -56,7 +56,7 @@ func calculateInSeconds(value int, unit string) int {
} }
} }
func (v TimeFormatValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v TimeFormatValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
completions := make([]protocol.CompletionItem, 0) completions := make([]protocol.CompletionItem, 0)
if line != "" && !timeFormatCompletionsPattern.MatchString(line) { if line != "" && !timeFormatCompletionsPattern.MatchString(line) {
@ -106,6 +106,6 @@ func (v TimeFormatValue) FetchCompletions(line string, cursor uint32) []protocol
return completions return completions
} }
func (v TimeFormatValue) FetchHoverInfo(line string, cursor uint32) []string { func (v TimeFormatValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{} return []string{}
} }

View File

@ -35,7 +35,7 @@ func (v UIDValue) GetTypeDescription() []string {
return []string{"User ID"} return []string{"User ID"}
} }
func (v UIDValue) CheckIsValid(value string) []*InvalidValue { func (v UIDValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
uid, err := strconv.Atoi(value) uid, err := strconv.Atoi(value)
if err != nil { if err != nil {
@ -90,7 +90,7 @@ var defaultUIDsExplanation = []EnumString{
}, },
} }
func (v UIDValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v UIDValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
infos, err := common.FetchPasswdInfo() infos, err := common.FetchPasswdInfo()
if err != nil { if err != nil {
@ -129,7 +129,7 @@ func (v UIDValue) FetchCompletions(line string, cursor uint32) []protocol.Comple
return completions return completions
} }
func (v UIDValue) FetchHoverInfo(line string, cursor uint32) []string { func (v UIDValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
uid, err := strconv.Atoi(line) uid, err := strconv.Atoi(line)
if err != nil { if err != nil {

View File

@ -28,7 +28,7 @@ func (v UmaskValue) GetTypeDescription() []string {
var umaskPattern = regexp.MustCompile("^[0-7]{4}$") var umaskPattern = regexp.MustCompile("^[0-7]{4}$")
func (v UmaskValue) CheckIsValid(value string) []*InvalidValue { func (v UmaskValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
if !umaskPattern.MatchString(value) { if !umaskPattern.MatchString(value) {
return []*InvalidValue{{ return []*InvalidValue{{
Err: UmaskInvalidError{}, Err: UmaskInvalidError{},
@ -40,7 +40,7 @@ func (v UmaskValue) CheckIsValid(value string) []*InvalidValue {
return []*InvalidValue{} return []*InvalidValue{}
} }
func (v UmaskValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem { func (v UmaskValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
kind := protocol.CompletionItemKindValue kind := protocol.CompletionItemKindValue
return []protocol.CompletionItem{ return []protocol.CompletionItem{
@ -111,6 +111,6 @@ func (v UmaskValue) FetchCompletions(line string, cursor uint32) []protocol.Comp
} }
} }
func (v UmaskValue) FetchHoverInfo(line string, cursor uint32) []string { func (v UmaskValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return []string{} return []string{}
} }

View File

@ -71,7 +71,7 @@ type AliasValueInclude struct {
func (a AliasValueInclude) CheckIsValid() []common.LSPError { func (a AliasValueInclude) CheckIsValid() []common.LSPError {
return utils.Map( return utils.Map(
fields.PathField.CheckIsValid(string(a.Path.Path)), fields.PathField.DeprecatedCheckIsValid(string(a.Path.Path)),
func(invalidValue *docvalues.InvalidValue) common.LSPError { func(invalidValue *docvalues.InvalidValue) common.LSPError {
return docvalues.LSPErrorFromInvalidValue(a.Location.Start.Line, *invalidValue) return docvalues.LSPErrorFromInvalidValue(a.Location.Start.Line, *invalidValue)
}, },
@ -88,7 +88,7 @@ type AliasValueEmail struct {
func (a AliasValueEmail) CheckIsValid() []common.LSPError { func (a AliasValueEmail) CheckIsValid() []common.LSPError {
return utils.Map( return utils.Map(
fields.PathField.CheckIsValid(a.Value), fields.PathField.DeprecatedCheckIsValid(a.Value),
func(invalidValue *docvalues.InvalidValue) common.LSPError { func(invalidValue *docvalues.InvalidValue) common.LSPError {
return docvalues.LSPErrorFromInvalidValue(a.Location.Start.Line, *invalidValue) return docvalues.LSPErrorFromInvalidValue(a.Location.Start.Line, *invalidValue)
}, },

View File

@ -6,7 +6,7 @@ import (
) )
var MountPointField = docvalues.OrValue{ var MountPointField = docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
{ {

View File

@ -195,10 +195,10 @@ var defaultOptions = []docvalues.EnumString{
type assignOption struct { type assignOption struct {
Documentation string Documentation string
Handler func(context docvalues.KeyValueAssignmentContext) docvalues.Value Handler func(context docvalues.KeyValueAssignmentContext) docvalues.DeprecatedValue
} }
var defaultAssignOptions = map[docvalues.EnumString]docvalues.Value{ var defaultAssignOptions = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc( docvalues.CreateEnumStringWithDoc(
"context", "context",
"The context= option is useful when mounting filesystems that do not support extended attributes, such as a floppy or hard disk formatted with VFAT, or systems that are not normally running under SELinux, such as an ext3 or ext4 formatted disk from a non-SELinux workstation. You can also use context= on filesystems you do not trust, such as a floppy. It also helps in compatibility with xattr-supporting filesystems on earlier 2.4.<x> kernel versions. Even where xattrs are supported, you can save time not having to label every file by assigning the entire disk one security context. A commonly used option for removable media is context=\"system_u:object_r:removable_t\".", "The context= option is useful when mounting filesystems that do not support extended attributes, such as a floppy or hard disk formatted with VFAT, or systems that are not normally running under SELinux, such as an ext3 or ext4 formatted disk from a non-SELinux workstation. You can also use context= on filesystems you do not trust, such as a floppy. It also helps in compatibility with xattr-supporting filesystems on earlier 2.4.<x> kernel versions. Even where xattrs are supported, you can save time not having to label every file by assigning the entire disk one security context. A commonly used option for removable media is context=\"system_u:object_r:removable_t\".",
@ -219,15 +219,15 @@ var defaultAssignOptions = map[docvalues.EnumString]docvalues.Value{
func createMountOptionField( func createMountOptionField(
options []docvalues.EnumString, options []docvalues.EnumString,
assignOption map[docvalues.EnumString]docvalues.Value, assignOption map[docvalues.EnumString]docvalues.DeprecatedValue,
) docvalues.Value { ) docvalues.DeprecatedValue {
dynamicOptions := docvalues.MergeKeyEnumAssignmentMaps(defaultAssignOptions, assignOption) dynamicOptions := docvalues.MergeKeyEnumAssignmentMaps(defaultAssignOptions, assignOption)
return docvalues.ArrayValue{ return docvalues.ArrayValue{
Separator: ",", Separator: ",",
DuplicatesExtractor: &mountOptionsExtractor, DuplicatesExtractor: &mountOptionsExtractor,
SubValue: docvalues.OrValue{ SubValue: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.KeyEnumAssignmentValue{ docvalues.KeyEnumAssignmentValue{
Values: dynamicOptions, Values: dynamicOptions,
ValueIsOptional: false, ValueIsOptional: false,
@ -242,9 +242,9 @@ func createMountOptionField(
} }
} }
var DefaultMountOptionsField = createMountOptionField([]docvalues.EnumString{}, map[docvalues.EnumString]docvalues.Value{}) var DefaultMountOptionsField = createMountOptionField([]docvalues.EnumString{}, map[docvalues.EnumString]docvalues.DeprecatedValue{})
var MountOptionsMapField = map[string]docvalues.Value{ var MountOptionsMapField = map[string]docvalues.DeprecatedValue{
"adfs": createMountOptionField( "adfs": createMountOptionField(
commondocumentation.AdfsDocumentationEnums, commondocumentation.AdfsDocumentationEnums,
commondocumentation.AdfsDocumentationAssignable, commondocumentation.AdfsDocumentationAssignable,

View File

@ -3,7 +3,7 @@ package fstabdocumentation
import docvalues "config-lsp/doc-values" import docvalues "config-lsp/doc-values"
var PassField = docvalues.OrValue{ var PassField = docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: false, EnforceValues: false,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{

View File

@ -13,14 +13,14 @@ var LabelField = docvalues.RegexValue{
} }
var SpecField = docvalues.OrValue{ var SpecField = docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
// docvalues.PathValue{ // docvalues.PathValue{
// RequiredType: docvalues.PathTypeFile & docvalues.PathTypeExistenceOptional, // RequiredType: docvalues.PathTypeFile & docvalues.PathTypeExistenceOptional,
// }, // },
docvalues.KeyEnumAssignmentValue{ docvalues.KeyEnumAssignmentValue{
Separator: "=", Separator: "=",
ValueIsOptional: false, ValueIsOptional: false,
Values: map[docvalues.EnumString]docvalues.Value{ Values: map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumString("UUID"): UuidField, docvalues.CreateEnumString("UUID"): UuidField,
docvalues.CreateEnumString("PARTUUID"): UuidField, docvalues.CreateEnumString("PARTUUID"): UuidField,
docvalues.CreateEnumString("LABEL"): LabelField, docvalues.CreateEnumString("LABEL"): LabelField,

View File

@ -17,28 +17,28 @@ func GetCompletion(
case parser.FstabFieldSpec: case parser.FstabFieldSpec:
value, cursor := GetFieldSafely(line.Fields.Spec, cursor) value, cursor := GetFieldSafely(line.Fields.Spec, cursor)
return fstabdocumentation.SpecField.FetchCompletions( return fstabdocumentation.SpecField.DeprecatedFetchCompletions(
value, value,
cursor, cursor,
), nil ), nil
case parser.FstabFieldMountPoint: case parser.FstabFieldMountPoint:
value, cursor := GetFieldSafely(line.Fields.MountPoint, cursor) value, cursor := GetFieldSafely(line.Fields.MountPoint, cursor)
return fstabdocumentation.MountPointField.FetchCompletions( return fstabdocumentation.MountPointField.DeprecatedFetchCompletions(
value, value,
cursor, cursor,
), nil ), nil
case parser.FstabFieldFileSystemType: case parser.FstabFieldFileSystemType:
value, cursor := GetFieldSafely(line.Fields.FilesystemType, cursor) value, cursor := GetFieldSafely(line.Fields.FilesystemType, cursor)
return fstabdocumentation.FileSystemTypeField.FetchCompletions( return fstabdocumentation.FileSystemTypeField.DeprecatedFetchCompletions(
value, value,
cursor, cursor,
), nil ), nil
case parser.FstabFieldOptions: case parser.FstabFieldOptions:
fileSystemType := line.Fields.FilesystemType.Value fileSystemType := line.Fields.FilesystemType.Value
var optionsField docvalues.Value var optionsField docvalues.DeprecatedValue
if foundField, found := fstabdocumentation.MountOptionsMapField[fileSystemType]; found { if foundField, found := fstabdocumentation.MountOptionsMapField[fileSystemType]; found {
optionsField = foundField optionsField = foundField
@ -48,7 +48,7 @@ func GetCompletion(
value, cursor := GetFieldSafely(line.Fields.Options, cursor) value, cursor := GetFieldSafely(line.Fields.Options, cursor)
completions := optionsField.FetchCompletions( completions := optionsField.DeprecatedFetchCompletions(
value, value,
cursor, cursor,
) )
@ -57,14 +57,14 @@ func GetCompletion(
case parser.FstabFieldFreq: case parser.FstabFieldFreq:
value, cursor := GetFieldSafely(line.Fields.Freq, cursor) value, cursor := GetFieldSafely(line.Fields.Freq, cursor)
return fstabdocumentation.FreqField.FetchCompletions( return fstabdocumentation.FreqField.DeprecatedFetchCompletions(
value, value,
cursor, cursor,
), nil ), nil
case parser.FstabFieldPass: case parser.FstabFieldPass:
value, cursor := GetFieldSafely(line.Fields.Pass, cursor) value, cursor := GetFieldSafely(line.Fields.Pass, cursor)
return fstabdocumentation.PassField.FetchCompletions( return fstabdocumentation.PassField.DeprecatedFetchCompletions(
value, value,
cursor, cursor,
), nil ), nil

View File

@ -21,7 +21,7 @@ func GetHoverInfo(entry *parser.FstabEntry, cursor uint32) (*protocol.Hover, err
return &FileSystemTypeField, nil return &FileSystemTypeField, nil
case parser.FstabFieldOptions: case parser.FstabFieldOptions:
fileSystemType := line.Fields.FilesystemType.Value fileSystemType := line.Fields.FilesystemType.Value
var optionsField docvalues.Value var optionsField docvalues.DeprecatedValue
if foundField, found := fstabdocumentation.MountOptionsMapField[fileSystemType]; found { if foundField, found := fstabdocumentation.MountOptionsMapField[fileSystemType]; found {
optionsField = foundField optionsField = foundField
@ -30,7 +30,7 @@ func GetHoverInfo(entry *parser.FstabEntry, cursor uint32) (*protocol.Hover, err
} }
relativeCursor := cursor - line.Fields.Options.Start relativeCursor := cursor - line.Fields.Options.Start
fieldInfo := optionsField.FetchHoverInfo(line.Fields.Options.Value, relativeCursor) fieldInfo := optionsField.DeprecatedFetchHoverInfo(line.Fields.Options.Value, relativeCursor)
hover := protocol.Hover{ hover := protocol.Hover{
Contents: protocol.MarkupContent{ Contents: protocol.MarkupContent{

View File

@ -17,7 +17,7 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa
if !found { if !found {
// Empty line, return spec completions // Empty line, return spec completions
return fstabdocumentation.SpecField.FetchCompletions( return fstabdocumentation.SpecField.DeprecatedFetchCompletions(
"", "",
params.Position.Character, params.Position.Character,
), nil ), nil

View File

@ -88,7 +88,7 @@ func (e *FstabLine) CheckIsValid() []protocol.Diagnostic {
diagnostics := make([]protocol.Diagnostic, 0) diagnostics := make([]protocol.Diagnostic, 0)
if e.Fields.Spec != nil { if e.Fields.Spec != nil {
errors := fstabdocumentation.SpecField.CheckIsValid(e.Fields.Spec.Value) errors := fstabdocumentation.SpecField.DeprecatedCheckIsValid(e.Fields.Spec.Value)
if len(errors) > 0 { if len(errors) > 0 {
diagnostics = append( diagnostics = append(
@ -99,7 +99,7 @@ func (e *FstabLine) CheckIsValid() []protocol.Diagnostic {
} }
if e.Fields.MountPoint != nil { if e.Fields.MountPoint != nil {
errors := fstabdocumentation.MountPointField.CheckIsValid(e.Fields.MountPoint.Value) errors := fstabdocumentation.MountPointField.DeprecatedCheckIsValid(e.Fields.MountPoint.Value)
if len(errors) > 0 { if len(errors) > 0 {
diagnostics = append( diagnostics = append(
@ -112,7 +112,7 @@ func (e *FstabLine) CheckIsValid() []protocol.Diagnostic {
var fileSystemType string = "" var fileSystemType string = ""
if e.Fields.FilesystemType != nil { if e.Fields.FilesystemType != nil {
errors := fstabdocumentation.FileSystemTypeField.CheckIsValid(e.Fields.FilesystemType.Value) errors := fstabdocumentation.FileSystemTypeField.DeprecatedCheckIsValid(e.Fields.FilesystemType.Value)
if len(errors) > 0 { if len(errors) > 0 {
diagnostics = append( diagnostics = append(
@ -125,7 +125,7 @@ func (e *FstabLine) CheckIsValid() []protocol.Diagnostic {
} }
if e.Fields.Options != nil && fileSystemType != "" { if e.Fields.Options != nil && fileSystemType != "" {
var optionsField docvalues.Value var optionsField docvalues.DeprecatedValue
if foundField, found := fstabdocumentation.MountOptionsMapField[fileSystemType]; found { if foundField, found := fstabdocumentation.MountOptionsMapField[fileSystemType]; found {
optionsField = foundField optionsField = foundField
@ -133,7 +133,7 @@ func (e *FstabLine) CheckIsValid() []protocol.Diagnostic {
optionsField = fstabdocumentation.DefaultMountOptionsField optionsField = fstabdocumentation.DefaultMountOptionsField
} }
errors := optionsField.CheckIsValid(e.Fields.Options.Value) errors := optionsField.DeprecatedCheckIsValid(e.Fields.Options.Value)
if len(errors) > 0 { if len(errors) > 0 {
diagnostics = append( diagnostics = append(
@ -144,7 +144,7 @@ func (e *FstabLine) CheckIsValid() []protocol.Diagnostic {
} }
if e.Fields.Freq != nil { if e.Fields.Freq != nil {
errors := fstabdocumentation.FreqField.CheckIsValid(e.Fields.Freq.Value) errors := fstabdocumentation.FreqField.DeprecatedCheckIsValid(e.Fields.Freq.Value)
if len(errors) > 0 { if len(errors) > 0 {
diagnostics = append( diagnostics = append(
@ -155,7 +155,7 @@ func (e *FstabLine) CheckIsValid() []protocol.Diagnostic {
} }
if e.Fields.Pass != nil { if e.Fields.Pass != nil {
errors := fstabdocumentation.PassField.CheckIsValid(e.Fields.Pass.Value) errors := fstabdocumentation.PassField.DeprecatedCheckIsValid(e.Fields.Pass.Value)
if len(errors) > 0 { if len(errors) > 0 {
diagnostics = append( diagnostics = append(

View File

@ -53,7 +53,7 @@ func analyzeEntriesAreValid(
err = append( err = append(
err, err,
utils.Map( utils.Map(
fields.IPAddressField.CheckIsValid(entry.IPAddress.Value.String()), fields.IPAddressField.DeprecatedCheckIsValid(entry.IPAddress.Value.String()),
func(val *docvalues.InvalidValue) common.LSPError { func(val *docvalues.InvalidValue) common.LSPError {
return common.LSPError{ return common.LSPError{
Range: entry.IPAddress.Location, Range: entry.IPAddress.Location,
@ -66,7 +66,7 @@ func analyzeEntriesAreValid(
err = append( err = append(
err, err,
utils.Map( utils.Map(
fields.HostnameField.CheckIsValid(entry.Hostname.Value), fields.HostnameField.DeprecatedCheckIsValid(entry.Hostname.Value),
func(val *docvalues.InvalidValue) common.LSPError { func(val *docvalues.InvalidValue) common.LSPError {
return common.LSPError{ return common.LSPError{
Range: entry.Hostname.Location, Range: entry.Hostname.Location,
@ -80,7 +80,7 @@ func analyzeEntriesAreValid(
err = append( err = append(
err, err,
utils.Map( utils.Map(
fields.HostnameField.CheckIsValid(alias.Value), fields.HostnameField.DeprecatedCheckIsValid(alias.Value),
func(val *docvalues.InvalidValue) common.LSPError { func(val *docvalues.InvalidValue) common.LSPError {
return common.LSPError{ return common.LSPError{
Range: alias.Location, Range: alias.Location,

View File

@ -42,7 +42,7 @@ func TextDocumentHover(
case handlers.HoverTargetIPAddress: case handlers.HoverTargetIPAddress:
line := entry.IPAddress.Value.String() line := entry.IPAddress.Value.String()
relativeCursor := uint32(entry.IPAddress.Location.Start.GetRelativeIndexPosition(index)) relativeCursor := uint32(entry.IPAddress.Location.Start.GetRelativeIndexPosition(index))
hover := fields.IPAddressField.FetchHoverInfo(line, relativeCursor) hover := fields.IPAddressField.DeprecatedFetchHoverInfo(line, relativeCursor)
return &protocol.Hover{ return &protocol.Hover{
Contents: hover, Contents: hover,

View File

@ -82,7 +82,7 @@ func checkOption(
errs = append( errs = append(
errs, errs,
utils.Map( utils.Map(
docOption.CheckIsValid(option.OptionValue.Value.Value), docOption.DeprecatedCheckIsValid(option.OptionValue.Value.Value),
func(invalidValue *docvalues.InvalidValue) common.LSPError { func(invalidValue *docvalues.InvalidValue) common.LSPError {
err := docvalues.LSPErrorFromInvalidValue(option.Start.Line, *invalidValue) err := docvalues.LSPErrorFromInvalidValue(option.Start.Line, *invalidValue)
err.ShiftCharacter(option.OptionValue.Start.Character) err.ShiftCharacter(option.OptionValue.Start.Character)
@ -137,4 +137,3 @@ func checkHostBlock(
return errs return errs
} }

View File

@ -28,7 +28,7 @@ var Options = map[string]docvalues.DocumentationValue{
"AddKeysToAgent": { "AddKeysToAgent": {
Documentation: `Specifies whether keys should be automatically added to a running ssh-agent(1). If this option is set to yes and a key is loaded from a file, the key and its passphrase are added to the agent with the default lifetime, as if by ssh-add(1). If this option is set to ask, ssh(1) will require confirmation using the SSH_ASKPASS program before adding a key (see ssh-add(1) for details). If this option is set to confirm, each use of the key must be confirmed, as if the -c option was specified to ssh-add(1). If this option is set to no, no keys are added to the agent. Alternately, this option may be specified as a time interval using the format described in the TIME FORMATS section of sshd_config(5) to specify the key's lifetime in ssh-agent(1), after which it will automatically be removed. The argument must be no (the default), yes, confirm (optionally followed by a time interval), ask or a time interval.`, Documentation: `Specifies whether keys should be automatically added to a running ssh-agent(1). If this option is set to yes and a key is loaded from a file, the key and its passphrase are added to the agent with the default lifetime, as if by ssh-add(1). If this option is set to ask, ssh(1) will require confirmation using the SSH_ASKPASS program before adding a key (see ssh-add(1) for details). If this option is set to confirm, each use of the key must be confirmed, as if the -c option was specified to ssh-add(1). If this option is set to no, no keys are added to the agent. Alternately, this option may be specified as a time interval using the format described in the TIME FORMATS section of sshd_config(5) to specify the key's lifetime in ssh-agent(1), after which it will automatically be removed. The argument must be no (the default), yes, confirm (optionally followed by a time interval), ask or a time interval.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: true, EnforceValues: true,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
@ -269,7 +269,7 @@ aes128-gcm@openssh.com,aes256-gcm@openssh.com
"ControlPersist": { "ControlPersist": {
Documentation: `When used in conjunction with ControlMaster, specifies that the master connection should remain open in the background (waiting for future client connections) after the initial client connection has been closed. If set to no (the default), then the master connection will not be placed into the background, and will close as soon as the initial client connection is closed. If set to yes or 0, then the master connection will remain in the background indefinitely (until killed or closed via a mechanism such as the 'ssh -O exit'). If set to a time in seconds, or a time in any of the formats documented in sshd_config(5), then the backgrounded master connection will automatically terminate after it has remained idle (with no client connections) for the specified time.`, Documentation: `When used in conjunction with ControlMaster, specifies that the master connection should remain open in the background (waiting for future client connections) after the initial client connection has been closed. If set to no (the default), then the master connection will not be placed into the background, and will close as soon as the initial client connection is closed. If set to yes or 0, then the master connection will remain in the background indefinitely (until killed or closed via a mechanism such as the 'ssh -O exit'). If set to a time in seconds, or a time in any of the formats documented in sshd_config(5), then the backgrounded master connection will automatically terminate after it has remained idle (with no client connections) for the specified time.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
booleanEnumValue, booleanEnumValue,
docvalues.TimeFormatValue{}, docvalues.TimeFormatValue{},
docvalues.PositiveNumberValue(), docvalues.PositiveNumberValue(),
@ -281,7 +281,7 @@ aes128-gcm@openssh.com,aes256-gcm@openssh.com
[bind_address:]port. IPv6 addresses can be specified by enclosing addresses in square brackets. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of localhost indicates that the listening port be bound for local use only, while an empty address or * indicates that the port should be available from all interfaces. [bind_address:]port. IPv6 addresses can be specified by enclosing addresses in square brackets. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of localhost indicates that the listening port be bound for local use only, while an empty address or * indicates that the port should be available from all interfaces.
Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh(1) will act as a SOCKS server. Multiple forwardings may be specified, and additional forwardings can be given on the command line. Only the superuser can forward privileged ports.`, Currently the SOCKS4 and SOCKS5 protocols are supported, and ssh(1) will act as a SOCKS server. Multiple forwardings may be specified, and additional forwardings can be given on the command line. Only the superuser can forward privileged ports.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.NumberValue{Min: &ZERO, Max: &MAX_PORT}, docvalues.NumberValue{Min: &ZERO, Max: &MAX_PORT},
docvalues.KeyValueAssignmentValue{ docvalues.KeyValueAssignmentValue{
Key: docvalues.IPAddressValue{ Key: docvalues.IPAddressValue{
@ -329,7 +329,7 @@ aes128-gcm@openssh.com,aes256-gcm@openssh.com
Documentation: `Specifies whether the connection to the authentication agent (if any) will be forwarded to the remote machine. The argument may be yes, no (the default), an explicit path to an agent socket or the name of an environment variable (beginning with $) in which to find the path. Documentation: `Specifies whether the connection to the authentication agent (if any) will be forwarded to the remote machine. The argument may be yes, no (the default), an explicit path to an agent socket or the name of an environment variable (beginning with $) in which to find the path.
Agent forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the agent's Unix-domain socket) can access the local agent through the forwarded connection. An attacker cannot obtain key material from the agent, however they can perform operations on the keys that enable them to authenticate using the identities loaded into the agent.`, Agent forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the agent's Unix-domain socket) can access the local agent through the forwarded connection. An attacker cannot obtain key material from the agent, however they can perform operations on the keys that enable them to authenticate using the identities loaded into the agent.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
booleanEnumValue, booleanEnumValue,
docvalues.StringValue{}, docvalues.StringValue{},
}, },
@ -397,7 +397,7 @@ rsa-sha2-512,rsa-sha2-256
The -Q option of ssh(1) may be used to list supported signature algorithms. This was formerly named HostbasedKeyTypes.`, The -Q option of ssh(1) may be used to list supported signature algorithms. This was formerly named HostbasedKeyTypes.`,
Value: docvalues.CustomValue{ Value: docvalues.CustomValue{
FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { FetchValue: func(_ docvalues.CustomValueContext) docvalues.DeprecatedValue {
options, err := ssh.QueryOpenSSHOptions("HostbasedAcceptedAlgorithms") options, err := ssh.QueryOpenSSHOptions("HostbasedAcceptedAlgorithms")
if err != nil { if err != nil {
@ -435,7 +435,7 @@ rsa-sha2-512,rsa-sha2-256
If hostkeys are known for the destination host then this default is modified to prefer their algorithms. If hostkeys are known for the destination host then this default is modified to prefer their algorithms.
The list of available signature algorithms may also be obtained using 'ssh -Q HostKeyAlgorithms'.`, The list of available signature algorithms may also be obtained using 'ssh -Q HostKeyAlgorithms'.`,
Value: docvalues.CustomValue{ Value: docvalues.CustomValue{
FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { FetchValue: func(_ docvalues.CustomValueContext) docvalues.DeprecatedValue {
options, _ := ssh.QueryOpenSSHOptions("HostKeyAlgorithms") options, _ := ssh.QueryOpenSSHOptions("HostKeyAlgorithms")
return prefixPlusMinusCaret(options) return prefixPlusMinusCaret(options)
@ -486,7 +486,7 @@ rsa-sha2-512,rsa-sha2-256
"IPQoS": { "IPQoS": {
Documentation: `Specifies the IPv4 type-of-service or DSCP class for connections. Accepted values are af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, ef, le, lowdelay, throughput, reliability, a numeric value, or none to use the operating system default. This option may take one or two arguments, separated by whitespace. If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is af21 (Low-Latency Data) for interactive sessions and cs1 (Lower Effort) for non-interactive sessions.`, Documentation: `Specifies the IPv4 type-of-service or DSCP class for connections. Accepted values are af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, ef, le, lowdelay, throughput, reliability, a numeric value, or none to use the operating system default. This option may take one or two arguments, separated by whitespace. If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is af21 (Low-Latency Data) for interactive sessions and cs1 (Lower Effort) for non-interactive sessions.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.NumberValue{}, docvalues.NumberValue{},
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
@ -597,7 +597,7 @@ diffie-hellman-group14-sha256
[bind_address:]port or a Unix domain socket path. The second argument is the destination and may be host:hostport or a Unix domain socket path if the remote host supports it. [bind_address:]port or a Unix domain socket path. The second argument is the destination and may be host:hostport or a Unix domain socket path if the remote host supports it.
IPv6 addresses can be specified by enclosing addresses in square brackets. Multiple forwardings may be specified, and additional forwardings can be given on the command line. Only the superuser can forward privileged ports. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of localhost indicates that the listening port be bound for local use only, while an empty address or * indicates that the port should be available from all interfaces. Unix domain socket paths may use the tokens described in the TOKENS section and environment variables as described in the ENVIRONMENT VARIABLES section.`, IPv6 addresses can be specified by enclosing addresses in square brackets. Multiple forwardings may be specified, and additional forwardings can be given on the command line. Only the superuser can forward privileged ports. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a specific address. The bind_address of localhost indicates that the listening port be bound for local use only, while an empty address or * indicates that the port should be available from all interfaces. Unix domain socket paths may use the tokens described in the TOKENS section and environment variables as described in the ENVIRONMENT VARIABLES section.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.NumberValue{Min: &ZERO, Max: &MAX_PORT}, docvalues.NumberValue{Min: &ZERO, Max: &MAX_PORT},
docvalues.KeyValueAssignmentValue{ docvalues.KeyValueAssignmentValue{
Key: docvalues.IPAddressValue{ Key: docvalues.IPAddressValue{
@ -678,7 +678,7 @@ hmac-sha2-256,hmac-sha2-512,hmac-sha1
"ObscureKeystrokeTiming": { "ObscureKeystrokeTiming": {
Documentation: `Specifies whether ssh(1) should try to obscure inter-keystroke timings from passive observers of network traffic. If enabled, then for interactive sessions, ssh(1) will send keystrokes at fixed intervals of a few tens of milliseconds and will send fake keystroke packets for some time after typing ceases. The argument to this keyword must be yes, no or an interval specifier of the form interval:milliseconds (e.g. interval:80 for 80 milliseconds). The default is to obscure keystrokes using a 20ms packet interval. Note that smaller intervals will result in higher fake keystroke packet rates.`, Documentation: `Specifies whether ssh(1) should try to obscure inter-keystroke timings from passive observers of network traffic. If enabled, then for interactive sessions, ssh(1) will send keystrokes at fixed intervals of a few tens of milliseconds and will send fake keystroke packets for some time after typing ceases. The argument to this keyword must be yes, no or an interval specifier of the form interval:milliseconds (e.g. interval:80 for 80 milliseconds). The default is to obscure keystrokes using a 20ms packet interval. Note that smaller intervals will result in higher fake keystroke packet rates.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
booleanEnumValue, booleanEnumValue,
docvalues.RegexValue{ docvalues.RegexValue{
Regex: *regexp.MustCompile(`^interval:[0-9]+$`), Regex: *regexp.MustCompile(`^interval:[0-9]+$`),
@ -768,7 +768,7 @@ rsa-sha2-512,rsa-sha2-256
The list of available signature algorithms may also be obtained using 'ssh -Q PubkeyAcceptedAlgorithms'.`, The list of available signature algorithms may also be obtained using 'ssh -Q PubkeyAcceptedAlgorithms'.`,
Value: docvalues.CustomValue{ Value: docvalues.CustomValue{
FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { FetchValue: func(_ docvalues.CustomValueContext) docvalues.DeprecatedValue {
options, _ := ssh.QueryOpenSSHOptions("PubkeyAcceptedAlgorithms") options, _ := ssh.QueryOpenSSHOptions("PubkeyAcceptedAlgorithms")
return prefixPlusMinusCaret(options) return prefixPlusMinusCaret(options)

View File

@ -0,0 +1,3 @@
package fields

View File

@ -81,13 +81,13 @@ func GetOptionCompletions(
} }
if entry.OptionValue == nil { if entry.OptionValue == nil {
return option.FetchCompletions("", 0), nil return option.DeprecatedFetchCompletions("", 0), nil
} }
// Hello wo|rld // Hello wo|rld
line := entry.OptionValue.Value.Raw line := entry.OptionValue.Value.Raw
// NEW: docvalues index // NEW: docvalues index
return option.FetchCompletions( return option.DeprecatedFetchCompletions(
line, line,
common.DeprecatedImprovedCursorToIndex( common.DeprecatedImprovedCursorToIndex(
cursor, cursor,

View File

@ -127,7 +127,7 @@ func analyzeMatchValueIsValid(
} }
docOption := fields.MatchValueFieldMap[criteria] docOption := fields.MatchValueFieldMap[criteria]
invalidValues := docOption.CheckIsValid(value.Value.Raw) invalidValues := docOption.DeprecatedCheckIsValid(value.Value.Raw)
errs = append( errs = append(
errs, errs,
@ -144,4 +144,3 @@ func analyzeMatchValueIsValid(
return errs return errs
} }

View File

@ -75,7 +75,7 @@ func checkOption(
errs = append(errs, checkIsUsingDoubleQuotes(option.OptionValue.Value, option.OptionValue.LocationRange)...) errs = append(errs, checkIsUsingDoubleQuotes(option.OptionValue.Value, option.OptionValue.LocationRange)...)
errs = append(errs, checkQuotesAreClosed(option.OptionValue.Value, option.OptionValue.LocationRange)...) errs = append(errs, checkQuotesAreClosed(option.OptionValue.Value, option.OptionValue.LocationRange)...)
invalidValues := docOption.CheckIsValid(option.OptionValue.Value.Value) invalidValues := docOption.DeprecatedCheckIsValid(option.OptionValue.Value.Value)
errs = append( errs = append(
errs, errs,

View File

@ -75,7 +75,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may
Note that each authentication method listed should also be explicitly enabled in the configuration. Note that each authentication method listed should also be explicitly enabled in the configuration.
The available authentication methods are: "gssapi-with-mic", "hostbased", "keyboard-interactive", "none" (used for access to password-less accounts when PermitEmptyPasswords is enabled), "password" and "publickey".`, The available authentication methods are: "gssapi-with-mic", "hostbased", "keyboard-interactive", "none" (used for access to password-less accounts when PermitEmptyPasswords is enabled), "password" and "publickey".`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: true, EnforceValues: true,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
@ -315,7 +315,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may
ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256 ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256
The list of available signature algorithms may also be obtained using "ssh -Q HostbasedAcceptedAlgorithms". This was formerly named HostbasedAcceptedKeyTypes.`, The list of available signature algorithms may also be obtained using "ssh -Q HostbasedAcceptedAlgorithms". This was formerly named HostbasedAcceptedKeyTypes.`,
Value: docvalues.CustomValue{ Value: docvalues.CustomValue{
FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { FetchValue: func(_ docvalues.CustomValueContext) docvalues.DeprecatedValue {
options, err := ssh.QueryOpenSSHOptions("HostbasedAcceptedAlgorithms") options, err := ssh.QueryOpenSSHOptions("HostbasedAcceptedAlgorithms")
if err != nil { if err != nil {
@ -348,7 +348,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may
"HostKeyAgent": { "HostKeyAgent": {
Documentation: `Identifies the UNIX-domain socket used to communicate with an agent that has access to the private host keys. If the string "SSH_AUTH_SOCK" is specified, the location of the socket will be read from the SSH_AUTH_SOCK environment variable.`, Documentation: `Identifies the UNIX-domain socket used to communicate with an agent that has access to the private host keys. If the string "SSH_AUTH_SOCK" is specified, the location of the socket will be read from the SSH_AUTH_SOCK environment variable.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: true, EnforceValues: true,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
@ -364,7 +364,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may
ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256 ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256
The list of available signature algorithms may also be obtained using "ssh -Q HostKeyAlgorithms".`, The list of available signature algorithms may also be obtained using "ssh -Q HostKeyAlgorithms".`,
Value: docvalues.CustomValue{ Value: docvalues.CustomValue{
FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { FetchValue: func(_ docvalues.CustomValueContext) docvalues.DeprecatedValue {
options, _ := ssh.QueryOpenSSHOptions("HostKeyAlgorithms") options, _ := ssh.QueryOpenSSHOptions("HostKeyAlgorithms")
return prefixPlusMinusCaret(options) return prefixPlusMinusCaret(options)
@ -400,7 +400,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may
"IPQoS": { "IPQoS": {
Documentation: `Specifies the IPv4 type-of-service or DSCP class for the connection. Accepted values are af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, ef, le, lowdelay, throughput, reliability, a numeric value, or none to use the operating system default. This option may take one or two arguments, separated by whitespace. If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is af21 (Low-Latency Data) for interactive sessions and cs1 (Lower Effort) for non-interactive sessions.`, Documentation: `Specifies the IPv4 type-of-service or DSCP class for the connection. Accepted values are af11, af12, af13, af21, af22, af23, af31, af32, af33, af41, af42, af43, cs0, cs1, cs2, cs3, cs4, cs5, cs6, cs7, ef, le, lowdelay, throughput, reliability, a numeric value, or none to use the operating system default. This option may take one or two arguments, separated by whitespace. If one argument is specified, it is used as the packet class unconditionally. If two values are specified, the first is automatically selected for interactive sessions and the second for non-interactive sessions. The default is af21 (Low-Latency Data) for interactive sessions and cs1 (Lower Effort) for non-interactive sessions.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.NumberValue{}, docvalues.NumberValue{},
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
@ -613,7 +613,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
}, },
Separator: ":", Separator: ":",
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
{ {
@ -640,7 +640,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
SubValue: docvalues.KeyValueAssignmentValue{ SubValue: docvalues.KeyValueAssignmentValue{
ValueIsOptional: true, ValueIsOptional: true,
Key: docvalues.OrValue{ Key: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
{ {
@ -660,7 +660,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
}, },
Separator: ":", Separator: ":",
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
{ {
@ -712,7 +712,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
"PermitUserEnvironment": { "PermitUserEnvironment": {
Documentation: `Specifies whether ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd(8). Valid options are yes, no or a pattern-list specifying which environment variable names to accept (for example "LANG,LC_*"). The default is no. Enabling environment processing may enable users to bypass access restrictions in some configurations using mechanisms such as LD_PRELOAD.`, Documentation: `Specifies whether ~/.ssh/environment and environment= options in ~/.ssh/authorized_keys are processed by sshd(8). Valid options are yes, no or a pattern-list specifying which environment variable names to accept (for example "LANG,LC_*"). The default is no. Enabling environment processing may enable users to bypass access restrictions in some configurations using mechanisms such as LD_PRELOAD.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
docvalues.CreateEnumString("yes"), docvalues.CreateEnumString("yes"),
@ -734,7 +734,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
"PerSourceMaxStartups": { "PerSourceMaxStartups": {
Documentation: `Specifies the number of unauthenticated connections allowed from a given source address, or “none” if there is no limit. This limit is applied in addition to MaxStartups, whichever is lower. The default is none.`, Documentation: `Specifies the number of unauthenticated connections allowed from a given source address, or “none” if there is no limit. This limit is applied in addition to MaxStartups, whichever is lower. The default is none.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: true, EnforceValues: true,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
@ -780,7 +780,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256 ssh-ed25519-cert-v01@openssh.com, ecdsa-sha2-nistp256-cert-v01@openssh.com, ecdsa-sha2-nistp384-cert-v01@openssh.com, ecdsa-sha2-nistp521-cert-v01@openssh.com, sk-ssh-ed25519-cert-v01@openssh.com, sk-ecdsa-sha2-nistp256-cert-v01@openssh.com, rsa-sha2-512-cert-v01@openssh.com, rsa-sha2-256-cert-v01@openssh.com, ssh-ed25519, ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, sk-ssh-ed25519@openssh.com, sk-ecdsa-sha2-nistp256@openssh.com, rsa-sha2-512,rsa-sha2-256
The list of available signature algorithms may also be obtained using "ssh -Q PubkeyAcceptedAlgorithms".`, The list of available signature algorithms may also be obtained using "ssh -Q PubkeyAcceptedAlgorithms".`,
Value: docvalues.CustomValue{ Value: docvalues.CustomValue{
FetchValue: func(_ docvalues.CustomValueContext) docvalues.Value { FetchValue: func(_ docvalues.CustomValueContext) docvalues.DeprecatedValue {
options, _ := ssh.QueryOpenSSHOptions("PubkeyAcceptedAlgorithms") options, _ := ssh.QueryOpenSSHOptions("PubkeyAcceptedAlgorithms")
return prefixPlusMinusCaret(options) return prefixPlusMinusCaret(options)
@ -828,7 +828,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
"RDomain": { "RDomain": {
Documentation: `Specifies an explicit routing domain that is applied after authentication has completed. The user session, as well as any forwarded or listening IP sockets, will be bound to this rdomain(4). If the routing domain is set to %D, then the domain in which the incoming connection was received will be applied.`, Documentation: `Specifies an explicit routing domain that is applied after authentication has completed. The user session, as well as any forwarded or listening IP sockets, will be bound to this rdomain(4). If the routing domain is set to %D, then the domain in which the incoming connection was received will be applied.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{
{ {
@ -933,7 +933,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av
"VersionAddendum": { "VersionAddendum": {
Documentation: `Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default is none.`, Documentation: `Optionally specifies additional text to append to the SSH protocol banner sent by the server upon connection. The default is none.`,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: true, EnforceValues: true,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{

View File

@ -79,7 +79,7 @@ var MatchAddressField = docvalues.IPAddressValue{
AllowRange: true, AllowRange: true,
} }
var MatchValueFieldMap = map[matchparser.MatchCriteriaType]docvalues.Value{ var MatchValueFieldMap = map[matchparser.MatchCriteriaType]docvalues.DeprecatedValue{
matchparser.MatchCriteriaTypeUser: MatchUserField, matchparser.MatchCriteriaTypeUser: MatchUserField,
matchparser.MatchCriteriaTypeGroup: MatchGroupField, matchparser.MatchCriteriaTypeGroup: MatchGroupField,
matchparser.MatchCriteriaTypeHost: MatchHostField, matchparser.MatchCriteriaTypeHost: MatchHostField,

View File

@ -86,13 +86,13 @@ func GetOptionCompletions(
} }
if entry.OptionValue == nil { if entry.OptionValue == nil {
return option.FetchCompletions("", 0), nil return option.DeprecatedFetchCompletions("", 0), nil
} }
// Hello wo|rld // Hello wo|rld
line := entry.OptionValue.Value.Raw line := entry.OptionValue.Value.Raw
// NEW: docvalues index // NEW: docvalues index
return option.FetchCompletions( return option.DeprecatedFetchCompletions(
line, line,
common.DeprecatedImprovedCursorToIndex( common.DeprecatedImprovedCursorToIndex(
cursor, cursor,

View File

@ -96,19 +96,19 @@ func getMatchValueCompletions(
switch entry.Criteria.Type { switch entry.Criteria.Type {
case matchparser.MatchCriteriaTypeUser: case matchparser.MatchCriteriaTypeUser:
return fields.MatchUserField.FetchCompletions(line, relativeCursor) return fields.MatchUserField.DeprecatedFetchCompletions(line, relativeCursor)
case matchparser.MatchCriteriaTypeGroup: case matchparser.MatchCriteriaTypeGroup:
return fields.MatchGroupField.FetchCompletions(line, relativeCursor) return fields.MatchGroupField.DeprecatedFetchCompletions(line, relativeCursor)
case matchparser.MatchCriteriaTypeHost: case matchparser.MatchCriteriaTypeHost:
return fields.MatchHostField.FetchCompletions(line, relativeCursor) return fields.MatchHostField.DeprecatedFetchCompletions(line, relativeCursor)
case matchparser.MatchCriteriaTypeAddress: case matchparser.MatchCriteriaTypeAddress:
return fields.MatchAddressField.FetchCompletions(line, relativeCursor) return fields.MatchAddressField.DeprecatedFetchCompletions(line, relativeCursor)
case matchparser.MatchCriteriaTypeLocalAddress: case matchparser.MatchCriteriaTypeLocalAddress:
return fields.MatchLocalAddressField.FetchCompletions(line, relativeCursor) return fields.MatchLocalAddressField.DeprecatedFetchCompletions(line, relativeCursor)
case matchparser.MatchCriteriaTypeLocalPort: case matchparser.MatchCriteriaTypeLocalPort:
return fields.MatchLocalPortField.FetchCompletions(line, relativeCursor) return fields.MatchLocalPortField.DeprecatedFetchCompletions(line, relativeCursor)
case matchparser.MatchCriteriaTypeRDomain: case matchparser.MatchCriteriaTypeRDomain:
return fields.MatchRDomainField.FetchCompletions(line, relativeCursor) return fields.MatchRDomainField.DeprecatedFetchCompletions(line, relativeCursor)
} }
return nil return nil

View File

@ -55,7 +55,7 @@ func GetHoverInfoForOption(
if option.OptionValue != nil && option.OptionValue.ContainsPosition(index) { if option.OptionValue != nil && option.OptionValue.ContainsPosition(index) {
line := option.OptionValue.Value.Raw line := option.OptionValue.Value.Raw
contents := docValue.FetchHoverInfo( contents := docValue.DeprecatedFetchHoverInfo(
line, line,
uint32(option.OptionValue.Start.GetRelativeIndexPosition(index)), uint32(option.OptionValue.Start.GetRelativeIndexPosition(index)),
) )

View File

@ -109,7 +109,7 @@ https://git.zx2c4.com/WireGuard/about/src/tools/man/wg-quick.8
Table = 1234 Table = 1234
`, `,
Value: docvalues.OrValue{ Value: docvalues.OrValue{
Values: []docvalues.Value{ Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{ docvalues.EnumValue{
EnforceValues: false, EnforceValues: false,
Values: []docvalues.EnumString{ Values: []docvalues.EnumString{

View File

@ -232,7 +232,7 @@ func analyzeProperty(
} }
} }
errors := option.CheckIsValid(p.Value.Value) errors := option.DeprecatedCheckIsValid(p.Value.Value)
return utils.Map(errors, func(err *docvalues.InvalidValue) protocol.Diagnostic { return utils.Map(errors, func(err *docvalues.InvalidValue) protocol.Diagnostic {
severity := protocol.DiagnosticSeverityError severity := protocol.DiagnosticSeverityError

View File

@ -150,11 +150,11 @@ func GetCompletionsForSectionPropertyLine(
if property.Value == nil { if property.Value == nil {
if character >= property.Separator.Location.End { if character >= property.Separator.Location.End {
return option.FetchCompletions("", 0), nil return option.DeprecatedFetchCompletions("", 0), nil
} }
} }
relativeCursor := character - property.Value.Location.Start relativeCursor := character - property.Value.Location.Start
return option.FetchCompletions(property.Value.Value, relativeCursor), nil return option.DeprecatedFetchCompletions(property.Value.Value, relativeCursor), nil
} }