Giter VIP home page Giter VIP logo

Comments (10)

wbthomason avatar wbthomason commented on June 3, 2024 1

I fixed this; it was indeed not a problem with coc or coc-rls. Turns out an old script was being sourced that set RUST_SRC_PATH to an invalid value; apparently VS Code ignores this variable or handles it being incorrect. Sorry for the trouble and thank you for the help!

from coc-rls.

chemzqm avatar chemzqm commented on June 3, 2024

Try add "rust-client.channel": "stable", in your coc-settings.json, don't know why nightly is broken for me.

from coc-rls.

wbthomason avatar wbthomason commented on June 3, 2024

Hmm, unfortunately that changes nothing. Explicitly setting nightly also has no effect (though that's more expected).

I'm testing this using a new project (e.g. cargo new coc-rls-test) and editing src/main.rs. I'm on Arch Linux; rls --version is "rls-preview 1.33.0 (9f3c906 2019-01-20)".

from coc-rls.

chemzqm avatar chemzqm commented on June 3, 2024

Don't know what happened, consider check out output channel of rust.

from coc-rls.

wbthomason avatar wbthomason commented on June 3, 2024

In the process of constructing

use std::thread;
use std::collections::HashMap;

fn main() {
  println!("Hello, world!");
}

from the main.rs created by cargo new, I get the following output:

## Output channel: rust
error: expected identifier, found keyword `fn`
 --> <racer-file>:2:1
  |
2 | fn main() {
  | ^^ expected identifier, found keyword

error: expected one of `::`, `;`, or `as`, found `main`
 --> <racer-file>:2:4
  |
2 | fn main() {
  |    ^^^^ expected one of `::`, `;`, or `as` here

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:2:1
  |
1 | use s
  |      - expected one of `::`, `;`, or `as` here
2 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:2:1
  |
1 | use std
  |        - expected one of `::`, `;`, or `as` here
2 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `:`
 --> <racer-file>:1:8
  |
1 | use std:
  |        ^ expected one of `::`, `;`, or `as` here

error: expected identifier, found keyword `fn`
 --> <racer-file>:2:1
  |
2 | fn main() {
  | ^^ expected identifier, found keyword

error: expected one of `::`, `;`, or `as`, found `main`
 --> <racer-file>:2:4
  |
2 | fn main() {
  |    ^^^^ expected one of `::`, `;`, or `as` here

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:2:1
  |
1 | use std::t
  |           - expected one of `::`, `;`, or `as` here
2 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:2:1
  |
1 | use std::thr
  |             - expected one of `::`, `;`, or `as` here
2 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:2:1
  |
1 | use std::threa
  |               - expected one of `::`, `;`, or `as` here
2 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use s
  |      - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std
  |        - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `:`
 --> <racer-file>:1:8
  |
1 | use std:
  |        ^ expected one of `::`, `;`, or `as` here

error: expected one of `::`, `;`, or `as`, found `:`
 --> <racer-file>:1:8
  |
1 | use std:
  |        ^ expected one of `::`, `;`, or `as` here

error: expected identifier, found keyword `fn`
 --> <racer-file>:3:1
  |
3 | fn main() {
  | ^^ expected identifier, found keyword

error: expected one of `::`, `;`, or `as`, found `main`
 --> <racer-file>:3:4
  |
3 | fn main() {
  |    ^^^^ expected one of `::`, `;`, or `as` here

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::c
  |           - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::col
  |             - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::colle
  |               - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::collect
  |                 - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::collection
  |                    - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `:`
 --> <racer-file>:1:21
  |
1 | use std::collections:
  |                     ^ expected one of `::`, `;`, or `as` here

error: expected identifier, found keyword `fn`
 --> <racer-file>:3:1
  |
3 | fn main() {
  | ^^ expected identifier, found keyword

error: expected one of `::`, `;`, or `as`, found `main`
 --> <racer-file>:3:4
  |
3 | fn main() {
  |    ^^^^ expected one of `::`, `;`, or `as` here

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::collections::H
  |                        - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::collections::Hash
  |                           - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

error: expected one of `::`, `;`, or `as`, found `fn`
 --> <racer-file>:3:1
  |
1 | use std::collections::HashMa
  |                             - expected one of `::`, `;`, or `as` here
2 | 
3 | fn main() {
  | ^^ unexpected token

It seems like RLS is failing to parse the file, maybe? Though this doesn't happen in VSCode, so I don't think it's a RLS error.

The relevant part of my VS Code config is:

  "rust.all_features": true,
  "rust.rustup": {
    "toolchain": "stable-x86_64-unknown-linux-gnu",
    "nightlyToolchain": "nightly-x86_64-unknown-linux-gnu"
  },
  "rust.mode": "rls",
  "rust.rls": {
    "useRustfmt": true
  }

from coc-rls.

wbthomason avatar wbthomason commented on June 3, 2024

@chemzqm: Just to confirm, you do get completion in the example I gave? And your rls version and coc config is the same as what I listed?

from coc-rls.

chemzqm avatar chemzqm commented on June 3, 2024

Sure, I only have those

  "rust.trace.server": "verbose",
  "rust-client.channel": "stable",

for coc-rls in my settings file.

Looks like the server have trouble parsing your file, so it doesn't provide any completion.

from coc-rls.

chemzqm avatar chemzqm commented on June 3, 2024

screen shot 2019-03-08 at 5 14 34 am

screen shot 2019-03-08 at 5 15 04 am

from coc-rls.

wbthomason avatar wbthomason commented on June 3, 2024

That is bizarre. With the exact same file you're editing and the example config from the coc.nvim README (with the rust-related settings you mention above added), I get nothing for completions on items in std, but do with VS Code (also using RLS).

Looking at the verbose server output, as above there are lots of errors about failing to parse the file, and the result of completion requests is always []. But only for completion requests on std items; items from 3rd party libraries succeed correctly. I'm very confused by this...

What does rls --version output for you? What Neovim version are you using?

from coc-rls.

wbthomason avatar wbthomason commented on June 3, 2024

Hmm. I just tried the same example using LCN and ncm2, and have the same symptoms. Although I've still no idea what's causing this bug, that seems to imply it isn't a problem with coc-rls, at least? As such, I'll close this issue. Thanks for the help!

from coc-rls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.