Skip to content

Commit 6ee8a4d

Browse files
committed
docs: update for content
1 parent b726127 commit 6ee8a4d

File tree

1 file changed

+41
-26
lines changed

1 file changed

+41
-26
lines changed

README.md

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,27 @@ BlogService 类信息,作为上下文(在注释中提供)提供给模型
320320
321321
## 步骤 1:构建 IDE 插件与度量体系设计
322322
323-
IDE、编辑器作为开发者的主要工具,其设计和学习成本也
324-
325-
相关资源:
323+
IDE、编辑器作为开发者的主要工具,其设计和学习成本也相对比较高。首先,我们可以用官方提供的模板生成:
326324
327325
- [IDEA 插件模板](https://github.com/JetBrains/intellij-platform-plugin-template)
328326
- [VSCode 插件模板](https://code.visualstudio.com/api/get-started/your-first-extension)
329327
328+
然后,再往上添加功能(是不是很简单),当然不是。以下是一些可以参考的 IDEA 插件资源:
329+
330+
- [Intellij Community 版本源码](https://github.com/JetBrains/intellij-community)
331+
- [IntelliJ SDK Docs Code Samples](https://github.com/JetBrains/intellij-sdk-code-samples)
332+
- [Intellij Rust](https://github.com/intellij-rust/intellij-rust)
333+
334+
当然了,更合适的是参考[AutoDev 插件](https://github.com/unit-mesh/auto-dev)。
335+
330336
### JetBrains 插件
331337
338+
对于 IDEA 插件实现来说,主要是通过 Action 和 Listener 来实现的,只需要在 `plugin.xml` 中注册即可。
339+
详细可以参考官方文档:[IntelliJ Platform Plugin SDK](https://plugins.jetbrains.com/docs/intellij/welcome.html)
340+
332341
#### 补全模式:Inlay
333342
334-
在自动代码补全上,国内的厂商主要参考的是 GitHub Copilot 的实现,逻辑也不复杂。
343+
在自动代码补全上,国内的厂商主要参考的是 GitHub Copilot 的实现,逻辑也不复杂。
335344
336345
**采用快捷键方式触发**
337346
@@ -351,30 +360,30 @@ IDE、编辑器作为开发者的主要工具,其设计和学习成本也
351360
352361
```kotlin
353362
class AutoDevEditorListener : EditorFactoryListener {
354-
override fun editorCreated(event: EditorFactoryEvent) {
355-
//...
356-
editor.document.addDocumentListener(AutoDevDocumentListener(editor), editorDisposable)
357-
editor.caretModel.addCaretListener(AutoDevCaretListener(editor), editorDisposable)
358-
//...
359-
}
360-
361-
class AutoDevCaretListener(val editor: Editor) : CaretListener {
362-
override fun caretPositionChanged(event: CaretEvent) {
363-
//...
364-
val wasTypeOver = TypeOverHandler.getPendingTypeOverAndReset(editor)
365-
//...
366-
llmInlayManager.disposeInlays(editor, InlayDisposeContext.CaretChange)
363+
override fun editorCreated(event: EditorFactoryEvent) {
364+
//...
365+
editor.document.addDocumentListener(AutoDevDocumentListener(editor), editorDisposable)
366+
editor.caretModel.addCaretListener(AutoDevCaretListener(editor), editorDisposable)
367+
//...
368+
}
369+
370+
class AutoDevCaretListener(val editor: Editor) : CaretListener {
371+
override fun caretPositionChanged(event: CaretEvent) {
372+
//...
373+
val wasTypeOver = TypeOverHandler.getPendingTypeOverAndReset(editor)
374+
//...
375+
llmInlayManager.disposeInlays(editor, InlayDisposeContext.CaretChange)
376+
}
367377
}
368-
}
369-
370-
class AutoDevDocumentListener(val editor: Editor) : BulkAwareDocumentListener {
371-
override fun documentChangedNonBulk(event: DocumentEvent) {
372-
//...
373-
val llmInlayManager = LLMInlayManager.getInstance()
374-
llmInlayManager
375-
.editorModified(editor, changeOffset)
378+
379+
class AutoDevDocumentListener(val editor: Editor) : BulkAwareDocumentListener {
380+
override fun documentChangedNonBulk(event: DocumentEvent) {
381+
//...
382+
val llmInlayManager = LLMInlayManager.getInstance()
383+
llmInlayManager
384+
.editorModified(editor, changeOffset)
385+
}
376386
}
377-
}
378387
}
379388
```
380389
@@ -410,6 +419,12 @@ class AutoDevEditorListener : EditorFactoryListener {
410419
</group>
411420
```
412421
422+
### 上下文构建
423+
424+
#### 静态代码分析
425+
426+
#### 相关代码分析
427+
413428
### VSCode 插件
414429
415430
TODO

0 commit comments

Comments
 (0)