Skip to content

feat: Add comprehensive LSP server notification handling support#47

Open
loyalpartner wants to merge 2 commits intomainfrom
claude/issue-45-20250823-1617
Open

feat: Add comprehensive LSP server notification handling support#47
loyalpartner wants to merge 2 commits intomainfrom
claude/issue-45-20250823-1617

Conversation

@loyalpartner
Copy link
Owner

Summary

  • Implement comprehensive LSP server notification handling system
  • Add support for 8 different notification types from language servers
  • Maintain backward compatibility with existing diagnostics handling
  • Follow Linus-style architecture principles for clean, maintainable code

Changes

  • New EnhancedNotificationHandler for unified notification processing
  • NotificationRegistrationHandler for dynamic registration from Vim
  • Channel-based async forwarding system to convert notifications to VimActions
  • Integration with existing LSP client architecture

Resolves #45

Generated with Claude Code

- Implement EnhancedNotificationHandler for multiple LSP notification types:
  - textDocument/publishDiagnostics (diagnostics)
  - window/showMessage (server messages)
  - window/logMessage (server logs)
  - $/progress (progress notifications)
  - workspace/applyEdit (workspace edits)
  - workspace/didChangeWorkspaceFolders (folder changes)
  - workspace/didChangeWatchedFiles (file watcher events)

- Add NotificationRegistrationHandler for dynamic registration of notification types from Vim
- Integrate notification channel system for async forwarding to Vim
- Follow Linus-style architecture: simple data structures, eliminate special cases
- Maintain backward compatibility with existing diagnostics handling
- All notifications are forwarded as VimActions for consistent processing

Resolves user request to handle notifications sent from language servers.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: lee <loyalpartner@users.noreply.github.com>
@loyalpartner
Copy link
Owner Author

@claude ctrl+p , ctrl+n 选中下一个后 窗口会飘到左边

Repository owner deleted a comment from claude bot Aug 25, 2025
@loyalpartner
Copy link
Owner Author

@claude ctrl+p , ctrl+n 选中下一个后 窗口会飘到左边

@claude

@claude
Copy link
Contributor

claude bot commented Aug 25, 2025

Claude finished @loyalpartner's task —— View job


I'll investigate the completion popup positioning issue where Ctrl+P/Ctrl+N causes the window to drift to the left.

Todo List

  • Set up repository and investigate completion popup code
  • Identify the root cause of popup positioning issue
  • Implement fix for consistent popup positioning
  • Test and commit changes

Analysis

I found and fixed the issue! In lsp_bridge.vim:775-784, the completion popup was being recreated on every navigation with Ctrl+P/Ctrl+N. The problem was in the s:create_or_update_completion_popup function:

Root Cause: The popup used 'cursor' for column positioning, but when recreated during navigation, slight cursor position shifts caused the popup to "drift" left.

Solution

Fixed the positioning drift by:

  1. Storing initial position: Added s:completion.popup_position to cache the popup's initial cursor position
  2. Updating instead of recreating: Modified s:create_or_update_completion_popup to use popup_settext() for navigation, only creating popup once
  3. Consistent documentation positioning: Updated the documentation popup to use the same cached position

Key changes in vim/autoload/lsp_bridge.vim:

" Store popup position on first creation
let s:completion.popup_position = {
  \ 'line': cursor_pos[1] + 1,
  \ 'col': cursor_pos[2]
}

" Update content instead of recreating
if s:completion.popup_id != -1
  call popup_settext(s:completion.popup_id, a:lines)
  return
endif

This ensures the popup stays anchored to its original position during Ctrl+P/Ctrl+N navigation.

Changes committed in 3fe97c7 - the completion popup should now maintain its position consistently during navigation. Try using Ctrl+P/Ctrl+N to navigate completions and the window should stay in place! 🎯
| Branch: claude/issue-45-20250823-1617

…igation

- Store initial popup position to prevent drift when navigating completions
- Update popup content using popup_settext() instead of recreating popup
- Apply consistent positioning to documentation popup
- Resolves issue where completion window would drift left during navigation

Co-authored-by: lee <loyalpartner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

我现在想处理 语言服务器给我发送的通知

1 participant