rogpeppe / godef

Print where symbols are defined in Go source code
BSD 3-Clause "New" or "Revised" License
665 stars 142 forks source link

Struct tips not pretty with go modules #109

Open ramya-rao-a opened 5 years ago

ramya-rao-a commented 5 years ago

From @xujintao on January 24, 2019 6:52

Struct tips not pretty with go modules.

vscode verson: 1.30.2 go extension: Go: Install/Update Tools go version: 1.11.2

//model/person.go

package model

type Person struct {
    Name string
    Age  int
}

// main.go

package main

import (
    "fmt"

    "github.com/xujintao/teststruct/model"
)
func main() {
    p := model.Person{"pi", 20}
    fmt.Println(p)
}

When mouse focus on Person, it tips:

type Person struct{Name string; Age int}

i expect:

type Person struct {
    Name string
    Age  int
}

Copied from original issue: Microsoft/vscode-go#2274

ramya-rao-a commented 5 years ago

From @Delphier on January 24, 2019 11:31

+1

ramya-rao-a commented 5 years ago

Is it different in a non module mode?

ramya-rao-a commented 5 years ago

From @xujintao on January 31, 2019 9:55

@ramya-rao-a Yes, it tips normally in non module mode.

ramya-rao-a commented 5 years ago

Can you please provide a screenshot showing the difference for the same struct in module and non module mode?

ramya-rao-a commented 5 years ago

From @xujintao on February 4, 2019 1:45

module image

non-module image

ramya-rao-a commented 5 years ago

Thanks @xujintao!

This data comes from godef which seems to be using different formatting for the content between modules and non modules.

I'll move this issue to the godef repo.

ramya-rao-a commented 5 years ago

cc @ianthehat, @rogpeppe