aurora-lsp 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aurora_lsp/__init__.py +28 -0
- aurora_lsp/analysis.py +485 -0
- aurora_lsp/client.py +305 -0
- aurora_lsp/diagnostics.py +207 -0
- aurora_lsp/facade.py +402 -0
- aurora_lsp/filters.py +195 -0
- aurora_lsp-0.1.0.dist-info/METADATA +195 -0
- aurora_lsp-0.1.0.dist-info/RECORD +9 -0
- aurora_lsp-0.1.0.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aurora-lsp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LSP integration for Aurora - code intelligence, dead code detection, and impact analysis
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Requires-Dist: mcp>=1.0.0
|
|
8
|
+
Requires-Dist: multilspy>=0.0.15
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
11
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# Aurora LSP
|
|
15
|
+
|
|
16
|
+
LSP integration for Aurora - code intelligence, dead code detection, and impact analysis.
|
|
17
|
+
|
|
18
|
+
Built on [multilspy](https://github.com/microsoft/multilspy) (Microsoft) with custom layers for import filtering and code analysis.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- **Find Usages (excluding imports)** - Distinguish actual code usage from import statements
|
|
23
|
+
- **Dead Code Detection** - Find functions/classes with 0 usages
|
|
24
|
+
- **Linting** - Get errors, warnings, hints via LSP diagnostics
|
|
25
|
+
- **Call Hierarchy** - Find callers of a function (where supported)
|
|
26
|
+
|
|
27
|
+
## Supported Languages
|
|
28
|
+
|
|
29
|
+
| Language | LSP Server | Import Filtering | Call Hierarchy |
|
|
30
|
+
|----------|------------|------------------|----------------|
|
|
31
|
+
| Python | Pyright | ✓ | Limited |
|
|
32
|
+
| TypeScript | tsserver | ✓ | ✓ |
|
|
33
|
+
| JavaScript | tsserver | ✓ | ✓ |
|
|
34
|
+
| Rust | rust-analyzer | ✓ | ✓ |
|
|
35
|
+
| Go | gopls | ✓ | ✓ |
|
|
36
|
+
| Java | Eclipse JDT | ✓ | ✓ |
|
|
37
|
+
| Ruby | Solargraph | ✓ | Limited |
|
|
38
|
+
| C# | OmniSharp | ✓ | ✓ |
|
|
39
|
+
| Dart | Dart Analysis | ✓ | ✓ |
|
|
40
|
+
| Kotlin | kotlin-lsp | ✓ | Limited |
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install aurora-lsp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Usage
|
|
49
|
+
|
|
50
|
+
### Basic Usage
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from aurora_lsp import AuroraLSP
|
|
54
|
+
|
|
55
|
+
# Initialize with workspace path
|
|
56
|
+
lsp = AuroraLSP("/path/to/project")
|
|
57
|
+
|
|
58
|
+
# Find usages of a symbol (excluding imports)
|
|
59
|
+
result = lsp.find_usages("src/main.py", line=10, col=5)
|
|
60
|
+
print(f"Found {result['total_usages']} usages ({result['total_imports']} imports filtered)")
|
|
61
|
+
|
|
62
|
+
# Get usage summary with impact assessment
|
|
63
|
+
summary = lsp.get_usage_summary("src/main.py", line=10, col=5, symbol_name="MyClass")
|
|
64
|
+
print(f"Impact: {summary['impact']} ({summary['files_affected']} files affected)")
|
|
65
|
+
|
|
66
|
+
# Find dead code
|
|
67
|
+
dead = lsp.find_dead_code()
|
|
68
|
+
for item in dead:
|
|
69
|
+
print(f"Unused: {item['name']} ({item['kind']}) in {item['file']}:{item['line']}")
|
|
70
|
+
|
|
71
|
+
# Lint a directory
|
|
72
|
+
diags = lsp.lint("src/")
|
|
73
|
+
print(f"{diags['total_errors']} errors, {diags['total_warnings']} warnings")
|
|
74
|
+
|
|
75
|
+
# Find callers of a function
|
|
76
|
+
callers = lsp.get_callers("src/utils.py", line=25, col=0)
|
|
77
|
+
for caller in callers:
|
|
78
|
+
print(f"Called by: {caller['name']} in {caller['file']}")
|
|
79
|
+
|
|
80
|
+
# Clean up
|
|
81
|
+
lsp.close()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Context Manager
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from aurora_lsp import AuroraLSP
|
|
88
|
+
|
|
89
|
+
with AuroraLSP("/path/to/project") as lsp:
|
|
90
|
+
dead = lsp.find_dead_code()
|
|
91
|
+
print(f"Found {len(dead)} dead code items")
|
|
92
|
+
# Server connections closed automatically
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Convenience Functions
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from aurora_lsp import find_usages, find_dead_code, lint
|
|
99
|
+
|
|
100
|
+
# One-off operations (creates temporary LSP instance)
|
|
101
|
+
result = find_usages("src/main.py", line=10, col=5)
|
|
102
|
+
dead = find_dead_code("src/")
|
|
103
|
+
diags = lint("src/")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## API Reference
|
|
107
|
+
|
|
108
|
+
### AuroraLSP
|
|
109
|
+
|
|
110
|
+
Main facade class providing synchronous API.
|
|
111
|
+
|
|
112
|
+
#### `find_usages(file_path, line, col, include_imports=False) -> dict`
|
|
113
|
+
|
|
114
|
+
Find usages of a symbol.
|
|
115
|
+
|
|
116
|
+
**Returns:**
|
|
117
|
+
- `usages`: List of usage locations with context
|
|
118
|
+
- `imports`: List of import locations
|
|
119
|
+
- `total_usages`: Count of actual usages
|
|
120
|
+
- `total_imports`: Count of import statements
|
|
121
|
+
|
|
122
|
+
#### `get_usage_summary(file_path, line, col, symbol_name=None) -> dict`
|
|
123
|
+
|
|
124
|
+
Get comprehensive usage summary.
|
|
125
|
+
|
|
126
|
+
**Returns:**
|
|
127
|
+
- `symbol`: Symbol name
|
|
128
|
+
- `total_usages`: Usage count
|
|
129
|
+
- `total_imports`: Import count
|
|
130
|
+
- `impact`: 'low' (<3), 'medium' (3-10), 'high' (>10)
|
|
131
|
+
- `files_affected`: Number of files with usages
|
|
132
|
+
- `usages_by_file`: Usages grouped by file
|
|
133
|
+
|
|
134
|
+
#### `find_dead_code(path=None, include_private=False) -> list[dict]`
|
|
135
|
+
|
|
136
|
+
Find functions/classes with 0 usages.
|
|
137
|
+
|
|
138
|
+
**Returns:** List of items with:
|
|
139
|
+
- `file`: File path
|
|
140
|
+
- `line`: Line number
|
|
141
|
+
- `name`: Symbol name
|
|
142
|
+
- `kind`: 'function', 'class', or 'method'
|
|
143
|
+
- `imports`: Number of times imported but never used
|
|
144
|
+
|
|
145
|
+
#### `lint(path=None, severity_filter=None) -> dict`
|
|
146
|
+
|
|
147
|
+
Get linting diagnostics.
|
|
148
|
+
|
|
149
|
+
**Returns:**
|
|
150
|
+
- `errors`: List of errors
|
|
151
|
+
- `warnings`: List of warnings
|
|
152
|
+
- `hints`: List of hints
|
|
153
|
+
- `total_errors`, `total_warnings`, `total_hints`: Counts
|
|
154
|
+
|
|
155
|
+
#### `get_callers(file_path, line, col) -> list[dict]`
|
|
156
|
+
|
|
157
|
+
Find functions that call this symbol.
|
|
158
|
+
|
|
159
|
+
**Returns:** List of items with:
|
|
160
|
+
- `file`: File path
|
|
161
|
+
- `line`: Line number
|
|
162
|
+
- `name`: Function name
|
|
163
|
+
|
|
164
|
+
## Architecture
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
┌─────────────────────────────────────────┐
|
|
168
|
+
│ AuroraLSP (facade.py) │ High-level sync API
|
|
169
|
+
├─────────────────────────────────────────┤
|
|
170
|
+
│ CodeAnalyzer (analysis.py) │ Dead code, usage summary
|
|
171
|
+
│ DiagnosticsFormatter (diagnostics.py) │ Linting
|
|
172
|
+
│ ImportFilter (filters.py) │ Import vs usage
|
|
173
|
+
├─────────────────────────────────────────┤
|
|
174
|
+
│ AuroraLSPClient (client.py) │ Async LSP operations
|
|
175
|
+
├─────────────────────────────────────────┤
|
|
176
|
+
│ multilspy (Microsoft) │ LSP server management
|
|
177
|
+
└─────────────────────────────────────────┘
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Install dev dependencies
|
|
184
|
+
pip install -e ".[dev]"
|
|
185
|
+
|
|
186
|
+
# Run tests
|
|
187
|
+
pytest tests/
|
|
188
|
+
|
|
189
|
+
# Type checking
|
|
190
|
+
mypy src/
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## License
|
|
194
|
+
|
|
195
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
aurora_lsp/__init__.py,sha256=fFdeIjEX4PqCFdYXi57k0sVaD8aGOqLtHTgt1qE4-kw,690
|
|
2
|
+
aurora_lsp/analysis.py,sha256=Qty0AXMp1wu5N5_CLm2ZtJwmR213L4gkva6NC5_GlpM,15482
|
|
3
|
+
aurora_lsp/client.py,sha256=yAlPUhg4aaMliq0Rq48ZM3hVEHB3tIw0G6rYm8INBMA,10545
|
|
4
|
+
aurora_lsp/diagnostics.py,sha256=LK0We0u4l-pKEipwT07dQYE9hDoImT1qagSoFqfRd84,6508
|
|
5
|
+
aurora_lsp/facade.py,sha256=uTfeB7acurxQjXtrv6hBEqhJepQsdhBXwmtuXCFsVAM,12519
|
|
6
|
+
aurora_lsp/filters.py,sha256=e2zo5UtFP8EWFJmV3oTRIdlr-5jq4kAt6CfBIBlG1G4,5616
|
|
7
|
+
aurora_lsp-0.1.0.dist-info/METADATA,sha256=j8YctH88GPmPkF8CmDNS2JfKtb99nEqq441ZpGM1UVE,5707
|
|
8
|
+
aurora_lsp-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
9
|
+
aurora_lsp-0.1.0.dist-info/RECORD,,
|