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

[Bug] Code autocomplete pastes "abs" after Space then Enter #894

Closed
davecparker opened this issue Dec 30, 2022 · 4 comments
Closed

[Bug] Code autocomplete pastes "abs" after Space then Enter #894

davecparker opened this issue Dec 30, 2022 · 4 comments
Labels
bug Something isn't working software: pybricks-code Issues with https://code.pybricks.com application topic: code completion Issues involving automaic code completion (intellesense)

Comments

@davecparker
Copy link

davecparker commented Dec 30, 2022

Code auto-completion gives a long list of global symbols after you type a space in an expression or unfinished statement (which is questionable, but I'm not flagging that here), and if you press Enter because you intend to finish that line later or continue it on the next line, it pastes "abs". This even happens when you are typing a comment (where space at end of a line that needs to be continued is a normal habit).

To reproduce

  1. Start a line of code that says "x = " (with the trailing space)
  2. Press Enter
  3. "abs" is pasted

Suggestion
If you don't have another way to prevent this, could you make the first entry in the global name list blank (i.e. none)?

@davecparker davecparker added the triage Issues that have not been triaged yet label Dec 30, 2022
@dlech dlech added bug Something isn't working topic: code completion Issues involving automaic code completion (intellesense) software: pybricks-code Issues with https://code.pybricks.com application and removed triage Issues that have not been triaged yet labels Dec 30, 2022
@dlech
Copy link
Member

dlech commented Dec 30, 2022

I dropped the trigger on space. You can try it at https://beta.pybricks.com. (v2.1.0-beta.4)

There is still a trigger on . which can be annoying on comments, but if we remove it, it means you have to press ctrl+space after every dot to get completion for methods/attributes.

@laurensvalk
Copy link
Member

I dropped the trigger on space.

Is there a way to suppress/enable it for specific cases? Now it suppresses import suggestions, e.g.

from pybricks.parameters import       # <--- now we don't get suggestions here

@laurensvalk laurensvalk reopened this Jan 12, 2023
@dlech
Copy link
Member

dlech commented Jan 12, 2023

There doesn't appear to be any context awareness on either side (Monaco editor or Jedi) to have a different behavior in a case like this.

It is still possible to trigger the completion here by pressing ctrl+space or by typing the first letter of the name if you already know what you want to import.

@dlech
Copy link
Member

dlech commented Feb 13, 2023

Practically speaking, I don't think we can improve this any further without replacing/forking both the monaco editor and jedi, so I think we should close the issue.

@dlech dlech closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working software: pybricks-code Issues with https://code.pybricks.com application topic: code completion Issues involving automaic code completion (intellesense)
Projects
None yet
Development

No branches or pull requests

3 participants