saibing / bingo

Bingo is a Go language server that speaks Language Server Protocol.
MIT License
495 stars 25 forks source link

fixed bug in code formatting #161

Closed imjustfly closed 5 years ago

imjustfly commented 5 years ago

There are two problems in code formatting:

  1. According to currently gopls's internal implementation, end point's offset is always -1, which makes the Offset() panic. Actually, as I tested in my neovim environment, checking file's ending is unnecessary now, so I removed these logic, and it works fine for me.

  2. internal/source's line and column number always starts from 1, so we should correct it first. Otherwise code formatting cannot work properly.

@saibing PTAL

saibing commented 5 years ago

@imjustfly

thank you very much