mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
feat(aliases): Add completion support for error values
This commit is contained in:
parent
ad1a8e0d95
commit
e1af64f2c0
@ -78,6 +78,38 @@ func GetCompletionsForEntry(
|
|||||||
userValue.Value,
|
userValue.Value,
|
||||||
relativeCursor,
|
relativeCursor,
|
||||||
), nil
|
), nil
|
||||||
|
case ast.AliasValueError:
|
||||||
|
errorValue := (*value).(ast.AliasValueError)
|
||||||
|
|
||||||
|
isAtErrorCode := errorValue.Code == nil &&
|
||||||
|
relativeCursor >= errorValue.Location.Start.Character &&
|
||||||
|
(errorValue.Message == nil ||
|
||||||
|
relativeCursor <= errorValue.Message.Location.Start.Character)
|
||||||
|
|
||||||
|
if isAtErrorCode {
|
||||||
|
kind := protocol.CompletionItemKindValue
|
||||||
|
|
||||||
|
detail_4 := "4XX (TempFail)"
|
||||||
|
insertText_4 := "400"
|
||||||
|
|
||||||
|
detail_5 := "5XX (PermFail)"
|
||||||
|
insertText_5 := "500"
|
||||||
|
|
||||||
|
return []protocol.CompletionItem{
|
||||||
|
{
|
||||||
|
Label: "4XX",
|
||||||
|
InsertText: &insertText_4,
|
||||||
|
Kind: &kind,
|
||||||
|
Detail: &detail_4,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Label: "5XX",
|
||||||
|
InsertText: &insertText_5,
|
||||||
|
Kind: &kind,
|
||||||
|
Detail: &detail_5,
|
||||||
|
},
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return completions, nil
|
return completions, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user