sublimelsp / LSP-rust-analyzer

Convenience package for rust-analyzer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Syntax Highlighting in Hover Tooltips

alterae opened this issue · comments

Currently, code in hover tooltips (such as the line that shows what module a given symbol is in, the symbol signature, and any code blocks in the documentation for a symbol) generated by this plugin lack any syntax highlighting. This somewhat impairs readability of these tooltips.

This does not seem to be a general issue with Sublime LSP, as LSP-Deno highlights code in tooltips just fine.

Screenshots

LSP-rust-analyzer tooltip, from a project of mine
image

LSP-Deno tooltip, for comparisson
image

Works here?

Screenshot 2022-01-03 at 16 10 04

Can you provide the output of the LSP: Troubleshoot server command?

Can you provide the output of the LSP: Troubleshoot server command?

Troubleshooting: rust-analyzer

Version

  • LSP: 1.15.0
  • Sublime Text: 4126

Server Test Run

  • exit code: 0
  • output

Server Configuration

  • command
[
  "${storage_path}/LSP-rust-analyzer/rust-analyzer"
]
  • shell command
"/home/michelle/.cache/sublime-text/Package Storage/LSP-rust-analyzer/rust-analyzer"
  • selector
source.rust
  • priority_selector
source.rust
  • init_options
{}
  • settings
{
  "rust-analyzer": {
    "assist": {
      "allowMergingIntoGlobImports": true, 
      "importEnforceGranularity": false, 
      "importGranularity": "crate", 
      "importGroup": true, 
      "importPrefix": "plain"
    }, 
    "callInfo": {
      "full": true
    }, 
    "cargo": {
      "allFeatures": false, 
      "autoreload": true, 
      "features": [], 
      "noDefaultFeatures": false, 
      "noSysroot": false, 
      "runBuildScripts": true, 
      "target": null, 
      "unsetTest": [
        "core"
      ], 
      "useRustcWrapperForBuildScripts": true
    }, 
    "cargoRunner": null, 
    "checkOnSave": {
      "allFeatures": null, 
      "allTargets": true, 
      "command": "clippy", 
      "enable": true, 
      "extraArgs": [], 
      "features": null, 
      "noDefaultFeatures": null, 
      "overrideCommand": null, 
      "target": null
    }, 
    "completion": {
      "addCallArgumentSnippets": true, 
      "addCallParenthesis": true, 
      "autoimport": {
        "enable": true
      }, 
      "autoself": {
        "enable": true
      }, 
      "postfix": {
        "enable": true
      }
    }, 
    "debug": {
      "engine": "auto", 
      "engineSettings": {}, 
      "openDebugPane": false, 
      "sourceFileMap": {
        "/rustc/<id>": "${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/lib/rustlib/src/rust"
      }
    }, 
    "diagnostics": {
      "disabled": [], 
      "enable": true, 
      "enableExperimental": true, 
      "remapPrefix": {}, 
      "warningsAsHint": [], 
      "warningsAsInfo": []
    }, 
    "experimental": {
      "procAttrMacros": false
    }, 
    "files": {
      "excludeDirs": [], 
      "watcher": "client"
    }, 
    "highlighting": {
      "strings": true
    }, 
    "hover": {
      "documentation": true, 
      "linksInHover": true
    }, 
    "hoverActions": {
      "debug": true, 
      "enable": true, 
      "gotoTypeDef": true, 
      "implementations": true, 
      "linksInHover": true, 
      "references": false, 
      "run": true
    }, 
    "inlayHints": {
      "chainingHints": true, 
      "enable": true, 
      "maxLength": 25, 
      "parameterHints": true, 
      "smallerHints": true, 
      "typeHints": true
    }, 
    "joinLines": {
      "joinAssignments": true, 
      "joinElseIf": true, 
      "removeTrailingComma": true, 
      "unwrapTrivialBlock": true
    }, 
    "lens": {
      "debug": true, 
      "enable": true, 
      "implementations": true, 
      "methodReferences": false, 
      "references": false, 
      "run": true
    }, 
    "linkedProjects": [], 
    "lruCapacity": null, 
    "notifications": {
      "cargoTomlNotFound": true
    }, 
    "procMacro": {
      "enable": true, 
      "server": null
    }, 
    "runnableEnv": null, 
    "runnables": {
      "cargoExtraArgs": [], 
      "overrideCargo": null
    }, 
    "rustcSource": null, 
    "rustfmt": {
      "enableRangeFormatting": false, 
      "extraArgs": [], 
      "overrideCommand": null
    }, 
    "terminusAutoClose": false, 
    "terminusUsePanel": true, 
    "workspace": {
      "symbol": {
        "search": {
          "kind": "only_types", 
          "scope": "workspace"
        }
      }
    }
  }
}
  • env
{}

Active view

  • File name
/home/michelle/code/rust/pong/src/game/ball.rs
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", 
  "lsp_active": true, 
  "syntax": "Packages/Rust Enhanced/RustEnhanced.sublime-syntax"
}
  • base scope
source.rust

Project / Workspace

  • folders
[
  "/home/michelle/code/rust/pong"
]
  • is project: True
  • project data:
{
  "folders": [
    {
      "binary_file_patterns": [
        "target/*"
      ], 
      "path": "."
    }
  ]
}

LSP configuration

{
  "clients": {
    "ccls": {
      "auto_complete_selector": "punctuation.accessor | (meta.preprocessor.include string - punctuation.definition.string.end)", 
      "command": [
        "ccls"
      ], 
      "selector": "source.c | source.c++ | source.objc | source.objc++"
    }, 
    "ocaml": {
      "command": [
        "ocamllsp"
      ], 
      "enabled": true, 
      "selector": "source.ocaml"
    }
  }, 
  "diagnostics_highlight_style": {
    "error": "underline", 
    "hint": "stippled", 
    "info": "stippled", 
    "warning": "underline"
  }, 
  "lsp_format_on_save": true, 
  "popup_max_characters_height": 25, 
  "popup_max_characters_width": 78, 
  "semantic_highlighting": true, 
  "show_code_lens": "phantom", 
  "show_diagnostics_panel_on_save": 0
}

System PATH

  • /usr/local/bin
  • /usr/bin
  • /bin
  • /usr/local/sbin
  • /home/michelle/.dotnet/tools
  • /usr/lib/jvm/default/bin
  • /usr/bin/site_perl
  • /usr/bin/vendor_perl
  • /usr/bin/core_perl

I'm using built-in Rust syntax from Packages/Rust/Rust.sublime-syntax. You are using Packages/Rust Enhanced/RustEnhanced.sublime-syntax.

I guess you've disabled the built-in syntax so the mdpopups dependency used for highlighting the code blocks can't find it and defaults to plain text.

I guess one option is to re-enable the built-in syntax. You should still be able to use "RustEnhanced" for the files themselves.

Ah, yeah. Re-enabling the Rust package solved the issue. Thank you.