xonsh icon indicating copy to clipboard operation
xonsh copied to clipboard

readline: Render completions using the entire line

Open daniel-shimon opened this issue 4 years ago • 4 comments

Since the completions we return are completed wrt. the completion prefix, in order to handle spaced strings we need to use the entire line as the completion prefix. For example: ls 'spaced Can now correctly result in: ls 'spaced file' / ls 'spaced dir/'

Closes #2865

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

daniel-shimon avatar Sep 02 '21 21:09 daniel-shimon

Codecov Report

Merging #4456 (0911870) into main (aec4860) will decrease coverage by 0.00%. The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4456      +/-   ##
==========================================
- Coverage   61.57%   61.56%   -0.01%     
==========================================
  Files         139      139              
  Lines       22488    22488              
  Branches     4147     4147              
==========================================
- Hits        13846    13845       -1     
  Misses       7541     7541              
- Partials     1101     1102       +1     
Flag Coverage Δ
linux 59.25% <50.00%> (ø)
macos 58.68% <50.00%> (ø)
windows 57.83% <0.00%> (-0.05%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
xonsh/readline_shell.py 43.77% <50.00%> (ø)
xonsh/procs/readers.py 56.42% <0.00%> (-0.46%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update aec4860...0911870. Read the comment docs.

codecov-commenter avatar Sep 02 '21 21:09 codecov-commenter

I'll look into it 👍

On Thu, Sep 9, 2021, 08:12 Noorhteen Raja NJ @.***> wrote:

@.**** commented on this pull request.

In xonsh/readline_shell.py https://github.com/xonsh/xonsh/pull/4456#discussion_r704957567:

@@ -453,7 +453,7 @@ def completedefault(self, prefix, line, begidx, endidx): multiline_text=prev_text + line, cursor_index=len(prev_text) + endidx, )

  •    rtn_completions = _render_completions(completions, prefix, plen)
    
  •    rtn_completions = _render_completions(completions, line, plen)
    

Is it possible to have tests for the rl-completions ? mocking could work or you can use rl_shell mock in test_readline_shell.py for testing.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xonsh/xonsh/pull/4456#pullrequestreview-749834924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AELF3BJKEHIAAF425VTFLODUBA63DANCNFSM5DKBHSXA .

daniel-shimon avatar Sep 09 '21 07:09 daniel-shimon

Hey @daniel-shimon -- gentle ping here. Is there anything else you wanted to add to this PR?

gforsyth avatar Sep 30 '21 15:09 gforsyth

Hey @daniel-shimon -- gentle ping here. Is there anything else you wanted to add to this PR?

Hi, sorry recently I don't have a lot of spare time to do xonsh stuff..

This PR has some problems which I addressed locally and added some half-baked tests. I need to work out some details when I'll get to it.. For now this should be treated as a draft

daniel-shimon avatar Oct 03 '21 22:10 daniel-shimon

Closing out old PRs, thanks!

gforsyth avatar Feb 14 '24 14:02 gforsyth