Debian Codegraph @

powernap/pkg/lsp/types.go

raw
1 package lsp
2
3 import (
4 "context"
5 "time"
6
7 "github.com/charmbracelet/x/powernap/pkg/lsp/protocol"
8 "github.com/charmbracelet/x/powernap/pkg/transport"
9 )
10
11 // OffsetEncoding represents the character encoding used for text document offsets.
12 type OffsetEncoding int
13
14 const (
15 // UTF8 encoding - bytes
16 UTF8 OffsetEncoding = iota
17 // UTF16 encoding - default for LSP
18 UTF16
19 // UTF32 encoding - codepoints
20 UTF32
21 )
22
23 // Client represents an LSP client connection to a language server.
24 type Client struct {
25 ID string
26 Name string
27 conn *transport.Connection
28 ctx context.Context
29 cancel context.CancelFunc
30 initialized bool
31 shutdown bool
32 capabilities protocol.ServerCapabilities
33 offsetEncoding OffsetEncoding
34 rootURI string
35 workspaceFolders []protocol.WorkspaceFolder
36 config map[string]any
37 initOptions map[string]any
38 }
39
40 // ClientConfig represents the configuration for creating a new LSP client.
41 type ClientConfig struct {
42 Command string
43 Args []string
44 RootURI string
45 WorkspaceFolders []protocol.WorkspaceFolder
46 InitOptions map[string]any
47 Settings map[string]any
48 Environment map[string]string
49 Timeout time.Duration
50 }