golang/go

x/tools/gopls: pointer to struct value field/method candidates not offered in type switch

Open

#38,564 opened on Apr 21, 2020

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Go (19,008 forks)batch import
Toolsgoplshelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

What version of Go are you using (go version)?

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

What did you do?

I haven't been able to reduce the example to anything smaller than this unfortunately:

-- go.mod --
module mod.com

go 1.12

require github.com/yuin/goldmark v1.1.27
-- main.go --
package main

import (
	"io/ioutil"

	"github.com/yuin/goldmark"
	"github.com/yuin/goldmark/ast"
	"github.com/yuin/goldmark/text"
)

func main() {
	input, err := ioutil.ReadFile("input.md")
	if err != nil {
		panic(err)
	}
	p := goldmark.DefaultParser()
	r := text.NewReader(input)
	node := p.Parse(r)
	ast.Walk(node, func(n ast.Node, entering bool) (ast.WalkStatus, error) {
		if !entering {
			return ast.WalkContinue, nil
		}
		switch node := node.(type) {
		case *ast.HTMLBlock:
			node.
		case *ast.FencedCodeBlock:
		}
		return ast.WalkContinue, nil
	})
}

Attempting completion after node. in the *ast.HTMLBlock: case does not give any of the field/method candidates that should be offered for a value of type *ast.HTMLBlock. Instead we get:

What did you expect to see?

The field/method candidates for the *ast.HTMLBlock value.

What did you see instead?

As above


cc @stamblerre @muirdm

FYI @leitzler

Contributor guide