D
D
Dmitry Afonchenko2018-06-07 14:05:58
go
Dmitry Afonchenko, 2018-06-07 14:05:58

How do I set up IntelliSense for Go for Visual Studio Code?

Good day everyone! I'm currently writing a small Go tutorial project in Visual Studio Code. Autocomplete works, but only for standard packages like json. But for my packages it does not work.
For example:

package auth

import (
  "encoding/json"

  "../data"
  "github.com/gorilla/websocket"
)

type RoomsManager struct {
  Rooms       map[string]*Room
  ConnToRooms map[*websocket.Conn]*Room
  AuthModule  *AuthModule
}

func (rm *RoomsManager) AddRoom(roomName string) {
  rm.Rooms[roomName] = &Room{
    Name:    roomName,
    Players: [2]*Player{nil, nil},
  }
}

I want it in the main package when I write
roomManager. (here the autocomplete should suggest AddRoom)
How can I fix this? Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Afonchenko, 2018-06-15
@Indermove

The problem ended up being the gocode extension:
https://github.com/Microsoft/vscode-go/issues/1723...

A
Alexey Stupenkov, 2018-06-08
@alexstup

You need to put your packages in the GOPATH/src/... directory, i.e. where packages are downloaded when added.
Then he will see.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question