jwilm/racerd

Completions are returning 204 No Content for anything but "global" scope

Opened this issue · 4 comments

I've just tried with a quite fresh (yesterday) install of YouCompleteMe + racer completion, and any time I trigger a completion with . or :: I get no results back (the stdout log of racerd shows 204 No Content).

If I however trigger a completion at a "global" scope (just hitting ctrl-space on an empty line), it returns 200 OK with actual completion suggestions

jwilm commented

Can you provide concrete examples of what works and what doesn't?

Hi @jwilm

I've encountered into the same issue.
My steps to reproduce:

  • run racerd --logging
  • run example curl command from example
  • see "204" in racerd's console:
GET http://127.0.0.1:3048/ping -> 200 OK (0.018089 ms)
POST http://127.0.0.1:3048/list_completions -> 204 No Content (0.579337 ms)
  • no json returned to curl

/find_definition has the same issue.
I use racerd 0.3.3 compiled within YouCompleteMe plugin for Vim.

If it helps see debug log below:

DEBUG:hyper::server: threads = 48
racerd listening at 127.0.0.1:3048
DEBUG:hyper::server: Incoming stream
DEBUG:hyper::server::request: Request Line: Post AbsolutePath("/list_completions") Http11
DEBUG:hyper::server::request: Headers { User-Agent: curl/7.47.0, Content-Length: 146, Content-Type: application/json, Host: 127.0.0.1:3048, Accept: */*, }
DEBUG:racer::core: Path: contextstr is |path::Path|, searchstr is ||
DEBUG:racer::core: Complete path with line: "let p = path::Path::"
DEBUG:racer::nameres: resolve_path P[path::Path::] "src.rs" 47 StartsWith
DEBUG:racer::nameres: resolve_path P[path::Path] "src.rs" 47 ExactMatch
DEBUG:racer::nameres: resolve_path P[path] "src.rs" 47 ExactMatch
DEBUG:racer::nameres: resolve_name path "src.rs" 47 ExactMatch Type
DEBUG:racer::nameres: search_local_scopes PathSegment { name: "path", types: [] } "src.rs" 47 ExactMatch Type
DEBUG:racer::nameres: searching scope Type start: 26 point: 47 'path' "src.rs" ExactMatch local: true, session: Session { .. }
DEBUG:racer::nameres: search_scope found matches ExactMatch []
DEBUG:racer::nameres: search_scope_headers for |path| pt: 25
DEBUG:racer::nameres: search_scope_headers preblock is |fn main() |
DEBUG:racer::nameres: search_fn_args: found start of fn!! 15 |impl blah {fn main() {}}| path
DEBUG:racer::nameres: searching scope Type start: 0 point: 47 'path' "src.rs" ExactMatch local: true, session: Session { .. }
DEBUG:racer::matchers: found use: path in |use std::path;|
DEBUG:syntex_syntax::parse::lexer: scanning whitespace: Some(TokenAndSpan { tok: Whitespace, sp: Span { lo: BytePos(3), hi: BytePos(4), expn_id: ExpnId(4294967295) } })
DEBUG:syntex_syntax::codemap: byte pos BytePos(0) is on the line at byte pos BytePos(0)
DEBUG:syntex_syntax::codemap: char pos CharPos(0) is on the line at char pos CharPos(0)
DEBUG:syntex_syntax::codemap: byte is on line: 1
DEBUG:syntex_syntax::parse::attr: parse_outer_attributes: self.token=Ident(use#0)
DEBUG:syntex_syntax::parse::attr: parse_outer_attributes: self.token=Eof
DEBUG:racer::nameres: resolve_path P[std::path] "src.rs" 0 ExactMatch
DEBUG:racer::nameres: resolve_path P[std] "src.rs" 0 ExactMatch
DEBUG:racer::nameres: resolve_name std "src.rs" 0 ExactMatch Type
DEBUG:racer::nameres: get_crate_file std, "src.rs"
DEBUG:racer::cargo: get_crate_file: from_path="src.rs"
DEBUG:racer::nameres: search_local_scopes PathSegment { name: "std", types: [] } "src.rs" 0 ExactMatch Type
DEBUG:racer::nameres: searching scope Type start: 0 point: 0 'std' "src.rs" ExactMatch local: true, session: Session { .. }
DEBUG:racer::matchers: import use std::path; involved in a cycle; ignoring
DEBUG:racer::nameres: search_scope found matches ExactMatch []
DEBUG:racer::nameres: search_crate_root |PathSegment { name: "std", types: [] }| "src.rs"
DEBUG:racer::nameres: search_prelude file PathSegment { name: "std", types: [] } ExactMatch Type
DEBUG:racer::nameres: resolve_path returning []
DEBUG:racer::nameres: search_scope found matches ExactMatch []
DEBUG:racer::nameres: search_crate_root |PathSegment { name: "path", types: [] }| "src.rs"
DEBUG:racer::nameres: search_prelude file PathSegment { name: "path", types: [] } ExactMatch Type
DEBUG:racer::nameres: resolve_path returning []
DEBUG:racer::nameres: resolve_path returning []
POST http://127.0.0.1:3048/list_completions -> 204 No Content (0.557813 ms)
DEBUG:hyper::server::response: writing head: Http11 NoContent
DEBUG:hyper::server::response: headers [
Headers { Content-Length: 0, Date: Fri, 07 Apr 2017 13:45:28 GMT, }]
DEBUG:hyper::server: keep_alive = true for 127.0.0.1:47426
DEBUG:hyper::server: keep_alive loop ending for 127.0.0.1:47426

Sorry, I set rust source folder as ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust but it should be set as ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src (I missed last component).

Now it works fine.