Repository navigation
Sysroot for rust src - #251
Conversation
|
|
||
| } | ||
|
|
||
| private static String GetRustcSysroot() |
There was a problem hiding this comment.
Have you tried to use the already existing GetSysrootAsync() method that I mentioned in the issue? Probably it's a bit hard to use here directly, because it requires an async context. I think the whole of Racer.Exec() should be async, but I can file that as a follow-up issue if you aren't able to do this now. In that case, please add a TODO comment here to eventually switch to using Cargo.GetSysrootAsync() .
There was a problem hiding this comment.
I have tried and failed. Simple call GetSysrootAsync().Result freezes forever whole VS, and async propagation looks like a bad idea. I will try to make racer async.
There was a problem hiding this comment.
The way to call an async method synchronously is to use .GetAwaiter().GetResult(). But this might also deadlock/freeze, so you have to be careful.
There was a problem hiding this comment.
Make all async not work =) The ICompletionSource is synchronious interface. And I cannot find any example to make it async.
There was a problem hiding this comment.
You should use await keyword for getting value from method GetSysrootAsync() in non-blocking mode. But it requires mark caller method async and change return type as Task<T>, where T is current type of returning value. Thus caller method will became "async-method" (by convention you should add Async suffix to his name) and you should use await keyword to call it new "async-method" and so on. On the top call-level of methods you can leave void return-type from method but you need to be careful with synchronization of synchronized mutable state. Task-based returning type is needed for supporting asynchronous calls of this methods and error handling of them. I hope it helps you.
More info here.
There was a problem hiding this comment.
@xilec Unfortunately it's not that easy.
@Vbif Yeah, I can't find any help in that direction either. So, if .GetAwaiter().GetResult() doesn't work, then just leave the code as is (including the synchronous GetRustcSysroot() method) and add a TODO comment to eventually replace this with Cargo.GetSysrootAsync().
Added options for enable rust source auto discovery through
--print sysrootcommad