Skip to content

LSP Shortcuts

Language Server Protocol (LSP) keyboard shortcuts across different editors. These shortcuts provide consistent navigation and code intelligence features.

Shortcut Reference Table

CommandVS CodeVisual StudioRiderLazyVim
Info (Hover)KKKK
Go to Definitiongdgdgdgd
Go to ImplementationgIgIgIgI
Go to Referencesgrgrgrgr
Navigate Back<C-o><C-o><C-o><C-o>
Navigate Forward<C-i><C-i><C-i><C-i>
Open TerminalCtrl + `Ctrl + `?<C-/>
Signature HelpgKgKgKgK
Rename SymbolF2Ctrl + R, Ctrl + RShift + F6<leader>cr
RefactoringCtrl + Shift + RCtrl + R, Ctrl + RCtrl + Alt + Shift + T<leader>ca
Format DocumentShift + Alt + FCtrl + K, Ctrl + DCtrl + Alt + L<leader>cf
Quick FixCtrl + .Ctrl + .Alt + Enter<leader>ca

Command Descriptions

Info (Hover)

Shows type information, documentation, and details about the symbol under the cursor.

Common across all editors: K

// Hover over a variable to see its type
const user = getUserById(123);  // Hover shows: const user: User

Go to Definition

Jumps to the definition of a symbol (function, class, variable, etc.).

Common across all editors: gd

javascript
function greet(name) {  // Definition
    return `Hello, ${name}`;
}

const message = greet("World");  // Press gd here jumps to function definition

Go to Implementation

Jumps to the implementation of an interface or abstract method.

Common across all editors: gI

csharp
public interface IUserService {
    User GetUser(int id);  // Interface definition
}

public class UserService : IUserService {
    public User GetUser(int id) {  // Press gI on interface method jumps here
        // Implementation
    }
}

Go to References

Shows all references/usages of a symbol across the codebase.

Common across all editors: gr

javascript
function calculateTotal(items) {  // Definition
    return items.reduce((sum, item) => sum + item.price, 0);
}

const total1 = calculateTotal(cart);  // Reference 1
const total2 = calculateTotal(orders);  // Reference 2
// Press gr shows all usages

Navigate through cursor position history.

  • Back: Ctrl + O (all editors)
  • Forward: Ctrl + I (all editors)

Useful after jumping to definitions or references.

Signature Help

Shows function signature, parameter types, and documentation while typing function calls.

Common across all editors: gK

javascript
function createUser(name, age, email) {
    // ...
}

createUser(  // Press gK here shows: createUser(name: string, age: number, email: string)

Rename Symbol

Renames a symbol and updates all references across the codebase.

EditorShortcut
VS CodeF2
Visual StudioCtrl + R, Ctrl + R
RiderShift + F6
LazyVim<leader>cr
javascript
function oldFunctionName() {  // Rename here
    // ...
}

oldFunctionName();  // Automatically updated
oldFunctionName();  // Automatically updated

Refactoring Menu

Opens the refactoring menu with available code actions.

EditorShortcut
VS CodeCtrl + Shift + R
Visual StudioCtrl + R, Ctrl + R
RiderCtrl + Alt + Shift + T
LazyVim<leader>ca

Available refactorings:

  • Extract method/function
  • Extract variable
  • Inline variable
  • Move to new file
  • Change signature

Format Document

Formats the entire document according to configured style rules.

EditorShortcut
VS CodeShift + Alt + F
Visual StudioCtrl + K, Ctrl + D
RiderCtrl + Alt + L
LazyVim<leader>cf

Quick Fix

Shows available quick fixes and code actions for the current position.

EditorShortcut
VS CodeCtrl + .
Visual StudioCtrl + .
RiderAlt + Enter
LazyVim<leader>ca

Common quick fixes:

  • Add missing import
  • Implement interface
  • Add null check
  • Convert to async
  • Fix indentation

Additional LSP Commands

VS Code Specific

CommandShortcut
Show all commandsCtrl + Shift + P
Go to symbol in fileCtrl + Shift + O
Go to symbol in workspaceCtrl + T
Find all referencesShift + F12
Peek definitionAlt + F12
Trigger parameter hintsCtrl + Shift + Space
Trigger suggestCtrl + Space

Visual Studio Specific

CommandShortcut
Go to AllCtrl + T or Ctrl + ,
Quick ActionsCtrl + .
Extract InterfaceCtrl + R, Ctrl + I
Extract MethodCtrl + R, Ctrl + M
Encapsulate FieldCtrl + R, Ctrl + E
Find All ReferencesShift + F12
Peek DefinitionAlt + F12

Rider Specific

CommandShortcut
Navigate ToCtrl + Shift + G
Go to TypeCtrl + T
Go to FileCtrl + Shift + T
Go to SymbolCtrl + Shift + Alt + N
Find UsagesShift + F12
Extract MethodCtrl + Alt + M
Introduce VariableCtrl + Alt + V
InlineCtrl + Alt + N

LazyVim/Neovim Specific

CommandShortcut
Telescope find files<leader>ff
Telescope live grep<leader>fg
Telescope buffers<leader>fb
Code actions<leader>ca
Diagnostics<leader>cd
Hover documentationK
Signature helpgK

Editor-Specific Features

VS Code

json
// settings.json
{
    "editor.formatOnSave": true,
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true,
        "source.organizeImports": true
    }
}

Visual Studio

Enable LSP-like shortcuts in Visual Studio:

Tools → Options → Keyboard → Show Commands containing:

  • Edit.InsertNextMatchingCaret
  • Edit.Duplicate

Rider

ReSharper shortcuts are built-in and highly customizable through:

File → Settings → Keymap

LazyVim

Leader key (default: Space)

Common leader combinations:

  • <leader>c - Code actions
  • <leader>f - Find/File operations
  • <leader>g - Git operations
  • <leader>s - Search operations

Setting Up LSP

VS Code

  1. Install language-specific extensions:

    • C#: C# Dev Kit
    • Python: Python
    • JavaScript/TypeScript: Built-in
    • Go: Go
    • Rust: rust-analyzer
  2. Extensions auto-configure LSP

Visual Studio

LSP support is built-in for C#, C++, and other Microsoft languages.

Rider

LSP support is built-in with ReSharper.

LazyVim/Neovim

  1. Install language servers:
bash
# TypeScript
npm install -g typescript typescript-language-server

# Python
pip install python-lsp-server

# Rust
rustup component add rust-analyzer
  1. Configure in LazyVim:
lua
-- lua/plugins/lsp.lua
return {
  "neovim/nvim-lspconfig",
  opts = {
    servers = {
      tsserver = {},
      pylsp = {},
      rust_analyzer = {},
    },
  },
}

Tips and Best Practices

Muscle Memory

Practice using consistent shortcuts:

  1. Use gd for definition (all editors)
  2. Use gr for references (all editors)
  3. Use K for hover info (all editors)

Workflow Efficiency

  1. Navigate: gdgrCtrl + O (back)
  2. Refactor: F2 (rename) → Ctrl + . (quick fix)
  3. Format: Shift + Alt + F (before commit)

Customization

Most editors allow customizing these shortcuts. However, keeping them consistent across editors improves productivity when switching between different development environments.

Troubleshooting

LSP Not Working

VS Code:

1. Check extension is installed
2. Reload window: Ctrl + Shift + P → "Reload Window"
3. Check output: Ctrl + Shift + U → Select language server

Neovim/LazyVim:

vim
:checkhealth
:LspInfo

Shortcuts Not Working

  1. Check for keybinding conflicts
  2. Review editor's keymap settings
  3. Ensure LSP server is running

See Also

External Resources

Released under the MIT License.