rrandom / Brackets-Rust-IDE

Help coding Rust in Brackets
27 stars 1 forks source link

Does not work on mac #3

Open cevarief opened 8 years ago

cevarief commented 8 years ago

I tried autocompletion of racer in console and worked good (std::io::something), but in brackets it does not show at all.

I put the racer executable in /usr/local/bin

Any clue ?

rrandom commented 8 years ago

I don't have a mac so I can't debug on it.:(... but I think you can press F12 in Brackets. and paste the error information from the console here..

cevarief commented 8 years ago

Here what i got in debug console:

Asking Hints RacerProviders.js:181 #### On update event, data: RUST_SRC_PATH environment variable must be set to point to the src directory of a rust checkout. E.g. "/home/foouser/src/rust/src"

$(RacerCli.nodeConnection).on("RacerDomain:hintUpdate", function (evt, data, petition) {
            if (petition === vpet) {
                if (data === 'PANIC PANIC PANIC\n') {
                    data = '';
                }
                console.info('#### On update event, data: ' + data);
                if (data) {
                    _needNewHints = false;
                    _resolveHint(data, petition);
                } else {
                    console.warn("No matching");
                }
            }
        });

Here what i got in terminal :

echo $RUST_SRC_PATH
/usr/local/src/rust/src

racer complete std::io::R
MATCH Result,26,9,/usr/local/src/rust/src/libstd/io/error.rs,Type,pub type Result<T> = result::Result<T, Error>;
MATCH Repeat,69,11,/usr/local/src/rust/src/libstd/io/util.rs,Struct,pub struct Repeat { byte: u8 }
MATCH Read,139,10,/usr/local/src/rust/src/libstd/io/mod.rs,Trait,pub trait Read {
rrandom commented 8 years ago

It seems racer child_process in Brackets\node can't detect environment variable RUST_SRC_PATH (https://github.com/phildawes/racer/blob/master/src/bin/main.rs#L176-L193). can you get same the results after running script below?

var exec = require('child_process').exec;
var ch = exec('racer complete std::io::R');
ch.stdout.pipe(process.stdout); 
ch.stderr.pipe(process.stdout);  

If you can, then the problem maybe in brackets

cevarief commented 8 years ago

Hi, thanks. Here's the output:

require.js:166 Uncaught Error: Module name "childprocess" has not been loaded yet for context: . Use require([]) http://requirejs.org/docs/errors.html#notloadedrequire.js:166 makeErrorrequire.js:1400 localRequirerequire.js:1745 requirejsVM737:2 (anonymous function)VM731:762 InjectedScript._evaluateOnVM731:695 InjectedScript._evaluateAndWrapVM731:609 InjectedScript.evaluate

i'm about to reinstall my brackets to refresh it.

cevarief commented 8 years ago

No luck.

Asking Hints
NodeDebugUtils.js:114 [node-error 10:33:36 AM] [Launcher] uncaught exception at top level, exiting. Error: spawn ENOENT
    at errnoException (child_process.js:980:11)
    at Process.ChildProcess._handle.onexit (child_process.js:771:34)NodeDebugUtils.js:114 handleLogEvent/utils/EventDispatcher.js:222 trigger/utils/EventDispatcher.js:260 triggerWithArray/utils/NodeConnection.js:479 NodeConnection._receive
NodeDebugUtils.js:114 [node-info 10:33:36 AM] [Server] stopping

The extension crashed node.

lilianmoraru commented 8 years ago

I have the same issue but on Ubuntu 15.10, 64-bit. There is highlighting but no code completion. For some reason F12(or selecting from menu) doesn't open the console... I tried putting in the field "RUST_SRC_PATH=[path to rust src] [path to racer bin]" and it also didn't work.

lilianmoraru commented 8 years ago

Well, tested on Windows 7, 64-bit doesn't work either... Both machines have Brackets 1.5, may be has something to do with that? On the Windows machine managed to open the dev console and it seems to get the matches, for "std::t" returned thread and time... But instantly after that:

WebSocket connection to 'ws://localhost:8888/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
rrandom commented 8 years ago

@lilianmoraru In Ubuntu, you should install Chrome or Chromium, then the F12 "Developer tools" could open. Or it will not open. I just tried on Ubuntu 14.04. it works well. And You should set RUST_SRC_PATH=[path to rust src] as your Ubuntu enviroment variable, setting like export RUST_SRC_PATH=/usr/local/src/rust/src in your .bashrc file. The only thing you need set in brackets is the absolute path to racer bin. As for Windows sitduation, I dont encounter it. Is there any detailed debug information?

7sharp9 commented 8 years ago

I don't get any popups if I type say std::

But the log shows something happening if I hit i :

Asking Hints
RacerProviders.js:181 #### On update event, data: PREFIX 13,14,i
MATCH intrinsics,1,0,/Users/dave/code/rust/src/libcore/intrinsics.rs,Module,/Users/dave/code/rust/src/libcore/intrinsics.rs
MATCH iter,1,0,/Users/dave/code/rust/src/libcore/iter.rs,Module,/Users/dave/code/rust/src/libcore/iter.rs
MATCH io,1,0,/Users/dave/code/rust/src/libstd/io/mod.rs,Module,/Users/dave/code/rust/src/libstd/io/mod.rs
END

But no pop up in the UI.

rrandom commented 8 years ago

@7sharp9 yes, I do it on purpose. Initially I let it pop up only one letter, but afterwards I found popop after typing 2 letters simplify the coding work. So I rewrote it.. In a word, popup appears after typing 2 letters means it works well. (e.g. st, std::in)

7sharp9 commented 8 years ago

Hmm, that ok if you know the API quite well, I find myself not knowing the first two letters though, so its a bit useless for me :-(

rrandom commented 8 years ago

@7sharp9 Good point, I may support it in the future after figuring out a better implementation.

rrandom commented 8 years ago

@7sharp9 your problem solved. :) try to git clone the master, since Brackets Extension Registry is broken.