What do i do if autocomplete doesn't work in my vs code golang project?

Issue

The simple advices like to restart VS Code or to reinstall the tools do not make any difference.

When I type in something, I get the result like in this
image.

The problem is not in the Intellisense itself, because when I work in my html or css files, autocomplete works perfectly

All the information I found in the internet hasn’t helped me so I’ve decided to search for help here.

Solution

This happens when you are in an another imported project’s source file, outside of your main project.

For example if you have a project in a folder like "test1" that imports a package, like import "test2". You open your test1 folder in VSCode, then navigate into a file from test2 for example with a Ctrl+Click on a test2 based func. Then in this file the linter will not help you, since you are not in the test2 project. You need to open another VSCode in test2 folder to have it work.

Answered By – Fenistil

Answer Checked By – Katrina (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.