Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Intellisense doesn't seem to work #1711

Closed
crny opened this issue Jun 4, 2018 · 16 comments
Closed

Intellisense doesn't seem to work #1711

crny opened this issue Jun 4, 2018 · 16 comments

Comments

@crny
Copy link

crny commented Jun 4, 2018

example: i need import "fmt" package, input
fmt.
image
Intellisense doesn't seem to work

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Jun 4, 2018

  • Which version of Go are you using?
  • Have you installed the Go extension?
  • Do other features like Go to definition, Find all references work as expected?
  • Do you see any errors in the console? Help -> Toggle Developer Tools -> Console?

If other features work as expected and there are no errors in the console, then

  • Run gocode close in a terminal and try again.
  • If it still doesnt work, run go get -u github.com/nsf/gocode to update the tool. If you use the go.toolsGopath setting, then set
    GOPATH to the value in that setting before running go get so that the tool is installed/updated in the right location
  • If it still doesnt work, run gocode -s -debug in a terminal and try again. Results from gocode will show up in the terminal.
    If you see expected results in the terminal, but not in VS Code, log an issue in the vscode-go repo, else
    log an issue in the gocode repo

@crny
Copy link
Author

crny commented Jun 5, 2018

go version 1.10.2
i have installed go extension.
vscode console not errors.

gocode debug log

`
018/06/05 10:23:56 Go project path: ws
2018/06/05 10:23:56 Got autocompletion request for '/Users/crny/go/src/ws/main.go'
2018/06/05 10:23:56 Cursor at: 30
2018/06/05 10:23:56 -------------------------------------------------------
package main

func main() {
f#
}
2018/06/05 10:23:56 -------------------------------------------------------
2018/06/05 10:23:56 Offset: 1
2018/06/05 10:23:56 Number of candidates found: 3
2018/06/05 10:23:56 Candidates are:
2018/06/05 10:23:56 const false
2018/06/05 10:23:56 type float32 built-in
2018/06/05 10:23:56 type float64 built-in
2018/06/05 10:23:56 =======================================================
2018/06/05 10:23:57 Go project path: ws
2018/06/05 10:23:57 Got autocompletion request for '/Users/crny/go/src/ws/main.go'
2018/06/05 10:23:57 Cursor at: 33
2018/06/05 10:23:57 -------------------------------------------------------
package main

func main() {
fmt.#
}
2018/06/05 10:23:57 -------------------------------------------------------
2018/06/05 10:23:57 Error parsing input file (inner block):
2018/06/05 10:23:57 4:6: expected selector or type assertion, found ';'
2018/06/05 10:23:57 extracted expression tokens: fmt
2018/06/05 10:23:57 Offset: 0
2018/06/05 10:23:57 Number of candidates found: 0
2018/06/05 10:23:57 Candidates are:
2018/06/05 10:23:57 =======================================================
`

@ramya-rao-a
Copy link
Contributor

Its possible that this is due to #1645 (comment)

Try running the below to install the gocode by mdempsky and try again

  • gocode close
  • go get -u github.com/mdempsky/gocode (If you have set go.toolsGopath, then set GOPATH to that value before running the go get)

@CheyiLin
Copy link

CheyiLin commented Jun 7, 2018

Got the same issue today after I upgraded to vscode 1.24 and go extension 0.6.82 which is using mdempsky/gocode. (with golang 1.10.2)

It shows different behavior with nsf/gocode when you're typing dot . and expecting the auto-complete list.

The mdempsky/gocode debug output:

2018/06/07 14:13:08 -------------------------------------------------------
2018/06/07 14:13:08 Error parsing input file (outer block):
2018/06/07 14:13:08  ... mycode.go:138:7: expected selector or type assertion, found ';'
2018/06/07 14:13:08  ... mycode.go:141:2: expected ';', found 'if'
2018/06/07 14:13:08 Elapsed duration: 129.0024ms
2018/06/07 14:13:08 Offset: 0
2018/06/07 14:13:08 Number of candidates found: 0
2018/06/07 14:13:08 Candidates are:
2018/06/07 14:13:08 =======================================================

@lggomezml
Copy link

A coworker had the same problem today after updating the extension and she had installed go 1.10. Rollbacking to 1.9 fixed it... is there anything we can do on the extension side to guard against this?

@ramya-rao-a
Copy link
Contributor

@CheyiLin Can you provide sample code where I can try this?
@lggomez Did your co-worker face the problem with go 1.10 as well as the latest version of the Go extension?

@CheyiLin
Copy link

CheyiLin commented Jun 8, 2018

@ramya-rao-a Sure, I'll do my best to provide reproducible sample. But after I switched back to nsf/gocode yesterday the auto-complete works as before normally.

@LiPengfei19820619
Copy link

@ramya-rao-a I met the same problem with go1.10.2/1.10.3 , vscode 1.24 insider, os win7/64bit.
what sample code or other information would you need?

@ramya-rao-a
Copy link
Contributor

@LiPengfei19820619 What is the version of the Go extension you are using? Any small sample code where you see the issue consistently can help. Also run gocode -s -debug in a terminal and try again. Results from gocode will show up in the terminal. That might help if figuring out whats going on

@LiPengfei19820619
Copy link

@ramya-rao-a the information is as follow, I hope they can help you, thanks.

  1. the version of the Go Extension:
    0.6.82
    2.the version of golang:
    C:\Users\lpf>go version
    go version go1.10.3 windows/amd64

  2. the gocode -s -debug outpu:
    Microsoft Windows [版本 6.1.7601]
    版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\lpf>gocode close
2018/06/10 08:06:12 dial tcp 127.0.0.1:37373: connectex: No connection could be made because the target machine actively refused it.

C:\Users\lpf>gocode -s -debug
2018/06/10 08:06:52 Got autocompletion request for 'd:\golang\code\src\chykj\collect-webapi\app\position_card_service.go'
2018/06/10 08:06:52 Cursor at: 741
2018/06/10 08:06:52 -------------------------------------------------------
package app

import (
"chykj/collect-webapi/domain/position/card"
)

// PositionCardService 人员定位基站领域服务
type PositionCardService struct {
}

// NewPositionCardService 创建人员定位基站领域服务
func NewPositionCardService() *PositionCardService {
return &PositionCardService{}
}

// GetAll 获取所有的人员定位卡
func (s *PositionCardService) GetAll() []card.Card {
return positionCardRepository.GetAll()
}

// GetByID 根据ID获取人员定位基站服务
func (s *PositionCardService) GetByID(id string) (*card.Card, error) {
return positionCardRepository.GetByID(id)
}

// Add 更新人员定位基站服务
func (s *PositionCardService) Add(card *card.Card) error {
s#
return positionCardRepository.Add(card)
}

// Update 更新人员定位基站服务
func (s *PositionCardService) Update(card *card.Card) error {
return positionCardRepository.Update(card)
}

// Delete 删除人员定位基站服务
func (s *PositionCardService) Delete(id string) error {
return positionCardRepository.Delete(id)
}
2018/06/10 08:06:52 -------------------------------------------------------
2018/06/10 08:06:52 Elapsed duration: 3.0002ms
2018/06/10 08:06:52 Offset: 0
2018/06/10 08:06:52 Number of candidates found: 1
2018/06/10 08:06:52 Candidates are:
2018/06/10 08:06:52 var s *PositionCardService
2018/06/10 08:06:52 =======================================================
2018/06/10 08:06:52 Got autocompletion request for 'd:\golang\code\src\chykj\collect-webapi\app\position_card_service.go'
2018/06/10 08:06:52 Cursor at: 742
2018/06/10 08:06:52 -------------------------------------------------------
package app

import (
"chykj/collect-webapi/domain/position/card"
)

// PositionCardService 人员定位基站领域服务
type PositionCardService struct {
}

// NewPositionCardService 创建人员定位基站领域服务
func NewPositionCardService() *PositionCardService {
return &PositionCardService{}
}

// GetAll 获取所有的人员定位卡
func (s *PositionCardService) GetAll() []card.Card {
return positionCardRepository.GetAll()
}

// GetByID 根据ID获取人员定位基站服务
func (s *PositionCardService) GetByID(id string) (*card.Card, error) {
return positionCardRepository.GetByID(id)
}

// Add 更新人员定位基站服务
func (s *PositionCardService) Add(card *card.Card) error {
s.#
return positionCardRepository.Add(card)
}

// Update 更新人员定位基站服务
func (s *PositionCardService) Update(card *card.Card) error {
return positionCardRepository.Update(card)
}

// Delete 删除人员定位基站服务
func (s *PositionCardService) Delete(id string) error {
return positionCardRepository.Delete(id)
}
2018/06/10 08:06:52 -------------------------------------------------------
2018/06/10 08:06:52 Error parsing input file (outer block):
2018/06/10 08:06:52 d:\golang\code\src\chykj\collect-webapi\app\position_card_service.go:28:4: expected selector or type assertion, found ';'
2018/06/10 08:06:52 d:\golang\code\src\chykj\collect-webapi\app\position_card_service.go:29:2: expected ';', found 'return'
2018/06/10 08:06:52 Elapsed duration: 20.0012ms
2018/06/10 08:06:52 Offset: 0
2018/06/10 08:06:52 Number of candidates found: 5
2018/06/10 08:06:52 Candidates are:
2018/06/10 08:06:52 func Add(card *invalid type) error
2018/06/10 08:06:52 func Delete(id string) error
2018/06/10 08:06:52 func GetAll() []invalid type
2018/06/10 08:06:52 func GetByID(id string) (*invalid type, error)
2018/06/10 08:06:52 func Update(card *invalid type) error
2018/06/10 08:06:52 =======================================================
2018/06/10 08:07:07 Got autocompletion request for 'd:\golang\code\src\chykj\collect-webapi\app\position_card_service.go'
2018/06/10 08:07:07 Cursor at: 741
2018/06/10 08:07:07 -------------------------------------------------------
package app

import (
"chykj/collect-webapi/domain/position/card"
)

// PositionCardService 人员定位基站领域服务
type PositionCardService struct {
}

// NewPositionCardService 创建人员定位基站领域服务
func NewPositionCardService() *PositionCardService {
return &PositionCardService{}
}

// GetAll 获取所有的人员定位卡
func (s *PositionCardService) GetAll() []card.Card {
return positionCardRepository.GetAll()
}

// GetByID 根据ID获取人员定位基站服务
func (s *PositionCardService) GetByID(id string) (*card.Card, error) {
return positionCardRepository.GetByID(id)
}

// Add 更新人员定位基站服务
func (s *PositionCardService) Add(card *card.Card) error {
p#
return positionCardRepository.Add(card)
}

// Update 更新人员定位基站服务
func (s *PositionCardService) Update(card *card.Card) error {
return positionCardRepository.Update(card)
}

// Delete 删除人员定位基站服务
func (s *PositionCardService) Delete(id string) error {
return positionCardRepository.Delete(id)
}
2018/06/10 08:07:07 -------------------------------------------------------
2018/06/10 08:07:07 Elapsed duration: 6.0004ms
2018/06/10 08:07:07 Offset: 0
2018/06/10 08:07:07 Number of candidates found: 2
2018/06/10 08:07:07 Candidates are:
2018/06/10 08:07:07 var positionCardRepository invalid type
2018/06/10 08:07:07 var positionCardService *PositionCardService
2018/06/10 08:07:07 =======================================================
2018/06/10 08:07:16 Got autocompletion request for 'd:\golang\code\src\chykj\collect-webapi\app\position_card_service.go'
2018/06/10 08:07:16 Cursor at: 763
2018/06/10 08:07:16 -------------------------------------------------------
package app

import (
"chykj/collect-webapi/domain/position/card"
)

// PositionCardService 人员定位基站领域服务
type PositionCardService struct {
}

// NewPositionCardService 创建人员定位基站领域服务
func NewPositionCardService() *PositionCardService {
return &PositionCardService{}
}

// GetAll 获取所有的人员定位卡
func (s *PositionCardService) GetAll() []card.Card {
return positionCardRepository.GetAll()
}

// GetByID 根据ID获取人员定位基站服务
func (s *PositionCardService) GetByID(id string) (*card.Card, error) {
return positionCardRepository.GetByID(id)
}

// Add 更新人员定位基站服务
func (s *PositionCardService) Add(card *card.Card) error {
positionCardRepository.#
return positionCardRepository.Add(card)
}

// Update 更新人员定位基站服务
func (s *PositionCardService) Update(card *card.Card) error {
return positionCardRepository.Update(card)
}

// Delete 删除人员定位基站服务
func (s *PositionCardService) Delete(id string) error {
return positionCardRepository.Delete(id)
}
2018/06/10 08:07:16 -------------------------------------------------------
2018/06/10 08:07:16 Error parsing input file (outer block):
2018/06/10 08:07:16 d:\golang\code\src\chykj\collect-webapi\app\position_card_service.go:28:25: expected selector or type assertion, found ';'
2018/06/10 08:07:16 d:\golang\code\src\chykj\collect-webapi\app\position_card_service.go:29:2: expected ';', found 'return'
2018/06/10 08:07:16 Elapsed duration: 12.0007ms
2018/06/10 08:07:16 Offset: 0
2018/06/10 08:07:16 Number of candidates found: 0
2018/06/10 08:07:16 Candidates are:
2018/06/10 08:07:16 =======================================================

@ramya-rao-a
Copy link
Contributor

Let's first ensure that the right gocode is being used

  • Run gocode close and gocode exit
  • Delete the folders mdempsky/gocode and nfs/gocode from your GOPATH/src and GOPATH/pkg. (If you have set go.toolsGopath setting then delete the same from there)
  • Run go get -u github.com/mdempsky/gocode
  • Check the created/modified date of the gocode executable in GOPATH/bin folder. Ensure it matches the timestamp of when you ran the previous step.
  • Run gocode -s -debug
  • Try completions in VS Code

@ikgo
Copy link

ikgo commented Jun 11, 2018

clean install of nsf/gocode fix the problem for go 1.10.1 and 1.10.3

mdempsky/gocode not working in both cases

@lggomez
Copy link
Contributor

lggomez commented Jun 11, 2018

@ramya-rao-a so it seems that the clean install did the trick, since she still has both 1.9 and 1.10 installed so we can't determine if that was the root cause

I'd go along with @ikgo's commentary

@ramya-rao-a
Copy link
Contributor

@ikgo, @lggomez

There is still the problem of nsf/gocode having other problems with Go 1.10 and above. So we still have to figure out what the root cause was for mdempsky/gocode to not work.

Everyone,
Please go through #1723 (comment) and see if that helps.

@Undermove
Copy link

Undermove commented Jun 15, 2018

@ramya-rao-a
I've tried this but it caused no effect :-(

go version go1.10.2 windows/amd64

Windows 10x64

Extension Author (truncated) Version
auto-close-tag for 0.5.6
auto-rename-tag for 0.0.15
Go ms- 0.6.82
vs-keybindings ms- 0.2.0
debugger-for-chrome msj 4.6.0

@ramya-rao-a
Copy link
Contributor

ramya-rao-a commented Mar 8, 2019

Its about 9 months since the last activity in this issue.
Ever since, we have released many updates to the Go extension, and gocode itself has shipped many bug fixes.

Please update gocode using the command Go: Install/Update Tools -> gocode -> Ok if you havent done that lately.

If anyone still has problems, please try running gocode in server mode to see if it gives any helpful errors. See #1711 (comment)

Thank you everyone for your patience and Happy Coding!

@microsoft microsoft locked as resolved and limited conversation to collaborators Mar 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants