mirror of
https://github.com/Myzel394/config-lsp.git
synced 2025-06-18 23:15:26 +02:00
38 lines
961 B
Go
38 lines
961 B
Go
package docvalues
|
|
|
|
import (
|
|
protocol "github.com/tliron/glsp/protocol_3_16"
|
|
)
|
|
|
|
type CustomValueContext interface {
|
|
GetIsContext() bool
|
|
}
|
|
|
|
type EmptyValueContext struct{}
|
|
|
|
func (EmptyValueContext) GetIsContext() bool {
|
|
return true
|
|
}
|
|
|
|
var EmptyValueContextInstance = EmptyValueContext{}
|
|
|
|
type CustomValue struct {
|
|
FetchValue func(context CustomValueContext) Value
|
|
}
|
|
|
|
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) FetchCompletions(line string, cursor uint32) []protocol.CompletionItem {
|
|
return v.FetchValue(EmptyValueContextInstance).FetchCompletions(line, cursor)
|
|
}
|
|
|
|
func (v CustomValue) FetchHoverInfo(line string, cursor uint32) []string {
|
|
return v.FetchValue(EmptyValueContextInstance).FetchHoverInfo(line, cursor)
|
|
}
|