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

Separate the auto suggest of the current class from the ancestral classes #121

Open
gavr123456789 opened this issue Apr 11, 2021 · 5 comments

Comments

@gavr123456789
Copy link

Here what I mean:

type
  Foo = object of RootObj
  Bar = object of Foo
  Sas = object of Bar


proc foo1(f: Foo, y: int, z: int) =
  echo y, z

proc foo2(f: Foo, y: int, z: int) =
  echo y, z

proc foo3(f: Foo, y: int, z: int) =
  echo y, z

proc bar1(f: Bar, y: int, z: int) =
  echo y, z

proc bar2(f: Bar, y: int, z: int) =
  echo y, z

proc bar3(f: Bar, y: int, z: int) =
  echo y, z

proc sas1(f: Sas, y: int, z: int) =
  echo y, z

proc sas2(f: Sas, y: int, z: int) =
  echo y, z

proc sas3(f: Sas, y: int, z: int) =
  echo y, z


let sas = Sas()

sas.

Here I see all procs in suggestion:
image

In large libraries such as GTK, because of the UFCS hints and methods of all the ancestors, a combinatorial explosion of autocompletion is obtained. After each dot, I get most of the GTK as a result of which the auto-completion becomes less useful.

image

I suggest putting the options that relate directly to the object first and marking them in a special way.
For the example above, this would mean seeing sas 1,2,3 first, you can also sort by inheritance order, then the order would be sasN, barN, fooN.

Most likely this issue also applies to https://github.com/pragmagic/vscode-nim

@Araq
Copy link
Member

Araq commented Apr 12, 2021

How about this alternative: If there are multiple options of the same name, only show one. The one that is closest to sas's class.

@gavr123456789
Copy link
Author

gavr123456789 commented Apr 12, 2021

@Araq Can you give an example of what you mean? The same names are functions with an overload? In my example, the functions are named so only to make it clearer which classes they belong to. The main problem is to determine which functions from the suggested ones are directly related to the object after which the point was put.

In the example with GTK, more than 100 functions appear in autocompletion for most objects due to the fact that they are mixed into one heap: methods of objects, methods of the object's ancestors, and simply methods that take any of these entities as the first argument.

@gavr123456789
Copy link
Author

I will clarify a little, with the inheritance hierarchy A - > B - > C. After the dot after c, the first will be members (procedures and fields) of class C, then B and A.

@Araq
Copy link
Member

Araq commented Apr 14, 2021

The same names are functions with an overload?

That's what I mean, yes.

@gavr123456789
Copy link
Author

gavr123456789 commented Apr 14, 2021

The same names are functions with an overload?

That's what I mean, yes.

@Araq Yes, this is a good idea, in vsc you can display overloads without displaying the same names in the autocomplete
image
image

But this does not solve the problem of the huge number of procs in auto-completion due to the UFSC. you need to put the procs belonging to the objects in the order of the hierarchy to simplify navigation.

image

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

2 participants