LSP Intelligence
Code completion, diagnostics, navigation, and more powered by nargo lsp
The plugin integrates with nargo lsp (the Noir Language Server) to provide intelligent code assistance. This includes code completion, real-time diagnostics, navigation, hover information, and more.
Code Completion
Section titled “Code Completion”Get context-aware suggestions as you type.
Keyboard shortcut: Ctrl+Space (or start typing after . or ::)
Code completion provides:
- Function and method names
- Struct fields
- Module members
- Import suggestions
- Local variables
- Type names
use std::hash::poseidon;
fn example() { // Type "pos" then Ctrl+Space to see poseidon suggestions let hash = poseidon::bn254::hash_1([1]);
// After ".", completion shows available methods let arr = [1, 2, 3]; let len = arr.len(); // .len() suggested after arr.}Diagnostics
Section titled “Diagnostics”Real-time error and warning highlighting as you type.
Diagnostics show:
- Errors (red underline) - Code that won’t compile
- Warnings (yellow underline) - Potential issues
fn diagnostics_demo() { let x: Field = "not a field"; // Error: type mismatch let unused = 5; // Warning: unused variable}Errors appear in:
- The editor (underlined)
- The gutter (red/yellow icons)
- The Problems tool window
Go to Definition
Section titled “Go to Definition”Navigate to where a symbol is defined.
Keyboard shortcut: Cmd+B (macOS) or Ctrl+B (Windows/Linux)
Also works with:
Cmd+Click/Ctrl+Clickon a symbol- Right-click → Go to → Declaration
use std::hash::poseidon;
fn main() { let result = helper_function(5); // Cmd+B here → jumps to definition}
fn helper_function(x: Field) -> Field { x * 2}Works for:
- Functions
- Structs
- Modules
- Imported items
- Local variables
Hover Information
Section titled “Hover Information”See type information and documentation by hovering over symbols.
Hover shows:
- Type signatures
- Function parameters
- Documentation comments
- Module paths
/// Adds two fields togetherfn add(a: Field, b: Field) -> Field { a + b}
fn demo() { let result = add(1, 2); // Hover over "add" to see signature and docs}Find References
Section titled “Find References”Find all usages of a symbol across your project.
Keyboard shortcut: Alt+F7 (macOS/Windows/Linux)
Also available via:
- Right-click → Find Usages
- Edit → Find → Find Usages
The References panel shows all locations where the symbol is used, organized by file.
Signature Help
Section titled “Signature Help”See function parameter hints while typing.
Keyboard shortcut: Cmd+P (macOS) or Ctrl+P (Windows/Linux)
When typing function arguments, signature help shows:
- Parameter names and types
- Current parameter (highlighted)
- Overload information (if applicable)
fn greet(name: str<32>, times: u32) { // ...}
fn demo() { greet( // Signature help appears here showing: name: str<32>, times: u32 "Alice", 3 );}Code Actions
Section titled “Code Actions”Quick fixes and refactoring suggestions.
Keyboard shortcut: Alt+Enter (when cursor is on an issue)
Also shown via the lightbulb icon in the gutter.
Code actions may include:
- Import suggestions
- Quick fixes for common errors
- Refactoring options
Keyboard Shortcuts Summary
Section titled “Keyboard Shortcuts Summary”| Action | macOS | Windows/Linux |
|---|---|---|
| Code Completion | Ctrl+Space | Ctrl+Space |
| Go to Definition | Cmd+B | Ctrl+B |
| Find References | Alt+F7 | Alt+F7 |
| Signature Help | Cmd+P | Ctrl+P |
| Code Actions | Alt+Enter | Alt+Enter |
| Next Error | F2 | F2 |
| Previous Error | Shift+F2 | Shift+F2 |
Troubleshooting LSP
Section titled “Troubleshooting LSP”If LSP features aren’t working:
- Check nargo is installed: Run
nargo --versionin terminal - Restart LSP: Tools → Noir → Restart Language Server
- Check settings: Ensure LSP is enabled in Settings → Languages & Frameworks → Noir
- Check logs: Help → Show Log in Finder/Explorer and search for “Noir”
See Troubleshooting for more solutions.