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

Order of entries in the code completion window #1218

Open
groehner opened this issue Jul 31, 2023 · 3 comments
Open

Order of entries in the code completion window #1218

groehner opened this issue Jul 31, 2023 · 3 comments

Comments

@groehner
Copy link
Contributor

The entries in the code completion window are probably sorted alphabetically. As a result, attributes of a class with visibility "private (i.e. __)" get lost in the long list of Dunder entries.
For programming the methods of a class, it would be better if its attributes and methods came first in the code completion list.

@pyscripter
Copy link
Owner

pyscripter commented Aug 1, 2023

Earlier, the order I was using was based on:

function ComparePythonIdents(const S1, S2 : string): Integer; overload;
Var
  L1, L2 : integer;
begin
  L1 := Length(S1);
  L2 := Length(S2);
  if (L1 > 0) and (S1[1] = Char('_')) and (L2>0) and (S2[1] = Char('_')) then
    Result := CompareText(S1, S2)
  else if (L1 > 0) and (S1[1] = Char('_')) then
    Result := 1
  else if (L2>0) and (S2[1] = Char('_')) then
    Result := -1
  else
    Result := CompareText(S1, S2)
end;

Since starting using the JEDI language server I keep the order the server provides, which I think is similar to the one above.

It was not clear to me, what you think is the "best" order. Could you please give an example?

@groehner
Copy link
Contributor Author

groehner commented Aug 1, 2023

The best order is by relevance.
For a python file with a class, this means that on "self." all attributes and methods of the class, then the attributes and methods of the superclass etc. are offered.

Here an example with PyCharm (which missing attributes firstname, lastname, ..., of the superclass):

grafik

I thnik that for methode brackets should be showed and inserted when selecting a code completion.

@pyscripter
Copy link
Owner

I see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants