Improve LSP performance and resolve autocompletion conflicts#101
Merged
Conversation
- stdin 写入改为经 channel 交独立线程处理,避免语言服务器索引时 管道写阻塞主线程命令循环 - 读取消息由逐条 emit 改为合批 lsp:messages,避免重服务器索引时 IPC 洪流压垮 webview 主线程
languageServerWithTransport 已内置带 override 的 autocompletion (含默认补全键位),再叠加自定义 lspCompletion 会触发 "Config merge conflict for field override" 导致建 state 失败。 改为仅依赖库内置补全,删除冗余的 lspCompletion。
editorView/extensions 用普通 ref 会被深度响应式代理,连同内部 LSP client 一起被 Proxy。watch(editorView) 因此在 view 每次内部 mutation 时触发,与 applyDiffMarkers 的 dispatch 形成 mutation→watch→dispatch 无限循环;LSP 接入后 client 持续 mutate 会立即点燃该循环导致整页卡死。改用 shallowRef,watch 仅在 view 重建时触发。
base 已内置跳转定义键位与重命名基建,但格式化未接入、重命名未绑键。 此处补齐: - F2 触发重命名 - Shift-Alt-F / Mod-Shift-I 格式化整篇文档,Mod-K Mod-F 格式化选区 - formattingOptions 对齐编辑器缩进配置(tab_size / indent_with_tab)
库自带 F12 仅处理同文件定义,目标在其它文件时结果被直接丢弃。 覆盖 F12 命令:同文件仍交由库移动光标,跨文件则将 file:// 还原为 本地路径并派发 lsp:open-location 事件;App 监听后 smartOpen 打开 目标文件再 gotoLine 定位。 注:Cmd+Click 暂仍为同文件跳转(未覆盖 base 的 mouseHandler)。
- 抽出 gotoDefinitionAt(view, pos),F12 与 Cmd/Ctrl+Click 共用 - 以 Prec.highest 覆盖 base 的 mousedown 处理器,抢先处理后返回 true 阻止其同文件-only 的旧逻辑 - gotoLine 增加可选 character 参数,跨文件跳转定位到定义的精确列
- server_cmd 增加对应语言到语言服务器的映射 - server_defs 增加检测与一键安装项 - 前端 LANGUAGE_ID / LANGUAGE_EXT 同步登记,使其可启动 LSP
- 抽出可复用的 runGotoDefinition(从 plugin 读 documentUri),供 F12/Cmd+Click/右键菜单共用 - 在编辑器内容区右键弹出菜单:跳转定义、重命名、格式化文档/选区 - 仅当前语言支持 LSP 时弹出;菜单位置夹取到视口内
- lspDiagnostics 去抖收集编辑器诊断到响应式 store(顺带降低索引期 高频刷新的渲染压力) - DiagnosticsPanel 底部面板列出错误/警告,点击跳转到对应行列 - 状态栏 LSP 区显示错误/警告计数,点击开关问题面板
- 用 pending 标记正在进行的动作(commit/push/commitPush),busy 据其派生 - 对应按钮显示加载转圈,其余按钮禁用以防重复点击 - commitAndPush 改为独立流程,整段期间在该按钮上显示加载
窄面板下按钮被 flex 压缩导致文字撑出背景、加载时与 spinner 重叠。 按钮改为不收缩 + 不换行(shrink-0/whitespace-nowrap),容器允许换行。
Button 内置 loading 是 spinner+文字并排,窄按钮里二者挤在一起看似 “两个推送”。改为加载时用 Loader2 替换按钮文字,并加 min-width 防塌缩。
回退此前手动 Loader2 + flex-wrap/min-w 的过度改动,按钮加载状态 直接用 :loading="pending === ...'" 绑定即可。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.