mirror of
https://github.com/joshuadavidthomas/django-language-server.git
synced 2025-09-27 20:42:14 +00:00
Get rid of all transport types and settle on Protobuf (#25)
* Get rid of all transport types and settle on Protobuf hope i don't regret this * Update Cargo.toml * Update agent.py
This commit is contained in:
parent
643a47953e
commit
0a6e975ca5
38 changed files with 1484 additions and 685 deletions
|
@ -1,29 +0,0 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package djls;
|
||||
|
||||
// Commands we send to Python
|
||||
message ToAgent {
|
||||
oneof command {
|
||||
HealthCheck health_check = 1;
|
||||
Shutdown shutdown = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message HealthCheck {}
|
||||
message Shutdown {}
|
||||
|
||||
// Responses we get back
|
||||
message FromAgent {
|
||||
oneof message {
|
||||
HealthCheckResponse health_check = 1;
|
||||
Error error = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message HealthCheckResponse {}
|
||||
|
||||
message Error {
|
||||
string message = 1;
|
||||
string traceback = 2; // Optional stack trace from Python
|
||||
}
|
23
proto/v1/check.proto
Normal file
23
proto/v1/check.proto
Normal file
|
@ -0,0 +1,23 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package djls.v1.check;
|
||||
|
||||
message HealthRequest {}
|
||||
message HealthResponse {
|
||||
bool passed = 1;
|
||||
optional string error = 2;
|
||||
}
|
||||
|
||||
message DjangoAvailableRequest {}
|
||||
message DjangoAvailableResponse {
|
||||
bool passed = 1;
|
||||
optional string error = 2;
|
||||
}
|
||||
|
||||
message AppInstalledRequest {
|
||||
string app_name = 1;
|
||||
}
|
||||
message AppInstalledResponse {
|
||||
bool passed = 1;
|
||||
optional string error = 2;
|
||||
}
|
15
proto/v1/django.proto
Normal file
15
proto/v1/django.proto
Normal file
|
@ -0,0 +1,15 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package djls.v1.django;
|
||||
|
||||
// models
|
||||
message Project {
|
||||
string version = 3;
|
||||
}
|
||||
|
||||
// commands
|
||||
message GetProjectInfoRequest {}
|
||||
|
||||
message GetProjectInfoResponse {
|
||||
Project project = 1;
|
||||
}
|
40
proto/v1/messages.proto
Normal file
40
proto/v1/messages.proto
Normal file
|
@ -0,0 +1,40 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package djls.v1.messages;
|
||||
|
||||
import "v1/check.proto";
|
||||
import "v1/django.proto";
|
||||
import "v1/python.proto";
|
||||
|
||||
message Request {
|
||||
oneof command {
|
||||
check.HealthRequest check__health = 1;
|
||||
check.DjangoAvailableRequest check__django_available = 2;
|
||||
check.AppInstalledRequest check__app_installed = 3;
|
||||
python.GetEnvironmentRequest python__get_environment = 1000;
|
||||
django.GetProjectInfoRequest django__get_project_info = 2000;
|
||||
}
|
||||
}
|
||||
|
||||
message Response {
|
||||
oneof result {
|
||||
check.HealthResponse check__health = 1;
|
||||
check.DjangoAvailableResponse check__django_available = 2;
|
||||
check.AppInstalledResponse check__app_installed = 3;
|
||||
python.GetEnvironmentResponse python__get_environment = 1000;
|
||||
django.GetProjectInfoResponse django__get_project_info = 2000;
|
||||
Error error = 9000;
|
||||
}
|
||||
}
|
||||
|
||||
message Error {
|
||||
Code code = 1;
|
||||
string message = 2;
|
||||
string traceback = 3;
|
||||
enum Code {
|
||||
UNKNOWN = 0;
|
||||
INVALID_REQUEST = 1;
|
||||
PYTHON_ERROR = 2;
|
||||
DJANGO_ERROR = 3;
|
||||
}
|
||||
}
|
80
proto/v1/python.proto
Normal file
80
proto/v1/python.proto
Normal file
|
@ -0,0 +1,80 @@
|
|||
syntax = "proto3";
|
||||
|
||||
package djls.v1.python;
|
||||
|
||||
// models
|
||||
message Python {
|
||||
Os os = 1;
|
||||
Site site = 2;
|
||||
Sys sys = 3;
|
||||
Sysconfig sysconfig = 4;
|
||||
}
|
||||
|
||||
message Os {
|
||||
map<string, string> environ = 1;
|
||||
}
|
||||
|
||||
message Site {
|
||||
map<string, Package> packages = 1;
|
||||
}
|
||||
|
||||
message Sys {
|
||||
bool debug_build = 1;
|
||||
bool dev_mode = 2;
|
||||
bool is_venv = 3;
|
||||
string abiflags = 4;
|
||||
string base_prefix = 5;
|
||||
string default_encoding = 6;
|
||||
string executable = 7;
|
||||
string filesystem_encoding = 8;
|
||||
string implementation_name = 9;
|
||||
string platform = 10;
|
||||
string prefix = 11;
|
||||
repeated string builtin_module_names = 12;
|
||||
repeated string dll_paths = 13;
|
||||
repeated string path = 14;
|
||||
VersionInfo version_info = 15;
|
||||
}
|
||||
|
||||
message VersionInfo {
|
||||
uint32 major = 1;
|
||||
uint32 minor = 2;
|
||||
uint32 micro = 3;
|
||||
ReleaseLevel releaselevel = 4;
|
||||
uint32 serial = 5;
|
||||
}
|
||||
|
||||
enum ReleaseLevel {
|
||||
ALPHA = 0;
|
||||
BETA = 1;
|
||||
CANDIDATE = 2;
|
||||
FINAL = 3;
|
||||
}
|
||||
|
||||
message Sysconfig {
|
||||
string data = 1;
|
||||
string include = 2;
|
||||
string platinclude = 3;
|
||||
string platlib = 4;
|
||||
string platstdlib = 5;
|
||||
string purelib = 6;
|
||||
string scripts = 7;
|
||||
string stdlib = 8;
|
||||
}
|
||||
|
||||
message Package {
|
||||
string dist_name = 1;
|
||||
string dist_version = 2;
|
||||
optional bool dist_editable = 3;
|
||||
optional string dist_entry_points = 4;
|
||||
optional string dist_location = 5;
|
||||
repeated string dist_requires = 6;
|
||||
optional string dist_requires_python = 7;
|
||||
}
|
||||
|
||||
// commands
|
||||
message GetEnvironmentRequest {}
|
||||
|
||||
message GetEnvironmentResponse {
|
||||
Python python = 1;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue