Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Commit 5c97229

Browse files
authored
Merge pull request #4 from lsp-client/copilot/add-basic-availability-tests
Add integration tests for all supported language servers
2 parents 8f8cddb + 51b3689 commit 5c97229

File tree

15 files changed

+519
-0
lines changed

15 files changed

+519
-0
lines changed

tests/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Shared test fixtures and utilities for LSP CLI tests."""
2+
3+
import subprocess
4+
from pathlib import Path
5+
6+
7+
class BaseLSPTest:
8+
"""Base class for LSP CLI tests with common helper methods."""
9+
10+
def run_lsp_command(self, *args, timeout=30):
11+
"""Run an lsp command and return the result."""
12+
result = subprocess.run(
13+
["uv", "run", "lsp"] + list(args),
14+
capture_output=True,
15+
text=True,
16+
timeout=timeout,
17+
cwd=Path(__file__).parent.parent,
18+
)
19+
return result

tests/fixtures/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Build artifacts
2+
node_modules/
3+
target/
4+
*.pyc
5+
__pycache__/
6+
7+
# Lock files that might be generated
8+
package-lock.json
9+
yarn.lock
10+
Cargo.lock

tests/fixtures/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Test Fixtures
2+
3+
This directory contains minimal test projects for each supported language in LSP CLI.
4+
5+
## Purpose
6+
7+
These fixtures are used by the language support tests (`test_language_support.py`) to verify that LSP CLI can correctly:
8+
- Detect and start language servers for each supported language
9+
- Manage server lifecycle (start, list, stop)
10+
- Handle multiple language servers simultaneously
11+
12+
## Structure
13+
14+
Each subdirectory contains a minimal but valid project for its respective language:
15+
16+
- **go_project/**: Go project with `go.mod` and simple main package
17+
- **rust_project/**: Rust project with `Cargo.toml` and src directory
18+
- **typescript_project/**: TypeScript project with `package.json`, `tsconfig.json`, and TypeScript file
19+
- **javascript_project/**: JavaScript project with `package.json` and ES module
20+
- **deno_project/**: Deno project with `deno.json` configuration
21+
22+
## Requirements
23+
24+
For the tests to work, the following language servers must be installed:
25+
- `basedpyright` (Python)
26+
- `gopls` (Go)
27+
- `rust-analyzer` (Rust)
28+
- `typescript-language-server` (TypeScript/JavaScript)
29+
- `deno` (Deno)
30+
31+
However, the tests will skip or fail gracefully if the required language server is not installed or cannot be started for a project.
32+
33+
## Maintenance
34+
35+
These fixtures should remain minimal and focused. They exist only to verify basic LSP server integration, not to test language-specific features.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"tasks": {
3+
"run": "deno run main.ts"
4+
}
5+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* A simple greeter class
3+
*/
4+
export class Greeter {
5+
private name: string;
6+
7+
/**
8+
* Creates a new Greeter instance
9+
* @param name The name to greet
10+
*/
11+
constructor(name: string) {
12+
this.name = name;
13+
}
14+
15+
/**
16+
* Returns a greeting message
17+
* @returns The greeting message
18+
*/
19+
greet(): string {
20+
return `Hello, ${this.name}!`;
21+
}
22+
}
23+
24+
const greeter = new Greeter("World");
25+
console.log(greeter.greet());

tests/fixtures/go_project/go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module example.com/hello
2+
3+
go 1.21

tests/fixtures/go_project/main.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package main
2+
3+
import "fmt"
4+
5+
// Greeter provides greeting functionality
6+
type Greeter struct {
7+
name string
8+
}
9+
10+
// NewGreeter creates a new Greeter instance
11+
func NewGreeter(name string) *Greeter {
12+
return &Greeter{name: name}
13+
}
14+
15+
// Greet returns a greeting message
16+
func (g *Greeter) Greet() string {
17+
return fmt.Sprintf("Hello, %s!", g.name)
18+
}
19+
20+
func main() {
21+
greeter := NewGreeter("World")
22+
fmt.Println(greeter.Greet())
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* A simple greeter class
3+
*/
4+
export class Greeter {
5+
/**
6+
* Creates a new Greeter instance
7+
* @param {string} name - The name to greet
8+
*/
9+
constructor(name) {
10+
this.name = name;
11+
}
12+
13+
/**
14+
* Returns a greeting message
15+
* @returns {string} The greeting message
16+
*/
17+
greet() {
18+
return `Hello, ${this.name}!`;
19+
}
20+
}
21+
22+
const greeter = new Greeter("World");
23+
console.log(greeter.greet());
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "hello-javascript",
3+
"version": "1.0.0",
4+
"description": "Test JavaScript project",
5+
"main": "index.js",
6+
"type": "module"
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "hello"
3+
version = "0.1.0"
4+
edition = "2021"
5+
6+
[dependencies]

0 commit comments

Comments
 (0)