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

Multiple rust-analyzer spawned #85

Open
pplanel opened this issue Nov 28, 2024 · 0 comments
Open

Multiple rust-analyzer spawned #85

pplanel opened this issue Nov 28, 2024 · 0 comments

Comments

@pplanel
Copy link

pplanel commented Nov 28, 2024

Hello, when using ra-multiplex with rustaceanvim it spawn N rust-analyzers for each project .rs file opened.

Is this the expected behaviour?

ps --long | where name == ra-multiplex

╭───┬───────┬───────┬──────────────┬────────┬──────┬─────────┬───────────┬───────────────────────────────────────────────┬───────────────────────────────────────────┬───────────────╮
│ # │  pid  │ ppid  │     name     │ status │ cpu  │   mem   │  virtual  │                    command                    │                    cwd                    │  start_time   │
├───┼───────┼───────┼──────────────┼────────┼──────┼─────────┼───────────┼───────────────────────────────────────────────┼───────────────────────────────────────────┼───────────────┤
│ 0 │ 23872 │ 23852 │ ra-multiplex │ Sleep  │ 0.00 │ 5.4 MiB │ 391.8 GiB │ ra-multiplex                                  │ /Users/pplanel/src/pplanel/web_components │ 4 minutes ago │
│ 1 │ 23358 │ 23337 │ ra-multiplex │ Sleep  │ 0.00 │ 5.3 MiB │ 391.8 GiB │ ra-multiplex                                  │ /Users/pplanel/src/tools/ra-multiplex     │ 5 minutes ago │
│ 2 │ 22733 │ 19312 │ ra-multiplex │ Sleep  │ 0.00 │ 9.0 MiB │ 391.9 GiB │ /Users/pplanel/.local/bin/ra-multiplex server │ /Users/pplanel/src/tools/ra-multiplex     │ 6 minutes ago │
╰───┴───────┴───────┴──────────────┴────────┴──────┴─────────┴───────────┴───────────────────────────────────────────────┴───────────────────────────────────────────┴───────────────╯

ps --long | where name == rust-analyzer

╭───┬───────┬───────┬───────────────┬────────┬──────┬───────────┬───────────┬──────────────────────────────────────────────────────────────────┬───────────────────────────────────────┬───────────────╮
│ # │  pid  │ ppid  │     name      │ status │ cpu  │    mem    │  virtual  │                             command                              │                  cwd                  │  start_time   │
├───┼───────┼───────┼───────────────┼────────┼──────┼───────────┼───────────┼──────────────────────────────────────────────────────────────────┼───────────────────────────────────────┼───────────────┤
│ 0 │ 23877 │ 22733 │ rust-analyzer │ Sleep  │ 0.00 │   1.0 GiB │ 394.9 GiB │ /Users/pplanel/.rustup/toolchains/stable-aarch64-apple-darwin/bi │ /Users/pplanel/src/tools/ra-multiplex │ 5 minutes ago │
│   │       │       │               │        │      │           │           │ n/rust-analyzer                                                  │                                       │               │
│ 1 │ 23363 │ 22733 │ rust-analyzer │ Sleep  │ 0.00 │ 645.6 MiB │ 394.2 GiB │ /Users/pplanel/.rustup/toolchains/stable-aarch64-apple-darwin/bi │ /Users/pplanel/src/tools/ra-multiplex │ 5 minutes ago │
│   │       │       │               │        │      │           │           │ n/rust-analyzer                                                  │                                       │               │
╰───┴───────┴───────┴───────────────┴────────┴──────┴───────────┴───────────┴──────────────────────────────────────────────────────────────────┴───────────────────────────────────────┴───────────────╯

rustaceanvim config:

return {
  {
    "mrcjkb/rustaceanvim",
    opts = {
      server = {
        cmd = function()
          return { "ra-multiplex" }
        end,
        default_settings = {
          ["rust-analyzer"] = {
            diagnostics = {
              enable = true,
              disabled = { "unresolved-proc-macro" },
              enableExperimental = true,
            },
            rustfmt = {
              extraArgs = { "+nightly" },
            },
          },
        },
      },
    },
  },
}

ra-multiplex config:

# this is an example configuration file for ra-multiplex
#
# all configuration options here are set to their default value they'll have if
# they're not present in the file or if the config file is missing completely.

# time in seconds after which a rust-analyzer server instance with no clients
# connected will get killed to save system memory.
#
# you can set this option to `false` for infinite timeout
instance_timeout = 300 # after 5 minutes

# time in seconds how long to wait between the gc task checks for disconnected
# clients and possibly starts a timeout task. the value must be at least 1.
gc_interval = 10 # every 10 seconds

# ip address and port on which ra-multiplex-server listens
# or unix socket path on *nix operating systems
#
# the default "127.0.0.1" only allows connections from localhost which is
# preferred since the protocol doesn't worry about security.
# ra-multiplex server expects the filesystem structure and contents to be the
# same on its machine as on ra-multiplex's machine. if you want to run the
# server on a different computer it's theoretically possible but at least for
# now you're on your own.
#
# ports below 1024 will typically require root privileges and should be
# avoided, the default was picked at random, this only needs to change if
# another application happens to collide with ra-multiplex.
listen = ["127.0.0.1", 27631] # localhost & some random unprivileged port
# listen = "/var/run/ra-mux/ra-mux.sock" # unix socket

# ip address and port to which ra-multiplex will connect to
# or unix socket path on *nix operating systems
#
# this should usually just match the value of `listen`
connect = ["127.0.0.1", 27631] # same as `listen`
# connect = "/var/run/ra-mux/ra-mux.sock" # same as `listen`

# default log filters
#
# RUST_LOG env variable overrides this option, both use the same syntax which
# is documented in the `env_logger` documentation here:
# <https://docs.rs/env_logger/0.9.0/env_logger/index.html#enabling-logging>
log_filters = "info"

# environemnt variable names passed from `ra-multiplex client` to the server
#
# by default no variables are passed. and all servers are spawned in
# the same environment as the `ra-multiplex server` is. when a name like
# "LD_LIBRARY_PATH" is specifified the proxy reads the variable value from its
# environment and passes it to the server which then passes it on to the server
# executable.
#
# if "PATH" is specified here then the PATH from the client environment is
# going to be used for looking up a relative `--server-path`.
pass_environment = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant