创建一个自己的 code autocompletion 插件

Ivan Lv6

创建一个 code completion 插件, 能够自己管理上下文. 目前的设想是, 如果模型是在这样的场景下训练的, 例如:

1
2
3
4
5
6
7
8
9
10
11
12
def fn1(arg1, arg2, ...):
...

def fn2(arg1, arg2, ...):
...

# main logic
for i in range(...):
# doing something
print(...)

I # cursor position

此时我们可以通过代码解析器, 将 cursor 附近的一些代码片段, 结合里面用到的函数, 将函数定义 (仅定义以及对应的 doc string 提供给 agent 作为上下文). 使得只有非常小上下文的模型也能够表现得较为出色.

  • Title: 创建一个自己的 code autocompletion 插件
  • Author: Ivan
  • Created at : 2026-09-23 00:00:00
  • Updated at : 2026-10-23 18:02:31
  • Link: https://ivanfan-van.github.io/2026/09/23/note-1-inbox-002/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
创建一个自己的 code autocompletion 插件