nvim: vim-fern で LSP workspace file operation 通知を統合 - #2
Open
xecua wants to merge 3 commits into
Open
Conversation
fern でのリネーム/ファイル作成/ディレクトリ作成/削除に合わせて
workspace/will*Files および workspace/did*Files を LSP サーバへ送信し、
返された WorkspaceEdit (インポートパス変更等) をバッファへ反映する。
- nvim/lua/xecua/fern_lsp.lua を新規作成
- will/did rename・create・delete の各 LSP 通知関数
- setup_keymaps(): fern ftplugin から呼ぶバッファローカルキーマップ設定
- r : リネーム (will → rename → バッファ名更新 → did)
- n : 新規ファイル (will → writefile → did)
- N : 新規ディレクトリ (will → mkdir → did)
- D : 削除 (will → delete → did)
- nvim/dpp/plugins.toml
- igorlfs/nvim-lsp-file-operations の lua_post_source に
vim.lsp.config("*", ...) を追加し、vim.lsp.enable() 経由の
サーバにも file operation capabilities を通知するよう修正
- fern ftplugin の末尾に setup_keymaps() 呼び出しを追加
https://claude.ai/code/session_01Nki9sigCcADUFEGc84JqWd
プラグインは開発終了のため除去。代わりに lsp.lua の
vim.lsp.config("*", ...) で workspace.fileOperations capabilities を
全サーバに直接宣言するよう変更。
fern_lsp.lua による will/did 通知は引き続き機能する。
https://claude.ai/code/session_01Nki9sigCcADUFEGc84JqWd
独自の入力プロンプト実装を廃止し、fern ネイティブの rename action
(fern-replacer バッファ) にフックする方式に変更。
- fern_lsp.lua
- M.setup(): fern-replacer filetype の BufWritePre/BufWritePost/BufUnload
に autocmd を登録。BufWritePre で b:fern_replacer_candidates と
バッファ行を突き合わせ、変更があるペアに対して willRenameFiles を
一括送信。BufWritePost または BufUnload (どちらか早い方) で
didRenameFiles を送信 (冪等)。複数ファイルの一括 rename に対応。
- setup_keymaps(): r キーを独自実装から <Plug>(fern-action-rename) に変更
- plugins.toml: vim-fern の lua_source に M.setup() 呼び出しを追加
https://claude.ai/code/session_01Nki9sigCcADUFEGc84JqWd
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.
fern でのリネーム/ファイル作成/ディレクトリ作成/削除に合わせて
workspace/willFiles および workspace/didFiles を LSP サーバへ送信し、
返された WorkspaceEdit (インポートパス変更等) をバッファへ反映する。
vim.lsp.config("*", ...) を追加し、vim.lsp.enable() 経由の
サーバにも file operation capabilities を通知するよう修正
https://claude.ai/code/session_01Nki9sigCcADUFEGc84JqWd