Thread overview
How to make autocompletion for IDE?
Jul 25, 2017
unDEFER
Jul 25, 2017
Andrea Fontana
Jul 25, 2017
Andrea Fontana
Jul 25, 2017
unDEFER
Jul 25, 2017
Andrea Fontana
Jul 25, 2017
unDEFER
Jul 26, 2017
Andrea Fontana
Jul 26, 2017
unDEFER
Jul 25, 2017
Basile B.
Jul 25, 2017
unDEFER
July 25, 2017
Hello!
I have written my text editor with highlighting, and now I want to add IDE features to it.
I want to make autocompletion, but not only complete members of class/struct, but also all functions which maybe used with type, if the first argument of the function is this type. I.e. in "a".fromStringz() style instead of fromStringz(a).

For it I will take editable now sources, add to it lines like this:

  foreach(d; __traits(allMembers, std.string))
  {
      if (is(typeof(mixin("\"abc\"."~d~"()"))))
	  pragma(msg, "\"abc\"."~d~"()" );
  }

So it will print all methods which can be called for strings as "abc".function().
And I want to compile this file with options "-c -o-".
The problem that compilation for files with avarage count of imports may take e.g. 7 seconds..

7 seconds is too long to wait autocompletion.
But compiler really do this "task" with autocompletion requests very fast.

And I think how to implement the next:
Add the task to some other file task.d. import it to the first file with mixin(import("task.d")). Change syscall open() to my function which if will see that it opens "task.d" waiting the time when user will ask autocomplete (press Ctrl-space), and then write the task to "task.d" and continue execution of compiler...

The problem that I see in this conception is that seems not possible write such import which will be imported only when compiler starts handle templates and simultaneously in the place where will be accessed all local variables of a function.

Any ideas?
July 25, 2017
On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote:
> Any ideas?

I think you should use/contribute to DCD project
https://github.com/dlang-community/DCC

Andrea
July 25, 2017
On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote:
> On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote:
>> Any ideas?
>
> I think you should use/contribute to DCD project
> https://github.com/dlang-community/DCC
>
> Andrea

Sorry, this is the right link:
https://github.com/dlang-community/DCD
July 25, 2017
On Tuesday, 25 July 2017 at 10:24:13 UTC, Andrea Fontana wrote:
> On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote:
>> On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote:
>>> Any ideas?
>>
>> I think you should use/contribute to DCD project
>> https://github.com/dlang-community/DCC
>>
>> Andrea
>
> Sorry, this is the right link:
> https://github.com/dlang-community/DCD

Yes this project where "Not working: UFCS suggestions and That one feature that you REALLY needed".. I want to have all features that I really need :-)
But If I will not find how do UFCS suggestions fast, I probably will use DCD for all other things..
July 25, 2017
On Tuesday, 25 July 2017 at 10:32:11 UTC, unDEFER wrote:
> Yes this project where "Not working: UFCS suggestions and That one feature that you REALLY needed".. I want to have all features that I really need :-)
> But If I will not find how do UFCS suggestions fast, I probably will use DCD for all other things..

If you want to add UFCS suggestions to DCD it would be useful for your project and all other IDEs too!

Andrea
July 25, 2017
On Tuesday, 25 July 2017 at 10:32:11 UTC, unDEFER wrote:
> On Tuesday, 25 July 2017 at 10:24:13 UTC, Andrea Fontana wrote:
>> On Tuesday, 25 July 2017 at 10:23:33 UTC, Andrea Fontana wrote:
>>> On Tuesday, 25 July 2017 at 10:06:47 UTC, unDEFER wrote:
>>>> Any ideas?
>>>
>>> I think you should use/contribute to DCD project
>>> https://github.com/dlang-community/DCC
>>>
>>> Andrea
>>
>> Sorry, this is the right link:
>> https://github.com/dlang-community/DCD
>
> Yes this project where "Not working: UFCS suggestions and That one feature that you REALLY needed".. I want to have all features that I really need :-)
> But If I will not find how do UFCS suggestions fast, I probably will use DCD for all other things..

I think that you underestimate the amount of work needed and your solution which is to use the compiler with -o- looks bad. What you really need is a compiler front-end which is basically what libdparse + DSymbol are. DCD uses them.
July 25, 2017
On Tuesday, 25 July 2017 at 10:35:14 UTC, Andrea Fontana wrote:

> If you want to add UFCS suggestions to DCD it would be useful for your project and all other IDEs too!
>
> Andrea

Thank you, I will think. But if it was easy, authors self would do it :-)
July 25, 2017
On Tuesday, 25 July 2017 at 10:42:40 UTC, Basile B. wrote:

> I think that you underestimate the amount of work needed and your solution which is to use the compiler with -o- looks bad. What you really need is a compiler front-end which is basically what libdparse + DSymbol are. DCD uses them.

No, with feature like
auto func()
and
void templ(T)(T a)
if (is(a))
{}

It is impossible to consider all it by myself. It means write the second compiler.
So I just want to use the ready compiler.
July 26, 2017
On Tuesday, 25 July 2017 at 10:45:38 UTC, unDEFER wrote:
> On Tuesday, 25 July 2017 at 10:35:14 UTC, Andrea Fontana wrote:
>
>> If you want to add UFCS suggestions to DCD it would be useful for your project and all other IDEs too!
>>
>> Andrea
>
> Thank you, I will think. But if it was easy, authors self would do it :-)

Did you try with [1]?

[1] http://forum.dlang.org/post/okktlu$2bin$1@digitalmars.com
July 26, 2017
On Wednesday, 26 July 2017 at 07:41:20 UTC, Andrea Fontana wrote:
> Did you try with [1]?
>
> [1] http://forum.dlang.org/post/okktlu$2bin$1@digitalmars.com

Thank you, interesting. But I'm afraid it is not enough.