LSP Shortcuts
Language Server Protocol (LSP) keyboard shortcuts across different editors. These shortcuts provide consistent navigation and code intelligence features.
Shortcut Reference Table
| Command | VS Code | Visual Studio | Rider | LazyVim |
|---|---|---|---|---|
| Info (Hover) | K | K | K | K |
| Go to Definition | gd | gd | gd | gd |
| Go to Implementation | gI | gI | gI | gI |
| Go to References | gr | gr | gr | gr |
| Navigate Back | <C-o> | <C-o> | <C-o> | <C-o> |
| Navigate Forward | <C-i> | <C-i> | <C-i> | <C-i> |
| Open Terminal | Ctrl + ` | Ctrl + ` | ? | <C-/> |
| Signature Help | gK | gK | gK | gK |
| Rename Symbol | F2 | Ctrl + R, Ctrl + R | Shift + F6 | <leader>cr |
| Refactoring | Ctrl + Shift + R | Ctrl + R, Ctrl + R | Ctrl + Alt + Shift + T | <leader>ca |
| Format Document | Shift + Alt + F | Ctrl + K, Ctrl + D | Ctrl + Alt + L | <leader>cf |
| Quick Fix | Ctrl + . | 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: UserGo to Definition
Jumps to the definition of a symbol (function, class, variable, etc.).
Common across all editors: gd
function greet(name) { // Definition
return `Hello, ${name}`;
}
const message = greet("World"); // Press gd here jumps to function definitionGo to Implementation
Jumps to the implementation of an interface or abstract method.
Common across all editors: gI
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
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 usagesNavigate Back/Forward
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
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.
| Editor | Shortcut |
|---|---|
| VS Code | F2 |
| Visual Studio | Ctrl + R, Ctrl + R |
| Rider | Shift + F6 |
| LazyVim | <leader>cr |
function oldFunctionName() { // Rename here
// ...
}
oldFunctionName(); // Automatically updated
oldFunctionName(); // Automatically updatedRefactoring Menu
Opens the refactoring menu with available code actions.
| Editor | Shortcut |
|---|---|
| VS Code | Ctrl + Shift + R |
| Visual Studio | Ctrl + R, Ctrl + R |
| Rider | Ctrl + 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.
| Editor | Shortcut |
|---|---|
| VS Code | Shift + Alt + F |
| Visual Studio | Ctrl + K, Ctrl + D |
| Rider | Ctrl + Alt + L |
| LazyVim | <leader>cf |
Quick Fix
Shows available quick fixes and code actions for the current position.
| Editor | Shortcut |
|---|---|
| VS Code | Ctrl + . |
| Visual Studio | Ctrl + . |
| Rider | Alt + 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
| Command | Shortcut |
|---|---|
| Show all commands | Ctrl + Shift + P |
| Go to symbol in file | Ctrl + Shift + O |
| Go to symbol in workspace | Ctrl + T |
| Find all references | Shift + F12 |
| Peek definition | Alt + F12 |
| Trigger parameter hints | Ctrl + Shift + Space |
| Trigger suggest | Ctrl + Space |
Visual Studio Specific
| Command | Shortcut |
|---|---|
| Go to All | Ctrl + T or Ctrl + , |
| Quick Actions | Ctrl + . |
| Extract Interface | Ctrl + R, Ctrl + I |
| Extract Method | Ctrl + R, Ctrl + M |
| Encapsulate Field | Ctrl + R, Ctrl + E |
| Find All References | Shift + F12 |
| Peek Definition | Alt + F12 |
Rider Specific
| Command | Shortcut |
|---|---|
| Navigate To | Ctrl + Shift + G |
| Go to Type | Ctrl + T |
| Go to File | Ctrl + Shift + T |
| Go to Symbol | Ctrl + Shift + Alt + N |
| Find Usages | Shift + F12 |
| Extract Method | Ctrl + Alt + M |
| Introduce Variable | Ctrl + Alt + V |
| Inline | Ctrl + Alt + N |
LazyVim/Neovim Specific
| Command | Shortcut |
|---|---|
| Telescope find files | <leader>ff |
| Telescope live grep | <leader>fg |
| Telescope buffers | <leader>fb |
| Code actions | <leader>ca |
| Diagnostics | <leader>cd |
| Hover documentation | K |
| Signature help | gK |
Editor-Specific Features
VS Code
// 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.InsertNextMatchingCaretEdit.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
Install language-specific extensions:
- C#: C# Dev Kit
- Python: Python
- JavaScript/TypeScript: Built-in
- Go: Go
- Rust: rust-analyzer
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
- Install language servers:
# TypeScript
npm install -g typescript typescript-language-server
# Python
pip install python-lsp-server
# Rust
rustup component add rust-analyzer- Configure in LazyVim:
-- lua/plugins/lsp.lua
return {
"neovim/nvim-lspconfig",
opts = {
servers = {
tsserver = {},
pylsp = {},
rust_analyzer = {},
},
},
}Tips and Best Practices
Muscle Memory
Practice using consistent shortcuts:
- Use
gdfor definition (all editors) - Use
grfor references (all editors) - Use
Kfor hover info (all editors)
Workflow Efficiency
- Navigate:
gd→gr→Ctrl + O(back) - Refactor:
F2(rename) →Ctrl + .(quick fix) - 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 serverNeovim/LazyVim:
:checkhealth
:LspInfoShortcuts Not Working
- Check for keybinding conflicts
- Review editor's keymap settings
- Ensure LSP server is running
See Also
- VS Code Configuration - Complete VS Code setup
- Cross-Platform Commands - Terminal shortcuts