zbirenbaum / zbirenbaum/copilot.lua

Check first (n?) characters of a suggestion

Open
#487 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Lua
Stars
4.1k
Forks
161
Avg merge
11h 54m
Merged PRs (30d)
13

Description

So I probably hate myself more than most people and want to use <Tab> for completions :)

But I'm trying to dynamically check if the first (few?) characters of a suggestion are \t, in which case I'll simply passthrough the Tab key. I am sort of able to do this right now with suggestion.accept(<function>), but I think it'd be a quick and user friendly addition to either provide a method to get the first (n?) chars of a suggestion, or take in a string and match it against its text. E.g.:

local first_5 = suggestion.get_n_chars(5)
-- or
local starts_with_tab = suggestion.startswith('\t')

Anyway, cheers for the amazing plugin!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the suggestion API around suggestion.accept(function) and trace how suggestion text is exposed during completion handling. Determine the smallest API shape for inspecting a prefix or matching a starting string, then verify that a suggestion beginning with a tab can be detected without accepting it.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, neovim
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.