Skip to content

Commit

Permalink
refactor: Rename Value -> DeprecatedValue
Browse files Browse the repository at this point in the history
  • Loading branch information
Myzel394 committed Sep 28, 2024
1 parent 6ab293d commit b7e7868
Show file tree
Hide file tree
Showing 73 changed files with 287 additions and 286 deletions.
2 changes: 1 addition & 1 deletion common-documentation/mnt-adfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var AdfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var AdfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"uid",
"Set the owner of the files in the filesystem (default: uid=0).",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-affs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import docvalues "config-lsp/doc-values"

var prefixMaxLength = uint32(30)

var AffsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var AffsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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).",
Expand Down
4 changes: 2 additions & 2 deletions common-documentation/mnt-btrfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import docvalues "config-lsp/doc-values"

var maxInlineMin = 2048

var BtrfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var BtrfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.",
Expand Down Expand Up @@ -71,7 +71,7 @@ var BtrfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
"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",
): docvalues.OrValue{
Values: []docvalues.Value{
Values: []docvalues.DeprecatedValue{
docvalues.EnumValue{
EnforceValues: true,
Values: []docvalues.EnumString{
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-debugfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var DebugfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var DebugfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"uid",
"Set the owner of the mountpoint.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-devpts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var DevptsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var DevptsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-ext2.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var Ext2DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var Ext2DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-ext3.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var Ext3DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var Ext3DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-ext4.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import docvalues "config-lsp/doc-values"
var zero = 0
var maxJournalIOPrio = 7

var Ext4DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var Ext4DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-fat.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
docvalues "config-lsp/doc-values"
)

var FatDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var FatDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"blocksize",
"Set blocksize (default 512). This option is obsolete.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-hfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var HfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var HfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"creator",
"Set the creator/type values as shown by the MacOS finder used for creating new files. Default values: '????'.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-hpfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var HpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var HpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"uid",
"Set the owner and group of all files. (Default: the UID and GID of the current process.)",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-iso9660.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var Iso9660DocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var Iso9660DocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.)",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-jfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var JfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var JfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-ncpfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var NcpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{}
var NcpfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{}

var NcpfsDocumentationEnums = []docvalues.EnumString{}
2 changes: 1 addition & 1 deletion common-documentation/mnt-ntfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var NtfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var NtfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"iocharset",
"Character set to use when returning file names. Unlike VFAT, NTFS suppresses names that contain nonconvertible characters. Deprecated.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var OverlayDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var OverlayDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"lowerdir",
"Any filesystem, does not need to be on a writable filesystem.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-reiserfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var ReiserfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var ReiserfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"hash",
"Choose which hash function reiserfs will use to find files within directories.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-ubifs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var UbifsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var UbifsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-udf.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var UdfDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var UdfDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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'.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-ufs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

import docvalues "config-lsp/doc-values"

var UfsDocumentationAssignable = map[docvalues.EnumString]docvalues.Value{
var UfsDocumentationAssignable = map[docvalues.EnumString]docvalues.DeprecatedValue{
docvalues.CreateEnumStringWithDoc(
"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. That’s why the user must specify the type of ufs by mount option.",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-umsdos.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"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
if key.InsertText == "dotsOK" {
return false
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-usbfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

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(
"devuid",
"Set the owner of the device files in the usbfs filesystem (default: uid=gid=0)",
Expand Down
2 changes: 1 addition & 1 deletion common-documentation/mnt-vfat.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package commondocumentation

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(
"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",
Expand Down
8 changes: 4 additions & 4 deletions doc-values/base-value.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
protocol "github.com/tliron/glsp/protocol_3_16"
)

type Value interface {
type DeprecatedValue interface {
GetTypeDescription() []string
CheckIsValid(value string) []*InvalidValue
FetchCompletions(line string, cursor uint32) []protocol.CompletionItem
FetchHoverInfo(line string, cursor uint32) []string
DeprecatedCheckIsValid(value string) []*InvalidValue
DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem
DeprecatedFetchHoverInfo(line string, cursor uint32) []string
}

type InvalidValue struct {
Expand Down
2 changes: 1 addition & 1 deletion doc-values/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (e ValueError) GetPublishDiagnosticsParams() protocol.Diagnostic {
}
}
func (e ValueError) Error() string {
return "Value error"
return "DeprecatedValue error"
}

type OptionAlreadyExistsError struct {
Expand Down
16 changes: 8 additions & 8 deletions doc-values/extra-values.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"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
func UserValue(separatorForMultiple string, enforceValues bool) Value {
func UserValue(separatorForMultiple string, enforceValues bool) DeprecatedValue {
return CustomValue{
FetchValue: func(context CustomValueContext) Value {
FetchValue: func(context CustomValueContext) DeprecatedValue {
infos, err := common.FetchPasswdInfo()

if err != nil {
Expand All @@ -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{
FetchValue: func(context CustomValueContext) Value {
FetchValue: func(context CustomValueContext) DeprecatedValue {
infos, err := common.FetchGroupInfo()

if err != nil {
Expand All @@ -66,14 +66,14 @@ func GroupValue(separatorForMultiple string, enforceValues bool) Value {
}
}

func PositiveNumberValue() Value {
func PositiveNumberValue() DeprecatedValue {
zero := 0
return NumberValue{
Min: &zero,
}
}

func MaskValue() Value {
func MaskValue() DeprecatedValue {
min := 0
max := 777
return NumberValue{Min: &min, Max: &max}
Expand All @@ -88,7 +88,7 @@ func SingleEnumValue(value string) EnumValue {
}
}

func DomainValue() Value {
func DomainValue() DeprecatedValue {
return RegexValue{
Regex: *regexp.MustCompile(`^.+?\..+$`),
}
Expand Down
4 changes: 2 additions & 2 deletions doc-values/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
result := make(map[EnumString]Value)
result := make(map[EnumString]DeprecatedValue)

slices.Reverse(maps)

Expand Down
16 changes: 8 additions & 8 deletions doc-values/value-array.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var ExtractKeyDuplicatesExtractor = func(separator string) func(string) string {
var DuplicatesAllowedExtractor func(string) string = nil

type ArrayValue struct {
SubValue Value
SubValue DeprecatedValue
Separator string
// If this function is nil, no duplicate check is done.
// (value) => Extracted value
Expand All @@ -45,15 +45,15 @@ type ArrayValue struct {
}

func (v ArrayValue) GetTypeDescription() []string {
subValue := v.SubValue.(Value)
subValue := v.SubValue.(DeprecatedValue)

return append(
[]string{fmt.Sprintf("An Array separated by '%s' of:", v.Separator)},
subValue.GetTypeDescription()...,
)
}

func (v ArrayValue) CheckIsValid(value string) []*InvalidValue {
func (v ArrayValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
errors := []*InvalidValue{}
values := strings.Split(value, v.Separator)

Expand Down Expand Up @@ -100,7 +100,7 @@ func (v ArrayValue) CheckIsValid(value string) []*InvalidValue {

currentIndex := uint32(0)
for _, subValue := range values {
newErrors := v.SubValue.CheckIsValid(subValue)
newErrors := v.SubValue.DeprecatedCheckIsValid(subValue)

if len(newErrors) > 0 {
ShiftInvalidValues(currentIndex, newErrors)
Expand Down Expand Up @@ -173,15 +173,15 @@ func (v ArrayValue) getCurrentValue(line string, cursor uint32) (string, uint32)
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)

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)

return v.SubValue.FetchHoverInfo(value, cursor)
return v.SubValue.DeprecatedFetchHoverInfo(value, cursor)
}
14 changes: 7 additions & 7 deletions doc-values/value-custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ func (EmptyValueContext) GetIsContext() bool {
var EmptyValueContextInstance = EmptyValueContext{}

type CustomValue struct {
FetchValue func(context CustomValueContext) Value
FetchValue func(context CustomValueContext) DeprecatedValue
}

func (v CustomValue) GetTypeDescription() []string {
return v.FetchValue(EmptyValueContextInstance).GetTypeDescription()
}

func (v CustomValue) CheckIsValid(value string) []*InvalidValue {
return v.FetchValue(EmptyValueContextInstance).CheckIsValid(value)
func (v CustomValue) DeprecatedCheckIsValid(value string) []*InvalidValue {
return v.FetchValue(EmptyValueContextInstance).DeprecatedCheckIsValid(value)
}

func (v CustomValue) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return v.FetchValue(EmptyValueContextInstance).FetchCompletions(line, cursor)
func (v CustomValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
return v.FetchValue(EmptyValueContextInstance).DeprecatedFetchCompletions(line, cursor)
}

func (v CustomValue) FetchHoverInfo(line string, cursor uint32) []string {
return v.FetchValue(EmptyValueContextInstance).FetchHoverInfo(line, cursor)
func (v CustomValue) DeprecatedFetchHoverInfo(line string, cursor uint32) []string {
return v.FetchValue(EmptyValueContextInstance).DeprecatedFetchHoverInfo(line, cursor)
}
Loading

0 comments on commit b7e7868

Please sign in to comment.