From b520ada4edbaaa3b448d931b8ef05e7d97c8f099 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Sun, 4 May 2025 20:58:32 +0200 Subject: [PATCH 01/14] fix(server): Improve SSH fields Signed-off-by: Myzel394 --- server/handlers/sshd_config/fields/fields.go | 20 ++++++++++++++----- .../sshd_config/handlers/completions.go | 4 ++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/server/handlers/sshd_config/fields/fields.go b/server/handlers/sshd_config/fields/fields.go index 99e57cd..f18893e 100644 --- a/server/handlers/sshd_config/fields/fields.go +++ b/server/handlers/sshd_config/fields/fields.go @@ -146,14 +146,24 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may Documentation: `Specifies a file that lists principal names that are accepted for certificate authentication. When using certificates signed by a key listed in TrustedUserCAKeys, this file lists names, one of which must appear in the certificate for it to be accepted for authentication. Names are listed one per line preceded by key options (as described in “AUTHORIZED_KEYS FILE FORMAT” in sshd(8)). Empty lines and comments starting with ‘#’ are ignored. Arguments to AuthorizedPrincipalsFile accept the tokens described in the “TOKENS” section. After expansion, AuthorizedPrincipalsFile is taken to be an absolute path or one relative to the user's home directory. The default is none, i.e. not to use a principals file – in this case, the username of the user must appear in a certificate's principals list for it to be accepted. Note that AuthorizedPrincipalsFile is only used when authentication proceeds using a CA listed in TrustedUserCAKeys and is not consulted for certification authorities trusted via ~/.ssh/authorized_keys, though the principals= key option offers a similar facility (see sshd(8) for details).`, - Value: docvalues.PathValue{ - RequiredType: docvalues.PathTypeFile, + Value: docvalues.OrValue{ + Values: []docvalues.DeprecatedValue{ + docvalues.SingleEnumValue("none"), + docvalues.PathValue{ + RequiredType: docvalues.PathTypeFile, + }, + }, }, }, "banner": { Documentation: `The contents of the specified file are sent to the remote user before authentication is allowed. If the argument is none then no banner is displayed. By default, no banner is displayed.`, - Value: docvalues.PathValue{ - RequiredType: docvalues.PathTypeFile, + Value: docvalues.OrValue{ + Values: []docvalues.DeprecatedValue{ + docvalues.SingleEnumValue("none"), + docvalues.PathValue{ + RequiredType: docvalues.PathTypeFile, + }, + }, }, }, "casignaturealgorithms": { @@ -592,7 +602,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av }, }, "modulifile": { - Documentation: `Specifies the moduli(5) file that contains the Diffie- Hellman groups used for the “diffie-hellman-group-exchange-sha1” and “diffie-hellman-group-exchange-sha256” key exchange methods. The default is /etc/moduli.`, + Documentation: `Specifies the moduli(5) file that contains the Diffie-Hellman groups used for the “diffie-hellman-group-exchange-sha1” and “diffie-hellman-group-exchange-sha256” key exchange methods. The default is /etc/moduli.`, Value: docvalues.PathValue{ RequiredType: docvalues.PathTypeFile, }, diff --git a/server/handlers/sshd_config/handlers/completions.go b/server/handlers/sshd_config/handlers/completions.go index f533daf..058359a 100644 --- a/server/handlers/sshd_config/handlers/completions.go +++ b/server/handlers/sshd_config/handlers/completions.go @@ -18,6 +18,10 @@ func GetRootCompletions( parentMatchBlock *ast.SSHDMatchBlock, suggestValue bool, ) ([]protocol.CompletionItem, error) { + if d.Indexes == nil { + return nil, nil + } + kind := protocol.CompletionItemKindField availableOptions := make(map[fields.NormalizedOptionName]docvalues.DocumentationValue, 0) From fa45351ec5cda7a5f11c45c0c4d1d3b41a381a82 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Sun, 4 May 2025 22:21:20 +0200 Subject: [PATCH 02/14] fix(server): Fix SSH fields Signed-off-by: Myzel394 --- server/handlers/sshd_config/fields/fields.go | 47 ++++++++++--------- server/handlers/sshd_config/fields/options.go | 1 + 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/server/handlers/sshd_config/fields/fields.go b/server/handlers/sshd_config/fields/fields.go index f18893e..d7eaf1b 100644 --- a/server/handlers/sshd_config/fields/fields.go +++ b/server/handlers/sshd_config/fields/fields.go @@ -83,31 +83,36 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may }, }, docvalues.ArrayValue{ - Separator: ",", - DuplicatesExtractor: &docvalues.SimpleDuplicatesExtractor, + Separator: " ", + DuplicatesExtractor: nil, RespectQuotes: true, - SubValue: docvalues.EnumValue{ - EnforceValues: true, - Values: []docvalues.EnumString{ - docvalues.CreateEnumString("none"), + SubValue: docvalues.ArrayValue{ + Separator: ",", + DuplicatesExtractor: &docvalues.SimpleDuplicatesExtractor, + RespectQuotes: true, + SubValue: docvalues.EnumValue{ + EnforceValues: true, + Values: []docvalues.EnumString{ + docvalues.CreateEnumString("none"), - docvalues.CreateEnumString("password"), - docvalues.CreateEnumString("publickey"), - docvalues.CreateEnumString("gssapi-with-mic"), - docvalues.CreateEnumString("keyboard-interactive"), - docvalues.CreateEnumString("hostbased"), + docvalues.CreateEnumString("password"), + docvalues.CreateEnumString("publickey"), + docvalues.CreateEnumString("gssapi-with-mic"), + docvalues.CreateEnumString("keyboard-interactive"), + docvalues.CreateEnumString("hostbased"), - docvalues.CreateEnumString("password:bsdauth"), - docvalues.CreateEnumString("publickey:bsdauth"), - docvalues.CreateEnumString("gssapi-with-mic:bsdauth"), - docvalues.CreateEnumString("keyboard-interactive:bsdauth"), - docvalues.CreateEnumString("hostbased:bsdauth"), + docvalues.CreateEnumString("password:bsdauth"), + docvalues.CreateEnumString("publickey:bsdauth"), + docvalues.CreateEnumString("gssapi-with-mic:bsdauth"), + docvalues.CreateEnumString("keyboard-interactive:bsdauth"), + docvalues.CreateEnumString("hostbased:bsdauth"), - docvalues.CreateEnumString("password:pam"), - docvalues.CreateEnumString("publickey:pam"), - docvalues.CreateEnumString("gssapi-with-mic:pam"), - docvalues.CreateEnumString("keyboard-interactive:pam"), - docvalues.CreateEnumString("hostbased:pam"), + docvalues.CreateEnumString("password:pam"), + docvalues.CreateEnumString("publickey:pam"), + docvalues.CreateEnumString("gssapi-with-mic:pam"), + docvalues.CreateEnumString("keyboard-interactive:pam"), + docvalues.CreateEnumString("hostbased:pam"), + }, }, }, }, diff --git a/server/handlers/sshd_config/fields/options.go b/server/handlers/sshd_config/fields/options.go index 4f9f233..f52ba9f 100644 --- a/server/handlers/sshd_config/fields/options.go +++ b/server/handlers/sshd_config/fields/options.go @@ -8,4 +8,5 @@ var AllowedDuplicateOptions = map[NormalizedOptionName]struct{}{ "listenaddress": {}, "match": {}, "port": {}, + "hostkey": {}, } From 9a1686a7d8304103a65ebaa45a0be53ba79e9a17 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 15:34:21 +0200 Subject: [PATCH 03/14] fix(server): Improve ssh handlers Signed-off-by: Myzel394 --- flake.lock | 12 ++++---- flake.nix | 8 ++--- server/doc-values/value-path.go | 30 +++++++++---------- server/handlers/aliases/fields/fields.go | 2 ++ server/handlers/fstab/fields/spec.go | 3 +- server/handlers/ssh_config/fields/fields.go | 5 ++++ server/handlers/sshd_config/fields/fields.go | 14 +++++++-- .../lsp/text-document-completion.go | 1 + 8 files changed, 47 insertions(+), 28 deletions(-) diff --git a/flake.lock b/flake.lock index ec4995b..3f6093a 100644 --- a/flake.lock +++ b/flake.lock @@ -26,11 +26,11 @@ ] }, "locked": { - "lastModified": 1742209644, - "narHash": "sha256-jMy1XqXqD0/tJprEbUmKilTkvbDY/C0ZGSsJJH4TNCE=", + "lastModified": 1745875161, + "narHash": "sha256-0YkWCS13jpoo3+sX/3kcgdxBNt1VZTmvF+FhZb4rFKI=", "owner": "tweag", "repo": "gomod2nix", - "rev": "8f3534eb8f6c5c3fce799376dc3b91bae6b11884", + "rev": "2cbd7fdd6eeab65c494cc426e18f4e4d2a5e35c0", "type": "github" }, "original": { @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742669843, - "narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=", + "lastModified": 1748026106, + "narHash": "sha256-6m1Y3/4pVw1RWTsrkAK2VMYSzG4MMIj7sqUy7o8th1o=", "owner": "nixos", "repo": "nixpkgs", - "rev": "1e5b653dff12029333a6546c11e108ede13052eb", + "rev": "063f43f2dbdef86376cc29ad646c45c46e93234c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b512ad8..a0158d2 100644 --- a/flake.nix +++ b/flake.nix @@ -28,14 +28,14 @@ inherit system; overlays = [ (final: prev: { - go = prev.go_1_22; - buildGoModule = prev.buildGo122Module; + go = prev.go_1_24; + buildGoModule = prev.buildGo124Module; }) gomod2nix.overlays.default ]; }; inputs = [ - pkgs.go_1_22 + pkgs.go_1_24 ]; serverUncompressed = pkgs.buildGoModule { nativeBuildInputs = inputs; @@ -133,7 +133,7 @@ }; devShells.default = let - version = "0.16.2"; + version = "0.18.1"; ourGopls = pkgs.buildGoModule { pname = "gopls"; inherit version; diff --git a/server/doc-values/value-path.go b/server/doc-values/value-path.go index 87f79ec..6160b68 100644 --- a/server/doc-values/value-path.go +++ b/server/doc-values/value-path.go @@ -21,12 +21,12 @@ func (e PathInvalidError) Error() string { type PathType uint8 const ( - PathTypeExistenceOptional PathType = 0 PathTypeFile PathType = 1 PathTypeDirectory PathType = 2 ) type PathValue struct { + IsOptional bool RequiredType PathType } @@ -34,29 +34,30 @@ func (v PathValue) GetTypeDescription() []string { hints := make([]string, 0) switch v.RequiredType { - case PathTypeExistenceOptional: - hints = append(hints, "Optional") - break case PathTypeFile: hints = append(hints, "File") case PathTypeDirectory: hints = append(hints, "Directory") } + if v.IsOptional { + hints = append(hints, "Optional") + } + return []string{strings.Join(hints, ", ")} } func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue { - if v.RequiredType == PathTypeExistenceOptional { - return nil - } - if !utils.DoesPathExist(value) { - return []*InvalidValue{{ - Err: PathDoesNotExistError{}, - Start: 0, - End: uint32(len(value)), - }} + if v.IsOptional { + return nil + } else { + return []*InvalidValue{{ + Err: PathDoesNotExistError{}, + Start: 0, + End: uint32(len(value)), + }} + } } isValid := false @@ -77,8 +78,7 @@ func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue { Err: PathInvalidError{}, Start: 0, End: uint32(len(value)), - }, - } + }} } func (v PathValue) DeprecatedFetchCompletions(line string, cursor uint32) []protocol.CompletionItem { diff --git a/server/handlers/aliases/fields/fields.go b/server/handlers/aliases/fields/fields.go index f29804e..65ae99f 100644 --- a/server/handlers/aliases/fields/fields.go +++ b/server/handlers/aliases/fields/fields.go @@ -15,6 +15,7 @@ var UserDeclaration = "`user`" var PathField = docvalues.DocumentationValue{ Documentation: "Append messages to file, specified by its absolute pathname", Value: docvalues.PathValue{ + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, } @@ -40,6 +41,7 @@ var EmailDeclaration = "`user-part@domain-part`" var IncludeField = docvalues.DocumentationValue{ Documentation: "Include any definitions in file as alias entries. The format of the file is identical to this one.", Value: docvalues.PathValue{ + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, } diff --git a/server/handlers/fstab/fields/spec.go b/server/handlers/fstab/fields/spec.go index 0602cfa..133fbc3 100644 --- a/server/handlers/fstab/fields/spec.go +++ b/server/handlers/fstab/fields/spec.go @@ -16,7 +16,8 @@ var LabelField = docvalues.RegexValue{ var SpecField = docvalues.OrValue{ Values: []docvalues.DeprecatedValue{ docvalues.PathValue{ - RequiredType: docvalues.PathTypeExistenceOptional, + IsOptional: false, + RequiredType: docvalues.PathTypeFile, }, docvalues.KeyEnumAssignmentValue{ Separator: "=", diff --git a/server/handlers/ssh_config/fields/fields.go b/server/handlers/ssh_config/fields/fields.go index 179beb1..900fad1 100644 --- a/server/handlers/ssh_config/fields/fields.go +++ b/server/handlers/ssh_config/fields/fields.go @@ -139,6 +139,7 @@ rsa-sha2-512,rsa-sha2-256 Arguments to CertificateFile may use the tilde syntax to refer to a user's home directory, the tokens described in the TOKENS section and environment variables as described in the ENVIRONMENT VARIABLES section. It is possible to have multiple certificate files specified in configuration files; these certificates will be tried in sequence. Multiple CertificateFile directives will add to the list of certificates used for authentication.`, Value: docvalues.PathValue{ + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, }, @@ -366,6 +367,7 @@ aes128-gcm@openssh.com,aes256-gcm@openssh.com DuplicatesExtractor: &docvalues.SimpleDuplicatesExtractor, RespectQuotes: true, SubValue: docvalues.PathValue{ + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, }, @@ -834,6 +836,7 @@ rsa-sha2-512,rsa-sha2-256 Documentation: `Specifies a path to a library that will be used when loading any FIDO authenticator-hosted keys, overriding the default of using the built-in USB HID support. If the specified value begins with a ‘$’ character, then it will be treated as an environment variable containing the path to the library.`, Value: docvalues.PathValue{ + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -963,6 +966,7 @@ rsa-sha2-512,rsa-sha2-256 DuplicatesExtractor: &docvalues.SimpleDuplicatesExtractor, RespectQuotes: true, SubValue: docvalues.PathValue{ + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, }, @@ -986,6 +990,7 @@ rsa-sha2-512,rsa-sha2-256 "xauthlocation": { Documentation: `Specifies the full pathname of the xauth(1) program. The default is /usr/X11R6/bin/xauth.`, Value: docvalues.PathValue{ + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, diff --git a/server/handlers/sshd_config/fields/fields.go b/server/handlers/sshd_config/fields/fields.go index d7eaf1b..e3f19bb 100644 --- a/server/handlers/sshd_config/fields/fields.go +++ b/server/handlers/sshd_config/fields/fields.go @@ -155,6 +155,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may Values: []docvalues.DeprecatedValue{ docvalues.SingleEnumValue("none"), docvalues.PathValue{ + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -166,6 +167,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may Values: []docvalues.DeprecatedValue{ docvalues.SingleEnumValue("none"), docvalues.PathValue{ + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -358,13 +360,19 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may }, "hostcertificate": { Documentation: `Specifies a file containing a public host certificate. The certificate's public key must match a private host key already specified by HostKey. The default behaviour of sshd(8) is not to load any certificates.`, - Value: docvalues.PathValue{}, + Value: docvalues.PathValue{ + IsOptional: true, + RequiredType: docvalues.PathTypeFile, + }, }, "hostkey": { Documentation: `Specifies a file containing a private host key used by SSH. The defaults are /etc/ssh/ssh_host_ecdsa_key, /etc/ssh/ssh_host_ed25519_key and /etc/ssh/ssh_host_rsa_key. Note that sshd(8) will refuse to use a file if it is group/world-accessible and that the HostKeyAlgorithms option restricts which of the keys are actually used by sshd(8). It is possible to have multiple host key files. It is also possible to specify public host key files instead. In this case operations on the private key will be delegated to an ssh-agent(1).`, - Value: docvalues.PathValue{}, + Value: docvalues.PathValue{ + IsOptional: true, + RequiredType: docvalues.PathTypeFile, + }, }, "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.`, @@ -609,6 +617,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av "modulifile": { Documentation: `Specifies the moduli(5) file that contains the Diffie-Hellman groups used for the “diffie-hellman-group-exchange-sha1” and “diffie-hellman-group-exchange-sha256” key exchange methods. The default is /etc/moduli.`, Value: docvalues.PathValue{ + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -874,6 +883,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av "securitykeyprovider": { Documentation: `Specifies a path to a library that will be used when loading FIDO authenticator-hosted keys, overriding the default of using the built-in USB HID support.`, Value: docvalues.PathValue{ + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, diff --git a/server/handlers/sshd_config/lsp/text-document-completion.go b/server/handlers/sshd_config/lsp/text-document-completion.go index 72a9a38..b4ead50 100644 --- a/server/handlers/sshd_config/lsp/text-document-completion.go +++ b/server/handlers/sshd_config/lsp/text-document-completion.go @@ -24,6 +24,7 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa entry, matchBlock := d.Config.FindOption(line) + if entry == nil || entry.Separator == nil || entry.Key == nil || From 429c2cd4be2b18be936099495662044e7153ba01 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 16:16:45 +0200 Subject: [PATCH 04/14] fix(server): Improvements Signed-off-by: Myzel394 --- flake.lock | 6 +- server/doc-values/value-path.go | 69 +++++++++++++------ server/handlers/aliases/fields/fields.go | 4 +- server/handlers/fstab/fields/spec.go | 2 +- server/handlers/ssh_config/fields/fields.go | 10 +-- server/handlers/sshd_config/fields/fields.go | 14 ++-- .../lsp/text-document-completion.go | 1 - server/utils/common.go | 18 ++++- 8 files changed, 81 insertions(+), 43 deletions(-) diff --git a/flake.lock b/flake.lock index 3f6093a..35d34f1 100644 --- a/flake.lock +++ b/flake.lock @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1748026106, - "narHash": "sha256-6m1Y3/4pVw1RWTsrkAK2VMYSzG4MMIj7sqUy7o8th1o=", + "lastModified": 1748370509, + "narHash": "sha256-QlL8slIgc16W5UaI3w7xHQEP+Qmv/6vSNTpoZrrSlbk=", "owner": "nixos", "repo": "nixpkgs", - "rev": "063f43f2dbdef86376cc29ad646c45c46e93234c", + "rev": "4faa5f5321320e49a78ae7848582f684d64783e9", "type": "github" }, "original": { diff --git a/server/doc-values/value-path.go b/server/doc-values/value-path.go index 6160b68..6be9e88 100644 --- a/server/doc-values/value-path.go +++ b/server/doc-values/value-path.go @@ -2,31 +2,21 @@ package docvalues import ( "config-lsp/utils" - protocol "github.com/tliron/glsp/protocol_3_16" + "errors" "strings" + + protocol "github.com/tliron/glsp/protocol_3_16" ) -type PathDoesNotExistError struct{} - -func (e PathDoesNotExistError) Error() string { - return "This path does not exist" -} - -type PathInvalidError struct{} - -func (e PathInvalidError) Error() string { - return "This path is invalid" -} - type PathType uint8 const ( - PathTypeFile PathType = 1 - PathTypeDirectory PathType = 2 + PathTypeFile PathType = 1 + PathTypeDirectory PathType = 2 ) type PathValue struct { - IsOptional bool + IsOptional bool RequiredType PathType } @@ -53,29 +43,66 @@ func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue { return nil } else { return []*InvalidValue{{ - Err: PathDoesNotExistError{}, + Err: errors.New("This path does not exist"), Start: 0, End: uint32(len(value)), }} } } - isValid := false + fileRequired := (v.RequiredType & PathTypeFile) == PathTypeFile + directoryRequired := (v.RequiredType & PathTypeDirectory) == PathTypeDirectory - if (v.RequiredType & PathTypeFile) == PathTypeFile { + isValid := true + + // If file is expected + if fileRequired { + // and exists isValid = isValid && utils.IsPathFile(value) + // file not expected + } else { + // and should not exist + isValid = isValid && !utils.IsPathFile(value) } - if (v.RequiredType & PathTypeDirectory) == PathTypeDirectory { + // if directory + if directoryRequired { + // and exists isValid = isValid && utils.IsPathDirectory(value) + // directory not expected + } else { + // and should not exist + isValid = isValid && !utils.IsPathDirectory(value) } if isValid { return nil } + if fileRequired && directoryRequired { + return []*InvalidValue{{ + Err: errors.New("This must be either a file or a directory"), + Start: 0, + End: uint32(len(value)), + }} + } + if fileRequired { + return []*InvalidValue{{ + Err: errors.New("This must be a file"), + Start: 0, + End: uint32(len(value)), + }} + } + if directoryRequired { + return []*InvalidValue{{ + Err: errors.New("This must be a directory"), + Start: 0, + End: uint32(len(value)), + }} + } + return []*InvalidValue{{ - Err: PathInvalidError{}, + Err: errors.New("This path is invalid"), Start: 0, End: uint32(len(value)), }} diff --git a/server/handlers/aliases/fields/fields.go b/server/handlers/aliases/fields/fields.go index 65ae99f..f56db20 100644 --- a/server/handlers/aliases/fields/fields.go +++ b/server/handlers/aliases/fields/fields.go @@ -15,7 +15,7 @@ var UserDeclaration = "`user`" var PathField = docvalues.DocumentationValue{ Documentation: "Append messages to file, specified by its absolute pathname", Value: docvalues.PathValue{ - IsOptional: true, + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, } @@ -41,7 +41,7 @@ var EmailDeclaration = "`user-part@domain-part`" var IncludeField = docvalues.DocumentationValue{ Documentation: "Include any definitions in file as alias entries. The format of the file is identical to this one.", Value: docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, } diff --git a/server/handlers/fstab/fields/spec.go b/server/handlers/fstab/fields/spec.go index 133fbc3..9a20997 100644 --- a/server/handlers/fstab/fields/spec.go +++ b/server/handlers/fstab/fields/spec.go @@ -16,7 +16,7 @@ var LabelField = docvalues.RegexValue{ var SpecField = docvalues.OrValue{ Values: []docvalues.DeprecatedValue{ docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, docvalues.KeyEnumAssignmentValue{ diff --git a/server/handlers/ssh_config/fields/fields.go b/server/handlers/ssh_config/fields/fields.go index 900fad1..eff98c2 100644 --- a/server/handlers/ssh_config/fields/fields.go +++ b/server/handlers/ssh_config/fields/fields.go @@ -139,7 +139,7 @@ rsa-sha2-512,rsa-sha2-256 Arguments to CertificateFile may use the tilde syntax to refer to a user's home directory, the tokens described in the TOKENS section and environment variables as described in the ENVIRONMENT VARIABLES section. It is possible to have multiple certificate files specified in configuration files; these certificates will be tried in sequence. Multiple CertificateFile directives will add to the list of certificates used for authentication.`, Value: docvalues.PathValue{ - IsOptional: true, + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, }, @@ -367,7 +367,7 @@ aes128-gcm@openssh.com,aes256-gcm@openssh.com DuplicatesExtractor: &docvalues.SimpleDuplicatesExtractor, RespectQuotes: true, SubValue: docvalues.PathValue{ - IsOptional: true, + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, }, @@ -836,7 +836,7 @@ rsa-sha2-512,rsa-sha2-256 Documentation: `Specifies a path to a library that will be used when loading any FIDO authenticator-hosted keys, overriding the default of using the built-in USB HID support. If the specified value begins with a ‘$’ character, then it will be treated as an environment variable containing the path to the library.`, Value: docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -966,7 +966,7 @@ rsa-sha2-512,rsa-sha2-256 DuplicatesExtractor: &docvalues.SimpleDuplicatesExtractor, RespectQuotes: true, SubValue: docvalues.PathValue{ - IsOptional: true, + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, }, @@ -990,7 +990,7 @@ rsa-sha2-512,rsa-sha2-256 "xauthlocation": { Documentation: `Specifies the full pathname of the xauth(1) program. The default is /usr/X11R6/bin/xauth.`, Value: docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, diff --git a/server/handlers/sshd_config/fields/fields.go b/server/handlers/sshd_config/fields/fields.go index e3f19bb..d6d5f40 100644 --- a/server/handlers/sshd_config/fields/fields.go +++ b/server/handlers/sshd_config/fields/fields.go @@ -155,7 +155,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may Values: []docvalues.DeprecatedValue{ docvalues.SingleEnumValue("none"), docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -167,7 +167,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may Values: []docvalues.DeprecatedValue{ docvalues.SingleEnumValue("none"), docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -360,8 +360,8 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may }, "hostcertificate": { Documentation: `Specifies a file containing a public host certificate. The certificate's public key must match a private host key already specified by HostKey. The default behaviour of sshd(8) is not to load any certificates.`, - Value: docvalues.PathValue{ - IsOptional: true, + Value: docvalues.PathValue{ + IsOptional: true, RequiredType: docvalues.PathTypeFile, }, }, @@ -370,7 +370,7 @@ See PATTERNS in ssh_config(5) for more information on patterns. This keyword may Note that sshd(8) will refuse to use a file if it is group/world-accessible and that the HostKeyAlgorithms option restricts which of the keys are actually used by sshd(8). It is possible to have multiple host key files. It is also possible to specify public host key files instead. In this case operations on the private key will be delegated to an ssh-agent(1).`, Value: docvalues.PathValue{ - IsOptional: true, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -617,7 +617,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av "modulifile": { Documentation: `Specifies the moduli(5) file that contains the Diffie-Hellman groups used for the “diffie-hellman-group-exchange-sha1” and “diffie-hellman-group-exchange-sha256” key exchange methods. The default is /etc/moduli.`, Value: docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, @@ -883,7 +883,7 @@ Only a subset of keywords may be used on the lines following a Match keyword. Av "securitykeyprovider": { Documentation: `Specifies a path to a library that will be used when loading FIDO authenticator-hosted keys, overriding the default of using the built-in USB HID support.`, Value: docvalues.PathValue{ - IsOptional: false, + IsOptional: false, RequiredType: docvalues.PathTypeFile, }, }, diff --git a/server/handlers/sshd_config/lsp/text-document-completion.go b/server/handlers/sshd_config/lsp/text-document-completion.go index b4ead50..72a9a38 100644 --- a/server/handlers/sshd_config/lsp/text-document-completion.go +++ b/server/handlers/sshd_config/lsp/text-document-completion.go @@ -24,7 +24,6 @@ func TextDocumentCompletion(context *glsp.Context, params *protocol.CompletionPa entry, matchBlock := d.Config.FindOption(line) - if entry == nil || entry.Separator == nil || entry.Key == nil || diff --git a/server/utils/common.go b/server/utils/common.go index ba45c9c..e676ba0 100644 --- a/server/utils/common.go +++ b/server/utils/common.go @@ -1,6 +1,8 @@ package utils import ( + "errors" + "fmt" "os" ) @@ -13,11 +15,21 @@ func DoesPathExist(path string) bool { func IsPathDirectory(path string) bool { info, err := os.Stat(path) - return err == nil && info.IsDir() + if err != nil { + return false + } + + return info.IsDir() } func IsPathFile(path string) bool { - info, err := os.Stat(path) + _, err := os.Stat(path) - return err == nil && !info.IsDir() + print(fmt.Sprintf("Checking if path %s is a file: %v\n", path, err)) + + if errors.Is(err, os.ErrNotExist) { + return false + } + + return true } From 3c9ee9da53173b27d3f2d8bdc6e83aedf9278476 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 18:02:17 +0200 Subject: [PATCH 05/14] fix(server): Update version; Small fixes Signed-off-by: Myzel394 --- flake.lock | 12 ++++++------ flake.nix | 12 ++++++------ server/root-handler/common.go | 2 +- vs-code-extension/package.json | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/flake.lock b/flake.lock index 35d34f1..ec4995b 100644 --- a/flake.lock +++ b/flake.lock @@ -26,11 +26,11 @@ ] }, "locked": { - "lastModified": 1745875161, - "narHash": "sha256-0YkWCS13jpoo3+sX/3kcgdxBNt1VZTmvF+FhZb4rFKI=", + "lastModified": 1742209644, + "narHash": "sha256-jMy1XqXqD0/tJprEbUmKilTkvbDY/C0ZGSsJJH4TNCE=", "owner": "tweag", "repo": "gomod2nix", - "rev": "2cbd7fdd6eeab65c494cc426e18f4e4d2a5e35c0", + "rev": "8f3534eb8f6c5c3fce799376dc3b91bae6b11884", "type": "github" }, "original": { @@ -41,11 +41,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1748370509, - "narHash": "sha256-QlL8slIgc16W5UaI3w7xHQEP+Qmv/6vSNTpoZrrSlbk=", + "lastModified": 1742669843, + "narHash": "sha256-G5n+FOXLXcRx+3hCJ6Rt6ZQyF1zqQ0DL0sWAMn2Nk0w=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4faa5f5321320e49a78ae7848582f684d64783e9", + "rev": "1e5b653dff12029333a6546c11e108ede13052eb", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a0158d2..8b05f9a 100644 --- a/flake.nix +++ b/flake.nix @@ -23,26 +23,26 @@ "aarch64-windows" ] (system: let - version = "0.2.1"; # CI:CD-VERSION + version = "0.2.2"; # CI:CD-VERSION pkgs = import nixpkgs { inherit system; overlays = [ (final: prev: { - go = prev.go_1_24; - buildGoModule = prev.buildGo124Module; + go = prev.go_1_22; + buildGoModule = prev.buildGo122Module; }) gomod2nix.overlays.default ]; }; inputs = [ - pkgs.go_1_24 + pkgs.go_1_22 ]; serverUncompressed = pkgs.buildGoModule { nativeBuildInputs = inputs; pname = "github.com/Myzel394/config-lsp"; version = version; src = ./server; - vendorHash = "sha256-ttr45N8i86mSJX9Scy/Cf+YlxU5wAKMVb0YhKg28JKM="; + vendorHash = "sha256-kfWB99unxBmDVseOt9LmFBVSE3DBS5969M5oZJMlAAQ="; ldflags = [ "-s" "-w" ]; checkPhase = '' go test -v $(pwd)/... @@ -133,7 +133,7 @@ }; devShells.default = let - version = "0.18.1"; + version = "0.16.2"; ourGopls = pkgs.buildGoModule { pname = "gopls"; inherit version; diff --git a/server/root-handler/common.go b/server/root-handler/common.go index a6fea7a..f2841df 100644 --- a/server/root-handler/common.go +++ b/server/root-handler/common.go @@ -2,4 +2,4 @@ package roothandler // The comment below at the end of the line is required for the CI:CD to work. // Do not remove it -var Version = "0.2.1" // CI:CD-VERSION +var Version = "0.2.2" // CI:CD-VERSION diff --git a/vs-code-extension/package.json b/vs-code-extension/package.json index 1cf4393..b45df48 100644 --- a/vs-code-extension/package.json +++ b/vs-code-extension/package.json @@ -2,7 +2,7 @@ "name": "config-lsp", "description": "Language Features (completions, diagnostics, etc.) for your config files: gitconfig, fstab, aliases, hosts, wireguard, ssh_config, sshd_config, and more to come!", "author": "Myzel394", - "version": "0.2.1", + "version": "0.2.2", "repository": { "type": "git", "url": "https://github.com/Myzel394/config-lsp" From c578b4b448818ab078b88cd5bae2f6f2365972da Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 19:12:01 +0200 Subject: [PATCH 06/14] chore(server): Update go version Signed-off-by: Myzel394 --- flake.nix | 8 ++++---- server/go.mod | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index 8b05f9a..e55fba1 100644 --- a/flake.nix +++ b/flake.nix @@ -28,21 +28,21 @@ inherit system; overlays = [ (final: prev: { - go = prev.go_1_22; - buildGoModule = prev.buildGo122Module; + go = prev.go_1_24; + buildGoModule = prev.buildGo124Module; }) gomod2nix.overlays.default ]; }; inputs = [ - pkgs.go_1_22 + pkgs.go_1_24 ]; serverUncompressed = pkgs.buildGoModule { nativeBuildInputs = inputs; pname = "github.com/Myzel394/config-lsp"; version = version; src = ./server; - vendorHash = "sha256-kfWB99unxBmDVseOt9LmFBVSE3DBS5969M5oZJMlAAQ="; + vendorHash = "sha256-ttr45N8i86mSJX9Scy/Cf+YlxU5wAKMVb0YhKg28JKM="; ldflags = [ "-s" "-w" ]; checkPhase = '' go test -v $(pwd)/... diff --git a/server/go.mod b/server/go.mod index ba46ef0..dce457d 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,6 +1,6 @@ module config-lsp -go 1.22.5 +go 1.24 require ( github.com/antlr4-go/antlr/v4 v4.13.1 From d10655996fc1616336f34fa91e3c0e0464b59099 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 19:45:35 +0200 Subject: [PATCH 07/14] chore(server): Update antlr parsers Signed-off-by: Myzel394 --- server/go.mod | 2 +- .../ast/parser/aliases_base_listener.go | 2 +- .../aliases/ast/parser/aliases_lexer.go | 2 +- .../aliases/ast/parser/aliases_listener.go | 2 +- .../aliases/ast/parser/aliases_parser.go | 2 +- server/handlers/fstab/ast/parser/Fstab.interp | 10 +-- server/handlers/fstab/ast/parser/Fstab.tokens | 4 - .../fstab/ast/parser/FstabLexer.interp | 14 +--- .../fstab/ast/parser/FstabLexer.tokens | 4 - .../fstab/ast/parser/fstab_base_listener.go | 2 +- .../handlers/fstab/ast/parser/fstab_lexer.go | 69 ++++++----------- .../fstab/ast/parser/fstab_listener.go | 2 +- .../handlers/fstab/ast/parser/fstab_parser.go | 77 +++++++------------ .../hosts/ast/parser/hosts_base_listener.go | 2 +- .../handlers/hosts/ast/parser/hosts_lexer.go | 2 +- .../hosts/ast/parser/hosts_listener.go | 2 +- .../handlers/hosts/ast/parser/hosts_parser.go | 2 +- .../ast/parser/config_base_listener.go | 2 +- .../ssh_config/ast/parser/config_lexer.go | 2 +- .../ssh_config/ast/parser/config_listener.go | 2 +- .../ssh_config/ast/parser/config_parser.go | 2 +- .../parser/match_base_listener.go | 2 +- .../match-parser/parser/match_lexer.go | 2 +- .../match-parser/parser/match_listener.go | 2 +- .../match-parser/parser/match_parser.go | 2 +- .../ast/parser/config_base_listener.go | 2 +- .../sshd_config/ast/parser/config_lexer.go | 2 +- .../sshd_config/ast/parser/config_listener.go | 2 +- .../sshd_config/ast/parser/config_parser.go | 2 +- .../parser/match_base_listener.go | 2 +- .../match-parser/parser/match_lexer.go | 2 +- .../match-parser/parser/match_listener.go | 2 +- .../match-parser/parser/match_parser.go | 2 +- 33 files changed, 79 insertions(+), 153 deletions(-) diff --git a/server/go.mod b/server/go.mod index dce457d..ba46ef0 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,6 +1,6 @@ module config-lsp -go 1.24 +go 1.22.5 require ( github.com/antlr4-go/antlr/v4 v4.13.1 diff --git a/server/handlers/aliases/ast/parser/aliases_base_listener.go b/server/handlers/aliases/ast/parser/aliases_base_listener.go index 6818fb1..eb02085 100644 --- a/server/handlers/aliases/ast/parser/aliases_base_listener.go +++ b/server/handlers/aliases/ast/parser/aliases_base_listener.go @@ -1,4 +1,4 @@ -// Code generated from Aliases.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Aliases.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Aliases diff --git a/server/handlers/aliases/ast/parser/aliases_lexer.go b/server/handlers/aliases/ast/parser/aliases_lexer.go index 3c0522b..a0a3824 100644 --- a/server/handlers/aliases/ast/parser/aliases_lexer.go +++ b/server/handlers/aliases/ast/parser/aliases_lexer.go @@ -1,4 +1,4 @@ -// Code generated from Aliases.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Aliases.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser diff --git a/server/handlers/aliases/ast/parser/aliases_listener.go b/server/handlers/aliases/ast/parser/aliases_listener.go index 69e142a..bde88ab 100644 --- a/server/handlers/aliases/ast/parser/aliases_listener.go +++ b/server/handlers/aliases/ast/parser/aliases_listener.go @@ -1,4 +1,4 @@ -// Code generated from Aliases.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Aliases.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Aliases diff --git a/server/handlers/aliases/ast/parser/aliases_parser.go b/server/handlers/aliases/ast/parser/aliases_parser.go index 62919e8..d762253 100644 --- a/server/handlers/aliases/ast/parser/aliases_parser.go +++ b/server/handlers/aliases/ast/parser/aliases_parser.go @@ -1,4 +1,4 @@ -// Code generated from Aliases.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Aliases.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Aliases diff --git a/server/handlers/fstab/ast/parser/Fstab.interp b/server/handlers/fstab/ast/parser/Fstab.interp index eae0ba8..e1a1f02 100644 --- a/server/handlers/fstab/ast/parser/Fstab.interp +++ b/server/handlers/fstab/ast/parser/Fstab.interp @@ -5,10 +5,6 @@ null '#' null null -null -null -null -null token symbolic names: null @@ -17,10 +13,6 @@ WHITESPACE HASH STRING QUOTED_STRING -ADFS -AFFS -BTRFS -EXFAT rule names: entry @@ -33,4 +25,4 @@ pass atn: -[4, 1, 9, 68, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 3, 0, 16, 8, 0, 1, 0, 3, 0, 19, 8, 0, 1, 0, 3, 0, 22, 8, 0, 1, 0, 3, 0, 25, 8, 0, 1, 0, 3, 0, 28, 8, 0, 1, 0, 3, 0, 31, 8, 0, 1, 0, 3, 0, 34, 8, 0, 1, 0, 3, 0, 37, 8, 0, 1, 0, 3, 0, 40, 8, 0, 1, 0, 3, 0, 43, 8, 0, 1, 0, 3, 0, 46, 8, 0, 1, 0, 3, 0, 49, 8, 0, 1, 0, 3, 0, 52, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 0, 0, 7, 0, 2, 4, 6, 8, 10, 12, 0, 2, 1, 0, 4, 5, 1, 0, 4, 9, 73, 0, 15, 1, 0, 0, 0, 2, 55, 1, 0, 0, 0, 4, 57, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 61, 1, 0, 0, 0, 10, 63, 1, 0, 0, 0, 12, 65, 1, 0, 0, 0, 14, 16, 5, 2, 0, 0, 15, 14, 1, 0, 0, 0, 15, 16, 1, 0, 0, 0, 16, 18, 1, 0, 0, 0, 17, 19, 3, 2, 1, 0, 18, 17, 1, 0, 0, 0, 18, 19, 1, 0, 0, 0, 19, 21, 1, 0, 0, 0, 20, 22, 5, 2, 0, 0, 21, 20, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 24, 1, 0, 0, 0, 23, 25, 3, 4, 2, 0, 24, 23, 1, 0, 0, 0, 24, 25, 1, 0, 0, 0, 25, 27, 1, 0, 0, 0, 26, 28, 5, 2, 0, 0, 27, 26, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 30, 1, 0, 0, 0, 29, 31, 3, 6, 3, 0, 30, 29, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 33, 1, 0, 0, 0, 32, 34, 5, 2, 0, 0, 33, 32, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 36, 1, 0, 0, 0, 35, 37, 3, 8, 4, 0, 36, 35, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 40, 5, 2, 0, 0, 39, 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, 1, 0, 0, 0, 41, 43, 3, 10, 5, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 45, 1, 0, 0, 0, 44, 46, 5, 2, 0, 0, 45, 44, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 49, 3, 12, 6, 0, 48, 47, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 52, 5, 2, 0, 0, 51, 50, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 54, 5, 0, 0, 1, 54, 1, 1, 0, 0, 0, 55, 56, 7, 0, 0, 0, 56, 3, 1, 0, 0, 0, 57, 58, 7, 0, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 7, 1, 0, 0, 60, 7, 1, 0, 0, 0, 61, 62, 7, 0, 0, 0, 62, 9, 1, 0, 0, 0, 63, 64, 5, 1, 0, 0, 64, 11, 1, 0, 0, 0, 65, 66, 5, 1, 0, 0, 66, 13, 1, 0, 0, 0, 13, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51] \ No newline at end of file +[4, 1, 5, 68, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 3, 0, 16, 8, 0, 1, 0, 3, 0, 19, 8, 0, 1, 0, 3, 0, 22, 8, 0, 1, 0, 3, 0, 25, 8, 0, 1, 0, 3, 0, 28, 8, 0, 1, 0, 3, 0, 31, 8, 0, 1, 0, 3, 0, 34, 8, 0, 1, 0, 3, 0, 37, 8, 0, 1, 0, 3, 0, 40, 8, 0, 1, 0, 3, 0, 43, 8, 0, 1, 0, 3, 0, 46, 8, 0, 1, 0, 3, 0, 49, 8, 0, 1, 0, 3, 0, 52, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 0, 0, 7, 0, 2, 4, 6, 8, 10, 12, 0, 1, 1, 0, 4, 5, 73, 0, 15, 1, 0, 0, 0, 2, 55, 1, 0, 0, 0, 4, 57, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 61, 1, 0, 0, 0, 10, 63, 1, 0, 0, 0, 12, 65, 1, 0, 0, 0, 14, 16, 5, 2, 0, 0, 15, 14, 1, 0, 0, 0, 15, 16, 1, 0, 0, 0, 16, 18, 1, 0, 0, 0, 17, 19, 3, 2, 1, 0, 18, 17, 1, 0, 0, 0, 18, 19, 1, 0, 0, 0, 19, 21, 1, 0, 0, 0, 20, 22, 5, 2, 0, 0, 21, 20, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 24, 1, 0, 0, 0, 23, 25, 3, 4, 2, 0, 24, 23, 1, 0, 0, 0, 24, 25, 1, 0, 0, 0, 25, 27, 1, 0, 0, 0, 26, 28, 5, 2, 0, 0, 27, 26, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 30, 1, 0, 0, 0, 29, 31, 3, 6, 3, 0, 30, 29, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 33, 1, 0, 0, 0, 32, 34, 5, 2, 0, 0, 33, 32, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 36, 1, 0, 0, 0, 35, 37, 3, 8, 4, 0, 36, 35, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, 0, 38, 40, 5, 2, 0, 0, 39, 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, 1, 0, 0, 0, 41, 43, 3, 10, 5, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, 43, 45, 1, 0, 0, 0, 44, 46, 5, 2, 0, 0, 45, 44, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 49, 3, 12, 6, 0, 48, 47, 1, 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 52, 5, 2, 0, 0, 51, 50, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 54, 5, 0, 0, 1, 54, 1, 1, 0, 0, 0, 55, 56, 7, 0, 0, 0, 56, 3, 1, 0, 0, 0, 57, 58, 7, 0, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 7, 0, 0, 0, 60, 7, 1, 0, 0, 0, 61, 62, 7, 0, 0, 0, 62, 9, 1, 0, 0, 0, 63, 64, 5, 1, 0, 0, 64, 11, 1, 0, 0, 0, 65, 66, 5, 1, 0, 0, 66, 13, 1, 0, 0, 0, 13, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51] \ No newline at end of file diff --git a/server/handlers/fstab/ast/parser/Fstab.tokens b/server/handlers/fstab/ast/parser/Fstab.tokens index 9584238..b662895 100644 --- a/server/handlers/fstab/ast/parser/Fstab.tokens +++ b/server/handlers/fstab/ast/parser/Fstab.tokens @@ -3,8 +3,4 @@ WHITESPACE=2 HASH=3 STRING=4 QUOTED_STRING=5 -ADFS=6 -AFFS=7 -BTRFS=8 -EXFAT=9 '#'=3 diff --git a/server/handlers/fstab/ast/parser/FstabLexer.interp b/server/handlers/fstab/ast/parser/FstabLexer.interp index 51b46ca..929374e 100644 --- a/server/handlers/fstab/ast/parser/FstabLexer.interp +++ b/server/handlers/fstab/ast/parser/FstabLexer.interp @@ -5,10 +5,6 @@ null '#' null null -null -null -null -null token symbolic names: null @@ -17,10 +13,6 @@ WHITESPACE HASH STRING QUOTED_STRING -ADFS -AFFS -BTRFS -EXFAT rule names: DIGITS @@ -28,10 +20,6 @@ WHITESPACE HASH STRING QUOTED_STRING -ADFS -AFFS -BTRFS -EXFAT channel names: DEFAULT_TOKEN_CHANNEL @@ -41,4 +29,4 @@ mode names: DEFAULT_MODE atn: -[4, 0, 9, 76, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 1, 0, 4, 0, 21, 8, 0, 11, 0, 12, 0, 22, 1, 1, 4, 1, 26, 8, 1, 11, 1, 12, 1, 27, 1, 2, 1, 2, 1, 3, 4, 3, 33, 8, 3, 11, 3, 12, 3, 34, 1, 4, 1, 4, 3, 4, 39, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 44, 8, 4, 10, 4, 12, 4, 47, 9, 4, 1, 4, 3, 4, 50, 8, 4, 1, 4, 3, 4, 53, 8, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 1, 8, 0, 0, 9, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, 8, 17, 9, 1, 0, 12, 1, 0, 48, 57, 2, 0, 9, 9, 32, 32, 3, 0, 9, 9, 32, 32, 35, 35, 2, 0, 65, 65, 97, 97, 2, 0, 68, 68, 100, 100, 2, 0, 70, 70, 102, 102, 2, 0, 83, 83, 115, 115, 2, 0, 66, 66, 98, 98, 2, 0, 84, 84, 116, 116, 2, 0, 82, 82, 114, 114, 2, 0, 69, 69, 101, 101, 2, 0, 88, 88, 120, 120, 82, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, 0, 0, 0, 17, 1, 0, 0, 0, 1, 20, 1, 0, 0, 0, 3, 25, 1, 0, 0, 0, 5, 29, 1, 0, 0, 0, 7, 32, 1, 0, 0, 0, 9, 36, 1, 0, 0, 0, 11, 54, 1, 0, 0, 0, 13, 59, 1, 0, 0, 0, 15, 64, 1, 0, 0, 0, 17, 70, 1, 0, 0, 0, 19, 21, 7, 0, 0, 0, 20, 19, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 22, 23, 1, 0, 0, 0, 23, 2, 1, 0, 0, 0, 24, 26, 7, 1, 0, 0, 25, 24, 1, 0, 0, 0, 26, 27, 1, 0, 0, 0, 27, 25, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 4, 1, 0, 0, 0, 29, 30, 5, 35, 0, 0, 30, 6, 1, 0, 0, 0, 31, 33, 8, 2, 0, 0, 32, 31, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 32, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, 35, 8, 1, 0, 0, 0, 36, 38, 5, 34, 0, 0, 37, 39, 3, 3, 1, 0, 38, 37, 1, 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 45, 1, 0, 0, 0, 40, 41, 3, 7, 3, 0, 41, 42, 3, 3, 1, 0, 42, 44, 1, 0, 0, 0, 43, 40, 1, 0, 0, 0, 44, 47, 1, 0, 0, 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 49, 1, 0, 0, 0, 47, 45, 1, 0, 0, 0, 48, 50, 3, 7, 3, 0, 49, 48, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, 50, 52, 1, 0, 0, 0, 51, 53, 5, 34, 0, 0, 52, 51, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 10, 1, 0, 0, 0, 54, 55, 7, 3, 0, 0, 55, 56, 7, 4, 0, 0, 56, 57, 7, 5, 0, 0, 57, 58, 7, 6, 0, 0, 58, 12, 1, 0, 0, 0, 59, 60, 7, 3, 0, 0, 60, 61, 7, 5, 0, 0, 61, 62, 7, 5, 0, 0, 62, 63, 7, 6, 0, 0, 63, 14, 1, 0, 0, 0, 64, 65, 7, 7, 0, 0, 65, 66, 7, 8, 0, 0, 66, 67, 7, 9, 0, 0, 67, 68, 7, 5, 0, 0, 68, 69, 7, 6, 0, 0, 69, 16, 1, 0, 0, 0, 70, 71, 7, 10, 0, 0, 71, 72, 7, 11, 0, 0, 72, 73, 7, 5, 0, 0, 73, 74, 7, 3, 0, 0, 74, 75, 7, 8, 0, 0, 75, 18, 1, 0, 0, 0, 8, 0, 22, 27, 34, 38, 45, 49, 52, 0] \ No newline at end of file +[4, 0, 5, 46, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 1, 0, 4, 0, 13, 8, 0, 11, 0, 12, 0, 14, 1, 1, 4, 1, 18, 8, 1, 11, 1, 12, 1, 19, 1, 2, 1, 2, 1, 3, 4, 3, 25, 8, 3, 11, 3, 12, 3, 26, 1, 4, 1, 4, 3, 4, 31, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 36, 8, 4, 10, 4, 12, 4, 39, 9, 4, 1, 4, 3, 4, 42, 8, 4, 1, 4, 3, 4, 45, 8, 4, 0, 0, 5, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 1, 0, 3, 1, 0, 48, 57, 2, 0, 9, 9, 32, 32, 3, 0, 9, 9, 32, 32, 35, 35, 52, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 1, 12, 1, 0, 0, 0, 3, 17, 1, 0, 0, 0, 5, 21, 1, 0, 0, 0, 7, 24, 1, 0, 0, 0, 9, 28, 1, 0, 0, 0, 11, 13, 7, 0, 0, 0, 12, 11, 1, 0, 0, 0, 13, 14, 1, 0, 0, 0, 14, 12, 1, 0, 0, 0, 14, 15, 1, 0, 0, 0, 15, 2, 1, 0, 0, 0, 16, 18, 7, 1, 0, 0, 17, 16, 1, 0, 0, 0, 18, 19, 1, 0, 0, 0, 19, 17, 1, 0, 0, 0, 19, 20, 1, 0, 0, 0, 20, 4, 1, 0, 0, 0, 21, 22, 5, 35, 0, 0, 22, 6, 1, 0, 0, 0, 23, 25, 8, 2, 0, 0, 24, 23, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 24, 1, 0, 0, 0, 26, 27, 1, 0, 0, 0, 27, 8, 1, 0, 0, 0, 28, 30, 5, 34, 0, 0, 29, 31, 3, 3, 1, 0, 30, 29, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 37, 1, 0, 0, 0, 32, 33, 3, 7, 3, 0, 33, 34, 3, 3, 1, 0, 34, 36, 1, 0, 0, 0, 35, 32, 1, 0, 0, 0, 36, 39, 1, 0, 0, 0, 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, 39, 37, 1, 0, 0, 0, 40, 42, 3, 7, 3, 0, 41, 40, 1, 0, 0, 0, 41, 42, 1, 0, 0, 0, 42, 44, 1, 0, 0, 0, 43, 45, 5, 34, 0, 0, 44, 43, 1, 0, 0, 0, 44, 45, 1, 0, 0, 0, 45, 10, 1, 0, 0, 0, 8, 0, 14, 19, 26, 30, 37, 41, 44, 0] \ No newline at end of file diff --git a/server/handlers/fstab/ast/parser/FstabLexer.tokens b/server/handlers/fstab/ast/parser/FstabLexer.tokens index 9584238..b662895 100644 --- a/server/handlers/fstab/ast/parser/FstabLexer.tokens +++ b/server/handlers/fstab/ast/parser/FstabLexer.tokens @@ -3,8 +3,4 @@ WHITESPACE=2 HASH=3 STRING=4 QUOTED_STRING=5 -ADFS=6 -AFFS=7 -BTRFS=8 -EXFAT=9 '#'=3 diff --git a/server/handlers/fstab/ast/parser/fstab_base_listener.go b/server/handlers/fstab/ast/parser/fstab_base_listener.go index 0578f75..4db867e 100644 --- a/server/handlers/fstab/ast/parser/fstab_base_listener.go +++ b/server/handlers/fstab/ast/parser/fstab_base_listener.go @@ -1,4 +1,4 @@ -// Code generated from Fstab.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Fstab.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Fstab diff --git a/server/handlers/fstab/ast/parser/fstab_lexer.go b/server/handlers/fstab/ast/parser/fstab_lexer.go index abac890..7cac58c 100644 --- a/server/handlers/fstab/ast/parser/fstab_lexer.go +++ b/server/handlers/fstab/ast/parser/fstab_lexer.go @@ -1,4 +1,4 @@ -// Code generated from Fstab.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Fstab.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser @@ -46,51 +46,34 @@ func fstablexerLexerInit() { "", "", "", "'#'", } staticData.SymbolicNames = []string{ - "", "DIGITS", "WHITESPACE", "HASH", "STRING", "QUOTED_STRING", "ADFS", - "AFFS", "BTRFS", "EXFAT", + "", "DIGITS", "WHITESPACE", "HASH", "STRING", "QUOTED_STRING", } staticData.RuleNames = []string{ - "DIGITS", "WHITESPACE", "HASH", "STRING", "QUOTED_STRING", "ADFS", "AFFS", - "BTRFS", "EXFAT", + "DIGITS", "WHITESPACE", "HASH", "STRING", "QUOTED_STRING", } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 0, 9, 76, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, - 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 2, 7, 7, 7, 2, 8, 7, 8, 1, 0, 4, 0, 21, - 8, 0, 11, 0, 12, 0, 22, 1, 1, 4, 1, 26, 8, 1, 11, 1, 12, 1, 27, 1, 2, 1, - 2, 1, 3, 4, 3, 33, 8, 3, 11, 3, 12, 3, 34, 1, 4, 1, 4, 3, 4, 39, 8, 4, - 1, 4, 1, 4, 1, 4, 5, 4, 44, 8, 4, 10, 4, 12, 4, 47, 9, 4, 1, 4, 3, 4, 50, - 8, 4, 1, 4, 3, 4, 53, 8, 4, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 6, 1, 6, 1, - 6, 1, 6, 1, 6, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 7, 1, 8, 1, 8, 1, 8, 1, - 8, 1, 8, 1, 8, 0, 0, 9, 1, 1, 3, 2, 5, 3, 7, 4, 9, 5, 11, 6, 13, 7, 15, - 8, 17, 9, 1, 0, 12, 1, 0, 48, 57, 2, 0, 9, 9, 32, 32, 3, 0, 9, 9, 32, 32, - 35, 35, 2, 0, 65, 65, 97, 97, 2, 0, 68, 68, 100, 100, 2, 0, 70, 70, 102, - 102, 2, 0, 83, 83, 115, 115, 2, 0, 66, 66, 98, 98, 2, 0, 84, 84, 116, 116, - 2, 0, 82, 82, 114, 114, 2, 0, 69, 69, 101, 101, 2, 0, 88, 88, 120, 120, - 82, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, 0, 0, 0, 7, 1, 0, 0, - 0, 0, 9, 1, 0, 0, 0, 0, 11, 1, 0, 0, 0, 0, 13, 1, 0, 0, 0, 0, 15, 1, 0, - 0, 0, 0, 17, 1, 0, 0, 0, 1, 20, 1, 0, 0, 0, 3, 25, 1, 0, 0, 0, 5, 29, 1, - 0, 0, 0, 7, 32, 1, 0, 0, 0, 9, 36, 1, 0, 0, 0, 11, 54, 1, 0, 0, 0, 13, - 59, 1, 0, 0, 0, 15, 64, 1, 0, 0, 0, 17, 70, 1, 0, 0, 0, 19, 21, 7, 0, 0, - 0, 20, 19, 1, 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 20, 1, 0, 0, 0, 22, 23, - 1, 0, 0, 0, 23, 2, 1, 0, 0, 0, 24, 26, 7, 1, 0, 0, 25, 24, 1, 0, 0, 0, - 26, 27, 1, 0, 0, 0, 27, 25, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 4, 1, 0, - 0, 0, 29, 30, 5, 35, 0, 0, 30, 6, 1, 0, 0, 0, 31, 33, 8, 2, 0, 0, 32, 31, - 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 32, 1, 0, 0, 0, 34, 35, 1, 0, 0, 0, - 35, 8, 1, 0, 0, 0, 36, 38, 5, 34, 0, 0, 37, 39, 3, 3, 1, 0, 38, 37, 1, - 0, 0, 0, 38, 39, 1, 0, 0, 0, 39, 45, 1, 0, 0, 0, 40, 41, 3, 7, 3, 0, 41, - 42, 3, 3, 1, 0, 42, 44, 1, 0, 0, 0, 43, 40, 1, 0, 0, 0, 44, 47, 1, 0, 0, - 0, 45, 43, 1, 0, 0, 0, 45, 46, 1, 0, 0, 0, 46, 49, 1, 0, 0, 0, 47, 45, - 1, 0, 0, 0, 48, 50, 3, 7, 3, 0, 49, 48, 1, 0, 0, 0, 49, 50, 1, 0, 0, 0, - 50, 52, 1, 0, 0, 0, 51, 53, 5, 34, 0, 0, 52, 51, 1, 0, 0, 0, 52, 53, 1, - 0, 0, 0, 53, 10, 1, 0, 0, 0, 54, 55, 7, 3, 0, 0, 55, 56, 7, 4, 0, 0, 56, - 57, 7, 5, 0, 0, 57, 58, 7, 6, 0, 0, 58, 12, 1, 0, 0, 0, 59, 60, 7, 3, 0, - 0, 60, 61, 7, 5, 0, 0, 61, 62, 7, 5, 0, 0, 62, 63, 7, 6, 0, 0, 63, 14, - 1, 0, 0, 0, 64, 65, 7, 7, 0, 0, 65, 66, 7, 8, 0, 0, 66, 67, 7, 9, 0, 0, - 67, 68, 7, 5, 0, 0, 68, 69, 7, 6, 0, 0, 69, 16, 1, 0, 0, 0, 70, 71, 7, - 10, 0, 0, 71, 72, 7, 11, 0, 0, 72, 73, 7, 5, 0, 0, 73, 74, 7, 3, 0, 0, - 74, 75, 7, 8, 0, 0, 75, 18, 1, 0, 0, 0, 8, 0, 22, 27, 34, 38, 45, 49, 52, - 0, + 4, 0, 5, 46, 6, -1, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, + 4, 7, 4, 1, 0, 4, 0, 13, 8, 0, 11, 0, 12, 0, 14, 1, 1, 4, 1, 18, 8, 1, + 11, 1, 12, 1, 19, 1, 2, 1, 2, 1, 3, 4, 3, 25, 8, 3, 11, 3, 12, 3, 26, 1, + 4, 1, 4, 3, 4, 31, 8, 4, 1, 4, 1, 4, 1, 4, 5, 4, 36, 8, 4, 10, 4, 12, 4, + 39, 9, 4, 1, 4, 3, 4, 42, 8, 4, 1, 4, 3, 4, 45, 8, 4, 0, 0, 5, 1, 1, 3, + 2, 5, 3, 7, 4, 9, 5, 1, 0, 3, 1, 0, 48, 57, 2, 0, 9, 9, 32, 32, 3, 0, 9, + 9, 32, 32, 35, 35, 52, 0, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 0, 0, 5, 1, 0, + 0, 0, 0, 7, 1, 0, 0, 0, 0, 9, 1, 0, 0, 0, 1, 12, 1, 0, 0, 0, 3, 17, 1, + 0, 0, 0, 5, 21, 1, 0, 0, 0, 7, 24, 1, 0, 0, 0, 9, 28, 1, 0, 0, 0, 11, 13, + 7, 0, 0, 0, 12, 11, 1, 0, 0, 0, 13, 14, 1, 0, 0, 0, 14, 12, 1, 0, 0, 0, + 14, 15, 1, 0, 0, 0, 15, 2, 1, 0, 0, 0, 16, 18, 7, 1, 0, 0, 17, 16, 1, 0, + 0, 0, 18, 19, 1, 0, 0, 0, 19, 17, 1, 0, 0, 0, 19, 20, 1, 0, 0, 0, 20, 4, + 1, 0, 0, 0, 21, 22, 5, 35, 0, 0, 22, 6, 1, 0, 0, 0, 23, 25, 8, 2, 0, 0, + 24, 23, 1, 0, 0, 0, 25, 26, 1, 0, 0, 0, 26, 24, 1, 0, 0, 0, 26, 27, 1, + 0, 0, 0, 27, 8, 1, 0, 0, 0, 28, 30, 5, 34, 0, 0, 29, 31, 3, 3, 1, 0, 30, + 29, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 37, 1, 0, 0, 0, 32, 33, 3, 7, 3, + 0, 33, 34, 3, 3, 1, 0, 34, 36, 1, 0, 0, 0, 35, 32, 1, 0, 0, 0, 36, 39, + 1, 0, 0, 0, 37, 35, 1, 0, 0, 0, 37, 38, 1, 0, 0, 0, 38, 41, 1, 0, 0, 0, + 39, 37, 1, 0, 0, 0, 40, 42, 3, 7, 3, 0, 41, 40, 1, 0, 0, 0, 41, 42, 1, + 0, 0, 0, 42, 44, 1, 0, 0, 0, 43, 45, 5, 34, 0, 0, 44, 43, 1, 0, 0, 0, 44, + 45, 1, 0, 0, 0, 45, 10, 1, 0, 0, 0, 8, 0, 14, 19, 26, 30, 37, 41, 44, 0, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -136,8 +119,4 @@ const ( FstabLexerHASH = 3 FstabLexerSTRING = 4 FstabLexerQUOTED_STRING = 5 - FstabLexerADFS = 6 - FstabLexerAFFS = 7 - FstabLexerBTRFS = 8 - FstabLexerEXFAT = 9 ) diff --git a/server/handlers/fstab/ast/parser/fstab_listener.go b/server/handlers/fstab/ast/parser/fstab_listener.go index 730daae..792243e 100644 --- a/server/handlers/fstab/ast/parser/fstab_listener.go +++ b/server/handlers/fstab/ast/parser/fstab_listener.go @@ -1,4 +1,4 @@ -// Code generated from Fstab.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Fstab.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Fstab diff --git a/server/handlers/fstab/ast/parser/fstab_parser.go b/server/handlers/fstab/ast/parser/fstab_parser.go index 7cc9582..f866c80 100644 --- a/server/handlers/fstab/ast/parser/fstab_parser.go +++ b/server/handlers/fstab/ast/parser/fstab_parser.go @@ -1,4 +1,4 @@ -// Code generated from Fstab.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Fstab.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Fstab @@ -36,8 +36,7 @@ func fstabParserInit() { "", "", "", "'#'", } staticData.SymbolicNames = []string{ - "", "DIGITS", "WHITESPACE", "HASH", "STRING", "QUOTED_STRING", "ADFS", - "AFFS", "BTRFS", "EXFAT", + "", "DIGITS", "WHITESPACE", "HASH", "STRING", "QUOTED_STRING", } staticData.RuleNames = []string{ "entry", "spec", "mountPoint", "fileSystem", "mountOptions", "freq", @@ -45,35 +44,35 @@ func fstabParserInit() { } staticData.PredictionContextCache = antlr.NewPredictionContextCache() staticData.serializedATN = []int32{ - 4, 1, 9, 68, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, + 4, 1, 5, 68, 2, 0, 7, 0, 2, 1, 7, 1, 2, 2, 7, 2, 2, 3, 7, 3, 2, 4, 7, 4, 2, 5, 7, 5, 2, 6, 7, 6, 1, 0, 3, 0, 16, 8, 0, 1, 0, 3, 0, 19, 8, 0, 1, 0, 3, 0, 22, 8, 0, 1, 0, 3, 0, 25, 8, 0, 1, 0, 3, 0, 28, 8, 0, 1, 0, 3, 0, 31, 8, 0, 1, 0, 3, 0, 34, 8, 0, 1, 0, 3, 0, 37, 8, 0, 1, 0, 3, 0, 40, 8, 0, 1, 0, 3, 0, 43, 8, 0, 1, 0, 3, 0, 46, 8, 0, 1, 0, 3, 0, 49, 8, 0, 1, 0, 3, 0, 52, 8, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 1, 3, 1, 4, 1, 4, 1, 5, 1, 5, 1, 6, 1, 6, 1, 6, 0, 0, 7, 0, 2, 4, 6, 8, 10, 12, - 0, 2, 1, 0, 4, 5, 1, 0, 4, 9, 73, 0, 15, 1, 0, 0, 0, 2, 55, 1, 0, 0, 0, - 4, 57, 1, 0, 0, 0, 6, 59, 1, 0, 0, 0, 8, 61, 1, 0, 0, 0, 10, 63, 1, 0, - 0, 0, 12, 65, 1, 0, 0, 0, 14, 16, 5, 2, 0, 0, 15, 14, 1, 0, 0, 0, 15, 16, - 1, 0, 0, 0, 16, 18, 1, 0, 0, 0, 17, 19, 3, 2, 1, 0, 18, 17, 1, 0, 0, 0, - 18, 19, 1, 0, 0, 0, 19, 21, 1, 0, 0, 0, 20, 22, 5, 2, 0, 0, 21, 20, 1, - 0, 0, 0, 21, 22, 1, 0, 0, 0, 22, 24, 1, 0, 0, 0, 23, 25, 3, 4, 2, 0, 24, - 23, 1, 0, 0, 0, 24, 25, 1, 0, 0, 0, 25, 27, 1, 0, 0, 0, 26, 28, 5, 2, 0, - 0, 27, 26, 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 30, 1, 0, 0, 0, 29, 31, - 3, 6, 3, 0, 30, 29, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 33, 1, 0, 0, 0, - 32, 34, 5, 2, 0, 0, 33, 32, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 36, 1, - 0, 0, 0, 35, 37, 3, 8, 4, 0, 36, 35, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, - 39, 1, 0, 0, 0, 38, 40, 5, 2, 0, 0, 39, 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, - 0, 40, 42, 1, 0, 0, 0, 41, 43, 3, 10, 5, 0, 42, 41, 1, 0, 0, 0, 42, 43, - 1, 0, 0, 0, 43, 45, 1, 0, 0, 0, 44, 46, 5, 2, 0, 0, 45, 44, 1, 0, 0, 0, - 45, 46, 1, 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 49, 3, 12, 6, 0, 48, 47, 1, - 0, 0, 0, 48, 49, 1, 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 52, 5, 2, 0, 0, 51, - 50, 1, 0, 0, 0, 51, 52, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 54, 5, 0, 0, - 1, 54, 1, 1, 0, 0, 0, 55, 56, 7, 0, 0, 0, 56, 3, 1, 0, 0, 0, 57, 58, 7, - 0, 0, 0, 58, 5, 1, 0, 0, 0, 59, 60, 7, 1, 0, 0, 60, 7, 1, 0, 0, 0, 61, - 62, 7, 0, 0, 0, 62, 9, 1, 0, 0, 0, 63, 64, 5, 1, 0, 0, 64, 11, 1, 0, 0, - 0, 65, 66, 5, 1, 0, 0, 66, 13, 1, 0, 0, 0, 13, 15, 18, 21, 24, 27, 30, - 33, 36, 39, 42, 45, 48, 51, + 0, 1, 1, 0, 4, 5, 73, 0, 15, 1, 0, 0, 0, 2, 55, 1, 0, 0, 0, 4, 57, 1, 0, + 0, 0, 6, 59, 1, 0, 0, 0, 8, 61, 1, 0, 0, 0, 10, 63, 1, 0, 0, 0, 12, 65, + 1, 0, 0, 0, 14, 16, 5, 2, 0, 0, 15, 14, 1, 0, 0, 0, 15, 16, 1, 0, 0, 0, + 16, 18, 1, 0, 0, 0, 17, 19, 3, 2, 1, 0, 18, 17, 1, 0, 0, 0, 18, 19, 1, + 0, 0, 0, 19, 21, 1, 0, 0, 0, 20, 22, 5, 2, 0, 0, 21, 20, 1, 0, 0, 0, 21, + 22, 1, 0, 0, 0, 22, 24, 1, 0, 0, 0, 23, 25, 3, 4, 2, 0, 24, 23, 1, 0, 0, + 0, 24, 25, 1, 0, 0, 0, 25, 27, 1, 0, 0, 0, 26, 28, 5, 2, 0, 0, 27, 26, + 1, 0, 0, 0, 27, 28, 1, 0, 0, 0, 28, 30, 1, 0, 0, 0, 29, 31, 3, 6, 3, 0, + 30, 29, 1, 0, 0, 0, 30, 31, 1, 0, 0, 0, 31, 33, 1, 0, 0, 0, 32, 34, 5, + 2, 0, 0, 33, 32, 1, 0, 0, 0, 33, 34, 1, 0, 0, 0, 34, 36, 1, 0, 0, 0, 35, + 37, 3, 8, 4, 0, 36, 35, 1, 0, 0, 0, 36, 37, 1, 0, 0, 0, 37, 39, 1, 0, 0, + 0, 38, 40, 5, 2, 0, 0, 39, 38, 1, 0, 0, 0, 39, 40, 1, 0, 0, 0, 40, 42, + 1, 0, 0, 0, 41, 43, 3, 10, 5, 0, 42, 41, 1, 0, 0, 0, 42, 43, 1, 0, 0, 0, + 43, 45, 1, 0, 0, 0, 44, 46, 5, 2, 0, 0, 45, 44, 1, 0, 0, 0, 45, 46, 1, + 0, 0, 0, 46, 48, 1, 0, 0, 0, 47, 49, 3, 12, 6, 0, 48, 47, 1, 0, 0, 0, 48, + 49, 1, 0, 0, 0, 49, 51, 1, 0, 0, 0, 50, 52, 5, 2, 0, 0, 51, 50, 1, 0, 0, + 0, 51, 52, 1, 0, 0, 0, 52, 53, 1, 0, 0, 0, 53, 54, 5, 0, 0, 1, 54, 1, 1, + 0, 0, 0, 55, 56, 7, 0, 0, 0, 56, 3, 1, 0, 0, 0, 57, 58, 7, 0, 0, 0, 58, + 5, 1, 0, 0, 0, 59, 60, 7, 0, 0, 0, 60, 7, 1, 0, 0, 0, 61, 62, 7, 0, 0, + 0, 62, 9, 1, 0, 0, 0, 63, 64, 5, 1, 0, 0, 64, 11, 1, 0, 0, 0, 65, 66, 5, + 1, 0, 0, 66, 13, 1, 0, 0, 0, 13, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, + 45, 48, 51, } deserializer := antlr.NewATNDeserializer(nil) staticData.atn = deserializer.Deserialize(staticData.serializedATN) @@ -117,10 +116,6 @@ const ( FstabParserHASH = 3 FstabParserSTRING = 4 FstabParserQUOTED_STRING = 5 - FstabParserADFS = 6 - FstabParserAFFS = 7 - FstabParserBTRFS = 8 - FstabParserEXFAT = 9 ) // FstabParser rules. @@ -754,10 +749,6 @@ type IFileSystemContext interface { GetParser() antlr.Parser // Getter signatures - ADFS() antlr.TerminalNode - AFFS() antlr.TerminalNode - BTRFS() antlr.TerminalNode - EXFAT() antlr.TerminalNode STRING() antlr.TerminalNode QUOTED_STRING() antlr.TerminalNode @@ -797,22 +788,6 @@ func NewFileSystemContext(parser antlr.Parser, parent antlr.ParserRuleContext, i func (s *FileSystemContext) GetParser() antlr.Parser { return s.parser } -func (s *FileSystemContext) ADFS() antlr.TerminalNode { - return s.GetToken(FstabParserADFS, 0) -} - -func (s *FileSystemContext) AFFS() antlr.TerminalNode { - return s.GetToken(FstabParserAFFS, 0) -} - -func (s *FileSystemContext) BTRFS() antlr.TerminalNode { - return s.GetToken(FstabParserBTRFS, 0) -} - -func (s *FileSystemContext) EXFAT() antlr.TerminalNode { - return s.GetToken(FstabParserEXFAT, 0) -} - func (s *FileSystemContext) STRING() antlr.TerminalNode { return s.GetToken(FstabParserSTRING, 0) } @@ -851,7 +826,7 @@ func (p *FstabParser) FileSystem() (localctx IFileSystemContext) { p.SetState(59) _la = p.GetTokenStream().LA(1) - if !((int64(_la) & ^0x3f) == 0 && ((int64(1)<<_la)&1008) != 0) { + if !(_la == FstabParserSTRING || _la == FstabParserQUOTED_STRING) { p.GetErrorHandler().RecoverInline(p) } else { p.GetErrorHandler().ReportMatch(p) diff --git a/server/handlers/hosts/ast/parser/hosts_base_listener.go b/server/handlers/hosts/ast/parser/hosts_base_listener.go index d9ddba3..c66cb8f 100644 --- a/server/handlers/hosts/ast/parser/hosts_base_listener.go +++ b/server/handlers/hosts/ast/parser/hosts_base_listener.go @@ -1,4 +1,4 @@ -// Code generated from Hosts.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Hosts.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Hosts diff --git a/server/handlers/hosts/ast/parser/hosts_lexer.go b/server/handlers/hosts/ast/parser/hosts_lexer.go index 2540abe..34f8fb2 100644 --- a/server/handlers/hosts/ast/parser/hosts_lexer.go +++ b/server/handlers/hosts/ast/parser/hosts_lexer.go @@ -1,4 +1,4 @@ -// Code generated from Hosts.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Hosts.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser diff --git a/server/handlers/hosts/ast/parser/hosts_listener.go b/server/handlers/hosts/ast/parser/hosts_listener.go index 8e66aac..b9d6068 100644 --- a/server/handlers/hosts/ast/parser/hosts_listener.go +++ b/server/handlers/hosts/ast/parser/hosts_listener.go @@ -1,4 +1,4 @@ -// Code generated from Hosts.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Hosts.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Hosts diff --git a/server/handlers/hosts/ast/parser/hosts_parser.go b/server/handlers/hosts/ast/parser/hosts_parser.go index 5f6503e..f888f3d 100644 --- a/server/handlers/hosts/ast/parser/hosts_parser.go +++ b/server/handlers/hosts/ast/parser/hosts_parser.go @@ -1,4 +1,4 @@ -// Code generated from Hosts.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Hosts.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Hosts diff --git a/server/handlers/ssh_config/ast/parser/config_base_listener.go b/server/handlers/ssh_config/ast/parser/config_base_listener.go index 00e7840..3170dc5 100644 --- a/server/handlers/ssh_config/ast/parser/config_base_listener.go +++ b/server/handlers/ssh_config/ast/parser/config_base_listener.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Config diff --git a/server/handlers/ssh_config/ast/parser/config_lexer.go b/server/handlers/ssh_config/ast/parser/config_lexer.go index 021f1fc..04b7d3a 100644 --- a/server/handlers/ssh_config/ast/parser/config_lexer.go +++ b/server/handlers/ssh_config/ast/parser/config_lexer.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser diff --git a/server/handlers/ssh_config/ast/parser/config_listener.go b/server/handlers/ssh_config/ast/parser/config_listener.go index 1acf598..843cb39 100644 --- a/server/handlers/ssh_config/ast/parser/config_listener.go +++ b/server/handlers/ssh_config/ast/parser/config_listener.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Config diff --git a/server/handlers/ssh_config/ast/parser/config_parser.go b/server/handlers/ssh_config/ast/parser/config_parser.go index aefb1e3..69802a0 100644 --- a/server/handlers/ssh_config/ast/parser/config_parser.go +++ b/server/handlers/ssh_config/ast/parser/config_parser.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Config diff --git a/server/handlers/ssh_config/match-parser/parser/match_base_listener.go b/server/handlers/ssh_config/match-parser/parser/match_base_listener.go index 4577b95..dc1f6f5 100644 --- a/server/handlers/ssh_config/match-parser/parser/match_base_listener.go +++ b/server/handlers/ssh_config/match-parser/parser/match_base_listener.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Match diff --git a/server/handlers/ssh_config/match-parser/parser/match_lexer.go b/server/handlers/ssh_config/match-parser/parser/match_lexer.go index 2731726..ed9af85 100644 --- a/server/handlers/ssh_config/match-parser/parser/match_lexer.go +++ b/server/handlers/ssh_config/match-parser/parser/match_lexer.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser diff --git a/server/handlers/ssh_config/match-parser/parser/match_listener.go b/server/handlers/ssh_config/match-parser/parser/match_listener.go index fb7606c..85ee989 100644 --- a/server/handlers/ssh_config/match-parser/parser/match_listener.go +++ b/server/handlers/ssh_config/match-parser/parser/match_listener.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Match diff --git a/server/handlers/ssh_config/match-parser/parser/match_parser.go b/server/handlers/ssh_config/match-parser/parser/match_parser.go index 8d040fa..799ff4f 100644 --- a/server/handlers/ssh_config/match-parser/parser/match_parser.go +++ b/server/handlers/ssh_config/match-parser/parser/match_parser.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Match diff --git a/server/handlers/sshd_config/ast/parser/config_base_listener.go b/server/handlers/sshd_config/ast/parser/config_base_listener.go index 00e7840..3170dc5 100644 --- a/server/handlers/sshd_config/ast/parser/config_base_listener.go +++ b/server/handlers/sshd_config/ast/parser/config_base_listener.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Config diff --git a/server/handlers/sshd_config/ast/parser/config_lexer.go b/server/handlers/sshd_config/ast/parser/config_lexer.go index 021f1fc..04b7d3a 100644 --- a/server/handlers/sshd_config/ast/parser/config_lexer.go +++ b/server/handlers/sshd_config/ast/parser/config_lexer.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser diff --git a/server/handlers/sshd_config/ast/parser/config_listener.go b/server/handlers/sshd_config/ast/parser/config_listener.go index 1acf598..843cb39 100644 --- a/server/handlers/sshd_config/ast/parser/config_listener.go +++ b/server/handlers/sshd_config/ast/parser/config_listener.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Config diff --git a/server/handlers/sshd_config/ast/parser/config_parser.go b/server/handlers/sshd_config/ast/parser/config_parser.go index aefb1e3..69802a0 100644 --- a/server/handlers/sshd_config/ast/parser/config_parser.go +++ b/server/handlers/sshd_config/ast/parser/config_parser.go @@ -1,4 +1,4 @@ -// Code generated from Config.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Config.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Config diff --git a/server/handlers/sshd_config/match-parser/parser/match_base_listener.go b/server/handlers/sshd_config/match-parser/parser/match_base_listener.go index 85a1a79..41eb975 100644 --- a/server/handlers/sshd_config/match-parser/parser/match_base_listener.go +++ b/server/handlers/sshd_config/match-parser/parser/match_base_listener.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Match diff --git a/server/handlers/sshd_config/match-parser/parser/match_lexer.go b/server/handlers/sshd_config/match-parser/parser/match_lexer.go index 361c298..a3f46bd 100644 --- a/server/handlers/sshd_config/match-parser/parser/match_lexer.go +++ b/server/handlers/sshd_config/match-parser/parser/match_lexer.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser diff --git a/server/handlers/sshd_config/match-parser/parser/match_listener.go b/server/handlers/sshd_config/match-parser/parser/match_listener.go index 4adb71d..077bc86 100644 --- a/server/handlers/sshd_config/match-parser/parser/match_listener.go +++ b/server/handlers/sshd_config/match-parser/parser/match_listener.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Match diff --git a/server/handlers/sshd_config/match-parser/parser/match_parser.go b/server/handlers/sshd_config/match-parser/parser/match_parser.go index 58bd86d..6c78391 100644 --- a/server/handlers/sshd_config/match-parser/parser/match_parser.go +++ b/server/handlers/sshd_config/match-parser/parser/match_parser.go @@ -1,4 +1,4 @@ -// Code generated from Match.g4 by ANTLR 4.13.0. DO NOT EDIT. +// Code generated from Match.g4 by ANTLR 4.13.2. DO NOT EDIT. package parser // Match From 0dda74c8cbd99a8edf7a368cc8b6922289e44ba0 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 19:45:58 +0200 Subject: [PATCH 08/14] chore(server): Move antlr parser updater to justfile Signed-off-by: Myzel394 --- justfile | 20 ++++++++++++++++++++ server/update_antlr_parser.sh | 21 --------------------- 2 files changed, 20 insertions(+), 21 deletions(-) delete mode 100755 server/update_antlr_parser.sh diff --git a/justfile b/justfile index 292f2d5..4a33108 100644 --- a/justfile +++ b/justfile @@ -23,6 +23,26 @@ show-nvim-logs: test: nix develop --command bash -c 'go test ./... -count=1' +[working-directory: "./server"] +update-antlr-parsers: + # aliases + cd handlers/aliases && antlr4 -Dlanguage=Go -o ast/parser Aliases.g4 + + # fstab + cd handlers/fstab && antlr4 -Dlanguage=Go -o ast/parser Fstab.g4 + + # sshd_config + cd handlers/sshd_config && antlr4 -Dlanguage=Go -o ast/parser Config.g4 + cd handlers/sshd_config/match-parser && antlr4 -Dlanguage=Go -o parser Match.g4 + + # ssh_config + cd handlers/ssh_config && antlr4 -Dlanguage=Go -o ast/parser Config.g4 + cd handlers/ssh_config/match-parser && antlr4 -Dlanguage=Go -o parser Match.g4 + + # hosts + cd handlers/hosts && antlr4 -Dlanguage=Go -o ast/parser Hosts.g4 + + # Ready for a PR? Run this recipe before opening the PR! ready: just lint diff --git a/server/update_antlr_parser.sh b/server/update_antlr_parser.sh deleted file mode 100755 index 9534937..0000000 --- a/server/update_antlr_parser.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -ROOT=$(git rev-parse --show-toplevel)/server - -# aliases -cd $ROOT/handlers/aliases && antlr4 -Dlanguage=Go -o ast/parser Aliases.g4 - -# fstab -cd $ROOT/hanlders/fstab && antlr4 -Dlanguage=Go -o ast/parser Fstab.g4 - -# sshd_config -cd $ROOT/handlers/sshd_config && antlr4 -Dlanguage=Go -o ast/parser Config.g4 -cd $ROOT/handlers/sshd_config/match-parser && antlr4 -Dlanguage=Go -o parser Match.g4 - -# ssh_config -cd $ROOT/handlers/ssh_config && antlr4 -Dlanguage=Go -o ast/parser Config.g4 -cd $ROOT/handlers/ssh_config/match-parser && antlr4 -Dlanguage=Go -o parser Match.g4 - -# hosts -cd $ROOT/handlers/hosts && antlr4 -Dlanguage=Go -o ast/parser Hosts.g4 - From 6fe41b5040c1cf46c26c8078cc9a519e19a005c4 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 19:46:19 +0200 Subject: [PATCH 09/14] feat(ci-cd): Check if code is up to date Signed-off-by: Myzel394 --- .github/workflows/pr-tests.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index 29fa2f7..bca8ede 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -16,6 +16,12 @@ jobs: with: github_access_token: ${{ secrets.GITHUB_TOKEN }} + - name: Check if project can be linted + run: nix develop --command bash -c "just lint" && git diff --exit-code + + - name: Check if antlr parsers are up to date + run: nix develop --command bash -c "just update-antlr-parsers" && git diff --exit-code + - name: Check Nix flake run: nix flake check From 5c6ca959125cdd69be6423e416ac6268dc5bf61f Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 19:58:11 +0200 Subject: [PATCH 10/14] chore(server): Update go version Signed-off-by: Myzel394 --- flake.nix | 26 +++----------------------- server/go.mod | 2 +- 2 files changed, 4 insertions(+), 24 deletions(-) diff --git a/flake.nix b/flake.nix index e55fba1..5131add 100644 --- a/flake.nix +++ b/flake.nix @@ -42,7 +42,7 @@ pname = "github.com/Myzel394/config-lsp"; version = version; src = ./server; - vendorHash = "sha256-ttr45N8i86mSJX9Scy/Cf+YlxU5wAKMVb0YhKg28JKM="; + vendorHash = "sha256-ttr45N8i86mSJX9Scy/Cf+YlxU5wAKMVb0YhKg28JKM"; ldflags = [ "-s" "-w" ]; checkPhase = '' go test -v $(pwd)/... @@ -68,6 +68,7 @@ in { packages = { default = server; + "server-uncompressed" = serverUncompressed; "vs-code-extension-bare" = let name = "config-lsp"; node-modules = pkgs.mkYarnPackage { @@ -133,28 +134,7 @@ }; devShells.default = let - version = "0.16.2"; - ourGopls = pkgs.buildGoModule { - pname = "gopls"; - inherit version; - modRoot = "gopls"; - vendorHash = "sha256-ta94xPboFtSxFeuMtPX76XiC1O7osNl4oLk64wIyyz4="; - - # https://github.com/golang/tools/blob/9ed98faa/gopls/main.go#L27-L30 - ldflags = [ "-X main.version=v${version}" ]; - - doCheck = false; - - # Only build gopls, and not the integration tests or documentation generator. - subPackages = [ "." ]; - - src = pkgs.fetchFromGitHub { - owner = "golang"; - repo = "tools"; - rev = "gopls/v${version}"; - hash = "sha256-amy00VMUcmyjDoZ4d9/+YswfcZ+1/cGvFsA4sAmc1dA="; - }; - }; + ourGopls = pkgs.gopls; in pkgs.mkShell { buildInputs = inputs ++ (with pkgs; [ diff --git a/server/go.mod b/server/go.mod index ba46ef0..dce457d 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,6 +1,6 @@ module config-lsp -go 1.22.5 +go 1.24 require ( github.com/antlr4-go/antlr/v4 v4.13.1 From d5ec3694dba303fcdace4c3c83ba89ad38ba15b8 Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 20:05:38 +0200 Subject: [PATCH 11/14] chore(server): Update dependencies Signed-off-by: Myzel394 --- flake.nix | 3 ++- server/go.mod | 28 +++++++++++-------------- server/go.sum | 57 +++++++++++++++++++++------------------------------ 3 files changed, 37 insertions(+), 51 deletions(-) diff --git a/flake.nix b/flake.nix index 5131add..829bcea 100644 --- a/flake.nix +++ b/flake.nix @@ -42,7 +42,8 @@ pname = "github.com/Myzel394/config-lsp"; version = version; src = ./server; - vendorHash = "sha256-ttr45N8i86mSJX9Scy/Cf+YlxU5wAKMVb0YhKg28JKM"; + vendorHash = "sha256-0/oMmrdQGnx7opL4SYaYU2FdroKkF60FtRTvZ1dYr/Y"; + proxyVendor = true; ldflags = [ "-s" "-w" ]; checkPhase = '' go test -v $(pwd)/... diff --git a/server/go.mod b/server/go.mod index dce457d..6f96180 100644 --- a/server/go.mod +++ b/server/go.mod @@ -5,32 +5,28 @@ go 1.24 require ( github.com/antlr4-go/antlr/v4 v4.13.1 github.com/emirpasic/gods v1.18.1 - github.com/google/go-cmp v0.6.0 - github.com/k0kubun/pp v3.0.1+incompatible - github.com/tliron/commonlog v0.2.17 + github.com/google/go-cmp v0.7.0 + github.com/hbollon/go-edlib v1.6.0 + github.com/tliron/commonlog v0.2.19 github.com/tliron/glsp v0.2.2 - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 + golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 ) require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/gorilla/websocket v1.5.3 // indirect - github.com/hbollon/go-edlib v1.6.0 // indirect github.com/iancoleman/strcase v0.3.0 // indirect - github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect - github.com/muesli/termenv v0.15.2 // indirect - github.com/petermattis/goid v0.0.0-20240716203034-badd1c0974d6 // indirect + github.com/muesli/termenv v0.16.0 // indirect + github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb // indirect github.com/pkg/errors v0.9.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/sasha-s/go-deadlock v0.3.1 // indirect + github.com/sasha-s/go-deadlock v0.3.5 // indirect github.com/segmentio/ksuid v1.0.4 // indirect - github.com/sourcegraph/jsonrpc2 v0.2.0 // indirect - github.com/tliron/kutil v0.3.24 // indirect - golang.org/x/crypto v0.31.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/term v0.27.0 // indirect + github.com/sourcegraph/jsonrpc2 v0.2.1 // indirect + github.com/tliron/kutil v0.3.26 // indirect + golang.org/x/crypto v0.38.0 // indirect + golang.org/x/sys v0.33.0 // indirect + golang.org/x/term v0.32.0 // indirect ) diff --git a/server/go.sum b/server/go.sum index 3a19871..7436035 100644 --- a/server/go.sum +++ b/server/go.sum @@ -4,8 +4,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -13,48 +13,37 @@ github.com/hbollon/go-edlib v1.6.0 h1:ga7AwwVIvP8mHm9GsPueC0d71cfRU/52hmPJ7Tprv4 github.com/hbollon/go-edlib v1.6.0/go.mod h1:wnt6o6EIVEzUfgbUZY7BerzQ2uvzp354qmS2xaLkrhM= github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40= -github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= -github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20240716203034-badd1c0974d6 h1:DUDJI8T/9NcGbbL+AWk6vIYlmQ8ZBS8LZqVre6zbkPQ= -github.com/petermattis/goid v0.0.0-20240716203034-badd1c0974d6/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= +github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= +github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb h1:3PrKuO92dUTMrQ9dx0YNejC6U/Si6jqKmyQ9vWjwqR4= +github.com/petermattis/goid v0.0.0-20250508124226-395b08cebbdb/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= -github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= +github.com/sasha-s/go-deadlock v0.3.5 h1:tNCOEEDG6tBqrNDOX35j/7hL5FcFViG6awUGROb2NsU= +github.com/sasha-s/go-deadlock v0.3.5/go.mod h1:bugP6EGbdGYObIlx7pUZtWqlvo8k9H6vCBBsiChJQ5U= github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c= github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE= -github.com/sourcegraph/jsonrpc2 v0.2.0 h1:KjN/dC4fP6aN9030MZCJs9WQbTOjWHhrtKVpzzSrr/U= -github.com/sourcegraph/jsonrpc2 v0.2.0/go.mod h1:ZafdZgk/axhT1cvZAPOhw+95nz2I/Ra5qMlU4gTRwIo= -github.com/tliron/commonlog v0.2.17 h1:GFVvzDZbNLkuQfT45IZeWkrR5AyqiX7Du8pWAtFuPTY= -github.com/tliron/commonlog v0.2.17/go.mod h1:J2Hb63/mMjYmkDzd7E+VL9wCHT6NFNSzV/IOjJWMJqc= +github.com/sourcegraph/jsonrpc2 v0.2.1 h1:2GtljixMQYUYCmIg7W9aF2dFmniq/mOr2T9tFRh6zSQ= +github.com/sourcegraph/jsonrpc2 v0.2.1/go.mod h1:ZafdZgk/axhT1cvZAPOhw+95nz2I/Ra5qMlU4gTRwIo= +github.com/tliron/commonlog v0.2.19 h1:v1mOH1TyzFLqkshR03khw7ENAZPjAyZTQBQrqN+vX9c= +github.com/tliron/commonlog v0.2.19/go.mod h1:AcdhfcUqlAWukDrzTGyaPhUgYiNdZhS4dKzD/e0tjcY= github.com/tliron/glsp v0.2.2 h1:IKPfwpE8Lu8yB6Dayta+IyRMAbTVunudeauEgjXBt+c= github.com/tliron/glsp v0.2.2/go.mod h1:GMVWDNeODxHzmDPvYbYTCs7yHVaEATfYtXiYJ9w1nBg= -github.com/tliron/kutil v0.3.24 h1:LvaqizF4htpEef9tC0B//sqtvQzEjDu69A4a1HrY+ko= -github.com/tliron/kutil v0.3.24/go.mod h1:2iSIhOnOe1reqczZQy6TauVHhItsq6xRLV2rVBvodpk= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +github.com/tliron/kutil v0.3.26 h1:G+dicQLvzm3zdOMrrQFLBfHJXtk57fEu2kf1IFNyJxw= +github.com/tliron/kutil v0.3.26/go.mod h1:1/HRVAb+fnRIRnzmhu0FPP+ZJKobrpwHStDVMuaXDzY= +golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8= +golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw= +golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 h1:y5zboxd6LQAqYIhHnB48p0ByQ/GnQx2BE33L8BOHQkI= +golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw= +golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg= +golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ= From a2decaeff35145cb919535fb254bbae1860afb5e Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 20:20:46 +0200 Subject: [PATCH 12/14] fix(server): Remove print statement --- server/utils/common.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/utils/common.go b/server/utils/common.go index e676ba0..3c2491d 100644 --- a/server/utils/common.go +++ b/server/utils/common.go @@ -2,7 +2,6 @@ package utils import ( "errors" - "fmt" "os" ) @@ -25,8 +24,6 @@ func IsPathDirectory(path string) bool { func IsPathFile(path string) bool { _, err := os.Stat(path) - print(fmt.Sprintf("Checking if path %s is a file: %v\n", path, err)) - if errors.Is(err, os.ErrNotExist) { return false } From ac97ec77ef34046a2f443b2797fc6c13642db08b Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 20:22:57 +0200 Subject: [PATCH 13/14] fix(server): Improve namin --- server/doc-values/value-path.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/doc-values/value-path.go b/server/doc-values/value-path.go index 6be9e88..6d28552 100644 --- a/server/doc-values/value-path.go +++ b/server/doc-values/value-path.go @@ -50,13 +50,13 @@ func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue { } } - fileRequired := (v.RequiredType & PathTypeFile) == PathTypeFile - directoryRequired := (v.RequiredType & PathTypeDirectory) == PathTypeDirectory + fileExpected := (v.RequiredType & PathTypeFile) == PathTypeFile + directoryExpected := (v.RequiredType & PathTypeDirectory) == PathTypeDirectory isValid := true // If file is expected - if fileRequired { + if fileExpected { // and exists isValid = isValid && utils.IsPathFile(value) // file not expected @@ -66,7 +66,7 @@ func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue { } // if directory - if directoryRequired { + if directoryExpected { // and exists isValid = isValid && utils.IsPathDirectory(value) // directory not expected @@ -79,21 +79,21 @@ func (v PathValue) DeprecatedCheckIsValid(value string) []*InvalidValue { return nil } - if fileRequired && directoryRequired { + if fileExpected && directoryExpected { return []*InvalidValue{{ Err: errors.New("This must be either a file or a directory"), Start: 0, End: uint32(len(value)), }} } - if fileRequired { + if fileExpected { return []*InvalidValue{{ Err: errors.New("This must be a file"), Start: 0, End: uint32(len(value)), }} } - if directoryRequired { + if directoryExpected { return []*InvalidValue{{ Err: errors.New("This must be a directory"), Start: 0, From e187040dd0a9a5f2db7d21cd6e9a14dd52d8fc0d Mon Sep 17 00:00:00 2001 From: Myzel394 Date: Thu, 29 May 2025 20:30:30 +0200 Subject: [PATCH 14/14] fix(ci-cd): Remove unused go version --- .github/workflows/pr-tests.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pr-tests.yaml b/.github/workflows/pr-tests.yaml index bca8ede..c034ad2 100644 --- a/.github/workflows/pr-tests.yaml +++ b/.github/workflows/pr-tests.yaml @@ -5,9 +5,6 @@ on: [pull_request] jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - go-version: [ '1.22.x' ] steps: - uses: actions/checkout@v4