pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Code completion will intermingle code completion with following, non-selected characters if no blank

Open ericwinger opened this issue 1 year ago • 2 comments

Bug description Code completion will complete with completion characters intermixed with following, non-selected characters if there is no blank before the existing characters.

To Reproduce Steps to reproduce the behavior:

  1. In a virgin image, open a source editor or a playground, highlight some text with a non-blank character immediately trailing the selection. image

  2. Start typing new characters replacing the old characters until a code completion pop-up appears. image

  3. Choose the first code completion option.

  4. Result is intermingled text image

Expected behavior Code completion behavior should not intermingle the code completion and the existing characters.

Screenshots See above

Version information:

Pharo 11.0.0 Build information: Pharo-11.0.0+build.714.sha.0ead11d0b8573ff685db8a39fceeca2a8d528d3e (64 Bit)

Expected development cost

  • It may be worth searching open code completion issues for a duplicate. I searched but couldn't find an exact match.
  • Costs include duplicated effort retyping code often for the user.
  • Other costs unknown.

Additional context Code completion is pretty handy, but this bug slows down development. NECPreferences spaceAfterCompletion = true in the above example There seem to be some problems in this method: CompletionEngine>>#replaceTokenInEditorWith: such as:

  • self editor selectInvisiblyFrom: wordStart to: wordEnd - 1. does make a visible selection
  • which appears to impact the following statement: old := self editor selection.

I didn't investigate further.

ericwinger avatar Jun 21 '24 18:06 ericwinger

Hi, Pharo code completion has been improved in Pharo 12. I think what you reported has been fixed. Could you check if everything work right in P12 or 13?

jecisc avatar Jun 21 '24 18:06 jecisc

Thanks for responding so quickly!

The behavior is different in Pharo 12, but it is still not correct. Now the following character(s?) are replaced. Here's an example.

  1. Select text up to colon image
  2. Type until auto complete. See snazzy new behavior dialog. Choose selection.
    image
  3. Replaces following colon image
Pharo 12.0.0
Build information: Pharo-12.0.0+SNAPSHOT.build.1516.sha.25ecf718d4a363b275862b4a093b1a240ec7e8d2 (64 Bit)

ericwinger avatar Jun 21 '24 18:06 ericwinger