Skip to content

Commit

Permalink
Explicitly specify that FilePath is not just absolute, but also a nor…
Browse files Browse the repository at this point in the history
…malized path.

It was implied, and every client I know of uses absolute and normalized paths.

[email protected]
BUG=

Review URL: https://codereview.chromium.org/1506323002 .
  • Loading branch information
scheglov committed Dec 9, 2015
1 parent 581392c commit 1f5973e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 4 deletions.
13 changes: 12 additions & 1 deletion pkg/analysis_server/doc/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -2908,7 +2908,12 @@ <h2 class="domain"><a name="types">Types</a></h2>
<dl><dt class="value">LIBRARY</dt><dt class="value">PART</dt></dl></dd><dt class="typeDefinition"><a name="type_FilePath">FilePath: String</a></dt><dd>

<p>
The absolute path of a file.
The absolute, normalized path of a file.
</p>
<p>
If the format of a file path in a request is not valid, e.g. the
path is not absolute or is not normalized, then an error of type
<tt>INVALID_FILE_PATH_FORMAT</tt> will be generated.
</p>
</dd><dt class="typeDefinition"><a name="type_FoldingKind">FoldingKind: String</a></dt><dd>
<p>
Expand Down Expand Up @@ -3686,6 +3691,12 @@ <h2 class="domain"><a name="types">Types</a></h2>
The context root used to create an execution context does not
exist.
</p>
</dd><dt class="value">INVALID_FILE_PATH_FORMAT</dt><dd>

<p>
The format of the given file path is invalid, e.g. is not
absolute and normalized.
</p>
</dd><dt class="value">INVALID_OVERLAY_CHANGE</dt><dd>

<p>
Expand Down
11 changes: 10 additions & 1 deletion pkg/analysis_server/lib/plugin/protocol/generated_protocol.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14065,6 +14065,7 @@ class RequestError implements HasToJson {
* GET_REACHABLE_SOURCES_INVALID_FILE
* INVALID_ANALYSIS_ROOT
* INVALID_EXECUTION_CONTEXT
* INVALID_FILE_PATH_FORMAT
* INVALID_OVERLAY_CHANGE
* INVALID_PARAMETER
* INVALID_REQUEST
Expand Down Expand Up @@ -14137,6 +14138,12 @@ class RequestErrorCode implements Enum {
*/
static const INVALID_EXECUTION_CONTEXT = const RequestErrorCode._("INVALID_EXECUTION_CONTEXT");

/**
* The format of the given file path is invalid, e.g. is not absolute and
* normalized.
*/
static const INVALID_FILE_PATH_FORMAT = const RequestErrorCode._("INVALID_FILE_PATH_FORMAT");

/**
* An "analysis.updateContent" request contained a ChangeContentOverlay
* object which can't be applied, due to an edit having an offset or length
Expand Down Expand Up @@ -14232,7 +14239,7 @@ class RequestErrorCode implements Enum {
/**
* A list containing all of the enum values that are defined.
*/
static const List<RequestErrorCode> VALUES = const <RequestErrorCode>[CONTENT_MODIFIED, FILE_NOT_ANALYZED, FORMAT_INVALID_FILE, FORMAT_WITH_ERRORS, GET_ERRORS_INVALID_FILE, GET_NAVIGATION_INVALID_FILE, GET_REACHABLE_SOURCES_INVALID_FILE, INVALID_ANALYSIS_ROOT, INVALID_EXECUTION_CONTEXT, INVALID_OVERLAY_CHANGE, INVALID_PARAMETER, INVALID_REQUEST, NO_INDEX_GENERATED, ORGANIZE_DIRECTIVES_ERROR, REFACTORING_REQUEST_CANCELLED, SERVER_ALREADY_STARTED, SERVER_ERROR, SORT_MEMBERS_INVALID_FILE, SORT_MEMBERS_PARSE_ERRORS, UNANALYZED_PRIORITY_FILES, UNKNOWN_REQUEST, UNKNOWN_SOURCE, UNSUPPORTED_FEATURE];
static const List<RequestErrorCode> VALUES = const <RequestErrorCode>[CONTENT_MODIFIED, FILE_NOT_ANALYZED, FORMAT_INVALID_FILE, FORMAT_WITH_ERRORS, GET_ERRORS_INVALID_FILE, GET_NAVIGATION_INVALID_FILE, GET_REACHABLE_SOURCES_INVALID_FILE, INVALID_ANALYSIS_ROOT, INVALID_EXECUTION_CONTEXT, INVALID_FILE_PATH_FORMAT, INVALID_OVERLAY_CHANGE, INVALID_PARAMETER, INVALID_REQUEST, NO_INDEX_GENERATED, ORGANIZE_DIRECTIVES_ERROR, REFACTORING_REQUEST_CANCELLED, SERVER_ALREADY_STARTED, SERVER_ERROR, SORT_MEMBERS_INVALID_FILE, SORT_MEMBERS_PARSE_ERRORS, UNANALYZED_PRIORITY_FILES, UNKNOWN_REQUEST, UNKNOWN_SOURCE, UNSUPPORTED_FEATURE];

final String name;

Expand All @@ -14258,6 +14265,8 @@ class RequestErrorCode implements Enum {
return INVALID_ANALYSIS_ROOT;
case "INVALID_EXECUTION_CONTEXT":
return INVALID_EXECUTION_CONTEXT;
case "INVALID_FILE_PATH_FORMAT":
return INVALID_FILE_PATH_FORMAT;
case "INVALID_OVERLAY_CHANGE":
return INVALID_OVERLAY_CHANGE;
case "INVALID_PARAMETER":
Expand Down
2 changes: 1 addition & 1 deletion pkg/analysis_server/lib/src/analysis_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class AnalysisServer {
* The version of the analysis server. The value should be replaced
* automatically during the build.
*/
static final String VERSION = '1.12.0';
static final String VERSION = '1.14.0';

/**
* The number of milliseconds to perform operations before inserting
Expand Down
2 changes: 2 additions & 0 deletions pkg/analysis_server/test/integration/protocol_matchers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2102,6 +2102,7 @@ final Matcher isRequestError = new LazyMatcher(() => new MatchesJsonObject(
* GET_REACHABLE_SOURCES_INVALID_FILE
* INVALID_ANALYSIS_ROOT
* INVALID_EXECUTION_CONTEXT
* INVALID_FILE_PATH_FORMAT
* INVALID_OVERLAY_CHANGE
* INVALID_PARAMETER
* INVALID_REQUEST
Expand All @@ -2128,6 +2129,7 @@ final Matcher isRequestErrorCode = new MatchesEnum("RequestErrorCode", [
"GET_REACHABLE_SOURCES_INVALID_FILE",
"INVALID_ANALYSIS_ROOT",
"INVALID_EXECUTION_CONTEXT",
"INVALID_FILE_PATH_FORMAT",
"INVALID_OVERLAY_CHANGE",
"INVALID_PARAMETER",
"INVALID_REQUEST",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ public class RequestErrorCode {
*/
public static final String INVALID_EXECUTION_CONTEXT = "INVALID_EXECUTION_CONTEXT";

/**
* The format of the given file path is invalid, e.g. is not absolute and normalized.
*/
public static final String INVALID_FILE_PATH_FORMAT = "INVALID_FILE_PATH_FORMAT";

/**
* An "analysis.updateContent" request contained a ChangeContentOverlay object which can't be
* applied, due to an edit having an offset or length that is out of range.
Expand Down
14 changes: 13 additions & 1 deletion pkg/analysis_server/tool/spec/spec_input.html
Original file line number Diff line number Diff line change
Expand Up @@ -2683,7 +2683,12 @@ <h2 class="domain"><a name="types">Types</a></h2>
<type name="FilePath">
<ref>String</ref>
<p>
The absolute path of a file.
The absolute, normalized path of a file.
</p>
<p>
If the format of a file path in a request is not valid, e.g. the
path is not absolute or is not normalized, then an error of type
<tt>INVALID_FILE_PATH_FORMAT</tt> will be generated.
</p>
</type>
<type name="FoldingKind">
Expand Down Expand Up @@ -3696,6 +3701,13 @@ <h2 class="domain"><a name="types">Types</a></h2>
exist.
</p>
</value>
<value>
<code>INVALID_FILE_PATH_FORMAT</code>
<p>
The format of the given file path is invalid, e.g. is not
absolute and normalized.
</p>
</value>
<value>
<code>INVALID_OVERLAY_CHANGE</code>
<p>
Expand Down

0 comments on commit 1f5973e

Please sign in to comment.