Skip to content

Recalculate completion entries when crossing :: namespace boundary#6

Closed
Vici37 wants to merge 1 commit intoI3oris:mainfrom
Vici37:namespace-completion
Closed

Recalculate completion entries when crossing :: namespace boundary#6
Vici37 wants to merge 1 commit intoI3oris:mainfrom
Vici37:namespace-completion

Conversation

@Vici37
Copy link

@Vici37 Vici37 commented Mar 10, 2024

When playing around with ic, I noticed the tab-completion wasn't helping when I needed to descend down nested module / class names. I added some extra conditions in the on_tab method in reply to detect when that was happening and trigger another on_completion run for the new namespace layer.

I couldn't think of an effective way to write tests for this, since reply tries to be crystal agnostic it looks like, and this is fairly crystal specific. Let me know if you have any ideas for writing a spec, would be happy to write any suggestions :)

reader.editor.verify("42.hello")

SpecHelper.send(pipe_in, "\e\t") # shit_tab
SpecHelper.send(pipe_in, "\e\t") # shift_tab
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was trying to find somewhere to add a spec for this change and discovered this amusing typo

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oups -__-

@I3oris
Copy link
Owner

I3oris commented Mar 13, 2024

Hello @Vici37 !

Thank you very much for this pull request, and all my excuses for the poor delay response.

I took a look into this and I found a way to do the same thing that your PR, but being crystal agnostic.

I'm will bring this soon :)

I3oris added a commit that referenced this pull request Mar 13, 2024
…etion when typing ':'. Permit auto completion to work well when crossing `::`. (Thanks @Vici37) (#6)

Add spec and fix typo.
@I3oris
Copy link
Owner

I3oris commented Mar 13, 2024

I used code in this PR to solve the problem in this commit. I decided to create a new commit because change was to important compared to your PR.

The crystal specific code is updated in the IC repository here. However, the code will be effective only when crystal will use the updated version of REPLy, since IC does'nt require REPLy itself, but use the REPLy version of Crystal.

@Vici37
Copy link
Author

Vici37 commented Mar 14, 2024

Woo, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants