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

Auto-completion without source code? #324

Closed
johalun opened this issue Aug 6, 2015 · 22 comments
Closed

Auto-completion without source code? #324

johalun opened this issue Aug 6, 2015 · 22 comments

Comments

@johalun
Copy link

johalun commented Aug 6, 2015

It seems like it is taken for granted that source code is always availble. What if we have a proprietary dynamic library (with API documentation) but no source code, is there anyway we can use racer to gives us auto completion based on this?

@phildawes
Copy link
Collaborator

Not currently, maybe in the future racer will do this somehow.
On 6 Aug 2015 2:19 am, "yohanesu" notifications@github.com wrote:

It seems like it is taken for granted that source code is always availble.
What if we have a proprietary dynamic library (with API documentation) but
no source code, is there anyway we can use racer to gives us auto
completion based on this?


Reply to this email directly or view it on GitHub
#324.

@torpak
Copy link

torpak commented Aug 12, 2015

If it is not a rust library you would build a rust wrapper for convenience anyway. Racer could work on that.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

Hmm, well it's a rust shared library, which is mine and proprietary... Would it be difficult to have racer scan the documentation generated by Cargo instead of source code?

@tomjakubowski
Copy link
Contributor

Hmm, well it's a rust shared library, which is mine and proprietary... Would it be difficult to have racer scan the documentation generated by Cargo instead of source code?

Yes. It's more feasible to reconstruct the information racer needs for completion from the metadata rustc places in the shared library, in a way similar to how rustdoc provides documentation for items defined in crates external to the one it's operating on.

@tomjakubowski
Copy link
Contributor

It might be possible to use the JSON output file Rustdoc can create, although I'm not sure how usable or stable that file is.

@tomjakubowski
Copy link
Contributor

It's more feasible to reconstruct the information racer needs for completion from the metadata rustc places in the shared library, in a way similar to how rustdoc provides documentation for items defined in crates external to the one it's operating on.

Come to think of it, the only way to reliably do this would be to depend on various rustc crates which aren't likely to be stabilized anytime soon (as rustdoc does). So that's not very feasible either.

@torpak
Copy link

torpak commented Aug 13, 2015

If it's your own proprietary rust library it seems a little paranoid if you don't let racer scan the code.If it's a dynamic library you can allways load it at runtime and use it like a C library. And yes it would needlessly complicate racer to support scanning documentation instead of code, i am sure of that even though i have not yet looked at the racer code.

-------- Ursprüngliche Nachricht --------
Von: yohanesu notifications@github.com
Datum: 13.08.2015 05:25 (GMT+01:00)
An: phildawes/racer racer@noreply.github.com
Cc: torpak arne@gtnw.de
Betreff: Re: [racer] Auto-completion without source code? (#324)

Hmm, well it's a rust shared library, which is mine and proprietary... Would it be difficult to have racer scan the documentation generated by Cargo instead of source code?


Reply to this email directly or view it on GitHub.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

Well of course I can let racer scan my code but I don't want to have to share the code. Can I let racer scan the code and save the result in some kind of database that racer can read from later?

@torpak
Copy link

torpak commented Aug 13, 2015

then don't share your code.Make a dynamic loader wrapper for it and racer can scan that.Your secret sauce stays secret an your customers can have racer code completion on the interface of the wrapper.And no one else has to work so your code can stay secret.it's a win-win situation.

-------- Ursprüngliche Nachricht --------
Von: yohanesu notifications@github.com
Datum: 13.08.2015 06:50 (GMT+01:00)
An: phildawes/racer racer@noreply.github.com
Cc: torpak arne@gtnw.de
Betreff: Re: [racer] Auto-completion without source code? (#324)

Well of course I can let racer scan my code but I don't want to have to share the code. Can I let racer scan the code and save the result in some kind of database that racer can read from later?


Reply to this email directly or view it on GitHub.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

Yeah that would work but it's gonna be a lot of work writing and maintaining those wrappers. I'd rather see some general solution for code-completion in rust instead of having developers spending extra time writing wrappers for something that should have a solution in the design of the language / compiler. Don't get me wrong, I am so grateful for racer as it makes using Rust a much better experience but at some point we're gonna have to think of a (easy) way to get code-completion without all the extra work and without sharing source-code.

@torpak
Copy link

torpak commented Aug 13, 2015

so its ok if there is a pain of maintaining unnecessary code, as long as it isn't your pain.

-------- Ursprüngliche Nachricht --------
Von: yohanesu notifications@github.com
Datum: 13.08.2015 07:26 (GMT+01:00)
An: phildawes/racer racer@noreply.github.com
Cc: torpak arne@gtnw.de
Betreff: Re: [racer] Auto-completion without source code? (#324)

Yeah that would work but it's gonna be a lot of work writing and maintaining those wrappers. I'd rather see some general solution for code-completion in rust instead of having developers spending extra time writing wrappers for something that should have a solution in the design of the language / compiler. Don't get me wrong, I am so grateful for racer as it makes using Rust a much better experience but at some point we're gonna have to think of a (easy) way to get code-completion without all the extra work and without sharing source-code.


Reply to this email directly or view it on GitHub.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

So it is unnecessary to be able to do code completion without access to source code? Talk about making it troublesome to use Rust in proprietary projects...

@torpak
Copy link

torpak commented Aug 13, 2015

Or let me phrase that a bit more precisely: why should people who share their code do more work, to make it easier for you to not share your code?

@torpak
Copy link

torpak commented Aug 13, 2015

Noone is making it troublesome they are just not making your problem their highest priority. And i am Sure the author of racer would even accept a patch if you want that feature bad enough to be willing to do something.But that would again be you doing work you can not charge anyone for.

-------- Ursprüngliche Nachricht --------
Von: yohanesu notifications@github.com
Datum: 13.08.2015 07:41 (GMT+01:00)
An: phildawes/racer racer@noreply.github.com
Cc: torpak arne@gtnw.de
Betreff: Re: [racer] Auto-completion without source code? (#324)

So it is unnecessary to be able to do code completion without access to source code? Talk about making it troublesome to use Rust in proprietary projects...


Reply to this email directly or view it on GitHub.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

What is wrong with not sharing code? The world is full of proprietary code and personally I would love to see Rust flourish and become an realistic alternative to C/C++/Swift etc in both open source and proprietary projects. While maybe it is not the main goal of Rust or Racer it is important to provide functionality that is convenient for the developers. What other languages forces developers to write wrappers just to provide code completion? (The subject is switching from Racer to Rust more and more....) I would love to pitch in but to know where to start we first have to start a dialog and see what is planned by the Rust folks and what options there are.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

Seems like you assume I don't want to do work I can not charge for just because I have a proprietary product.. If I could easily do it myself I would patch racer or rustc but it is beyond the scope of my expertise so that is why I am asking for advice here. I hardly think I am the only one who could benefit from this functionality. Anyway, no point in furthering discussing here. I will post the same question for the rustc people and see if they have something cooking...

@torpak
Copy link

torpak commented Aug 13, 2015

Rust doesn't force you to do anything. And racer isn't even an official part of mozillas rust efforts. It's the work of a single Volunteer who work on it in their sparetime. I understand there are Reasons to keep code under wraps.But why is a volunteer obligated to help you doing it, before they even have implemented all the features interesting to them selves?

@johalun
Copy link
Author

johalun commented Aug 13, 2015

I have never requested anyone to implement this for me. No one is obligated to do it. How did you come to this conclusion and why do you get so offensive? I was merely asking if there was any way to get code completion without source code using racer while stating that I think this is an important feature of a new language. Of course, this is not the responsibility of anyone in particular but I am trying to raise awareness of this feature.

@torpak
Copy link

torpak commented Aug 13, 2015

I was just trying to help you solve your problem, and you kept demanding a different solution. Maybe it was a misunderstanding.I never wanted to offend.If i did, i am truely sorry.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

And I'm grateful for your suggestion. Maybe I'll adopt it for the time being (currently my API is really unstable so it's gonna be a lot of double work though when API changes...). I apologize if I came on strong but I was trying to make a point that I don't think it is a feasible solution in the long run if Rust is going to become one of the big mainstream languages (which I really hope it will).

@torpak
Copy link

torpak commented Aug 13, 2015

I just had another idea why not write a generator for the wrapper/loader?That way you wouldn't have to maintain it and you could share the generator. that should be easy and solve the problem.

@johalun
Copy link
Author

johalun commented Aug 13, 2015

Actually I wrote that in my last comment but erased :) For functions I guess it would be easy but maybe not so easy to deal with structs that has both public and private field variables...

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

No branches or pull requests

4 participants