Skip to content

Instantly share code, notes, and snippets.

@arvid220u
Created June 6, 2024 06:40
Show Gist options
  • Save arvid220u/b976c87c7ec9f6f66595dc0ebc0f07d6 to your computer and use it in GitHub Desktop.
Save arvid220u/b976c87c7ec9f6f66595dc0ebc0f07d6 to your computer and use it in GitHub Desktop.
Shadow workspace proto file (see https://cursor.com/blog/shadow-workspace for more details)
syntax = "proto3";
package aiserver.v1;
option go_package = "github.com/anysphere/everysphere/schema/aiserver/v1";
service ShadowWorkspaceService {
rpc GetLintsForChange(GetLintsForChangeRequest) returns (GetLintsForChangeResponse) {}
rpc ShadowHealthCheck(ShadowHealthCheckRequest) returns (ShadowHealthCheckResponse) {}
}
message ShadowHealthCheckRequest {}
message ShadowHealthCheckResponse {}
// only lints in the supplied files are returned
//
// note that this only returns lints that were changed! unless `get_all_lints_not_just_delta_lints_for_range_in_final_model` is set
message GetLintsForChangeRequest {
repeated File files = 1;
message File {
string relative_workspace_path = 1;
// the "change" we are getting lints for is the implicit delta between `initial_content` and `final_content`
string initial_content = 2;
string final_content = 3;
// for any lints in the final model that are inside one of these ranges, we return it regardless of whether it existed in the initial model too
optional RangeCollection get_all_lints_not_just_delta_lints_for_ranges_in_final_model = 4;
message RangeCollection {
repeated IRange ranges = 1;
}
// simply corresponds to vscode's irange
message IRange {
// 1-indexed
int32 start_line_number = 1;
// 1-indexed
int32 start_column = 2;
// 1-indexed
// inclusive
int32 end_line_number = 3;
// 1-indexed
int32 end_column = 4;
}
}
// quick fixes will be returned for each lint. potentially a little bit slower
bool include_quick_fixes = 2;
// if a new file is not created, some tools will report inaccurate or incomplete lints (e.g., the typescript language server won't properly detect which tsconfig is the right one)
// the temporarily created file will have a .shadowworkspace-uuid.ts extension, to reduce the chance of conflicts
// the hope is that it won't affect the user, but it may, so therefore this is off by default for now
// once we have a proper proxy folder structure, then this should hopefully be obsolete
// WARNING: this can cause problems for the user!!! (our yarn watch breaks when new files are added and deleted, for example)
// do not run this for real users! before we have the proxy folder set up
bool do_not_use_in_prod_new_files_should_be_temporarily_created_for_increased_accuracy = 3;
}
message GetLintsForChangeResponse {
repeated Lint lints = 1;
message Lint {
string message = 1;
string severity = 2;
string relative_workspace_path = 3;
// the position refers to the position in the `final_content` model
int32 start_line_number_one_indexed = 4;
int32 start_column_one_indexed = 5;
int32 end_line_number_inclusive_one_indexed = 6;
int32 end_column_one_indexed = 7;
message QuickFix {
message Edit {
string relative_workspace_path = 1;
string text = 2;
int32 start_line_number_one_indexed = 3;
int32 start_column_one_indexed = 4;
int32 end_line_number_inclusive_one_indexed = 5;
int32 end_column_one_indexed = 6;
}
string message = 1;
string kind = 2;
bool is_preferred = 3;
// TODO: this edit can also be a file edit in vscode! currently, we ignore those, and only include text edits
repeated Edit edits = 4;
}
// only included if `include_quick_fixes` is true
repeated QuickFix quick_fixes = 9;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment