Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid misconfiguration and try to help racer to find a Cargo.toml #29

Merged
merged 4 commits into from
Jun 8, 2015

Conversation

alkama
Copy link
Contributor

@alkama alkama commented Jun 8, 2015

  • Rewrite the README file so that it warns for misconfiguration and is more structured.
  • Do not launch completion if the configuration is obviously wrong.
  • Check that "racer.racerBinPath" points to a valid file.
  • Check that "racer.rustSrcPath" points to a valid directory.
  • Rescan the current project path for each completion because it can change during the editor's life.
  • Write the temporary file directly in the project path to help racer locate a related Cargo.toml.
  • Clean temp files immediately after racer returns.

* Check that "racer.racerBinPath" points to a valid file.
* Check that "racer.rustSrcPath" points to a valid directory.
* Rescan the current project path for each completion because It can change during the editor's life.
* Write the temporary file directly in the project path to help racer locate a related Cargo.toml.
* Clean temp files immediately after racer returns.
@alkama
Copy link
Contributor Author

alkama commented Jun 8, 2015

If it didn't mess it, it should be valid for a v0.12 and should fix #26

@edubkendo
Copy link
Owner

I don't understand what you mean by, if it didn't mess it?

@alkama
Copy link
Contributor Author

alkama commented Jun 8, 2015

I just meant that it should work fine! (but that's unless I missed a corner case, we're human after all)

@edubkendo
Copy link
Owner

:)

edubkendo added a commit that referenced this pull request Jun 8, 2015
Avoid misconfiguration and try to help racer to find a Cargo.toml
@edubkendo edubkendo merged commit 23e598f into edubkendo:master Jun 8, 2015
@edubkendo
Copy link
Owner

Sorry, messed up the publishing and skipped a minor version but it's published.

@edubkendo edubkendo mentioned this pull request Jun 8, 2015
@alkama
Copy link
Contributor Author

alkama commented Jun 8, 2015

Cool! Thanks!

What remains now is to be more vocal about misconfigurations.
For now the errors go to the console and it seems Atom doesnt warn anymore about errors in the console. I'll see if I can use a message panel instead.

Maybe later I'll see if I can port a "go to definition" and/or snippet feature from racer.

@cart
Copy link
Contributor

cart commented Jun 9, 2015

Unfortunately these changes did not fix completion from external crates using Cargo.toml or completion from files within the project. Are these completions working for you now? The only completions I get are from the current file and rust/src. What configurations do you have? I am running Linux 4.0.5, gnome-shell 3.16, Atom .207, rust nightly (as of today), and current racer.

@alkama
Copy link
Contributor Author

alkama commented Jun 9, 2015

Hum, I'm on OSX. Can you check if racer is working correctly in isolation?
It should be fairly easy to mimic what atom-racer is doing using a commandline and see if racer responds correctly.

something like:
RUST_SRC_PATH=[RUST_SRC]:[ATOM_PROJECT_ROOT] [PATH_TO_RACER]/racer complete [NUM_ROW] [NUM_COL] [ATOM_PROJECT_ROOT]/[CURRENT_INCOMPLETE_FILE]

Because that's basically what we are submitting and just using the results.

If it doesn't work, it's probably something to issue and debug at racer instead :)

Dumb exemple

for:

  • an atom project in /home/me/rusttest
  • with rustc source code in /home/me/rustc-1.0.0/src/
  • and racer installed in /usr/local/bin/
  • given a file to complete being /home/me/rusttest/src/main.rs
fn foo() {
    ;
}
fn main() {
    f
}

the command would be:
RUST_SRC_PATH=/home/me/rustc-1.0.0/src/:/home/me/rusttest /usr/local/bin/racer complete 5 2 /home/me/rusttest/src/main.rs

Note: the "2" is because i'm using tabs which account for 1 character (the markdown formatter converts that to spaces and dont give justice).

@cart
Copy link
Contributor

cart commented Jun 9, 2015

I get cargo and project file completions when I run racer manually using the format you outlined. Now that I know what works, I will experiment with atom-racer and see if I can get something working.

@alkama
Copy link
Contributor Author

alkama commented Jun 9, 2015

Excellent :)
Hope you'll spot what's wrong.

@alkama alkama mentioned this pull request Jun 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants