LSP icon indicating copy to clipboard operation
LSP copied to clipboard

Logging panel is too short

Open detly opened this issue 4 years ago • 2 comments

I am trying to debug an issue with rust-analyzer. According to the RA docs I can get some useful information out of it by increasing logging. When I do that, by the time I can open the LSP log panel, the relevant messages are gone.

To Reproduce Steps to reproduce the behavior:

  1. Go to Preferences > Package Settings > LSP > Settings.

  2. Add:

    {
        "clients":
        {
    
            "rust-analyzer":
            {
                "command": ["~/.cargo/bin/rustup", "run", "nightly", "rust-analyzer"],
                "enabled": true,
                "env": {
                    "RA_LOG": "rust_analyzer=info",
                }
            },
        },
        "log_max_size": 0,
    }
    

    (Note that the command will probably have to change depending on how you installed RA.)

  3. Restart the language server, or open a Rust project.

  4. Open the LSP log panel.

  5. Watch as the relevant messages disappear out of the top of the panel.

I am not just talking about scrolling here, scrolling the panel contents up will still hit this limit.

This information is not available via the remote log setting.

Expected behavior I would expect to be able to set this somewhere.

Screenshots

Here's a GIF! I did not want to capture my actual code, but shortly after the GIF starts, I am restarting the RA language server.

Peek 2021-07-26 13-08

Environment:

  • OS: Ubuntu 21.04
  • Sublime Text version: 4113
  • LSP version: 1.7.0
  • Language servers used: rust-analyzer

detly avatar Jul 26 '21 05:07 detly

There is the log_max_size setting that you can increase.

Though maybe if the server has so much output, it would be best to also support logging to file.

rchl avatar Jul 26 '21 06:07 rchl

I could be wrong, but I think that setting is for line length, not total number of lines. At any rate, setting it to zero did not change this.

detly avatar Jul 26 '21 07:07 detly

Found the cause.

There is a hard-coded value. https://github.com/sublimelsp/LSP/blob/fe36b2d2c05126e9469fa3882dbff6731ce4a6b8/plugin/core/panels.py#L8

The content of the panel is deleted with this code: https://github.com/sublimelsp/LSP/blob/fe36b2d2c05126e9469fa3882dbff6731ce4a6b8/plugin/core/panels.py#L191-L192

IMO not sure if the delete code is necessary.

predragnikolic avatar Sep 06 '22 11:09 predragnikolic

Well, without it the log would fill up with no end. Could easily reach megabytes of text. Also I guess the syntax highlighting would stop working after some point.

rchl avatar Sep 06 '22 11:09 rchl