-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.go
50 lines (41 loc) · 1.21 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"flag"
"github.com/lasorda/protobuf-language-server/components"
"github.com/lasorda/protobuf-language-server/proto/view"
"github.com/lasorda/protobuf-language-server/go-lsp/logs"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp"
"github.com/lasorda/protobuf-language-server/go-lsp/lsp/defines"
)
var (
address *string
logPath *string
stdio *bool
)
func init() {
logPath = flag.String("logs", logs.DefaultLogFilePath(), "logs file path")
address = flag.String("listen", "", "address on which to listen for remote connections")
stdio = flag.Bool("stdio", false, "")
}
func main() {
flag.Parse()
logs.Init(logPath)
config := &lsp.Options{
CompletionProvider: &defines.CompletionOptions{
TriggerCharacters: &[]string{"."},
},
}
if *address != "" {
config.Address = *address
config.Network = "tcp"
}
server := lsp.NewServer(config)
view.Init(server)
server.OnDocumentSymbolWithSliceDocumentSymbol(components.ProvideDocumentSymbol)
server.OnDefinition(components.JumpDefine)
server.OnDocumentFormatting(components.Format)
server.OnCompletion(components.Completion)
server.OnHover(components.Hover)
server.OnDocumentRangeFormatting(components.FormatRange)
server.Run()
}