| // Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file |
| // for details. All rights reserved. Use of this source code is governed by a |
| // BSD-style license that can be found in the LICENSE file. |
| |
| syntax = "proto3"; |
| |
| package dart_services.api; |
| |
| message CompileRequest { |
| // The Dart source. |
| string source = 1; |
| |
| // Return the Dart to JS source map; optional (defaults to false). |
| bool returnSourceMap = 2; |
| } |
| |
| /// Compile request for a multiple file set. |
| message CompileFilesRequest { |
| // The Dart source files set. map of { filename1:sourcecode1 .. filenameN:sourcecodeN } |
| map<string, string> files = 1; |
| |
| // Return the Dart to JS source map; optional (defaults to false). |
| bool returnSourceMap = 2; |
| } |
| |
| message CompileDDCRequest { |
| // The Dart source. |
| string source = 1; |
| } |
| |
| /// DDC Compile request for a multiple file set. |
| message CompileFilesDDCRequest { |
| // The Dart source files set. map of { filename1:sourcecode1 .. filenameN:sourcecodeN } |
| map<string, string> files = 1; |
| } |
| |
| message SourceRequest { |
| // The Dart source. |
| string source = 1; |
| |
| // The offset within source to operate at. |
| int32 offset = 2; |
| } |
| |
| /// Multiple file set of dart source for analysis, completion, fixes, etc. |
| message SourceFilesRequest { |
| // The Dart source files set. map of { filename1:sourcecode1 .. filenameN:sourcecodeN } |
| map<string, string> files = 1; |
| |
| // active (within editor) source filename key within files map |
| string activeSourceName = 2; |
| |
| // The offset within active source file to operate at. |
| int32 offset = 3; |
| } |
| |
| message AnalysisResults { |
| repeated AnalysisIssue issues = 1; |
| |
| // The package imports parsed from the source. |
| repeated string packageImports = 2; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| message AnalysisIssue { |
| string kind = 1; |
| int32 line = 2; |
| string message = 3; |
| string sourceName = 4; |
| bool hasFixes = 5; |
| int32 charStart = 6; |
| int32 charLength = 7; |
| string url = 8; |
| repeated DiagnosticMessage diagnosticMessages = 9; |
| string correction = 10; |
| int32 column = 11; |
| string code = 12; |
| } |
| |
| message DiagnosticMessage { |
| string message = 1; |
| int32 line = 2; |
| int32 charStart = 3; |
| int32 charLength = 4; |
| } |
| |
| message VersionRequest {} |
| |
| message CompileResponse { |
| string result = 1; |
| string sourceMap = 2; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| message CompileDDCResponse { |
| string result = 1; |
| string modulesBaseUrl = 2; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| message DocumentResponse { |
| map<string, string> info = 1; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| message CompleteResponse { |
| // The offset of the start of the text to be replaced. |
| int32 replacementOffset = 1; |
| |
| // The length of the text to be replaced. |
| int32 replacementLength = 2; |
| |
| repeated Completion completions = 3; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| message Completion { map<string, string> completion = 1; } |
| |
| message FixesResponse { |
| repeated ProblemAndFixes fixes = 1; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| // Represents a problem detected during analysis, and a set of possible ways of |
| // resolving the problem. |
| message ProblemAndFixes { |
| repeated CandidateFix fixes = 1; |
| string problemMessage = 2; |
| int32 offset = 3; |
| int32 length = 4; |
| } |
| |
| // Represents a possible way of solving an Analysis Problem. |
| message CandidateFix { |
| string message = 1; |
| repeated SourceEdit edits = 2; |
| int32 selectionOffset = 3; |
| repeated LinkedEditGroup linkedEditGroups = 4; |
| } |
| |
| // Represents a single edit-point change to a source file. |
| message SourceEdit { |
| int32 offset = 1; |
| int32 length = 2; |
| string replacement = 3; |
| } |
| |
| message LinkedEditGroup { |
| // The positions of the regions that should be edited simultaneously. |
| repeated int32 positions = 1; |
| |
| // The length of the regions that should be edited simultaneously. |
| int32 length = 2; |
| |
| // Pre-computed suggestions for what every region might want to be changed to. |
| repeated LinkedEditSuggestion suggestions = 3; |
| } |
| |
| message LinkedEditSuggestion { |
| // The value that could be used to replace all of the linked edit regions. |
| string value = 1; |
| |
| // The kind of value being proposed. |
| string kind = 2; |
| } |
| |
| // Represents a reformatting of the code. |
| message FormatResponse { |
| // The formatted source code. |
| string newString = 1; |
| |
| // The (optional) new offset of the cursor; can be `null`. |
| int32 offset = 2; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| // The response from the `/assists` service call. |
| message AssistsResponse { |
| repeated CandidateFix assists = 1; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| // The response from the `/version` service call. |
| message VersionResponse { |
| // The Dart SDK version that DartServices is compatible with. |
| string sdkVersion = 1; |
| |
| // The full Dart SDK version that DartServices is compatible with. |
| string sdkVersionFull = 2; |
| |
| // The Dart SDK version that the server is running on. This will start with a |
| // semver string, and have a space and other build details appended. |
| string runtimeVersion = 3; |
| |
| // Removed. |
| string appEngineVersion = 4 [deprecated = true]; |
| |
| // Removed. |
| string servicesVersion = 5 [deprecated = true]; |
| |
| // The Flutter SDK's version. |
| string flutterVersion = 6; |
| |
| // The Flutter SDK's Dart version. |
| string flutterDartVersion = 7; |
| |
| // The Flutter SDK's full Dart version. |
| string flutterDartVersionFull = 8; |
| |
| // Package version numbers. |
| // |
| // Each package found in pubspec.lock is included, mapping the package name |
| // to the package version. |
| // |
| // Deprecated: Use `packageInfo` data if available. |
| map<string, string> packageVersions = 9; |
| |
| // Package information. |
| // |
| // Each package found in `pubspec.lock` is included. |
| repeated PackageInfo packageInfo = 10; |
| |
| // Experiments that this server is running |
| repeated string experiment = 11; |
| |
| // The Flutter engine SHA, located in bin/internal/engine.version. |
| string flutterEngineSha = 12; |
| |
| // Make this response compatible with BadRequest |
| ErrorMessage error = 99; |
| } |
| |
| message PackageInfo { |
| // The name of this package. |
| string name = 1; |
| |
| // The selected version of this package. |
| string version = 2; |
| |
| // Whether this package is supported as a directly importable package, |
| // or simply available as a transitive dependency of a supported package. |
| bool supported = 3; |
| } |
| |
| // Response from the server when errors are thrown internally |
| message BadRequest { ErrorMessage error = 99; } |
| |
| // Individual error messages. |
| message ErrorMessage { string message = 1; } |