helix-editor / helix

A post-modern modal text editor.
https://helix-editor.com
Mozilla Public License 2.0
33.73k stars 2.51k forks source link

Inconsistent behaviour of rust-analyzer inlay hints #7649

Closed cdbrkfxrpt closed 1 year ago

cdbrkfxrpt commented 1 year ago

Summary

Context

My languages.toml looks as follows:

[[language]]
name = "rust"
rulers = [101]

[language-server.rust-analyzer.config.check]
command = "clippy"
features = "all"

[language-server.rust-analyzer.config.rustfmt]
extraArgs = [ "+nightly" ]

[language-server.rust-analyzer.config.inlayHints]
bindingModeHints.enable = false
closingBraceHints.minLines = 10
closureReturnTypeHints.enable = "with_block"
discriminantHints.enable = "never"
lifetimeElisionHints.enable = "never"
typeHints.hideClosureInitialization = false
typeHints.enable = false
parameterHints.enable = false

I've verified that syntax is correct. The following is noteworthy:

Observed Behaviour

When I open a file directly, the settings are applied, ie no lifetime elision hints are shown, nor are discriminant hints, nor type hints not parameter hints.

When I then open the same file in a vertical split by typing :vs, the settings coming from the helix default config are applied, ie all of the above (including discriminant hints and lifetime elision hints - which are off by default in rust-analyzer, but are set to "fieldless" and "skip_trivial" respectively in the helix default config) are shown.

Furthermore, when I simply start helix via hx and then open a file, the defaults of helix will be applied as well.

Expected Behaviour

The settings from my languages.toml are always applied to any file open in any buffer in helix.

Reproduction Steps

I tried this:

  1. hx some_file.rs
  2. :vs

and this:

  1. hx
  2. use picker to open file

I expected this to happen:

Settings from my languages.toml file applied in all buffers.

Instead, this happened:

Settings from my languages.toml file applied in buffer opened via hx some_file.rs. Settings from helix's default languages.toml file applied in all other buffers.

Helix log

i deleted the log before performing the above steps to reproduce; the logo is still empty after the steps.

Platform

macOS 13.4.1 (c) (22F770820d)

Terminal Emulator

alacritty 0.12.2 (9d9982d)

Helix Version

helix 23.05 (7f5940be)

pascalkuthe commented 1 year ago

this are two seperate bugs The check whether inlay hints have been requested is buggy which causes helix to miss the first inlay hint computation. This is easily reproducible. But if you wait for the LSP to finish starting (see the status messages in the bottom) and then start editing the document you will get exactly the same inlay hints. I want to replace that with event-based request anyway which would fix that.

The config not getting picked up correctly: I can not reproduce this. I minimized the testcase a bit.

fn main() {
    println!("Hello World!");
    let foo = 2;
    let bar = 2;
}
#[repr(u8)]
pub enum MouseButton {
    Left = 2,
    Right,
    Middle,
}

In the config:

[language-server.rust-analyzer.config.inlayHints]
discriminantHints.enable = "always"

results in:

image

In the config:

[language-server.rust-analyzer.config.inlayHints]
discriminantHints.enable = "never"

results in:

image

cdbrkfxrpt commented 1 year ago

minimising the example doesn't help, unfortunately:

[[language]]
name = "rust"
rulers = [101]

[language-server.rust-analyzer.config.inlayHints]
discriminantHints.enable = "never"
typeHints.enable = false
parameterHints.enable = false

on a newly created rust project still results in:

image

i've tried also with only discriminantHints.enable = "never" and it still shows them.

pascalkuthe commented 1 year ago

please run helix in verbose mode hx -v and upload the log, this is likely just an issue with your configuration or RA version. The config works as intended for me

cdbrkfxrpt commented 1 year ago
2023-07-16T17:51:00.578 helix_vcs [INFO] PeelToCommit(
    Unborn {
        name: FullName(
            "refs/heads/master",
        ),
    },
)
2023-07-16T17:51:00.583 helix_vcs [INFO] failed to open diff base for /Users/florian.eich/sandbox/bintest/src/main.rs
2023-07-16T17:51:00.584 helix_vcs [INFO] PeelToCommit(
    Unborn {
        name: FullName(
            "refs/heads/master",
        ),
    },
)
2023-07-16T17:51:00.584 helix_vcs [INFO] failed to obtain current head name for /Users/florian.eich/sandbox/bintest/src/main.rs
2023-07-16T17:51:00.586 helix_lsp::client [INFO] Using custom LSP config: {"inlayHints":{"bindingModeHints":{"enable":false},"closingBraceHints":{"minLines":10},"closureReturnTypeHints":{"enable":"with_block"},"discriminantHints":{"enable":"fieldless"},"lifetimeElisionHints":{"enable":"skip_trivial"},"typeHints":{"hideClosureInitialization":false}}}
2023-07-16T17:51:00.586 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialize","params":{"capabilities":{"general":{"positionEncodings":["utf-8","utf-32","utf-16"]},"textDocument":{"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"completionItem":{"deprecatedSupport":true,"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"snippetSupport":true,"tagSupport":{"valueSet":[1]}},"completionItemKind":{}},"hover":{"contentFormat":["markdown"]},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"versionSupport":true},"rename":{"dynamicRegistration":false,"honorsChangeAnnotations":false,"prepareSupport":true},"signatureHelp":{"signatureInformation":{"activeParameterSupport":true,"documentationFormat":["markdown"],"parameterInformation":{"labelOffsetSupport":true}}}},"window":{"workDoneProgress":true},"workspace":{"applyEdit":true,"configuration":true,"didChangeConfiguration":{"dynamicRegistration":false},"executeCommand":{"dynamicRegistration":false},"inlayHint":{"refreshSupport":false},"symbol":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true,"failureHandling":"abort","normalizesLineEndings":false,"resourceOperations":["create","rename","delete"]},"workspaceFolders":true}},"clientInfo":{"name":"helix","version":"23.05 (7f5940be)"},"initializationOptions":{"inlayHints":{"bindingModeHints":{"enable":false},"closingBraceHints":{"minLines":10},"closureReturnTypeHints":{"enable":"with_block"},"discriminantHints":{"enable":"fieldless"},"lifetimeElisionHints":{"enable":"skip_trivial"},"typeHints":{"hideClosureInitialization":false}}},"processId":12228,"rootPath":"/Users/florian.eich/sandbox/bintest","rootUri":"file:///Users/florian.eich/sandbox/bintest","workspaceFolders":[{"name":"bintest","uri":"file:///Users/florian.eich/sandbox/bintest"}]},"id":0}
2023-07-16T17:51:00.659 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"result":{"capabilities":{"positionEncoding":"utf-8","textDocumentSync":{"openClose":true,"change":2,"save":{}},"selectionRangeProvider":true,"hoverProvider":true,"completionProvider":{"resolveProvider":true,"triggerCharacters":[":",".","'","("],"completionItem":{"labelDetailsSupport":false}},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"definitionProvider":true,"typeDefinitionProvider":true,"implementationProvider":true,"referencesProvider":true,"documentHighlightProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"documentFormattingProvider":true,"documentRangeFormattingProvider":false,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{"]},"renameProvider":{"prepareProvider":true},"foldingRangeProvider":true,"declarationProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true},"fileOperations":{"willRename":{"filters":[{"scheme":"file","pattern":{"glob":"**/*.rs","matches":"file"}},{"scheme":"file","pattern":{"glob":"**","matches":"folder"}}]}}},"callHierarchyProvider":true,"semanticTokensProvider":{"legend":{"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"],"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","mutable","public","reference","trait","unsafe"]},"range":true,"full":{"delta":true}},"inlayHintProvider":{"resolveProvider":true},"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true}},"serverInfo":{"name":"rust-analyzer","version":"1.71.0 (8ede3aae 2023-07-12)"}}}
2023-07-16T17:51:00.659 helix_lsp::transport [INFO] <- {"capabilities":{"callHierarchyProvider":true,"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite"],"resolveProvider":true},"codeLensProvider":{"resolveProvider":true},"completionProvider":{"completionItem":{"labelDetailsSupport":false},"resolveProvider":true,"triggerCharacters":[":",".","'","("]},"declarationProvider":true,"definitionProvider":true,"documentFormattingProvider":true,"documentHighlightProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"=","moreTriggerCharacter":[".",">","{"]},"documentRangeFormattingProvider":false,"documentSymbolProvider":true,"experimental":{"externalDocs":true,"hoverRange":true,"joinLines":true,"matchingBrace":true,"moveItem":true,"onEnter":true,"openCargoToml":true,"parentModule":true,"runnables":{"kinds":["cargo"]},"ssr":true,"workspaceSymbolScopeKindFiltering":true},"foldingRangeProvider":true,"hoverProvider":true,"implementationProvider":true,"inlayHintProvider":{"resolveProvider":true},"positionEncoding":"utf-8","referencesProvider":true,"renameProvider":{"prepareProvider":true},"selectionRangeProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":["documentation","declaration","static","defaultLibrary","async","attribute","callable","constant","consuming","controlFlow","crateRoot","injected","intraDocLink","library","mutable","public","reference","trait","unsafe"],"tokenTypes":["comment","decorator","enumMember","enum","function","interface","keyword","macro","method","namespace","number","operator","parameter","property","string","struct","typeParameter","variable","angle","arithmetic","attribute","attributeBracket","bitwise","boolean","brace","bracket","builtinAttribute","builtinType","character","colon","comma","comparison","constParameter","derive","deriveHelper","dot","escapeSequence","formatSpecifier","generic","label","lifetime","logical","macroBang","parenthesis","punctuation","selfKeyword","selfTypeKeyword","semicolon","typeAlias","toolModule","union","unresolvedReference"]},"range":true},"signatureHelpProvider":{"triggerCharacters":["(",",","<"]},"textDocumentSync":{"change":2,"openClose":true,"save":{}},"typeDefinitionProvider":true,"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.rs","matches":"file"},"scheme":"file"},{"pattern":{"glob":"**","matches":"folder"},"scheme":"file"}]}},"workspaceFolders":{"changeNotifications":true,"supported":true}},"workspaceSymbolProvider":true},"serverInfo":{"name":"rust-analyzer","version":"1.71.0 (8ede3aae 2023-07-12)"}}
2023-07-16T17:51:00.659 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"initialized","params":{}}
2023-07-16T17:51:00.659 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"workspace/didChangeConfiguration","params":{"settings":{"inlayHints":{"bindingModeHints":{"enable":false},"closingBraceHints":{"minLines":10},"closureReturnTypeHints":{"enable":"with_block"},"discriminantHints":{"enable":"fieldless"},"lifetimeElisionHints":{"enable":"skip_trivial"},"typeHints":{"hideClosureInitialization":false}}}}}
2023-07-16T17:51:00.659 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"languageId":"rust","text":"pub enum Status {\n    Unknown = 4,\n    Taken,\n    Blocked,\n}\n\nfn add(lhs: i64, rhs: i64) -> Option<i64> {\n    lhs.checked_add(rhs)\n}\n\nfn main() {\n    println!(\"Hello, world!\");\n\n    let fortytwo = add(20, 22).unwrap();\n    println!(\"fortytwo: {fortytwo}\");\n}\n","uri":"file:///Users/florian.eich/sandbox/bintest/src/main.rs","version":0}}}
2023-07-16T17:51:00.667 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"rust-analyzer"}]}}
2023-07-16T17:51:00.667 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Fetching"}}
2023-07-16T17:51:00.667 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":[null],"id":0}
2023-07-16T17:51:00.667 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":1}
2023-07-16T17:51:00.667 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"begin","title":"Fetching","cancellable":false}}}
2023-07-16T17:51:00.914 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"report","cancellable":false,"message":"metadata"}}}
2023-07-16T17:51:01.270 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"end"}}}
2023-07-16T17:51:01.270 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":2,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Roots Scanned"}}
2023-07-16T17:51:01.270 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"begin","title":"Roots Scanned","cancellable":false,"message":"0/2","percentage":0}}}
2023-07-16T17:51:01.270 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":3,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Fetching"}}
2023-07-16T17:51:01.270 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"begin","title":"Fetching","cancellable":false}}}
2023-07-16T17:51:01.273 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":2}
2023-07-16T17:51:01.273 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":3}
2023-07-16T17:51:01.447 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"report","cancellable":false,"message":"metadata"}}}
2023-07-16T17:51:01.769 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"end"}}}
2023-07-16T17:51:01.769 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":4,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Loading"}}
2023-07-16T17:51:01.769 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"begin","title":"Loading","cancellable":false}}}
2023-07-16T17:51:01.770 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":4}
2023-07-16T17:51:01.865 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"report","cancellable":false,"message":"building proc-macros: bintest"}}}
2023-07-16T17:51:01.865 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"report","cancellable":false,"message":"building proc-macros: bintest"}}}
2023-07-16T17:51:01.873 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Loading","value":{"kind":"end"}}}
2023-07-16T17:51:02.442 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"report","cancellable":false,"message":"1/2","percentage":50}}}
2023-07-16T17:51:02.473 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"end","message":"2/2"}}}
2023-07-16T17:51:02.473 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":5,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Roots Scanned"}}
2023-07-16T17:51:02.473 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"begin","title":"Roots Scanned","cancellable":false,"message":"0/2","percentage":0}}}
2023-07-16T17:51:02.473 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":6,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Fetching"}}
2023-07-16T17:51:02.473 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"begin","title":"Fetching","cancellable":false}}}
2023-07-16T17:51:02.484 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":6}
2023-07-16T17:51:02.485 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":5}
2023-07-16T17:51:02.634 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"report","cancellable":false,"message":"metadata"}}}
2023-07-16T17:51:02.656 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"report","cancellable":false,"message":"1/2","percentage":50}}}
2023-07-16T17:51:02.656 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Roots Scanned","value":{"kind":"end","message":"2/2"}}}
2023-07-16T17:51:02.923 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Fetching","value":{"kind":"end"}}}
2023-07-16T17:51:02.924 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":7,"method":"window/workDoneProgress/create","params":{"token":"rustAnalyzer/Indexing"}}
2023-07-16T17:51:02.924 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"begin","title":"Indexing","cancellable":false,"percentage":0}}}
2023-07-16T17:51:02.925 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":7}
2023-07-16T17:51:02.927 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"0/5 (core + 1 more)","percentage":0}}}
2023-07-16T17:51:02.953 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"1/5 (core)","percentage":20}}}
2023-07-16T17:51:02.979 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":8,"method":"window/workDoneProgress/create","params":{"token":"rust-analyzer/flycheck/0"}}
2023-07-16T17:51:02.979 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rust-analyzer/flycheck/0","value":{"kind":"begin","title":"cargo check","cancellable":true}}}
2023-07-16T17:51:02.979 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","result":null,"id":8}
2023-07-16T17:51:03.030 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rust-analyzer/flycheck/0","value":{"kind":"end"}}}
2023-07-16T17:51:04.394 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":40}}}
2023-07-16T17:51:04.394 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"2/5 (alloc)","percentage":40}}}
2023-07-16T17:51:04.516 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":60}}}
2023-07-16T17:51:04.516 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"3/5 (std)","percentage":60}}}
2023-07-16T17:51:04.762 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":80}}}
2023-07-16T17:51:04.762 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"message":"4/5 (proc_macro)","percentage":80}}}
2023-07-16T17:51:04.816 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"report","cancellable":false,"percentage":100}}}
2023-07-16T17:51:04.816 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"$/progress","params":{"token":"rustAnalyzer/Indexing","value":{"kind":"end"}}}
2023-07-16T17:51:05.701 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/florian.eich/sandbox/bintest/src/main.rs","diagnostics":[],"version":0}}
2023-07-16T17:51:11.022 helix_lsp::transport [INFO] -> {"jsonrpc":"2.0","method":"textDocument/inlayHint","params":{"range":{"end":{"character":0,"line":16},"start":{"character":0,"line":0}},"textDocument":{"uri":"file:///Users/florian.eich/sandbox/bintest/src/main.rs"}},"id":1}
2023-07-16T17:51:11.043 helix_lsp::transport [INFO] <- {"jsonrpc":"2.0","id":1,"result":[{"position":{"line":2,"character":9},"label":[{"value":" = "},{"value":"5","tooltip":"enum variant discriminant"}],"paddingLeft":false,"paddingRight":false},{"position":{"line":3,"character":11},"label":[{"value":" = "},{"value":"6","tooltip":"enum variant discriminant"}],"paddingLeft":false,"paddingRight":false},{"position":{"line":13,"character":16},"label":": i64","kind":1,"paddingLeft":false,"paddingRight":false},{"position":{"line":13,"character":23},"label":[{"value":"lhs","location":{"uri":"file:///Users/florian.eich/sandbox/bintest/src/main.rs","range":{"start":{"line":6,"character":7},"end":{"line":6,"character":10}}}},{"value":":"}],"kind":2,"paddingLeft":false,"paddingRight":true},{"position":{"line":13,"character":27},"label":[{"value":"rhs","location":{"uri":"file:///Users/florian.eich/sandbox/bintest/src/main.rs","range":{"start":{"line":6,"character":17},"end":{"line":6,"character":20}}}},{"value":":"}],"kind":2,"paddingLeft":false,"paddingRight":true}]}
2023-07-16T17:51:11.044 helix_lsp::transport [INFO] <- [{"label":[{"value":" = "},{"tooltip":"enum variant discriminant","value":"5"}],"paddingLeft":false,"paddingRight":false,"position":{"character":9,"line":2}},{"label":[{"value":" = "},{"tooltip":"enum variant discriminant","value":"6"}],"paddingLeft":false,"paddingRight":false,"position":{"character":11,"line":3}},{"kind":1,"label":": i64","paddingLeft":false,"paddingRight":false,"position":{"character":16,"line":13}},{"kind":2,"label":[{"location":{"range":{"end":{"character":10,"line":6},"start":{"character":7,"line":6}},"uri":"file:///Users/florian.eich/sandbox/bintest/src/main.rs"},"value":"lhs"},{"value":":"}],"paddingLeft":false,"paddingRight":true,"position":{"character":23,"line":13}},{"kind":2,"label":[{"location":{"range":{"end":{"character":20,"line":6},"start":{"character":17,"line":6}},"uri":"file:///Users/florian.eich/sandbox/bintest/src/main.rs"},"value":"rhs"},{"value":":"}],"paddingLeft":false,"paddingRight":true,"position":{"character":27,"line":13}}]

the result is the same, whether i have stable or nightly toolchain active.

(the log shows that the language-server part of my languages.toml simply does not get picked up)

pascalkuthe commented 1 year ago

It honestly looks like your config fil is not being picked up at all. You can try to introduce some invalid toml and see if helix complains at startup

cdbrkfxrpt commented 1 year ago

It honestly looks like your config fil is not being picked up at all. You can try to introduce some invalid toml and see if helix complains at startup

your reply and my edit intersected

so - i know that the config file is being read because it does apply the ruler at 101 characters.

also, if i add the line warblgarbl: 4 at the end of the file, i get the following on helix start:

image

pascalkuthe commented 1 year ago

Could you try inserting

[language-server.rust-analyzer.config.inlayHints]
discriminantHints.enable = "never"

at the very top of the languages.toml file (its important that there is nothing before it). I think your toml file might be invalid

gabydd commented 1 year ago

Ah it looks from your initial issue you are using the latest release not master. Release has a bit different way to configure language servers because multiple language servers was merged into master. It looks like:

[[language]]
name = "rust"
[language.config.<the rest>]
<config pairs>

Basically just remove -server and .rust-analyzer from the config

cdbrkfxrpt commented 1 year ago

Ah it looks from your initial issue you are using the latest release not master. Release has a bit different way to configure language servers because multiple language servers was merged into master. It looks like:

[[language]]
name = "rust"
[language.config.<the rest>]
<config pairs>

that worked. looks as expected, logs show correct rust-analyzer config being used.

my apologies. i actually tried using the "on older versions of helix" way (as per the docs) at some point and it didn't work, but that was probably just me having messed up the actual config.

also, i've updated the Wiki page and have inserted the release version 23.05 since it might not be immediately obvious what "on older versions" means.