microsoft / vscode-go

An extension for VS Code which provides support for the Go language. We have moved to https://github.com/golang/vscode-go
Other
5.93k stars 645 forks source link

Region comments not working when extension is enabled #3249

Closed SteelPhase closed 4 years ago

SteelPhase commented 4 years ago

go version go1.14.3 darwin/amd64 VSCode version: 1.45.1 VSCode Go version: 0.14.2 ENV:

AR="ar"
CC="clang"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_ENABLED="1"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
CXX="clang++"
GCCGO="gccgo"
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/steelphae/Library/Caches/go-build"
GOENV="/Users/steelphae/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0b/zk7t542s1sj_31mwpwyk3cy81gy8z8/T/go-build101750651=/tmp/go-build -gno-record-gcc-switches -fno-common"
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMOD="/Users/steelphae/Code/go-modules/go.company.com/org/app/go.mod"
GONOPROXY="go.company.com"
GONOSUMDB="go.company.com"
GOOS="darwin"
GOPATH="/Users/steelphae/Code/Go"
GOPRIVATE="go.company.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
PKG_CONFIG="pkg-config"

Share the Go related settings you have added/edited

{
    "go.useLanguageServer": true,
    "[go]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
        "editor.snippetSuggestions": "none",
    },
    "[go.mod]": {
        "editor.formatOnSave": true,
        "editor.codeActionsOnSave": {
            "source.organizeImports": true,
        },
    },
    "gopls": {
        "usePlaceholders": true,
        "staticcheck": false,
    }
}

Describe the bug

VSCode allows comments to be inserted that allow for additional folding points, but they appear to not function when this extension is enabled

https://github.com/microsoft/vscode/blob/master/extensions/go/language-configuration.json#L31-L37

Could potentially be a gopls issue, if microsoft/vscode-go#3160 is any indication

Steps to reproduce the behavior:

  1. Create a go file
  2. add //#region and //#endregion comments
  3. vscode will not let you fold them with this extention enabled
stamblerre commented 4 years ago

My suspicion is that this does have something to do with the LSP. Maybe the extension's middleware for the language server needs to join results with other providers. Does it work as expected when gopls is disabled?

SteelPhase commented 4 years ago

Just tested with gopls disabled, and folding worked

ramya-rao-a commented 4 years ago

Closing in favor of https://github.com/golang/vscode-go/issues/134 due to the repo move