fix(aliases): Improve file value

This commit is contained in:
Myzel394 2024-09-02 00:12:05 +02:00
parent 4254e0a8fe
commit 3a1b38400c
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
3 changed files with 19 additions and 2 deletions

View File

@ -124,6 +124,23 @@ func checkValue(
Err: ers.New("An error message is required"),
}}
}
case ast.AliasValueInclude:
incldueValue := value.(ast.AliasValueInclude)
if incldueValue.Path == nil {
return []common.LSPError{{
Range: incldueValue.Location,
Err: ers.New("A path is required"),
}}
}
// Again, I'm not sure if the path really needs to be absolute
if !path.IsAbs(string(incldueValue.Path.Path)) {
return []common.LSPError{{
Range: incldueValue.Path.Location,
Err: ers.New("This path must be absolute"),
}}
}
}
return nil
}

View File

@ -101,7 +101,7 @@ func (s *aliasesParserListener) EnterFile(ctx *parser.FileContext) {
// Set the path
include := rawValue.(AliasValueInclude)
include.Path = AliasValueIncludePath{
include.Path = &AliasValueIncludePath{
Location: location,
Path: path(ctx.GetText()),
}

View File

@ -66,7 +66,7 @@ type AliasValueIncludePath struct {
type AliasValueInclude struct {
AliasValue
Path AliasValueIncludePath
Path *AliasValueIncludePath
}
func (a AliasValueInclude) CheckIsValid() []common.LSPError {