Bingo fails to format another 'main' package in workspace
inliquid opened this issue · comments
inliquid commented
inliquid commented
After pulling latest commits, it panics:
--> request #12: textDocument/formatting: {"textDocument":{"uri":"file:///c%3A/Users/*****/go/src/*****/*****/*****/pkg/client/client.go"},"options":{"tabSize":4,"insertSpaces":false}}
panic serving textDocument/formatting: offset not set in {11 1 -1}
goroutine 1990 [running]:
github.com/saibing/bingo/langserver/internal/util.Panicf(0x97ac80, 0xc01203dc80, 0xa1cf4c, 0x2, 0xc0120a1708, 0x1, 0x1, 0xc0120a1718, 0x45b9a6)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/internal/util/util.go:116 +0x93
github.com/saibing/bingo/langserver.(*LangHandler).Handle.func1(0xc011f668c0, 0xc0120a1ee0)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/handler.go:115 +0xcb
panic(0x97ac80, 0xc01203dc80)
C:/Go/src/runtime/panic.go:522 +0x1c3
github.com/saibing/bingo/langserver/internal/span.Point.Offset(0xb, 0x1, 0xffffffffffffffff, 0x1)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/internal/span/span.go:88 +0x116
github.com/saibing/bingo/langserver.toProtocolEdits(0xb09c20, 0xc012076400, 0xb0d4c0, 0xc0117675e0, 0xc011f65720, 0x2, 0x2, 0xc011f65720, 0x2, 0x2)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/format.go:79 +0x35f
github.com/saibing/bingo/langserver.formatRange(0xb09c20, 0xc012076400, 0xb07ae0, 0xc00027a0c0, 0xc011fb9080, 0x53, 0x0, 0x939801, 0xc01207ca20, 0x0, ...)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/format.go:61 +0x219
github.com/saibing/bingo/langserver.(*LangHandler).handleTextDocumentFormatting(0xc00023a000, 0xb09c20, 0xc012076400, 0xb07b20, 0xc000202300, 0xc011f668c0, 0xc011fb9080, 0x53, 0x4, 0x0, ...)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/format.go:23 +0xbf
github.com/saibing/bingo/langserver.(*LangHandler).Handle(0xc00023a000, 0xb09c20, 0xc012076400, 0xb07b20, 0xc000202300, 0xc011f668c0, 0x0, 0x0, 0x0, 0x0)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/handler.go:324 +0x216d
github.com/saibing/bingo/langserver.(*LangHandler).handle(...)
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/handler.go:105
github.com/sourcegraph/jsonrpc2.(*HandlerWithErrorConfigurer).Handle(0xc00013e3b0, 0xb09c60, 0xc0000740d0, 0xc000202300, 0xc011f668c0)
C:/Users/*****/go/pkg/mod/github.com/sourcegraph/jsonrpc2@v0.0.0-20180831160525-549eb959f029/handler_with_error.go:21 +0x7a
created by github.com/saibing/bingo/langserver.lspHandler.Handle
C:/Users/*****/go/src/github.com/saibing/bingo/langserver/handler.go:51 +0x103
<-- error #12: textDocument/formatting: {"code":0,"message":"unexpected panic: offset not set in {11 1 -1}","data":null}
[Error - 20:01:17] Request textDocument/formatting failed.
Message: unexpected panic: offset not set in {11 1 -1}
Code: 0