You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The use case would be to generate a code snippet at a specific line.
In this scenario, it may be redundant to give the whole file as context, but a few lines before and after the current cursor line might help.
Edit: other helpful contexts can be passing the current function/class/scope and cursor location, etc.
Apologies if this is already implemented and I missed it. Thanks again!
The text was updated successfully, but these errors were encountered:
Thank you for this feature suggestion. This is already possible as of today, for example to insert the lines before and after the cursor, you can do the following:
require('gen').prompts['Code_Completion'] = {
prompt=function()
localbuf=vim.api.nvim_get_current_buf()
localrow, col=unpack(vim.api.nvim_win_get_cursor(0))
localbefore=vim.api.nvim_buf_get_text(0, 0, 0, row-1, col+1, {})
localafter=vim.api.nvim_buf_get_text(0, row-1, col+1, -1, -1, {})
localprompt='<|fim_prefix|>' ..table.concat(before, "\n") ..'<|fim_suffix|>' ..table.concat(after, "\n") ..'<|fim_middle|>only output the middle part, not the prefix/suffix, nothing else, just the missing code including the $filetype code fence ```$filetype\n<resulting code>\n``` for example ```$filetype\nconsole.log("hello")\n```'returnpromptend,
model="qwen2.5-coder:7b-instruct",
extract="```$filetype\n(.-)```"
}
vim.keymap.set('i', '<c-]>', '<esc>:Gen Code_Completion<CR>')
First, thanks a lot for this nifty plugin! :)
The use case would be to generate a code snippet at a specific line.
In this scenario, it may be redundant to give the whole file as context, but a few lines before and after the current cursor line might help.
Edit: other helpful contexts can be passing the current function/class/scope and cursor location, etc.
Apologies if this is already implemented and I missed it. Thanks again!
The text was updated successfully, but these errors were encountered: