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

[WIP] API refactor #156

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

[WIP] API refactor #156

wants to merge 5 commits into from

Conversation

rish987
Copy link

@rish987 rish987 commented Jun 2, 2023

Addresses #151. I'm making this PR right away so you can stay updated on my progress, and I will try to keep the commits as atomic as possible. Feel free to chime in anytime if something doesn't look right to you.

@rish987 rish987 marked this pull request as draft June 2, 2023 12:43
@ggandor
Copy link
Owner

ggandor commented Jun 2, 2023

Okay, thanks!

Just a quick glance:

First, let's leave Telescope out of this PR completely, as this refactor is much more general, and limit additions to the documentation to the actual API changes, if there will be. (An extension plugin/gist/snippet can be shared anytime.)

I don't understand the motivation behind moving with-highlight-chores into light-up-beacons; the very point of the macro is to wrap the more specific stuff with the general chores, and ensure the proper ordering in a foolproof way (and even with messed-up extmark priorities): cleanup first, backdrop, doing stuff, and then, after everything, calling redraw.

That said, yep, we should probably introduce "ranges" as a concept somehow. But that should cover search, backdrop & beacons too.

Fennel tips:

  • shorthand for {:foo foo :bar bar} is {: foo : bar}
  • {} tables are usually used (here) for passing optional values to functions, there's no need to redundantly mark "maybe" values in them ({:?foo bar})

@rish987 rish987 force-pushed the api-refactor branch 2 times, most recently from 493b49a to b7ed1ec Compare June 2, 2023 15:55
@rish987
Copy link
Author

rish987 commented Jun 2, 2023

Hey thanks. You will have to bear with me for a while as I am learning Fennel hahaha. I had moved with-highlight-chores into light-up-beacons with the intention of eventually making that the beacon() API function (because you wouldn't want to make the user have to call with-highlight-chores themselves). But I have reverted that for now, we can think about it later. I'm going to focus first on extracting the select() function (and target state).

(fn set-label-states [targets {: group-offset}]
(let [|label-set| (length targets.label-set)
offset (* group-offset |label-set|)
primary-start (+ offset (if targets.autojump? 2 1))
primary-start (+ offset 1)
Copy link
Author

Choose a reason for hiding this comment

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

Should be okay since it looks like the label will be nil in this case anyways

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.

None yet

2 participants