rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Extended paths on windows break rust-analyzer.

Open ofluffydev opened this issue 9 months ago • 1 comments

rust-analyzer version: rust-analyzer version: 0.3.2345-standalone (b0632f749e 2025-03-16) [c:\Users<removed username>.vscode\extensions\rust-lang.rust-analyzer-0.3.2345-win32-x64\server\rust-analyzer.exe]

rustc version: rustc 1.85.0 (4d91de4e4 2025-02-17)

editor or extension: VSCode

relevant settings: None altered, defaults.

code snippet to reproduce: Not caused by code, happens when vs code opens with a path containing \\?\ before the drive letter.

Error message [Error - 2:33:07 AM] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097 Error: Failed to deserialize InitializeParams: invalid international domain name: "file://%3F/g%3A/hackclub-ideas-backend"; {"processId":49436,"clientInfo":{"name":"Visual Studio Code","version":"1.98.2"},"locale":"en","rootPath":"\\?\G:\hackclub-ideas-backend","rootUri":"file://%3F/g%3A/hackclub-ideas-backend","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]},"resolveSupport":{"properties":["location.range"]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"didChangeConfiguration":{"dynamicRegistration":true},"workspaceFolders":true,"foldingRange":{"refreshSupport":true},"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"inlineValue":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"diagnostics":{"refreshSupport":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]},"labelDetailsSupport":true},"insertTextMode":2,"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"completionList":{"itemDefaults":["commitCharacters","editRange","insertTextFormat","insertTextMode","data"]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":true},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true,"rangesSupport":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true,"foldingRangeKind":{"valueSet":["comment","imports","region"]},"foldingRange":{"collapsedText":false}},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false,"serverCancelSupport":true,"augmentsSyntaxTokens":false},"linkedEditingRange":{"dynamicRegistration":true},"typeHierarchy":{"dynamicRegistration":true},"inlineValue":{"dynamicRegistration":true},"inlayHint":{"dynamicRegistration":true,"resolveSupport":{"properties":["tooltip","textEdits","label.tooltip","label.location","label.command"]}},"diagnostic":{"dynamicRegistration":true,"relatedDocumentSupport":false}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"staleRequestSupport":{"cancel":true,"retryOnContentModified":["textDocument/semanticTokens/full","textDocument/semanticTokens/range","textDocument/semanticTokens/full/delta"]},"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0","allowedTags":["ul","li","p","code","blockquote","ol","h1","h2","h3","h4","h5","h6","hr","em","pre","table","thead","tbody","tr","th","td","div","del","a","strong","br","img","span"]},"positionEncodings":["utf-16"]},"notebookDocument":{"synchronization":{"dynamicRegistration":true,"executionSummarySupport":true}},"experimental":{"snippetTextEdit":true,"codeActionGroup":true,"hoverActions":true,"serverStatusNotification":true,"colorDiagnosticOutput":true,"openServerLogs":true,"localDocs":true,"testExplorer":false,"commands":{"commands":["rust-analyzer.runSingle","rust-analyzer.debugSingle","rust-analyzer.showReferences","rust-analyzer.gotoLocation","rust-analyzer.triggerParameterHints","rust-analyzer.rename"]}}},"initializationOptions":{"restartServerOnConfigChange":false,"showUnlinkedFileNotification":true,"showRequestFailedErrorNotification":true,"showDependenciesExplorer":true,"showSyntaxTree":false,"testExplorer":false,"initializeStopped":false,"runnables":{"extraEnv":null,"problemMatcher":["$rustc"],"askBeforeUpdateTest":true,"command":null,"extraArgs":[],"extraTestBinaryArgs":["--show-output"]},"statusBar":{"clickAction":"openLogs","showStatusBar":{"documentSelector":[{"language":"rust"},{"pattern":"/Cargo.toml"},{"pattern":"/Cargo.lock"},{"scheme":"output","pattern":"extension-output-rust-lang.rust-analyzer*"}]}},"server":{"path":null,"extraEnv":null},"trace":{"server":"off","extension":false},"debug":{"engine":"auto","sourceFileMap":{"/rustc/":"${env:USERPROFILE}/.rustup/toolchains//lib/rustlib/src/rust"},"openDebugPane":false,"buildBeforeRestart":false,"engineSettings":{}},"typing":{"continueCommentsOnNewline":true,"triggerChars":"=."},"diagnostics":{"previewRustcOutput":false,"useRustcErrorCode":false,"disabled":[],"enable":true,"experimental":{"enable":false},"remapPrefix":{},"styleLints":{"enable":false},"warningsAsHint":[],"warningsAsInfo":[]},"assist":{"emitMustUse":false,"expressionFillDefault":"todo","termSearch":{"borrowcheck":true,"fuel":1800}},"cachePriming":{"enable":true,"numThreads":"physical"},"cargo":{"allTargets":true,"autoreload":true,"buildScripts":{"enable":true,"invocationStrategy":"per_workspace","overrideCommand":null,"rebuildOnSave":true,"useRustcWrapper":true},"cfgs":["debug_assertions","miri"],"extraArgs":[],"extraEnv":{},"features":[],"noDefaultFeatures":false,"sysroot":"discover","sysrootSrc":null,"target":null,"targetDir":null},"cfg":{"setTest":true},"checkOnSave":true,"check":{"allTargets":null,"command":"check","extraArgs":[],"extraEnv":{},"features":null,"ignore":[],"invocationStrategy":"per_workspace","noDefaultFeatures":null,"overrideCommand":null,"targets":null,"workspace":true},"completion":{"addSemicolonToUnit":true,"autoAwait":{"enable":true},"autoIter":{"enable":true},"autoimport":{"enable":true,"exclude":[{"path":"core::borrow::Borrow","type":"methods"},{"path":"core::borrow::BorrowMut","type":"methods"}]},"autoself":{"enable":true},"callable":{"snippets":"fill_arguments"},"excludeTraits":[],"fullFunctionSignatures":{"enable":false},"hideDeprecated":false,"limit":null,"postfix":{"enable":true},"privateEditable":{"enable":false},"snippets":{"custom":{"Ok":{"postfix":"ok","body":"Ok(${receiver})","description":"Wrap the expression in a Result::Ok","scope":"expr"},"Box::pin":{"postfix":"pinbox","body":"Box::pin(${receiver})","requires":"std::boxed::Box","description":"Put the expression into a pinned Box","scope":"expr"},"Arc::new":{"postfix":"arc","body":"Arc::new(${receiver})","requires":"std::sync::Arc","description":"Put the expression into an Arc","scope":"expr"},"Some":{"postfix":"some","body":"Some(${receiver})","description":"Wrap the expression in an Option::Some","scope":"expr"},"Err":{"postfix":"err","body":"Err(${receiver})","description":"Wrap the expression in a Result::Err","scope":"expr"},"Rc::new":{"postfix":"rc","body":"Rc::new(${receiver})","requires":"std::rc::Rc","description":"Put the expression into an Rc","scope":"expr"}}},"termSearch":{"enable":false,"fuel":1000}},"files":{"exclude":[],"watcher":"client"},"highlightRelated":{"breakPoints":{"enable":true},"closureCaptures":{"enable":true},"exitPoints":{"enable":true},"references":{"enable":true},"yieldPoints":{"enable":true}},"hover":{"actions":{"debug":{"enable":true},"enable":true,"gotoTypeDef":{"enable":true},"implementations":{"enable":true},"references":{"enable":false},"run":{"enable":true},"updateTest":{"enable":true}},"documentation":{"enable":true,"keywords":{"enable":true}},"dropGlue":{"enable":true},"links":{"enable":true},"maxSubstitutionLength":20,"memoryLayout":{"alignment":"hexadecimal","enable":true,"niches":false,"offset":"hexadecimal","size":"both"},"show":{"enumVariants":5,"fields":5,"traitAssocItems":null}},"imports":{"granularity":{"enforce":false,"group":"crate"},"group":{"enable":true},"merge":{"glob":true},"preferNoStd":false,"preferPrelude":false,"prefix":"plain","prefixExternPrelude":false},"inlayHints":{"bindingModeHints":{"enable":false},"chainingHints":{"enable":true},"closingBraceHints":{"enable":true,"minLines":25},"closureCaptureHints":{"enable":false},"closureReturnTypeHints":{"enable":"never"},"closureStyle":"impl_fn","discriminantHints":{"enable":"never"},"expressionAdjustmentHints":{"enable":"never","hideOutsideUnsafe":false,"mode":"prefix"},"genericParameterHints":{"const":{"enable":true},"lifetime":{"enable":false},"type":{"enable":false}},"implicitDrops":{"enable":false},"implicitSizedBoundHints":{"enable":false},"lifetimeElisionHints":{"enable":"never","useParameterNames":false},"maxLength":25,"parameterHints":{"enable":true},"rangeExclusiveHints":{"enable":false},"reborrowHints":{"enable":"never"},"renderColons":true,"typeHints":{"enable":true,"hideClosureInitialization":false,"hideClosureParameter":false,"hideNamedConstructor":false}},"interpret":{"tests":false},"joinLines":{"joinAssignments":true,"joinElseIf":true,"removeTrailingComma":true,"unwrapTrivialBlock":true},"lens":{"debug":{"enable":true},"enable":true,"implementations":{"enable":true},"location":"above_name","references":{"adt":{"enable":false},"enumVariant":{"enable":false},"method":{"enable":false},"trait":{"enable":false}},"run":{"enable":true},"updateTest":{"enable":true}},"linkedProjects":[],"lru":{"capacity":null,"query":{"capacities":{}}},"notifications":{"cargoTomlNotFound":true},"numThreads":null,"procMacro":{"attributes":{"enable":true},"enable":true,"ignored":{},"server":null},"references":{"excludeImports":false,"excludeTests":false},"rustc":{"source":null},"rustfmt":{"extraArgs":[],"overrideCommand":null,"rangeFormatting":{"enable":false}},"semanticHighlighting":{"doc":{"comment":{"inject":{"enable":true}}},"nonStandardTokens":true,"operator":{"enable":true,"specialization":{"enable":false}},"punctuation":{"enable":false,"separate":{"macro":{"bang":false}},"specialization":{"enable":false}},"strings":{"enable":true}},"signatureInfo":{"detail":"full","documentation":{"enable":true}},"vfs":{"extraIncludes":[]},"workspace":{"discoverConfig":null,"symbol":{"search":{"kind":"only_types","limit":128,"scope":"workspace"}}}},"trace":"off","workspaceFolders":[{"uri":"file://%3F/g%3A/hackclub-ideas-backend","name":"hackclub-ideas-backend"}]}

Stack backtrace: 0: std::backtrace_rs::backtrace::dbghelp64::trace at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\std\src....\backtrace\src\backtrace\dbghelp64.rs:91 1: std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\std\src....\backtrace\src\backtrace\mod.rs:66 2: std::backtrace::Backtrace::create at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\std\src\backtrace.rs:331 3: std::backtrace::Backtrace::capture at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\std\src\backtrace.rs:296 4: anyhow::error::<impl anyhow::Error>::msg 5: anyhow::__private::format_err 6: rust_analyzer::from_json 7: rust_analyzer::run_server 8: std::sys::backtrace::__rust_begin_short_backtrace 9: <&T as core::fmt::Debug>::fmt 10: alloc::boxed::impl$28::call_once at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\alloc\src\boxed.rs:1993 11: alloc::boxed::impl$28::call_once at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\alloc\src\boxed.rs:1993 12: std::sys::pal::windows::thread::impl$0::new::thread_start at /rustc/4d91de4e48198da2e33413efdcd9cd2cc0c46688/library\std\src\sys\pal\windows\thread.rs:56 13: BaseThreadInitThunk 14: RtlUserThreadStart [Error - 2:33:09 AM] Server process exited with code 1. [Error - 2:33:09 AM] Server initialization failed. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:33:09 AM] The Rust Analyzer Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information. [Error - 2:33:09 AM] Rust Analyzer Language Server client: couldn't create connection to server. Message: Pending response rejected since connection got disposed Code: -32097 [Error - 2:33:09 AM] Restarting server failed Message: Pending response rejected since connection got disposed Code: -32097

ofluffydev avatar Mar 17 '25 07:03 ofluffydev

Until https://github.com/rust-lang/rfcs/issues/721 is supported, you will have to use WSL/WSL2 or use the windows long path hacks like \\? and setup windows long path support which still does not work in most cases.

I am trying to integrate RustAnalyzer with a tool I wrote to handle long paths for me on windows which uses a process hack https://github.com/sumukhballal/cargo-winpath-redirect. If I have any success, I shall keep you updated.

sumukhballal avatar Jun 08 '25 08:06 sumukhballal