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

golang extension is not working for "Add folder to workspace" project #2935

Closed
JCzz opened this issue Dec 8, 2019 · 7 comments
Closed

golang extension is not working for "Add folder to workspace" project #2935

JCzz opened this issue Dec 8, 2019 · 7 comments
Labels
go-modules Related to Go modules upstream-gopls Issue for gopls

Comments

@JCzz
Copy link

JCzz commented Dec 8, 2019

Version: 1.40.2
Commit: f359dd69833dd8800b54d458f6d37ab7c78df520
Date: 2019-11-25T14:52:45.129Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Darwin x64 19.0.0

I have a project with sub projects folders

Workspace
-- main.go
-- Project(Add folder to workspace...)
---- main.go << not working - no intellisense

go code under workspace works but not for go code in sub project in workspace?

I an using modules and added this "go.useLanguageServer": true" to both workspace project and sub project.

Note: note intellisense does work for root workspace but not for sub project

@JCzz JCzz changed the title Add folder to workspace - no golang golang extension is not working for "Add folder to workspace" project Dec 8, 2019
@stamblerre
Copy link
Contributor

For gopls to work, the folder that you add to your workspace has to be the one that contains the go.mod file. Opening directories that contain a module will not work with gopls until golang/go#32394 is resolved. Where is the go.mod in relation to the projects that you opened?

@wtask
Copy link

wtask commented Dec 9, 2019

In current time, unhappinessly, to make VSCode work with submodules I think we need to add folders with submodules to workspace independently. First to add the main folder, then add independent "duplicate" of submodule folder. Then edit code opened from appropriate workspace folder. It is crazy...

@stamblerre
Copy link
Contributor

We are currently working on addressing this (follow along with the bug linked above), but yes - this is currently the required workflow for nested modules.

@wtask
Copy link

wtask commented Dec 9, 2019

This is not a frequent case, but sometimes it occurs :(

@JCzz
Copy link
Author

JCzz commented Dec 10, 2019

Thanks @stamblerre looking forward to an update.

The module is in the sub-project, that includes a .vscode - the go module is in a sub folder to the sub-project:
root-project/sub-project/go/server

And it works if I open vscode in this folder containing the module. But I have a bigger project where go is just one part of it all - so it would be very cool to be able to have just one instance of vs code open.

@stamblerre
Copy link
Contributor

You can add multiple folders to your workspace to have only one VS Code instance open, as @wtask suggested above (File -> Add Folder to Workspace).

@ramya-rao-a ramya-rao-a added upstream-gopls Issue for gopls go-modules Related to Go modules labels Dec 11, 2019
@ramya-rao-a
Copy link
Contributor

Thanks all

Closing this issue in favor of the upstream issue that @stamblerre has linked above

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
go-modules Related to Go modules upstream-gopls Issue for gopls
Projects
None yet
Development

No branches or pull requests

4 participants