diff options
Diffstat (limited to 'lua/clever_f')
| -rw-r--r-- | lua/clever_f/feedback_service.lua | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lua/clever_f/feedback_service.lua b/lua/clever_f/feedback_service.lua index 084b30a..b6552ef 100644 --- a/lua/clever_f/feedback_service.lua +++ b/lua/clever_f/feedback_service.lua @@ -307,7 +307,7 @@ function M.persistent_context_eligible(context) or context.key == "cvr" end -function FeedbackService:request_persistent(specification) +function FeedbackService:build_persistent(specification) if type(specification) ~= "table" then fail("persistent feedback request must be a table", 2) end @@ -321,13 +321,20 @@ function FeedbackService:request_persistent(specification) if not domain.ResolvedMotionPlan.is(specification.motion_plan) then fail("persistent feedback request requires a ResolvedMotionPlan", 2) end - local request = { + if specification.motion_plan.target_plan ~= specification.target_plan then + fail("persistent feedback must reuse the movement TargetPlan", 2) + end + return { context = context, anchor = domain.Position.coerce(specification.anchor), target_plan = specification.target_plan, motion_plan = specification.motion_plan, window = specification.window, } +end + +function FeedbackService:request_persistent(specification) + local request = self:build_persistent(specification) local requests = service_records[self].persistent_requests requests[#requests + 1] = request return request |
