Skip to content

msc5/lspinfo.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

LSPInfo.nvim

A Neovim plugin that provides a dynamic telescope picker for viewing and managing LSP (Language Server Protocol) client information in real-time.

Features

  • πŸ” Dynamic Telescope Picker: View all running LSP clients with detailed information
  • πŸ“Š Real-time Updates: See LSP client status changes dynamically in the previewer
  • 🎯 Buffer Information: View attached buffers with diagnostic counts for each LSP client
  • ⚑ LSP Actions: Restart, stop, and start LSP servers directly from the picker
  • 🎨 Beautiful UI: Clean, organized display with syntax highlighting
  • πŸ”§ Configurable: Customize telescope theme and update intervals

Requirements

Installation

Using lazy.nvim (Recommended)

{
    'msc5/lspinfo.nvim',
    dependencies = {
        'nvim-telescope/telescope.nvim',
        'nvim-lua/plenary.nvim',
    },
    config = function()
        require('lspinfo').setup({
            -- Configuration options (see Configuration section)
        })
    end,
}

Using packer.nvim

use({
    'msc5/lspinfo.nvim',
    requires = {
        'nvim-telescope/telescope.nvim',
        'nvim-lua/plenary.nvim',
    },
    config = function()
        require('lspinfo').setup()
    end,
})

Using vim-plug

Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'msc5/lspinfo.nvim'

Then in your init.lua:

require('lspinfo').setup()

Usage

Commands

  • :LSPInfo - Open the LSP client information picker

Keymaps

You can also bind the command to a keymap:

-- In your init.lua or keymaps file
vim.keymap.set('n', '<leader>li', '<cmd>LSPInfo<cr>', { desc = 'Show LSP Info' })

Programmatic Usage

-- Show LSP info picker
require('lspinfo').show()

-- Or call the clients module directly
require('lspinfo.clients')()

Configuration

The plugin can be configured by passing options to the setup() function:

require('lspinfo').setup({
    -- Telescope theme configuration
    telescope_theme = {
        layout_strategy = 'vertical',
        layout_config = {
            preview_height = 35,
            width = 0.5,
            height = 0.9,
        },
        results_title = 'Configured LSP Clients',
        sorting_strategy = 'ascending',
    },
    -- Command name for the LSPInfo command
    command_name = 'LSPInfo',
    -- Whether to enable dynamic updates in the previewer
    enable_dynamic_updates = true,
    -- Update interval for dynamic updates (in milliseconds)
    update_interval = 1000,
    -- Keymaps for the picker
    keymaps = {
        restart = 'r',             -- Restart LSP server
        stop = 's',                -- Stop LSP server
        start = 't',               -- Start LSP server
        capabilities = 'c',        -- Show capabilities
        close = '<Esc>',           -- Close picker
    },
})

Configuration Options

Option Type Default Description
telescope_theme table See above Telescope picker theme configuration
command_name string 'LSPInfo' Name of the user command
enable_dynamic_updates boolean true Enable real-time updates in previewer
update_interval number 1000 Update interval in milliseconds
keymaps.restart string 'r' Key to restart LSP server
keymaps.stop string 's' Key to stop LSP server
keymaps.start string 't' Key to start LSP server
keymaps.capabilities string 'c' Key to show capabilities
keymaps.close string '<Esc>' Key to close picker

Features in Detail

Dynamic Previewer

The previewer shows detailed information about each LSP client:

  • Client Name: The name of the LSP server
  • ID: Unique identifier for the client
  • Root Directory: The workspace root directory
  • Current Buffer: Whether the client is attached to the current buffer
  • Status: Running or stopped status
  • Initialized: Whether the client has completed initialization
  • Attached Buffers: List of all buffers with diagnostic counts

Real-time Updates

The previewer updates automatically when:

  • LSP clients start or stop
  • Buffers are attached or detached
  • Diagnostic counts change
  • Client status changes

LSP Actions

When you select an LSP client entry, you can perform actions:

  • Restart Server: Stop and restart the LSP server
  • Stop Server: Stop the LSP server
  • Start Server: Start the LSP server (if stopped)
  • Capabilities: View detailed server capabilities
  • LSP Commands: Execute custom LSP commands

Troubleshooting

No LSP clients shown

Make sure you have LSP servers configured and running. You can check with:

vim.lsp.get_clients()

Telescope not found

Ensure you have telescope.nvim installed and configured:

-- In your init.lua
require('telescope').setup()

Dynamic updates not working

Check that enable_dynamic_updates is set to true in your configuration. You can also adjust the update_interval if updates are too frequent or slow.

Plugin not loading

If you get an error like module 'lspinfo' not found, make sure:

  1. The plugin is properly installed in your Neovim configuration
  2. You're using the correct plugin manager configuration
  3. The plugin directory structure is correct (should be lua/lspinfo/)

You can test if the plugin loads correctly by running:

:lua print(require('lspinfo') ~= nil and "Plugin loaded!" or "Plugin not found")

Testing the plugin

You can run a simple test to verify the plugin works:

-- In Neovim, run this command:
:lua dofile('test_plugin.lua')

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with telescope.nvim
  • Inspired by the need for better LSP client management in Neovim

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages