sublimelsp / LSP-rust-analyzer

Convenience package for rust-analyzer
MIT License
70 stars 11 forks source link

command runSingle failed #136

Closed mxsur closed 3 months ago

mxsur commented 3 months ago

Have this problem. image

The list of installed packages: image

In setting I modified the command to point to the latest rust-analyzer https://github.com/rust-lang/rust-analyzer/releases/tag/2024-07-22

"command": [
        "${storage_path}/LSP-rust-analyzer-new/rust-analyzer"
    ],
❯ rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.79.0 (129f3b996 2024-06-10)`
predragnikolic commented 3 months ago

Are you using the LSP-rust-analyzer package or did you manually configure rust-analyzer in LSP.sublime-settings? If yes, you should not see that error, because it is handled by LSP-rust-analyzer with this code https://github.com/sublimelsp/LSP-rust-analyzer/blob/main/plugin.py#L202

If no, then I would assume that you manually configured rust-analyzer in LSP.sublime-settings in the "clients" section, That should explain the error popup, because then the rust-analyzer.runSingle is not handled.

mxsur commented 3 months ago

@predragnikolic I configured the following section in LSP.sublime-settings:

    "selector": "source.rust",
    "command": [
        "${storage_path}/LSP-rust-analyzer-new/rust-analyzer"
    ],
}

which points to a new folder LSP-rust-analyzer-NEW containing the latest rust-analyzer. The full path to it /home/xxx/.cache/sublime-text/Package Storage/LSP-rust-analyzer-new/rust-analyzer

If I shift to rust-analyzer version 3 weeks ago - than it works fine. So, perhaps, new version requires some special handling. Same happens with UI tests commands

predragnikolic commented 3 months ago

The issue is caused because that you actually don't use LSP-rust-analyzer, instead you created your own client configuration.

To explain, the easiest way to connect to a LSP server is to configure the server manually in LSP.sublime-settings. (that is the way that you did)

Sometimes the LSP server (like rust-analyzer) have custom requests, that needs to be handled with custom code, that is where packages like LSP-rust-analyzer come into play.

I would suggest you to remove the client configuration that you added. If you want to override the command of the LSP-rust-analyzer you could do it in LSP-rust-analyzer: Settings (available in the command palette) And put the command override there:

// Settings in here override those in "LSP-rust-analyzer/LSP-rust-analyzer.sublime-settings"
{
    "command": [
        "${storage_path}/LSP-rust-analyzer-new/rust-analyzer"
    ]
}

I would not suggest that unless you really know what you do.

There is an open OR to add v024-07-22 -> https://github.com/sublimelsp/LSP-rust-analyzer/pull/135 . it is just not merged yet.

mxsur commented 3 months ago

noted. thnx