Skip to content

Try support vim #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 25, 2025
Merged

Try support vim #46

merged 7 commits into from
Apr 25, 2025

Conversation

fengkx
Copy link
Owner

@fengkx fengkx commented Apr 23, 2025

LSP Server Capability Handling and Fallback Improvements

Summary

This PR improves the LSP server's capability handling and adds proper fallback mechanisms for both browser and Node.js environments. It also refactors the server initialization flow to be more robust and type-safe.

This will make LSP Server ready to be used in vim.

Key Changes

Architecture Changes

  • Moved DocumentStore initialization outside of startServer to allow platform-specific implementations
  • Added fallback mechanisms for when custom LSP capabilities are not available
  • Introduced DocumentStoreInNode class for Node.js-specific implementations
  • Made server options more explicit with required isBrowser flag

Capability Handling

  • Added proper capability checks for ListBeanFile and FileRead custom messages
  • Implemented fallback methods for file operations when custom capabilities are not available:
    • fallbackListBeanFiles: Uses workspace folder to find bean files
    • fallbackFileRead: Provides platform-specific file reading implementation

Browser Support

  • Removed experimental browser notification as the implementation is now more stable
  • Added proper type imports to avoid runtime dependencies
  • Improved browser-specific initialization

fengkx added 3 commits April 23, 2025 23:40
- Removed middleware from client options in lsp-client for cleaner code.
- Introduced DocumentStore class in lsp-server to manage document operations, including fallback methods for file reading and bean file listing.
- Updated startServer function to utilize the new DocumentStore, improving document management in both browser and node environments.
- Added support for reading files and listing bean files in the Node environment using fast-glob and fs/promises.
@fengkx fengkx mentioned this pull request Apr 24, 2025
fengkx added 4 commits April 24, 2025 12:09
- Updated references from 'manBeanFile' to 'mainBeanFile' in the DocumentStore class to ensure proper configuration handling.
- Adjusted warning message to reflect the correct property name for user guidance.
@fengkx fengkx merged commit c68a7f3 into master Apr 25, 2025
1 check passed
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