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

autocomplete #104

Closed
daretodave opened this issue May 9, 2024 · 1 comment · May be fixed by #117
Closed

autocomplete #104

daretodave opened this issue May 9, 2024 · 1 comment · May be fixed by #117
Labels
back-end backend work enhancement New feature or request front-end front end work react-wizard-needed bless us with your react skills ready
Milestone

Comments

@daretodave
Copy link
Contributor

we have so much vertical space compared to other terminals! we can take advantage of this and use a feature-rich auto-complete

inspiration:

either find a module that suites us or implement on our own

TAB AUTO

show these results real-time under the input
provide the first answer when tab is selected
do not close the selection when tab is selected however, tab is the cursor (hitting tab again goes to the next suggestion)
close only when:

  • right arrow is clicked
  • typing begins on tabbed selection
  • enter is clicked
    this gives the impression that tab enters a "selection mode" and avoids us replacing the behaviour of up and down to browse the history
    source:
  • from path
    • typing no should pull up node as a suggestion
    • typing a program name first should end this lookup
      • node no
        • this should not suggest node node as node was already provided for the program
        • this could be node node-file.js so we should switch to dir search below at this point
  • from the system directory structure
    • folder paths should be suggested to expand/complete
      • careful to make this non-performant
      • only search one directory down
      • only search for X milliseconds (maybe 200 < Dorothy threshold?) -- then bail with results. we don't need a 3 second long directory list cmd
  • from system commands
    • :ex should suggest :exit
  • from local commands (~mterm/commands.ts)
    • he should suggest hello

RIGHT AUTO

different then tab auto, this is a full prompt suggestion from what history says
hit right to complete the suggestion
only ONE suggestion that best matches the current typing
this suggestion is displayed in the input

e.g google search -
image

  • podcasts is not the current input BUT it is suggested and can be completed

  • from history

    • ~.mterm./.history should be scanned for results

there are three distinct efforts here

  • front end for tab auto
    • the context menu that shows as user types with suggestions
  • front end for right auto
    • the magic hovering text that shows to the right of the input text with history suggestions
  • backend provider (ipc main)
    • provides a string list to the renderer with results for async usage
@daretodave daretodave added enhancement New feature or request front-end front end work back-end backend work react-wizard-needed bless us with your react skills ready labels May 9, 2024
@daretodave
Copy link
Contributor Author

regarding backend provider work

  • the should be a way to extend auto-complete suggestions
  • for example, aws provides these docs for powershell or bash
Register-ArgumentCompleter -Native -CommandName aws -ScriptBlock {
    param($commandName, $wordToComplete, $cursorPosition)
        $env:COMP_LINE=$wordToComplete
        if ($env:COMP_LINE.Length -lt $cursorPosition){
            $env:COMP_LINE=$env:COMP_LINE + " "
        }
        $env:COMP_POINT=$cursorPosition
        aws_completer.exe | ForEach-Object {
            [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
        }
        Remove-Item Env:\COMP_LINE     
        Remove-Item Env:\COMP_POINT  
}
  • we don't need to mimic or support the completer etc, we just need a way any "vendor" can provide auto-complete suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end backend work enhancement New feature or request front-end front end work react-wizard-needed bless us with your react skills ready
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant