Dyalog / ride

Cross-platform IDE for Dyalog APL
https://dyalog.github.io/ride
MIT License
206 stars 32 forks source link

Inconsistent autocompletion #360

Closed DyalogRichard closed 6 years ago

DyalogRichard commented 6 years ago

Describe the issue you are having

The way different autocompletes work is inconsistent

Did you connect to an already running interpreter or start the interpreter from RIDE?

Connect

How do you reproduce the issue?

In the session type ]a The autocomplete options are ]adoc, ]align and ]array Backspace to erase the a and type b so that ]b is shown. The autocomplete options are ]box and ]boxing

Now type (backtick) (backtick) a There are a load of suggestions Backspace to erase the a and type b so that (backtick) (backtick)b is shown. No autocomplete options are shown

The differences appear to be:

] autocomplete (1) shows names that can complete what has already been typed (i.e. that start with the given sequence); (2) can be corrected

(backtick) (backtick) autocomplete (1) shows all names that contain what has already been typed (anywhere, not just at the start); (2) cannot be corrected

Should they not be consistent?

I find the (backtick) (backtick) autocomplete style less useful - especially not being able to correct, 'cos I make a lot of typing wrrors.

Paste the contents of Help → About (Shift+F1)

IDE:
  Version: 4.1.3170
  Platform: Linux x86_64
  Date: 2018-04-25 00:24:55 +0200
  Git commit: 9cd0c566b20f8eaa1abfb061d37a2fdf6d3911ef
  Preferences:{
    "dbg":"1",
    "floatOnTop":"1",
    "kbdLocale":"en_GB",
    "lbarOrder":"← +-×÷*⍟⌹○!? |⌈⌊⊥⊤⊣⊢ =≠≤<>≥≡≢ ∨∧⍲⍱ ↑↓⊂⊃⊆⌷⍋⍒ ⍳⍸∊⍷∩~∪ /\\⌿⍀ ,⍪⍴⌽⊖⍉ ¨⍨⍣.∘⍤@ ⍞⎕⍠⌸⌺⌶⍎⍕ ⋄⍝→⍵⍺∇& ¯⍬ ",
    "lineNums":"0",
    "wse":"1",
    "otherExe":"/home/richard/svn/trunk/apl/obj/apl/linux/64/unicode/tty/dev/dbg/dyalog"
  }

Interpreter:
  Version: 17.0.32919
  Platform: Linux-64
  Edition: Unicode/64
  Date: Apr 24 2018 at 15:24:55
abrudz commented 6 years ago

These are two very different systems. The backtick's autocomplete is an input method, i.e. it doesn't insert a continuation of what you typed, but rather substitutes it with something else. In fact, it probably shouldn't even be called autocomplete, but rather auto-substitute. This system is purely a RIDE feature. The ] autocomplete originates from the user command system, by way of the interpreter, and only serves to automate the continuation of what you wrote, just like all other autocompletes provided by the interpreter itself.

DyalogRichard commented 6 years ago

Right - but I still think it's odd they behave differently.

DyalogRichard commented 6 years ago

Subtext - without being able to try it to confirm, I think I'd prefer the backtick mechanism if it behaved more like the ] autocomplete.

abrudz commented 6 years ago

I can see backtick allowing correction (2), but it really does need to look everywhere (1) because of cases like implication which is only listed as logicalimplication. However, I do agree that pd finding expand is a bit over the top.

DyalogRichard commented 6 years ago

Matching non-contiguously does seem a bit OTT.

To address your concern, "implication" could be included in its own right. There's not much benefit of being able to match with "alim" or even "plica", for example.

It might well be too well established to change now, but I raised it so we at least give it thought as it seemed to be an obvious inconsistency. The fact that one is done in the interpreter and one in RIDE will be of no interest to the average user.

e9gille commented 6 years ago

Autocomplete with Monaco is somewhat complicated.

  1. It doesn't match by what you've typed so far, but rather uses a very relaxed algorithm to reduce the list of suggestions.
  2. Although backed by the interpreter's autocomplete feature, unless triggered explicitly on every keystroke, the initial list of items is used to narrow down the options.

As early testers (and myself included) didn't like the relaxed filtering of Monaco, I implemented point 2 above to get the effect desired. I haven't found a way to configure Monaco to just do it that way itself.

The prefix complete feature introduced by Nick has been wedged in with Monaco's completion provider system. As @abrudz points out, it is desirable to have a fuzzy search in these cases, but I haven't done anything yet about making it stricter. At the moment it just relies on Monaco's filtering system.

You will note that I also implemented a shell like autocomplete mode as per @JohnScholes suggestion #347. In short, there are inconsistencies in how autocomplete works, but happy to hear your views on how it is best implemented.

DyalogRichard commented 6 years ago

Thanks, Gil. I've also spoken with Jay this morning and we agree that this is probably no longer usefully managed as a bug report - there are a mixture of different issues all muddled up here. So, I'll close this issue and we can less formally handle it as part of "Jay's list of feedback he's received".

FYI - the 17.0 IME also supports ` now. It behaves differently again!