terrortylor / nvim-comment

A comment toggler for Neovim, written in Lua
MIT License
479 stars 23 forks source link

Can't toggle comment after format Go source #24

Closed ericzzh closed 3 years ago

ericzzh commented 3 years ago

NVIM v0.5.0 Build type: Release LuaJIT 2.1.0-beta3 File Type: Go

Before I run format source(go fmt), everything is OK. But as soon as the source is formatted, the toggling doesn't work for range operation, but works for a single line. The go fmt will change the source format.

https://user-images.githubusercontent.com/9389005/126290025-1652d34b-3147-4aa0-b771-a98364cfc5a1.mov

terrortylor commented 3 years ago

'm trying to replicate this but struggling. I've got a simple main.go:

package main

import "fmt"

func goats() {
    fmt.Println("this is some text")
    fmt.Println("what of it")

    fmt.Println("this is some text")
    fmt.Println("what of it")

    fmt.Println("this is some text")
    fmt.Println("what of it")
}

func main() {
    fmt.Println("hello mate")
    goats()
}

Commenting out line 9+10 with gcip, indenting line 17 too far to the right and then running gofmt: :!gofmt -w % I'm able to use motions to uncomment out lines 9+10 again as expected.

Are you able to give me some means to replicate this?