Skip to content
Back to skills

533 Lsp 29382149

ASecurity

Language Server Protocol client for diagnostics

  • 9 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 1, 2026
developmentjavascripttypescriptpythonrustgojava

Works with

  • cli

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned June 1, 2026

npx -y skills add tools-only/X-Skills --skill 533-lsp_29382149 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 533 Lsp 29382149?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 533 Lsp 29382149
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-533-lsp-29382149/badge)](https://www.skillsdirectory.com/skills/tools-only-533-lsp-29382149)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
title: LSP Module
path: src/tunacode/lsp
type: directory
depth: 1
description: Language Server Protocol client for diagnostics
exports: [LSPClient, get_diagnostics, start_server]
seams: [M, D]
---

# LSP Module

## Purpose
Implements a minimal Language Server Protocol client to fetch diagnostic feedback (errors, warnings) from language servers.

## Key Components

### client.py
**LSPClient Class**
Main LSP client implementation:
- **start_server()** - Spawn language server process
- **initialize()** - Initialize LSP handshake
- **get_diagnostics()** - Fetch diagnostics for file
- **shutdown()** - Gracefully terminate server
- **did_open()** - Notify file open
- **did_change()** - Notify file change
- **did_close()** - Notify file close

**Features:**
- Async subprocess management
- JSON-RPC communication
- Server lifecycle management
- Error handling and recovery

### diagnostics.py
**Diagnostic Functions:**
- **get_diagnostics()** - Fetch diagnostics for file
- **format_diagnostics()** - Format for display
- **parse_diagnostics()** - Parse LSP response

**Diagnostic Types:**
- Error - Critical issues
- Warning - Potential problems
- Information - Suggestions
- Hint - Style recommendations

### servers.py
**Language Server Registry**
Supported language servers:
- **Python** - pylsp, python-lsp-server
- **JavaScript/TypeScript** - typescript-language-server
- **Go** - gopls
- **Rust** - rust-analyzer
- **etc.**

**Server Configuration:**
```python
{
  "language": "python",
  "command": "pylsp",
  "args": [],
  "workspace": Path
}
```

## LSP Workflow

```
1. Start server process
2. Initialize LSP handshake
3. Notify file open (did_open)
4. Get diagnostics
5. Notify file change (did_change)
6. Get updated diagnostics
7. Notify file close (did_close)
8. Shutdown server
```

## Integration Points

- **tools/write_file.py** - Trigger diagnostics after write
- **tools/update_file.py** - Trigger diagnostics after update
- **tools/decorators.py** - LSP integration in file_tool decorator
- **ui/renderers/tools/diagnostics.py** - Display diagnostics

## Usage

Tool decorator integration:
```python
@file_tool(writes=True)
async def write_file(filepath: str, content: str):
    # Write file
    ...
    # Fetch diagnostics
    diagnostics = await lsp_client.get_diagnostics(filepath)
    # Append to output
    return result + diagnostics
```

## Seams (M, D)

**Modification Points:**
- Add new language servers
- Customize LSP client behavior
- Extend diagnostic formatting
- Add LSP features (completion, hover, etc.)

**Extension Points:**
- Implement additional LSP capabilities
- Add server auto-detection
- Create custom diagnostic formatters
- Add LSP server management

Files in this skill

  • README.md884 B
  • skill.md2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.