Skip to content

[Feat] genearted code based on description inside a sub window buffer #52

Description

@PyDevC

Feature Introduction: When the cursor line is a comment (detected via Treesitter or synID), use a different prompt template that instructs the model to generate the code described by the comment when a special request of auto-complete the function is called.

Feature Description:

-- User writes:
-- parse CSV file and return rows as objects
local function parse_csv(filepath)
end

-- user selects whole block of code

-- Model generates:
local function parse_csv(filepath)
    local rows = {}
    for line in io.lines(filepath) do
        table.insert(rows, vim.split(line, ","))
    end
    return rows
end
  1. Detect comment lines via vim.fn.synID or Treesitter comment nodes
  2. Use a different system prompt for comment-to-code mode
  3. Return multi-line blocks with proper indentation
  4. Fall back to normal completion if cursor is on code

Is your feature possible with the current status of repo? Yes. Requires a new prompt template and comment detection logic. Already have language detection via Treesitter.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI genIssue was generated by AIenhancementNew feature or requestmaintainer triagedmaintainer has triaged the issue

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions