z_mirror/luapls
git clone https://git.raiguard.me/z_mirror/luapls
85d1d1f
main
1package lsp 2 3import ( 4"encoding/json" 5 6"github.com/tliron/glsp" 7 protocol"github.com/tliron/glsp/protocol_3_16" 8) 9 10type Config struct { 11Roots * []string `json:"roots"` 12} 13 14func (s * Server )didChangeConfiguration (ctx * glsp.Context ,params * protocol.DidChangeConfigurationParams )error { 15return s .updateConfig (params .Settings ) 16} 17 18func (s * Server )updateConfig (settings any )error { 19// Because GLSP gives it to us as `any`, we have to re-marshal it to JSON then unmarshal it again. 20data ,err := json .Marshal (settings ) 21if err != nil { 22return err 23 } 24 25var config Config 26err = json .Unmarshal (data ,& config ) 27if err != nil { 28return err 29 } 30 31s .config = config 32return nil 33}