sublimelsp / LSP-gopls

Golang support for Sublime's LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gopls unable to update package dependencies in real-time

TwelveNight opened this issue · comments

Description:

I'm encountering an issue with gopls where it fails to recognize newly imported package dependencies in real-time. Although the packages are correctly added to the project's go.mod file and the code builds successfully, gopls does not provide immediate IDE support for the newly imported package. The package is only recognized after saving the changes, exiting the editor, and then relaunching gopls.

Steps to Reproduce:

  1. Open a Go project in Neovim (version 0.9.0) on Ubuntu 22.04.
  2. Add a new dependency to the project by modifying the go.mod file or using a package management tool like go get.
  3. Save the changes to the go.mod file.
  4. Import the newly added package in the codebase.
  5. Observe that gopls does not immediately recognize the newly imported package, and features like auto-completion, error checking, and other relevant IDE functionalities are unavailable.
  6. Save the changes to the file and exit Neovim.
  7. Relaunch Neovim and open the project.
  8. Observe that gopls now recognizes the imported package and provides the expected IDE support.

Expected Behavior:

When a new package dependency is added to a Go project, gopls should update its internal state and recognize the newly imported package in real-time. This includes providing accurate auto-completion suggestions, performing error checking against the updated dependencies, and enabling other relevant IDE features immediately after the import.

Actual Behavior:

Currently, gopls requires a manual restart to recognize newly imported package dependencies. After saving the changes, exiting Neovim, and relaunching gopls, the imported package is correctly recognized, and IDE features associated with the package become available.

Additional Information:

  • The project builds successfully using the go command-line tools.
  • Other features of gopls, such as code formatting and navigation, are functioning as expected.
  • This issue occurs consistently across different Go projects in Neovim v0.9.0 on Ubuntu 22.04.
  • I using mason.nvim to install the gopls

System Information:

  • Operating System: Ubuntu 22.04
  • Neovim Version: 0.9.0
  • Go Version: go1.20.4 linux/amd64
  • gopls Version: v0.12.2

Please let me know if any additional information is required to address this issue. Thank you for your assistance in resolving this problem.

QQ截图20230614202749

Hello,

You probably want to report this issue to the neovim community.
This repo is for Sublime Text.

All I can do for you is to give you this thread,
maybe it will give an answer to your issue...
neovim/neovim#16078 (comment)

Sorry, I just found gopls and opened issuse directly, this is so embarrassing 😅