Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP completely borked after upgrade to 2.2.0 from 1.30.0 #2509

Closed
kortschak opened this issue Aug 17, 2024 · 10 comments
Closed

LSP completely borked after upgrade to 2.2.0 from 1.30.0 #2509

kortschak opened this issue Aug 17, 2024 · 10 comments

Comments

@kortschak
Copy link

Describe the bug

I don't even know where to start. I upgraded ST to 4180 a couple of days ago. This appears to have broken LSP (gopls is my LS) confirmed by downgrading to 4169. Thinking that this may be due to the LSP version, I was on 1.30.0, I upgraded LSP to 2.2.0. Where the LSP was moderately broken (not working, but menus displaying), it is not completely borked. I have gone through the steps in the package control message and all the claimed areas appear to be as expected.

To Reproduce

Steps to reproduce the behavior:

Described above.

Expected behavior

A working LSP

Screenshots

Not relevant.

Logs

Troubleshooting: gopls

Version

  • LSP: 2.2.0
  • Sublime Text: 4180

Server Test Run

  • exit code: -1
  • output
neither "command" nor "tcp_port" is provided; cannot start a language server

Server Configuration

  • command
[]
  • shell command
  • selector

  • priority_selector

  • init_options
{
  "analyses": {
    "ST1003": false,
    "ST1016": false
  },
  "gofumpt": false,
  "staticcheck": true
}
  • settings
{}
  • env
{}

Active view

  • File name
/home/user/src/golang.org/x/tools/gopls/main.go
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc",
  "lsp_active": null,
  "syntax": "Packages/Go/Go.sublime-syntax"
}
  • base scope
source.go

Project / Workspace

  • folders
[
  "/home/user/src/golang.org/x/tools/gopls"
]
  • is project: False

LSP configuration

{
  "clients": {
    "gopls": {
      "build.buildFlags": [],
      "enabled": true,
      "initializationOptions": {
        "analyses": {
          "ST1003": false,
          "ST1016": false
        },
        "gofumpt": false,
        "staticcheck": true
      }
    },
    "rust-analyzer": {
      "enabled": true
    }
  },
  "log_debug": true,
  "log_server": [
    "panel"
  ],
  "log_stderr": true,
  "lsp_code_actions_on_save": {
    "source.fixAll": true,
    "source.organizeImports": true
  },
  "lsp_format_on_save": true
}

System PATH

  • /home/user/.local/bin
  • /home/user/bin
  • /home/user/.cargo/bin
  • /home/user/go/bin
  • /home/user/bin
  • /usr/local/sbin
  • /usr/local/bin
  • /usr/sbin
  • /usr/bin
  • /sbin
  • /bin
  • /usr/games
  • /usr/local/games
  • /snap/bin

Environment (please complete the following information):

  • OS: Ubuntu 18.04
  • Sublime Text version: 4180
  • LSP version: 2.2.0
  • Language servers used: gopls

Additional context

@rchl
Copy link
Member

rchl commented Aug 17, 2024

Short story: You need to upgrade Package Control to latest version for things to work. It will also require 1 or two ST restarts once you have updated to latest version.

Long story: sublimehq/sublime_text#6456 (comment)

@kortschak
Copy link
Author

That did not fix the issue; I upgraded Package Control and restarted three times (until it stopped complaining) then upgraded all the packages and then upgraded ST to the most recent version. I see exactly the same issue.

@predragnikolic
Copy link
Member

@kortschak is there any reason why you manually configured gopls? I would just suggest using the LSP-gopls package.

You manual configuration is missing a "command" that is necessary to start "gopls". You could fix that by adding the "command"

"clients": {
    "gopls": {
      "command":["path/to/gopls"],
  // ...

Or by removing you custom configuration and installing LSP-gopls.

@kortschak
Copy link
Author

The installation predates LSP-gopls.

@predragnikolic
Copy link
Member

Than please remove gopls from the "clients" section.
LSP-gopls setting should be put in LSP-gopls.sublime-settings file, not in LSP.sublime-settings.

@predragnikolic
Copy link
Member

When you install a LSP-* package, such as LSP-gopls, there is no need to manually put configuration in the "clients" section of a LSP.sublime-settings file.

@kortschak
Copy link
Author

gopls is the LS I'm using, I was not using LSP-gopls. This was the way that it was intended to be set up following the instructions provided by the gopls team.

@predragnikolic
Copy link
Member

I took a look at their docs https://cs.opensource.google/go/x/tools/+/refs/tags/gopls/v0.16.1:gopls/doc/subl.md
Their docs is not correct:

{
    "clients": {
        "gopls": {
             "enabled": true,
         }
    }
}

The configuration is missing a "command", and a "selector".
The manual configuration is not necessary, if a package as LSP-gopls exist.

Please revert what ever you did by reading their docs.
And just do what is specified here https://lsp.sublimetext.io/language_servers/#go

If you want you can open an issue at the gopls repo to remove/update the incorrect docs.

@kortschak
Copy link
Author

kortschak commented Aug 18, 2024

Their docs have worked for years (when I installed LSP and gopls, https://lsp.sublimetext.io/language_servers/#go did not exist). I'll file an issue when I have time.

@LDAP
Copy link
Contributor

LDAP commented Aug 18, 2024

I already tried 2 years ago golang/tools#377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants