# Analysis Server API Specification

# Version 1.40.1

This document contains a specification of the API provided by the analysis server. The API in this document is currently under development. Changes to the API will be accompanied by an update to the protocol version number according to the principles of semantic versioning (semver.org).

## Overview

The analysis server API is a bi-directional client-server API. The API is independent of the transport mechanism used, but is heavily influenced by a model in which sockets or character streams are used to transport JSON-RPC encoded information.

### Transport Mechanism

The characters passed to the server are expected to be encoded using UTF-8.

When character streams are used as the transport, messages are delineated by newlines. This means, in particular, that the JSON encoding process must not introduce newlines within a message. Note however that newlines are used in this document for readability.

It is the client's responsibility to read output from the server to avoid its blocking.

To ease interoperability with Lisp-based clients (which may not be able to easily distinguish between empty lists, empty maps, and null), client-to-server communication is allowed to replace any instance of "`{}`" or "`[]`" with null. The server will always properly represent empty lists as "`[]`" and empty maps as "`{}`".

### Communication Structure

Clients can make a request of the server and the server will provide a response for each request that it receives. While many of the requests that can be made by a client are informational in nature, we have chosen to always return a response so that clients can know whether the request was received and was correct.

There is no guarantee concerning the order in which responses will be returned, but there is a guarantee that the server will process requests in the order in which they are sent as long as the transport mechanism also makes this guarantee. Responses can be returned in an order that is different from the order in which the requests were received because some requests take longer to process than others.

Every request is required to have two fields and may have two additional optional fields. The first required field is the 'id' field, which is only used by the server to associate a response with the request that generated the response. The second required field is the 'method' field, which is used to determine what the server is being requested to do. One optional field is the 'params' field, whose structure is dependent on the method being requested. The structure of this field is described with each request for which it is required. The other optional field is the 'clientRequestTime' field, which is a number indicating the time at which the client made the request (milliseconds since epoch). Providing clientRequestTime helps us track how responsive the analysis server is to client requests and better address any issues that occur.

Every response has up to three fields. The first field is the 'id' field, which is always present and whose value is the identifier that was passed to the request that generated the response. The second field is the 'error' field, which is only present if an error was encountered while processing the request. The third field is the 'result' field, whose structure is dependent on the method being responded to, and is described with each request that will produce it.

The server can communicate to the clients by sending a notification. The purpose of these notifications is to provide information to clients as it becomes available rather than to require that clients poll for it. Unless explicitly stated, all notifications are designed to return the complete information available at the time the notification is sent; clients are not required to update previously communicated results. Consequently, the server can and should return partial results before all results are available. For example, the syntactic errors for a file can be returned as soon as the syntactic analysis is complete, and both syntactic and semantic errors can be returned together at a later time.

Each notification has two fields. The first field is the 'event' field, which identifies the kind of notification. The second field is the 'params' field, whose structure is dependent on the kind of notification being sent. The structure of this field is described with each notification.

The server can also communicate to the clients by sending a request. As with requests sent from the client, requests from the server have both an 'id' and a 'method' field, and an optional 'params' field. The ids used by the server are independent of the ids used by the client. In other words, the ids sent by the server might be equal to ids already sent from the client, but are unrelated to the client request with that same id.

In order to be backward compatible, clients should ignore fields that were not specified in the version of the API on which they were based. Clients should also use the server.getVersion request to test that the version of the server supports an API before using it.

### Eventual Consistency

The analysis server satisfies requests under the principle of eventual consistency. That is, in some cases it may return responses with the currently available results while it's catching up with unprocessed changes.

### Enumerations

Responses from the server may include enumerations indicating the kind of a specific item. The enums may be extended with new values in future versions of the server so clients should ensure unknown values are handled gracefully, either ignoring the item or treating it with some default/fallback handling.

### Changelog

#### 1.40.1

- Added an optional `extendedType` field to `Element` to store the name of the type that extensions apply to that can be used to improve the display names for unnamed extensions.

#### 1.40.0

- Added an optional `version` field to `AddContentOverlay` and `ChangeContentOverlay` to allow clients/servers to have a way to identify specific versions of documents.

#### 1.39.0

- Added a new `lspCapabilities` field to the `setClientCapabilities` parameters to allow clients to provide their LSP capabilities. These capabilities can indicate that a client can support `lsp.handle` requests in the server-to-client direction.

#### 1.38.0

- Deprecated the `analytics.enable` request.
- Deprecated the `analytics.isEnabled` request.

#### 1.37.0

- `SourceEdit` now has an optional human-readable `description` that may contain a description of a change.

#### 1.36.0

- Added a new `supportsUris` client capability to indicate that `FilePath`s should be URIs instead of file paths.
- Added an experimental "lsp.handle" request to allow sending LSP requests through the protocol.
- Added an experimental "lsp.notification" notification to allow receiving LSP notifications.

#### 1.35.0

- Removed the requests `completion.getSuggestions`, `completion.setSubscriptions`, and `completion.getSuggestionDetails`. These requests are no longer supported and the server will return an error if they are invoked. The associated object structures and notifications have also been removed.

#### 1.34.0

- Added the ability for the server to send requests to the client when the client uses `setClientCapabilities` to enable the requests. Also added the `openUrlRequest` and `showMessageRequest` requests.

#### 1.33.1

- `SourceChange` now has an optional `selectionLength` that may be provided when `selection` is.

#### 1.33.0

- Requests `getSuggestions2` and `getSuggestionDetails2` are enabled.

#### 1.32.10

- The `MOVE_FILE` refactor now supports moving/renaming folders.

#### 1.32.8

- Added `server.cancelRequest` to allow clients to request cancellation of outstanding requests.

#### 1.32.7

- `HoverInformation.elementDescription` may now include linebreaks to improve formatting of functions and methods with many parameters. This is not an API change but may be useful as a signal for clients that previously did their own formatting.

#### 1.32.6

- Added `FoldingKind.PARAMETERS` for folding regions for parameters that span multiple lines.

#### 1.32.5

- Added optional `replacementOffset` and `replacementLength` on `CompletionSuggestion` to support different per-completion text replacement ranges (for example when inserting names for arguments, a different range may be supplied than for completions that are not name labels).

#### 1.32.4

- Added `ElementKind.TYPE_ALIAS` and `HighlightRegionType.TYPE_ALIAS` for non-function type aliases.

#### 1.32.3

- Removed the experimental `completion.listTokenDetails` request and the associated data types.

#### 1.32.2

- Added `FoldingKind.COMMENT` for folding regions for blocks of comments.

#### 1.32.1

- Added `CompletionSuggestionKind.PACKAGE_NAME` for Pub package name completions in `pubspec.yaml`.

### Domains

For convenience, the API is divided into domains. Each domain is specified in a separate section below. The specifications of the API's refer to data structures beyond the standard JSON primitives. These data structures are documented in the section titled Types.

Server

- server.getVersion
- server.shutdown
- server.setSubscriptions
- server.cancelRequest
- server.setClientCapabilities
- server.openUrlRequest
- server.showMessageRequest

Analysis

- analysis.getErrors
- analysis.getHover
- analysis.getLibraryDependencies
- analysis.getNavigation
- analysis.getReachableSources
- analysis.reanalyze
- analysis.setAnalysisRoots
- analysis.setGeneralSubscriptions
- analysis.setPriorityFiles
- analysis.setSubscriptions
- analysis.updateContent
- analysis.updateOptions

Completion

- completion.getSuggestions2
- completion.registerLibraryPaths
- completion.getSuggestionDetails2

Search

- search.findElementReferences
- search.findMemberDeclarations
- search.findMemberReferences
- search.findTopLevelDeclarations
- search.getTypeHierarchy

Edit

- edit.format
- edit.getAssists
- edit.getAvailableRefactorings
- edit.getFixes
- edit.getPostfixCompletion
- edit.getRefactoring
- edit.sortMembers
- edit.organizeDirectives

Execution

- execution.createContext
- execution.deleteContext
- execution.getSuggestions
- execution.mapUri
- execution.setSubscriptions

Diagnostic

- diagnostic.getDiagnostics
- diagnostic.getServerPort

Flutter

- flutter.setSubscriptions

### Command-line Arguments

The command-line arguments that can be passed to the server.

#### Options

> --client-id

>   Specifies an identifier associated with the client. Used when generating error reports.

>   Clients are strongly encouraged to provide this information in order to improve the quality of information that can be provided to them.

> --client-version

>   Specifies the version of the client that is communicating with the server. Used when generating error reports.

>   Clients are strongly encouraged to provide this information in order to improve the quality of information that can be provided to them.

> --no-error-notification

>   Deprecated: clients should no longer pass this option in

>   Disable notifications about errors (see analysis.error). If this flag is not specified then notifications will be sent for all errors produced for all files in the actual analysis roots.
> --no-index

>   Deprecated: clients should no longer pass this option in

>   This flag used to disable the server from generating an index, but now it has no effect.
> --file-read-mode

>   Deprecated: clients should no longer pass this option in

>   An enumeration of the ways files can be read from disk. Some clients normalize end of line characters which would make the file offset and range information incorrect. The default option is `as-is`, but can also be set to `normalize-eol-always`. The default option (`as-is`) reads files as they are on disk. The `normalize-eol-always` option does the following:
>   - '\r\n' is converted to '\n';
>   - '\r' by itself is converted to '\n';
>   - this happens regardless of the OS editor is running on.

# Domains

## server domain

The server domain contains API's related to the execution of the server.

### Requests

server.getVersion

      request: {
        "id": String
        "method": "server.getVersion"
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "version": String
        }
      }

  Return the version number of the analysis server.

  #### returns:

  version: String

    The version number of the analysis server.

server.shutdown

      request: {
        "id": String
        "method": "server.shutdown"
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Cleanly shutdown the analysis server. Requests that are received after this request will not be processed. Requests that were received before this request, but for which a response has not yet been sent, will not be responded to. No further responses or notifications will be sent after the response to this request has been sent.

server.setSubscriptions

      request: {
        "id": String
        "method": "server.setSubscriptions"
        "params": {
          "subscriptions": List<ServerService>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Subscribe for services. All previous subscriptions are replaced by the given set of services.

  It is an error if any of the elements in the list are not valid services. If there is an error, then the current subscriptions will remain unchanged.

  #### parameters:

  subscriptions: List<ServerService>

    A list of the services being subscribed to.

server.cancelRequest

      request: {
        "id": String
        "method": "server.cancelRequest"
        "params": {
          "id": String
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Requests cancellation of a request sent by the client by id. This is provided on a best-effort basis and there is no guarantee the server will be able to cancel any specific request. The server will still always produce a response to the request even in the case of cancellation, but clients should discard any results of any cancelled request because they may be incomplete or inaccurate. This request always completes without error regardless of whether the request is successfully cancelled.

  #### parameters:

  id: String

    The id of the request that should be cancelled.

server.setClientCapabilities

      request: {
        "id": String
        "method": "server.setClientCapabilities"
        "params": {
          "requests": List<String>
          "supportsUris": optional bool
          "lspCapabilities": optional object
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Record the capabilities supported by the client. The default values, documented below, will be assumed until this request is received.

  #### parameters:

  requests: List<String>

    The names of the requests that the server can safely send to the client. Only requests whose name is in the list will be sent.

    A request should only be included in the list if the client will unconditionally honor the request.

    The default, used before this request is received, is an empty list.

    The following is a list of the names of the requests that can be specified:

    - `openUrlRequest`
    - `showMessageRequest`
  supportsUris: bool (optional)

    True if the client supports the server sending URIs in place of file paths.

    In this mode, the server will use URIs in all protocol fields with the type `FilePath`. Returned URIs may be `file://` URIs or custom schemes. The client can fetch the file contents for URIs with custom schemes (and receive modification events) through the LSP protocol (see the "lsp" domain).

    LSP notifications are automatically enabled when the client sets this capability.

  lspCapabilities: object (optional)

    LSP capabilities of the client as defined by the Language Server Protocol specification.

    If custom LSP capabilities are to be used, the setClientCapabilities request should be called before any LSP requests are made to the server.

    If LSP capabilities are not provided or no setClientCapabilities request is made, a very basic set of capabilities will be assumed.

server.openUrlRequest

      request: {
        "id": String
        "method": "server.openUrlRequest"
        "params": {
          "url": String
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Note: This is a request from the server to the client.

  Request that a URL be opened.

  The client is expected to open the URL, either within the client's UI or in the default browser.

  The request will only be sent from the server to the client if the client has indicated that it supports this request by using the `setClientCapabilities` request.

  #### parameters:

  url: String

    The URL to be opened.

server.showMessageRequest

      request: {
        "id": String
        "method": "server.showMessageRequest"
        "params": {
          "type": MessageType
          "message": String
          "actions": List<MessageAction>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "action": optional String
        }
      }

  Note: This is a request from the server to the client.

  Request that a message be displayed to the user.

  The client is expected to display the message to the user with one or more buttons with the specified labels, and to return a response consisting of the label of the button that was clicked.

  The request will only be sent from the server to the client if the client has indicated that it supports this request by using the `setClientCapabilities` request.

  This request is modeled after the same request from the LSP specification.

  #### parameters:

  type: MessageType

    The type of the message.

  message: String

    The message to be displayed.

  actions: List<MessageAction>

    The labels of the buttons by which the user can dismiss the message.

  #### returns:

  action: String (optional)

    The label of the action that was selected by the user. May be omitted or `null` if the user dismissed the message without clicking an action button.

### Notifications

server.connected

      notification: {
        "event": "server.connected"
        "params": {
          "version": String
          "pid": int
        }
      }

  Reports that the server is running. This notification is issued once after the server has started running but before any requests are processed to let the client know that it started correctly.

  It is not possible to subscribe to or unsubscribe from this notification.

  #### parameters:

  version: String

    The version number of the analysis server.

  pid: int

    The process id of the analysis server process.

server.error

      notification: {
        "event": "server.error"
        "params": {
          "isFatal": bool
          "message": String
          "stackTrace": String
        }
      }

  Reports that an unexpected error has occurred while executing the server. This notification is not used for problems with specific requests (which are returned as part of the response) but is used for exceptions that occur while performing other tasks, such as analysis or preparing notifications.

  It is not possible to subscribe to or unsubscribe from this notification.

  #### parameters:

  isFatal: bool

    True if the error is a fatal error, meaning that the server will shutdown automatically after sending this notification.

  message: String

    The error message indicating what kind of error was encountered.

  stackTrace: String

    The stack trace associated with the generation of the error, used for debugging the server.

server.pluginError

      notification: {
        "event": "server.pluginError"
        "params": {
          "message": String
        }
      }

  Reports that an unexpected error has occurred while setting up an analyzer plugin, or during a plugin's execution.

  It is not possible to subscribe to or unsubscribe from this notification.

  #### parameters:

  message: String

    The error message indicating what kind of error was encountered.

server.status

      notification: {
        "event": "server.status"
        "params": {
          "analysis": optional AnalysisStatus
          "pub": optional PubStatus
        }
      }

  Reports the current status of the server. Parameters are omitted if there has been no change in the status represented by that parameter.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"STATUS"` in the list of services passed in a server.setSubscriptions request.

  #### parameters:

  analysis: AnalysisStatus (optional)

    The current status of analysis, including whether analysis is being performed and if so what is being analyzed.

  pub: PubStatus (optional)

    The current status of pub execution, indicating whether we are currently running pub.

    Note: this status type is deprecated, and is no longer sent by the server.

## analysis domain

The analysis domain contains API's related to the analysis of files.

### Requests

analysis.getErrors

      request: {
        "id": String
        "method": "analysis.getErrors"
        "params": {
          "file": FilePath
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "errors": List<AnalysisError>
        }
      }

  Return the errors associated with the given file. If the errors for the given file have not yet been computed, or the most recently computed errors for the given file are out of date, then the response for this request will be delayed until they have been computed. If some or all of the errors for the file cannot be computed, then the subset of the errors that can be computed will be returned and the response will contain an error to indicate why the errors could not be computed. If the content of the file changes after this request was received but before a response could be sent, then an error of type `CONTENT_MODIFIED` will be generated.

  This request is intended to be used by clients that cannot asynchronously apply updated error information. Clients that can apply error information as it becomes available should use the information provided by the 'analysis.errors' notification.

  If a request is made for a file which does not exist, or which is not currently subject to analysis (e.g. because it is not associated with any analysis root specified to analysis.setAnalysisRoots), an error of type `GET_ERRORS_INVALID_FILE` will be generated.

  #### parameters:

  file: FilePath

    The file for which errors are being requested.

  #### returns:

  errors: List<AnalysisError>

    The errors associated with the file.

analysis.getHover

      request: {
        "id": String
        "method": "analysis.getHover"
        "params": {
          "file": FilePath
          "offset": int
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "hovers": List<HoverInformation>
        }
      }

  Return the hover information associated with the given location. If some or all of the hover information is not available at the time this request is processed the information will be omitted from the response.

  #### parameters:

  file: FilePath

    The file in which hover information is being requested.

  offset: int

    The offset for which hover information is being requested.

  #### returns:

  hovers: List<HoverInformation>

    The hover information associated with the location. The list will be empty if no information could be determined for the location. The list can contain multiple items if the file is being analyzed in multiple contexts in conflicting ways (such as a part that is included in multiple libraries).

analysis.getLibraryDependencies

      request: {
        "id": String
        "method": "analysis.getLibraryDependencies"
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "libraries": List<FilePath>
          "packageMap": Map<String, Map<String, List<FilePath>>>
        }
      }

  Return library dependency information for use in client-side indexing and package URI resolution.

  Clients that are only using the libraries field should consider using the analyzedFiles notification instead.

  #### returns:

  libraries: List<FilePath>

    A list of the paths of library elements referenced by files in existing analysis roots.

  packageMap: Map<String, Map<String, List<FilePath>>>

    A mapping from context source roots to package maps which map package names to source directories for use in client-side package URI resolution.

analysis.getNavigation

      request: {
        "id": String
        "method": "analysis.getNavigation"
        "params": {
          "file": FilePath
          "offset": int
          "length": int
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "files": List<FilePath>
          "targets": List<NavigationTarget>
          "regions": List<NavigationRegion>
        }
      }

  Return the navigation information associated with the given region of the given file. If the navigation information for the given file has not yet been computed, or the most recently computed navigation information for the given file is out of date, then the response for this request will be delayed until it has been computed. If the content of the file changes after this request was received but before a response could be sent, then an error of type `CONTENT_MODIFIED` will be generated.

  If a navigation region overlaps (but extends either before or after) the given region of the file it will be included in the result. This means that it is theoretically possible to get the same navigation region in response to multiple requests. Clients can avoid this by always choosing a region that starts at the beginning of a line and ends at the end of a (possibly different) line in the file.

  If a request is made for a file which does not exist, or which is not currently subject to analysis (e.g. because it is not associated with any analysis root specified to analysis.setAnalysisRoots), an error of type `GET_NAVIGATION_INVALID_FILE` will be generated.

  #### parameters:

  file: FilePath

    The file in which navigation information is being requested.

  offset: int

    The offset of the region for which navigation information is being requested.

  length: int

    The length of the region for which navigation information is being requested.

  #### returns:

  files: List<FilePath>

    A list of the paths of files that are referenced by the navigation targets.

  targets: List<NavigationTarget>

    A list of the navigation targets that are referenced by the navigation regions.

  regions: List<NavigationRegion>

    A list of the navigation regions within the requested region of the file.

analysis.getReachableSources

      request: {
        "id": String
        "method": "analysis.getReachableSources"
        "params": {
          "file": FilePath
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "sources": Map<String, List<String>>
        }
      }

  Return the transitive closure of reachable sources for a given file.

  If a request is made for a file which does not exist, or which is not currently subject to analysis (e.g. because it is not associated with any analysis root specified to analysis.setAnalysisRoots), an error of type `GET_REACHABLE_SOURCES_INVALID_FILE` will be generated.

  #### parameters:

  file: FilePath

    The file for which reachable source information is being requested.

  #### returns:

  sources: Map<String, List<String>>

    A mapping from source URIs to directly reachable source URIs. For example, a file "foo.dart" that imports "bar.dart" would have the corresponding mapping { "file:///foo.dart" : ["file:///bar.dart"] }. If "bar.dart" has further imports (or exports) there will be a mapping from the URI "file:///bar.dart" to them. To check if a specific URI is reachable from a given file, clients can check for its presence in the resulting key set.

analysis.reanalyze

      request: {
        "id": String
        "method": "analysis.reanalyze"
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Force re-reading of all potentially changed files, re-resolving of all referenced URIs, and corresponding re-analysis of everything affected in the current analysis roots.

analysis.setAnalysisRoots

      request: {
        "id": String
        "method": "analysis.setAnalysisRoots"
        "params": {
          "included": List<FilePath>
          "excluded": List<FilePath>
          "packageRoots": optional Map<FilePath, FilePath>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Sets the root paths used to determine which files to analyze. The set of files to be analyzed are all of the files in one of the root paths that are not either explicitly or implicitly excluded. A file is explicitly excluded if it is in one of the excluded paths. A file is implicitly excluded if it is in a subdirectory of one of the root paths where the name of the subdirectory starts with a period (that is, a hidden directory).

  Note that this request determines the set of requested analysis roots. The actual set of analysis roots at any given time is the intersection of this set with the set of files and directories actually present on the filesystem. When the filesystem changes, the actual set of analysis roots is automatically updated, but the set of requested analysis roots is unchanged. This means that if the client sets an analysis root before the root becomes visible to the server in the filesystem, there is no error; once the server sees the root in the filesystem it will start analyzing it. Similarly, the server will stop analyzing files that are removed from the file system but they will remain in the set of requested roots.

  If an included path represents a file, then the server will look in the directory containing the file for a pubspec.yaml file. If none is found, then the parents of the directory will be searched until such a file is found or the root of the file system is reached. If such a file is found, it will be used to resolve package: URI's within the file.

  #### parameters:

  included: List<FilePath>

    A list of the files and directories that should be analyzed.

  excluded: List<FilePath>

    A list of the files and directories within the included directories that should not be analyzed.

  packageRoots: Map<FilePath, FilePath> (optional)

    A mapping from source directories to package roots that should override the normal package: URI resolution mechanism.

    If a package root is a file, then the analyzer will behave as though that file is a ".dart_tool/package_config.json" file in the source directory. The effect is the same as specifying the file as a "--packages" parameter to the Dart VM when executing any Dart file inside the source directory.

    Files in any directories that are not overridden by this mapping have their package: URI's resolved using the normal pubspec.yaml mechanism. If this field is absent, or the empty map is specified, that indicates that the normal pubspec.yaml mechanism should always be used.

analysis.setGeneralSubscriptions

      request: {
        "id": String
        "method": "analysis.setGeneralSubscriptions"
        "params": {
          "subscriptions": List<GeneralAnalysisService>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Subscribe for general services (that is, services that are not specific to individual files). All previous subscriptions are replaced by the given set of services.

  It is an error if any of the elements in the list are not valid services. If there is an error, then the current subscriptions will remain unchanged.

  #### parameters:

  subscriptions: List<GeneralAnalysisService>

    A list of the services being subscribed to.

analysis.setPriorityFiles

      request: {
        "id": String
        "method": "analysis.setPriorityFiles"
        "params": {
          "files": List<FilePath>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Set the priority files to the files in the given list. A priority file is a file that is given priority when scheduling which analysis work to do first. The list typically contains those files that are visible to the user and those for which analysis results will have the biggest impact on the user experience. The order of the files within the list is significant: the first file will be given higher priority than the second, the second higher priority than the third, and so on.

  Note that this request determines the set of requested priority files. The actual set of priority files is the intersection of the requested set of priority files with the set of files currently subject to analysis. (See analysis.setSubscriptions for a description of files that are subject to analysis.)

  If a requested priority file is a directory it is ignored, but remains in the set of requested priority files so that if it later becomes a file it can be included in the set of actual priority files.

  #### parameters:

  files: List<FilePath>

    The files that are to be a priority for analysis.

analysis.setSubscriptions

      request: {
        "id": String
        "method": "analysis.setSubscriptions"
        "params": {
          "subscriptions": Map<AnalysisService, List<FilePath>>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Subscribe for services that are specific to individual files. All previous subscriptions are replaced by the current set of subscriptions. If a given service is not included as a key in the map then no files will be subscribed to the service, exactly as if the service had been included in the map with an explicit empty list of files.

  Note that this request determines the set of requested subscriptions. The actual set of subscriptions at any given time is the intersection of this set with the set of files currently subject to analysis. The files currently subject to analysis are the set of files contained within an actual analysis root but not excluded, plus all of the files transitively reachable from those files via import, export and part directives. (See analysis.setAnalysisRoots for an explanation of how the actual analysis roots are determined.) When the actual analysis roots change, the actual set of subscriptions is automatically updated, but the set of requested subscriptions is unchanged.

  If a requested subscription is a directory it is ignored, but remains in the set of requested subscriptions so that if it later becomes a file it can be included in the set of actual subscriptions.

  It is an error if any of the keys in the map are not valid services. If there is an error, then the existing subscriptions will remain unchanged.

  #### parameters:

  subscriptions: Map<AnalysisService, List<FilePath>>

    A table mapping services to a list of the files being subscribed to the service.

analysis.updateContent

      request: {
        "id": String
        "method": "analysis.updateContent"
        "params": {
          "files": Map<FilePath, AddContentOverlay | ChangeContentOverlay | RemoveContentOverlay>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
        }
      }

  Update the content of one or more files. Files that were previously updated but not included in this update remain unchanged. This effectively represents an overlay of the filesystem. The files whose content is overridden are therefore seen by the server as being files with the given content, even if the files do not exist on the filesystem or if the file path represents the path to a directory on the filesystem.

  #### parameters:

  files: Map<FilePath, AddContentOverlay | ChangeContentOverlay | RemoveContentOverlay>

    A table mapping the files whose content has changed to a description of the content change.

  #### returns:

analysis.updateOptions

      request: {
        "id": String
        "method": "analysis.updateOptions"
        "params": {
          "options": AnalysisOptions
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Deprecated: all of the options can be set by users in an analysis options file.

  Update the options controlling analysis based on the given set of options. Any options that are not included in the analysis options will not be changed. If there are options in the analysis options that are not valid, they will be silently ignored.

  #### parameters:

  options: AnalysisOptions

    The options that are to be used to control analysis.

### Notifications

analysis.analyzedFiles

      notification: {
        "event": "analysis.analyzedFiles"
        "params": {
          "directories": List<FilePath>
        }
      }

  Reports the paths of the files that are being analyzed.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"ANALYZED_FILES"` in the list of services passed in an analysis.setGeneralSubscriptions request.

  #### parameters:

  directories: List<FilePath>

    A list of the paths of the files that are being analyzed.

analysis.closingLabels

      notification: {
        "event": "analysis.closingLabels"
        "params": {
          "file": FilePath
          "labels": List<ClosingLabel>
        }
      }

  Reports closing labels relevant to a given file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"CLOSING_LABELS"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file the closing labels relate to.

  labels: List<ClosingLabel>

    Closing labels relevant to the file. Each item represents a useful label associated with some range which may be useful to display to the user within the editor at the end of the range to indicate what construct is closed at that location. Closing labels include constructor/method calls and List arguments that span multiple lines. Note that the ranges that are returned can overlap each other because they may be associated with constructs that can be nested.

analysis.errors

      notification: {
        "event": "analysis.errors"
        "params": {
          "file": FilePath
          "errors": List<AnalysisError>
        }
      }

  Reports the errors associated with a given file. The set of errors included in the notification is always a complete list that supersedes any previously reported errors.

  #### parameters:

  file: FilePath

    The file containing the errors.

  errors: List<AnalysisError>

    The errors contained in the file.

analysis.flushResults

      notification: {
        "event": "analysis.flushResults"
        "params": {
          "files": List<FilePath>
        }
      }

  Reports that any analysis results that were previously associated with the given files should be considered to be invalid because those files are no longer being analyzed, either because the analysis root that contained it is no longer being analyzed or because the file no longer exists.

  If a file is included in this notification and at some later time a notification with results for the file is received, clients should assume that the file is once again being analyzed and the information should be processed.

  It is not possible to subscribe to or unsubscribe from this notification.

  #### parameters:

  files: List<FilePath>

    The files that are no longer being analyzed.

analysis.folding

      notification: {
        "event": "analysis.folding"
        "params": {
          "file": FilePath
          "regions": List<FoldingRegion>
        }
      }

  Reports the folding regions associated with a given file. Folding regions can be nested, but will not be overlapping. Nesting occurs when a foldable element, such as a method, is nested inside another foldable element such as a class.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"FOLDING"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file containing the folding regions.

  regions: List<FoldingRegion>

    The folding regions contained in the file.

analysis.highlights

      notification: {
        "event": "analysis.highlights"
        "params": {
          "file": FilePath
          "regions": List<HighlightRegion>
        }
      }

  Reports the highlight regions associated with a given file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"HIGHLIGHTS"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file containing the highlight regions.

  regions: List<HighlightRegion>

    The highlight regions contained in the file. Each highlight region represents a particular syntactic or semantic meaning associated with some range. Note that the highlight regions that are returned can overlap other highlight regions if there is more than one meaning associated with a particular region.

analysis.implemented

      notification: {
        "event": "analysis.implemented"
        "params": {
          "file": FilePath
          "classes": List<ImplementedClass>
          "members": List<ImplementedMember>
        }
      }

  Reports the classes that are implemented or extended and class members that are implemented or overridden in a file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"IMPLEMENTED"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file with which the implementations are associated.

  classes: List<ImplementedClass>

    The classes defined in the file that are implemented or extended.

  members: List<ImplementedMember>

    The members defined in the file that are implemented or overridden.

analysis.invalidate

      notification: {
        "event": "analysis.invalidate"
        "params": {
          "file": FilePath
          "offset": int
          "length": int
          "delta": int
        }
      }

  Reports that the navigation information associated with a region of a single file has become invalid and should be re-requested.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"INVALIDATE"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file whose information has been invalidated.

  offset: int

    The offset of the invalidated region.

  length: int

    The length of the invalidated region.

  delta: int

    The delta to be applied to the offsets in information that follows the invalidated region in order to update it so that it doesn't need to be re-requested.

analysis.navigation

      notification: {
        "event": "analysis.navigation"
        "params": {
          "file": FilePath
          "regions": List<NavigationRegion>
          "targets": List<NavigationTarget>
          "files": List<FilePath>
        }
      }

  Reports the navigation targets associated with a given file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"NAVIGATION"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file containing the navigation regions.

  regions: List<NavigationRegion>

    The navigation regions contained in the file. The regions are sorted by their offsets. Each navigation region represents a list of targets associated with some range. The lists will usually contain a single target, but can contain more in the case of a part that is included in multiple libraries or in Dart code that is compiled against multiple versions of a package. Note that the navigation regions that are returned do not overlap other navigation regions.

  targets: List<NavigationTarget>

    The navigation targets referenced in the file. They are referenced by `NavigationRegion`s by their index in this array.

  files: List<FilePath>

    The files containing navigation targets referenced in the file. They are referenced by `NavigationTarget`s by their index in this array.

analysis.occurrences

      notification: {
        "event": "analysis.occurrences"
        "params": {
          "file": FilePath
          "occurrences": List<Occurrences>
        }
      }

  Reports the occurrences of references to elements within a single file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"OCCURRENCES"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file in which the references occur.

  occurrences: List<Occurrences>

    The occurrences of references to elements within the file.

analysis.outline

      notification: {
        "event": "analysis.outline"
        "params": {
          "file": FilePath
          "kind": FileKind
          "libraryName": optional String
          "outline": Outline
        }
      }

  Reports the outline associated with a single file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"OUTLINE"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file with which the outline is associated.

  kind: FileKind

    The kind of the file.

  libraryName: String (optional)

    The name of the library defined by the file using a "library" directive, or referenced by a "part of" directive. If both "library" and "part of" directives are present, then the "library" directive takes precedence. This field will be omitted if the file has neither "library" nor "part of" directives.

  outline: Outline

    The outline associated with the file.

analysis.overrides

      notification: {
        "event": "analysis.overrides"
        "params": {
          "file": FilePath
          "overrides": List<Override>
        }
      }

  Reports the overriding members in a file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"OVERRIDES"` in the list of services passed in an analysis.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file with which the overrides are associated.

  overrides: List<Override>

    The overrides associated with the file.

## completion domain

The code completion domain contains commands related to getting code completion suggestions.

### Requests

completion.getSuggestions2

      request: {
        "id": String
        "method": "completion.getSuggestions2"
        "params": {
          "file": FilePath
          "offset": int
          "maxResults": int
          "completionCaseMatchingMode": optional CompletionCaseMatchingMode
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "replacementOffset": int
          "replacementLength": int
          "suggestions": List<CompletionSuggestion>
          "isIncomplete": bool
        }
      }

  Request that completion suggestions for the given offset in the given file be returned. The suggestions will be filtered using fuzzy matching with the already existing prefix.

  #### parameters:

  file: FilePath

    The file containing the point at which suggestions are to be made.

  offset: int

    The offset within the file at which suggestions are to be made.

  maxResults: int

    The maximum number of suggestions to return. If the number of suggestions after filtering is greater than the `maxResults`, then `isIncomplete` is set to `true`.

  completionCaseMatchingMode: CompletionCaseMatchingMode (optional)

    The mode of code completion being invoked. If no value is provided, `MATCH_FIRST_CHAR` will be assumed.

  #### returns:

  replacementOffset: int

    The offset of the start of the text to be replaced. This will be different from the offset used to request the completion suggestions if there was a portion of an identifier before the original offset. In particular, the replacementOffset will be the offset of the beginning of said identifier.

  replacementLength: int

    The length of the text to be replaced if the remainder of the identifier containing the cursor is to be replaced when the suggestion is applied (that is, the number of characters in the existing identifier).

  suggestions: List<CompletionSuggestion>

    The completion suggestions being reported. This list is filtered by the already existing prefix, and sorted first by relevance, and (if the same) by the suggestion text. The list will have at most `maxResults` items. If the user types a new keystroke, the client is expected to either do local filtering (when the returned list was complete), or ask the server again (if `isIncomplete` was `true`).

    This list contains suggestions from both imported, and not yet imported libraries. Items from not yet imported libraries will have `isNotImported` set to `true`.

  isIncomplete: bool

    True if the number of suggestions after filtering was greater than the requested `maxResults`.

completion.registerLibraryPaths

      request: {
        "id": String
        "method": "completion.registerLibraryPaths"
        "params": {
          "paths": List<LibraryPathSet>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  The client can make this request to express interest in certain libraries to receive completion suggestions from based on the client path. If this request is received before the client has used 'completion.setSubscriptions' to subscribe to the `AVAILABLE_SUGGESTION_SETS` service, then an error of type `NOT_SUBSCRIBED_TO_AVAILABLE_SUGGESTION_SETS` will be generated. All previous paths are replaced by the given set of paths.

  #### parameters:

  paths: List<LibraryPathSet>

    A list of objects each containing a path and the additional libraries from which the client is interested in receiving completion suggestions. If one configured path is beneath another, the descendant will override the ancestors' configured libraries of interest.

completion.getSuggestionDetails2

      request: {
        "id": String
        "method": "completion.getSuggestionDetails2"
        "params": {
          "file": FilePath
          "offset": int
          "completion": String
          "libraryUri": String
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "completion": String
          "change": SourceChange
        }
      }

  Clients must make this request when the user has selected a completion suggestion with the `isNotImported` field set to `true`. The server will respond with the text to insert, as well as any `SourceChange` that needs to be applied in case the completion requires an additional import to be added. The text to insert might be different from the original suggestion to include an import prefix if the library will be imported with a prefix to avoid shadowing conflicts in the file.

  #### parameters:

  file: FilePath

    The path of the file into which this completion is being inserted.

  offset: int

    The offset in the file where the completion will be inserted.

  completion: String

    The `completion` from the selected `CompletionSuggestion`. It could be a name of a class, or a name of a constructor in the form "typeName.constructorName()", or an enumeration constant in the form "enumName.constantName", etc.

  libraryUri: String

    The URI of the library to import, so that the element referenced in the `completion` becomes accessible.

  #### returns:

  completion: String

    The full text to insert, which possibly includes now an import prefix. The client should insert this text, not the `completion` from the selected `CompletionSuggestion`.

  change: SourceChange

    A change for the client to apply to make the accepted completion suggestion available. In most cases the change is to add a new import directive to the file.

### Notifications

completion.existingImports

      notification: {
        "event": "completion.existingImports"
        "params": {
          "file": FilePath
          "imports": ExistingImports
        }
      }

  Reports existing imports in a library. This notification may be sent multiple times for a library. When a notification is processed, clients should replace any previous information for the library.

  #### parameters:

  file: FilePath

    The defining file of the library.

  imports: ExistingImports

    The existing imports in the library.

## search domain

The search domain contains commands related to searches that can be performed against the code base.

### Requests

search.findElementReferences

      request: {
        "id": String
        "method": "search.findElementReferences"
        "params": {
          "file": FilePath
          "offset": int
          "includePotential": bool
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "id": optional SearchId
          "element": optional Element
        }
      }

  Perform a search for references to the element defined or referenced at the given offset in the given file.

  An identifier is returned immediately, and individual results will be returned via the search.results notification as they become available.

  #### parameters:

  file: FilePath

    The file containing the declaration of or reference to the element used to define the search.

  offset: int

    The offset within the file of the declaration of or reference to the element.

  includePotential: bool

    True if potential matches are to be included in the results.

  #### returns:

  id: SearchId (optional)

    The identifier used to associate results with this search request.

    If no element was found at the given location, this field will be absent, and no results will be reported via the search.results notification.

  element: Element (optional)

    The element referenced or defined at the given offset and whose references will be returned in the search results.

    If no element was found at the given location, this field will be absent.

search.findMemberDeclarations

      request: {
        "id": String
        "method": "search.findMemberDeclarations"
        "params": {
          "name": String
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "id": SearchId
        }
      }

  Perform a search for declarations of members whose name is equal to the given name.

  An identifier is returned immediately, and individual results will be returned via the search.results notification as they become available.

  #### parameters:

  name: String

    The name of the declarations to be found.

  #### returns:

  id: SearchId

    The identifier used to associate results with this search request.

search.findMemberReferences

      request: {
        "id": String
        "method": "search.findMemberReferences"
        "params": {
          "name": String
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "id": SearchId
        }
      }

  Perform a search for references to members whose name is equal to the given name. This search does not check to see that there is a member defined with the given name, so it is able to find references to undefined members as well.

  An identifier is returned immediately, and individual results will be returned via the search.results notification as they become available.

  #### parameters:

  name: String

    The name of the references to be found.

  #### returns:

  id: SearchId

    The identifier used to associate results with this search request.

search.findTopLevelDeclarations

      request: {
        "id": String
        "method": "search.findTopLevelDeclarations"
        "params": {
          "pattern": String
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "id": SearchId
        }
      }

  Perform a search for declarations of top-level elements (classes, typedefs, getters, setters, functions and fields) whose name matches the given pattern.

  An identifier is returned immediately, and individual results will be returned via the search.results notification as they become available.

  #### parameters:

  pattern: String

    The regular expression used to match the names of the declarations to be found.

  #### returns:

  id: SearchId

    The identifier used to associate results with this search request.

search.getTypeHierarchy

      request: {
        "id": String
        "method": "search.getTypeHierarchy"
        "params": {
          "file": FilePath
          "offset": int
          "superOnly": optional bool
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "hierarchyItems": optional List<TypeHierarchyItem>
        }
      }

  Return the type hierarchy of the class declared or referenced at the given location.

  #### parameters:

  file: FilePath

    The file containing the declaration or reference to the type for which a hierarchy is being requested.

  offset: int

    The offset of the name of the type within the file.

  superOnly: bool (optional)

    True if the client is only requesting superclasses and interfaces hierarchy.

  #### returns:

  hierarchyItems: List<TypeHierarchyItem> (optional)

    A list of the types in the requested hierarchy. The first element of the list is the item representing the type for which the hierarchy was requested. The index of other elements of the list is unspecified, but correspond to the integers used to reference supertype and subtype items within the items.

    This field will be absent if the code at the given file and offset does not represent a type, or if the file has not been sufficiently analyzed to allow a type hierarchy to be produced.

### Notifications

search.results

      notification: {
        "event": "search.results"
        "params": {
          "id": SearchId
          "results": List<SearchResult>
          "isLast": bool
        }
      }

  Reports some or all of the results of performing a requested search. Unlike other notifications, this notification contains search results that should be added to any previously received search results associated with the same search id.

  #### parameters:

  id: SearchId

    The id associated with the search.

  results: List<SearchResult>

    The search results being reported.

  isLast: bool

    True if this is that last set of results that will be returned for the indicated search.

## edit domain

The edit domain contains commands related to edits that can be applied to the code.

### Requests

edit.format

      request: {
        "id": String
        "method": "edit.format"
        "params": {
          "file": FilePath
          "selectionOffset": int
          "selectionLength": int
          "lineLength": optional int
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "edits": List<SourceEdit>
          "selectionOffset": int
          "selectionLength": int
        }
      }

  Format the contents of a single file. The currently selected region of text is passed in so that the selection can be preserved across the formatting operation. The updated selection will be as close to matching the original as possible, but whitespace at the beginning or end of the selected region will be ignored. If preserving selection information is not required, zero (0) can be specified for both the selection offset and selection length.

  If a request is made for a file which does not exist, or which is not currently subject to analysis (e.g. because it is not associated with any analysis root specified to analysis.setAnalysisRoots), an error of type `FORMAT_INVALID_FILE` will be generated. If the source contains syntax errors, an error of type `FORMAT_WITH_ERRORS` will be generated.

  #### parameters:

  file: FilePath

    The file containing the code to be formatted.

  selectionOffset: int

    The offset of the current selection in the file.

  selectionLength: int

    The length of the current selection in the file.

  lineLength: int (optional)

    The line length to be used by the formatter. This value is ignored if a `formatter.page_width` has been configured in the relevant `analysis_options.yaml` file.

  #### returns:

  edits: List<SourceEdit>

    The edit(s) to be applied in order to format the code. The list will be empty if the code was already formatted (there are no changes).

  selectionOffset: int

    The offset of the selection after formatting the code.

  selectionLength: int

    The length of the selection after formatting the code.

edit.getAssists

      request: {
        "id": String
        "method": "edit.getAssists"
        "params": {
          "file": FilePath
          "offset": int
          "length": int
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "assists": List<SourceChange>
        }
      }

  Return the set of assists that are available at the given location. An assist is distinguished from a refactoring primarily by the fact that it affects a single file and does not require user input in order to be performed.

  #### parameters:

  file: FilePath

    The file containing the code for which assists are being requested.

  offset: int

    The offset of the code for which assists are being requested.

  length: int

    The length of the code for which assists are being requested.

  #### returns:

  assists: List<SourceChange>

    The assists that are available at the given location.

edit.getAvailableRefactorings

      request: {
        "id": String
        "method": "edit.getAvailableRefactorings"
        "params": {
          "file": FilePath
          "offset": int
          "length": int
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "kinds": List<RefactoringKind>
        }
      }

  Get a list of the kinds of refactorings that are valid for the given selection in the given file.

  #### parameters:

  file: FilePath

    The file containing the code on which the refactoring would be based.

  offset: int

    The offset of the code on which the refactoring would be based.

  length: int

    The length of the code on which the refactoring would be based.

  #### returns:

  kinds: List<RefactoringKind>

    The kinds of refactorings that are valid for the given selection.

edit.getFixes

      request: {
        "id": String
        "method": "edit.getFixes"
        "params": {
          "file": FilePath
          "offset": int
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "fixes": List<AnalysisErrorFixes>
        }
      }

  Return the set of fixes that are available for the errors at a given offset in a given file.

  If a request is made for a file which does not exist, or which is not currently subject to analysis (e.g. because it is not associated with any analysis root specified to analysis.setAnalysisRoots), an error of type `GET_FIXES_INVALID_FILE` will be generated.

  #### parameters:

  file: FilePath

    The file containing the errors for which fixes are being requested.

  offset: int

    The offset used to select the errors for which fixes will be returned.

  #### returns:

  fixes: List<AnalysisErrorFixes>

    The fixes that are available for the errors at the given offset.

edit.getPostfixCompletion

      request: {
        "id": String
        "method": "edit.getPostfixCompletion"
        "params": {
          "file": FilePath
          "key": String
          "offset": int
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "change": SourceChange
        }
      }

  Get the changes required to convert the postfix template at the given location into the template's expanded form.

  #### parameters:

  file: FilePath

    The file containing the postfix template to be expanded.

  key: String

    The unique name that identifies the template in use.

  offset: int

    The offset used to identify the code to which the template will be applied.

  #### returns:

  change: SourceChange

    The change to be applied in order to complete the statement.

edit.getRefactoring

      request: {
        "id": String
        "method": "edit.getRefactoring"
        "params": {
          "kind": RefactoringKind
          "file": FilePath
          "offset": int
          "length": int
          "validateOnly": bool
          "options": optional RefactoringOptions
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "initialProblems": List<RefactoringProblem>
          "optionsProblems": List<RefactoringProblem>
          "finalProblems": List<RefactoringProblem>
          "feedback": optional RefactoringFeedback
          "change": optional SourceChange
          "potentialEdits": optional List<String>
        }
      }

  Get the changes required to perform a refactoring.

  If another refactoring request is received during the processing of this one, an error of type `REFACTORING_REQUEST_CANCELLED` will be generated.

  #### parameters:

  kind: RefactoringKind

    The kind of refactoring to be performed.

  file: FilePath

    The file containing the code involved in the refactoring.

  offset: int

    The offset of the region involved in the refactoring.

  length: int

    The length of the region involved in the refactoring.

  validateOnly: bool

    True if the client is only requesting that the values of the options be validated and no change be generated.

  options: RefactoringOptions (optional)

    Data used to provide values provided by the user. The structure of the data is dependent on the kind of refactoring being performed. The data that is expected is documented in the section titled Refactorings, labeled as "Options". This field can be omitted if the refactoring does not require any options or if the values of those options are not known.

  #### returns:

  initialProblems: List<RefactoringProblem>

    The initial status of the refactoring, i.e. problems related to the context in which the refactoring is requested. The array will be empty if there are no known problems.

  optionsProblems: List<RefactoringProblem>

    The options validation status, i.e. problems in the given options, such as light-weight validation of a new name, flags compatibility, etc. The array will be empty if there are no known problems.

  finalProblems: List<RefactoringProblem>

    The final status of the refactoring, i.e. problems identified in the result of a full, potentially expensive validation and / or change creation. The array will be empty if there are no known problems.

  feedback: RefactoringFeedback (optional)

    Data used to provide feedback to the user. The structure of the data is dependent on the kind of refactoring being created. The data that is returned is documented in the section titled Refactorings, labeled as "Feedback".

  change: SourceChange (optional)

    The changes that are to be applied to affect the refactoring. This field will be omitted if there are problems that prevent a set of changes from being computed, such as having no options specified for a refactoring that requires them, or if only validation was requested.

  potentialEdits: List<String> (optional)

    The ids of source edits that are not known to be valid. An edit is not known to be valid if there was insufficient type information for the server to be able to determine whether or not the code needs to be modified, such as when a member is being renamed and there is a reference to a member from an unknown type. This field will be omitted if the change field is omitted or if there are no potential edits for the refactoring.

edit.sortMembers

      request: {
        "id": String
        "method": "edit.sortMembers"
        "params": {
          "file": FilePath
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "edit": SourceFileEdit
        }
      }

  Sort all of the directives, unit and class members of the given Dart file.

  If a request is made for a file that does not exist, does not belong to an analysis root or is not a Dart file, `SORT_MEMBERS_INVALID_FILE` will be generated.

  If the Dart file has scan or parse errors, `SORT_MEMBERS_PARSE_ERRORS` will be generated.

  #### parameters:

  file: FilePath

    The Dart file to sort.

  #### returns:

  edit: SourceFileEdit

    The file edit that is to be applied to the given file to affect the sorting.

edit.organizeDirectives

      request: {
        "id": String
        "method": "edit.organizeDirectives"
        "params": {
          "file": FilePath
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "edit": SourceFileEdit
        }
      }

  Organizes all of the directives - removes unused imports and sorts directives of the given Dart file according to the Dart Style Guide.

  If a request is made for a file that does not exist, does not belong to an analysis root or is not a Dart file, `FILE_NOT_ANALYZED` will be generated.

  If directives of the Dart file cannot be organized, for example because it has scan or parse errors, or by other reasons, `ORGANIZE_DIRECTIVES_ERROR` will be generated. The message will provide details about the reason.

  #### parameters:

  file: FilePath

    The Dart file to organize directives in.

  #### returns:

  edit: SourceFileEdit

    The file edit that is to be applied to the given file to affect the organizing.

## execution domain

The execution domain contains commands related to providing an execution or debugging experience.

### Requests

execution.createContext

      request: {
        "id": String
        "method": "execution.createContext"
        "params": {
          "contextRoot": FilePath
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "id": ExecutionContextId
        }
      }

  Create an execution context for the executable file with the given path. The context that is created will persist until execution.deleteContext is used to delete it. Clients, therefore, are responsible for managing the lifetime of execution contexts.

  #### parameters:

  contextRoot: FilePath

    The path of the Dart or HTML file that will be launched, or the path of the directory containing the file.

  #### returns:

  id: ExecutionContextId

    The identifier used to refer to the execution context that was created.

execution.deleteContext

      request: {
        "id": String
        "method": "execution.deleteContext"
        "params": {
          "id": ExecutionContextId
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Delete the execution context with the given identifier. The context id is no longer valid after this command. The server is allowed to re-use ids when they are no longer valid.

  #### parameters:

  id: ExecutionContextId

    The identifier of the execution context that is to be deleted.

execution.getSuggestions

      request: {
        "id": String
        "method": "execution.getSuggestions"
        "params": {
          "code": String
          "offset": int
          "contextFile": FilePath
          "contextOffset": int
          "variables": List<RuntimeCompletionVariable>
          "expressions": optional List<RuntimeCompletionExpression>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "suggestions": optional List<CompletionSuggestion>
          "expressions": optional List<RuntimeCompletionExpression>
        }
      }

  Request completion suggestions for the given runtime context.

  It might take one or two requests of this type to get completion suggestions. The first request should have only "code", "offset", and "variables", but not "expressions". If there are sub-expressions that can have different runtime types, and are considered to be safe to evaluate at runtime (e.g. getters), so using their actual runtime types can improve completion results, the server will not include the "suggestions" field in the response, and instead will return the "expressions" field. The client will use debug API to get current runtime types for these sub-expressions and send another request, this time with "expressions". If there are no interesting sub-expressions to get runtime types for, or when the "expressions" field is provided by the client, the server will return "suggestions" in the response.

  #### parameters:

  code: String

    The code to get suggestions in.

  offset: int

    The offset within the code to get suggestions at.

  contextFile: FilePath

    The path of the context file, e.g. the file of the current debugger frame. The combination of the context file and context offset can be used to ensure that all variables of the context are available for completion (with their static types).

  contextOffset: int

    The offset in the context file, e.g. the line offset in the current debugger frame.

  variables: List<RuntimeCompletionVariable>

    The runtime context variables that are potentially referenced in the code.

  expressions: List<RuntimeCompletionExpression> (optional)

    The list of sub-expressions in the code for which the client wants to provide runtime types. It does not have to be the full list of expressions requested by the server, for missing expressions their static types will be used.

    When this field is omitted, the server will return completion suggestions only when there are no interesting sub-expressions in the given code. The client may provide an empty list, in this case the server will return completion suggestions.

  #### returns:

  suggestions: List<CompletionSuggestion> (optional)

    The completion suggestions. In contrast to usual completion requests, suggestions for private elements also will be provided.

    If there are sub-expressions that can have different runtime types, and are considered to be safe to evaluate at runtime (e.g. getters), so using their actual runtime types can improve completion results, the server omits this field in the response, and instead will return the "expressions" field.

  expressions: List<RuntimeCompletionExpression> (optional)

    The list of sub-expressions in the code for which the server would like to know runtime types to provide better completion suggestions.

    This field is omitted the field "suggestions" is returned.

execution.mapUri

      request: {
        "id": String
        "method": "execution.mapUri"
        "params": {
          "id": ExecutionContextId
          "file": optional FilePath
          "uri": optional String
        }
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "file": optional FilePath
          "uri": optional String
        }
      }

  Map a URI from the execution context to the file that it corresponds to, or map a file to the URI that it corresponds to in the execution context.

  Exactly one of the file and uri fields must be provided. If both fields are provided, then an error of type `INVALID_PARAMETER` will be generated. Similarly, if neither field is provided, then an error of type `INVALID_PARAMETER` will be generated.

  If the file field is provided and the value is not the path of a file (either the file does not exist or the path references something other than a file), then an error of type `INVALID_PARAMETER` will be generated.

  If the uri field is provided and the value is not a valid URI or if the URI references something that is not a file (either a file that does not exist or something other than a file), then an error of type `INVALID_PARAMETER` will be generated.

  If the contextRoot used to create the execution context does not exist, then an error of type `INVALID_EXECUTION_CONTEXT` will be generated.

  #### parameters:

  id: ExecutionContextId

    The identifier of the execution context in which the URI is to be mapped.

  file: FilePath (optional)

    The path of the file to be mapped into a URI.

  uri: String (optional)

    The URI to be mapped into a file path.

  #### returns:

  file: FilePath (optional)

    The file to which the URI was mapped. This field is omitted if the uri field was not given in the request.

  uri: String (optional)

    The URI to which the file path was mapped. This field is omitted if the file field was not given in the request.

execution.setSubscriptions

      request: {
        "id": String
        "method": "execution.setSubscriptions"
        "params": {
          "subscriptions": List<ExecutionService>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Deprecated: the analysis server no longer fires `LAUNCH_DATA` events.

  Subscribe for services. All previous subscriptions are replaced by the given set of services.

  It is an error if any of the elements in the list are not valid services. If there is an error, then the current subscriptions will remain unchanged.

  #### parameters:

  subscriptions: List<ExecutionService>

    A list of the services being subscribed to.

### Notifications

execution.launchData

      notification: {
        "event": "execution.launchData"
        "params": {
          "file": FilePath
          "kind": optional ExecutableKind
          "referencedFiles": optional List<FilePath>
        }
      }

  Reports information needed to allow a single file to be launched.

  This notification is not subscribed to by default. Clients can subscribe by including the value "LAUNCH_DATA" in the list of services passed in an `execution.setSubscriptions` request.

  #### parameters:

  file: FilePath

    The file for which launch data is being provided. This will either be a Dart library or an HTML file.

  kind: ExecutableKind (optional)

    The kind of the executable file. This field is omitted if the file is not a Dart file.

  referencedFiles: List<FilePath> (optional)

    A list of the Dart files that are referenced by the file. This field is omitted if the file is not an HTML file.

## diagnostic domain

The diagnostic domain contains server diagnostics APIs.

### Requests

diagnostic.getDiagnostics

      request: {
        "id": String
        "method": "diagnostic.getDiagnostics"
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "contexts": List<ContextData>
        }
      }

  Return server diagnostics.

  #### returns:

  contexts: List<ContextData>

    The list of analysis contexts.

diagnostic.getServerPort

      request: {
        "id": String
        "method": "diagnostic.getServerPort"
      }

      response: {
        "id": String
        "error": optional RequestError
        "result": {
          "port": int
        }
      }

  Return the port of the diagnostic web server. If the server is not running this call will start the server. If unable to start the diagnostic web server, this call will return an error of `DEBUG_PORT_COULD_NOT_BE_OPENED`.

  #### returns:

  port: int

    The diagnostic server port.

## flutter domain

The analysis domain contains API's related to Flutter support.

### Requests

flutter.setSubscriptions

      request: {
        "id": String
        "method": "flutter.setSubscriptions"
        "params": {
          "subscriptions": Map<FlutterService, List<FilePath>>
        }
      }

      response: {
        "id": String
        "error": optional RequestError
      }

  Subscribe for services that are specific to individual files. All previous subscriptions are replaced by the current set of subscriptions. If a given service is not included as a key in the map then no files will be subscribed to the service, exactly as if the service had been included in the map with an explicit empty list of files.

  Note that this request determines the set of requested subscriptions. The actual set of subscriptions at any given time is the intersection of this set with the set of files currently subject to analysis. The files currently subject to analysis are the set of files contained within an actual analysis root but not excluded, plus all of the files transitively reachable from those files via import, export and part directives. (See analysis.setAnalysisRoots for an explanation of how the actual analysis roots are determined.) When the actual analysis roots change, the actual set of subscriptions is automatically updated, but the set of requested subscriptions is unchanged.

  If a requested subscription is a directory it is ignored, but remains in the set of requested subscriptions so that if it later becomes a file it can be included in the set of actual subscriptions.

  It is an error if any of the keys in the map are not valid services. If there is an error, then the existing subscriptions will remain unchanged.

  #### parameters:

  subscriptions: Map<FlutterService, List<FilePath>>

    A table mapping services to a list of the files being subscribed to the service.

### Notifications

flutter.outline

      notification: {
        "event": "flutter.outline"
        "params": {
          "file": FilePath
          "outline": FlutterOutline
        }
      }

  Reports the Flutter outline associated with a single file.

  This notification is not subscribed to by default. Clients can subscribe by including the value `"OUTLINE"` in the list of services passed in an flutter.setSubscriptions request.

  #### parameters:

  file: FilePath

    The file with which the outline is associated.

  outline: FlutterOutline

    The outline associated with the file.

## Types

This section contains descriptions of the data types referenced in the API's of the various domains.

AddContentOverlay: object

  A directive to begin overlaying the contents of a file. The supplied content will be used for analysis in place of the file contents in the filesystem.

  If this directive is used on a file that already has a file content overlay, the old overlay is discarded and replaced with the new one.

  type = "add"
  content: String

    The new content of the file.

  version: int (optional)

    An optional version number for the document. Version numbers allow the server to tag edits with the version of the document they apply to which can avoid applying edits to documents that have already been updated since the edits were computed.

    If version numbers are supplied with AddContentOverlay and ChangeContentOverlay, they must be increasing (but not necessarily consecutive) numbers.

AnalysisError: object

  An indication of an error, warning, or hint that was produced by the analysis.

  severity: AnalysisErrorSeverity

    The severity of the error.

  type: AnalysisErrorType

    The type of the error.

  location: Location

    The location associated with the error.

  message: String

    The message to be displayed for this error. The message should indicate what is wrong with the code and why it is wrong.

  correction: String (optional)

    The correction message to be displayed for this error. The correction message should indicate how the user can fix the error. The field is omitted if there is no correction message associated with the error code.

  code: String

    The name, as a string, of the error code associated with this error.

  url: String (optional)

    The URL of a page containing documentation associated with this error.

  contextMessages: List<DiagnosticMessage> (optional)

    Additional messages associated with this diagnostic that provide context to help the user understand the diagnostic.

  hasFix: bool (optional)

    A hint to indicate to interested clients that this error has an associated fix (or fixes). The absence of this field implies there are not known to be fixes. Note that since the operation to calculate whether fixes apply needs to be performant it is possible that complicated tests will be skipped and a false negative returned. For this reason, this attribute should be treated as a "hint". Despite the possibility of false negatives, no false positives should be returned. If a client sees this flag set they can proceed with the confidence that there are in fact associated fixes.

AnalysisErrorFixes: object

  A list of fixes associated with a specific error.

  error: AnalysisError

    The error with which the fixes are associated.

  fixes: List<SourceChange>

    The fixes associated with the error.

AnalysisErrorSeverity: String

  An enumeration of the possible severities of analysis errors.

  INFO
  WARNING
  ERROR
AnalysisErrorType: String

  An enumeration of the possible types of analysis errors.

  CHECKED_MODE_COMPILE_TIME_ERROR
  COMPILE_TIME_ERROR
  HINT
  LINT
  STATIC_TYPE_WARNING
  STATIC_WARNING
  SYNTACTIC_ERROR
  TODO
AnalysisOptions: object

  Deprecated: the only reference to this type has been deprecated.

  A set of options controlling what kind of analysis is to be performed. If the value of a field is omitted the value of the option will not be changed.

  enableAsync: bool (optional)

    Deprecated: this feature is always enabled.

    True if the client wants to enable support for the proposed async feature.

  enableDeferredLoading: bool (optional)

    Deprecated: this feature is always enabled.

    True if the client wants to enable support for the proposed deferred loading feature.

  enableEnums: bool (optional)

    Deprecated: this feature is always enabled.

    True if the client wants to enable support for the proposed enum feature.

  enableNullAwareOperators: bool (optional)

    Deprecated: this feature is always enabled.

    True if the client wants to enable support for the proposed "null aware operators" feature.

  generateDart2jsHints: bool (optional)

    True if hints that are specific to dart2js should be generated. This option is ignored if generateHints is false.

  generateHints: bool (optional)

    True if hints should be generated as part of generating errors and warnings.

  generateLints: bool (optional)

    True if lints should be generated as part of generating errors and warnings.

AnalysisService: String

  An enumeration of the services provided by the analysis domain that are related to a specific list of files.

  CLOSING_LABELS
  FOLDING
  HIGHLIGHTS
  IMPLEMENTED
  INVALIDATE

    This service is not currently implemented and will become a GeneralAnalysisService in a future release.

  NAVIGATION
  OCCURRENCES
  OUTLINE
  OVERRIDES
AnalysisStatus: object

  An indication of the current state of analysis.

  isAnalyzing: bool

    True if analysis is currently being performed.

  analysisTarget: String (optional)

    The name of the current target of analysis. This field is omitted if analyzing is false.

AssistDescription: object

  The description of a registered assist.

  id: String

    The ID.

  message: String

    The message that is presented to the user, to carry out this assist.

BulkFix: object

  A description of bulk fixes to a library.

  path: FilePath

    The path of the library.

  fixes: List<BulkFixDetail>

    A list of bulk fix details.

BulkFixDetail: object

  A description of a fix applied to a library.

  code: String

    The code of the diagnostic associated with the fix.

  occurrences: int

    The number times the associated diagnostic was fixed in the associated source edit.

ChangeContentOverlay: object

  A directive to modify an existing file content overlay. One or more ranges of text are deleted from the old file content overlay and replaced with new text.

  The edits are applied in the order in which they occur in the list. This means that the offset of each edit must be correct under the assumption that all previous edits have been applied.

  It is an error to use this overlay on a file that does not yet have a file content overlay or that has had its overlay removed via RemoveContentOverlay.

  If any of the edits cannot be applied due to its offset or length being out of range, an `INVALID_OVERLAY_CHANGE` error will be reported.

  type = "change"
  edits: List<SourceEdit>

    The edits to be applied to the file.

  version: int (optional)

    An optional version number for the document. Version numbers allow the server to tag edits with the version of the document they apply to which can avoid applying edits to documents that have already been updated since the edits were computed.

    If version numbers are supplied with AddContentOverlay and ChangeContentOverlay, they must be increasing (but not necessarily consecutive) numbers.

ClosingLabel: object

  A label that is associated with a range of code that may be useful to render at the end of the range to aid code readability. For example, a constructor call that spans multiple lines may result in a closing label to allow the constructor type/name to be rendered alongside the closing parenthesis.

  offset: int

    The offset of the construct being labelled.

  length: int

    The length of the whole construct to be labelled.

  label: String

    The label associated with this range that should be displayed to the user.

CompletionCaseMatchingMode: String

  An enumeration of the character case matching modes that the user may set in the client.

  FIRST_CHAR

    Match the first character case only when filtering completions, the default for this enumeration.

  ALL_CHARS

    Match all character cases when filtering completion lists.

  NONE

    Do not match character cases when filtering completion lists.

CompletionMode: String

  An enumeration of the kinds of code completion that users can invoke.

  BASIC

    Basic code completion invocation type, and the default for this enumeration.

  SMART

    Smart code completion, currently not implemented.

CompletionSuggestion: object

  A suggestion for how to complete partially entered text. Many of the fields are optional, depending on the kind of element being suggested.

  kind: CompletionSuggestionKind

    The kind of element being suggested.

  relevance: int

    The relevance of this completion suggestion where a higher number indicates a higher relevance.

  completion: String

    The identifier to be inserted if the suggestion is selected. If the suggestion is for a method or function, the client might want to additionally insert a template for the parameters. The information required in order to do so is contained in other fields.

  displayText: String (optional)

    Text to be displayed in, for example, a completion pop-up. This field is only defined if the displayed text should be different than the completion. Otherwise it is omitted.

  replacementOffset: int (optional)

    The offset of the start of the text to be replaced. If supplied, this should be used in preference to the offset provided on the containing completion results. This value may be provided independently of replacementLength (for example if only one differs from the completion result value).

  replacementLength: int (optional)

    The length of the text to be replaced. If supplied, this should be used in preference to the offset provided on the containing completion results. This value may be provided independently of replacementOffset (for example if only one differs from the completion result value).

  selectionOffset: int

    The offset, relative to the beginning of the completion, of where the selection should be placed after insertion.

  selectionLength: int

    The number of characters that should be selected after insertion.

  isDeprecated: bool

    True if the suggested element is deprecated.

  isPotential: bool

    True if the element is not known to be valid for the target. This happens if the type of the target is dynamic.

  docSummary: String (optional)

    An abbreviated version of the Dartdoc associated with the element being suggested. This field is omitted if there is no Dartdoc associated with the element.

  docComplete: String (optional)

    The Dartdoc associated with the element being suggested. This field is omitted if there is no Dartdoc associated with the element.

  declaringType: String (optional)

    The class that declares the element being suggested. This field is omitted if the suggested element is not a member of a class.

  defaultArgumentListString: String (optional)

    A default String for use in generating argument list source contents on the client side.

  defaultArgumentListTextRanges: List<int> (optional)

    Pairs of offsets and lengths describing 'defaultArgumentListString' text ranges suitable for use by clients to set up linked edits of default argument source contents. For example, given an argument list string 'x, y', the corresponding text range [0, 1, 3, 1], indicates two text ranges of length 1, starting at offsets 0 and 3. Clients can use these ranges to treat the 'x' and 'y' values specially for linked edits.

  element: Element (optional)

    Information about the element reference being suggested.

  returnType: String (optional)

    The return type of the getter, function or method or the type of the field being suggested. This field is omitted if the suggested element is not a getter, function or method.

  parameterNames: List<String> (optional)

    The names of the parameters of the function or method being suggested. This field is omitted if the suggested element is not a setter, function or method.

  parameterTypes: List<String> (optional)

    The types of the parameters of the function or method being suggested. This field is omitted if the parameterNames field is omitted.

  requiredParameterCount: int (optional)

    The number of required parameters for the function or method being suggested. This field is omitted if the parameterNames field is omitted.

  hasNamedParameters: bool (optional)

    True if the function or method being suggested has at least one named parameter. This field is omitted if the parameterNames field is omitted.

  parameterName: String (optional)

    The name of the optional parameter being suggested. This field is omitted if the suggestion is not the addition of an optional argument within an argument list.

  parameterType: String (optional)

    The type of the options parameter being suggested. This field is omitted if the parameterName field is omitted.

  libraryUri: String (optional)

    This field is omitted if `getSuggestions` was used rather than `getSuggestions2`.

    This field is omitted if this suggestion corresponds to a locally declared element.

    If this suggestion corresponds to an already imported element, then this field is the URI of a library that provides this element, not the URI of the library where the element is declared.

    If this suggestion corresponds to an element from a not yet imported library, this field is the URI of a library that could be imported to make this suggestion accessible in the file where completion was requested, such as `package:foo/bar.dart` or `file:///home/me/workspace/foo/test/bar_test.dart`.

  isNotImported: bool (optional)

    True if the suggestion is for an element from a not yet imported library. This field is omitted if the element is declared locally, or is from library is already imported, so that the suggestion can be inserted as is, or if `getSuggestions` was used rather than `getSuggestions2`.

CompletionSuggestionKind: String

  An enumeration of the kinds of elements that can be included in a completion suggestion.

  ARGUMENT_LIST

    A list of arguments for the method or function that is being invoked. For this suggestion kind, the completion field is a textual representation of the invocation and the parameterNames, parameterTypes, and requiredParameterCount attributes are defined.

  IMPORT
  IDENTIFIER

    The element identifier should be inserted at the completion location. For example "someMethod" in `import 'myLib.dart' show someMethod;`. For suggestions of this kind, the element attribute is defined and the completion field is the element's identifier.

  INVOCATION

    The element is being invoked at the completion location. For example, 'someMethod' in `x.someMethod();`. For suggestions of this kind, the element attribute is defined and the completion field is the element's identifier.

  KEYWORD

    A keyword is being suggested. For suggestions of this kind, the completion is the keyword.

  NAMED_ARGUMENT

    A named argument for the current call site is being suggested. For suggestions of this kind, the completion is the named argument identifier including a trailing ':' and a space.

  OPTIONAL_ARGUMENT
  OVERRIDE

    An overriding implementation of a class member is being suggested.

  PARAMETER
  PACKAGE_NAME

    The name of a pub package is being suggested.

ContextData: object

  Information about an analysis context.

  name: String

    The name of the context.

  explicitFileCount: int

    Explicitly analyzed files.

  implicitFileCount: int

    Implicitly analyzed files.

  workItemQueueLength: int

    The number of work items in the queue.

  cacheEntryExceptions: List<String>

    Exceptions associated with cache entries.

DiagnosticMessage: object

  A message associated with a diagnostic.

  For example, if the diagnostic is reporting that a variable has been referenced before it was declared, it might have a diagnostic message that indicates where the variable is declared.

  message: String

    The message to be displayed to the user.

  location: Location

    The location associated with or referenced by the message. Clients should provide the ability to navigate to the location.

Element: object

  Information about an element (something that can be declared in code).

  kind: ElementKind

    The kind of the element.

  name: String

    The name of the element. This is typically used as the label in the outline.

  location: Location (optional)

    The location of the name in the declaration of the element.

  flags: int

    A bit-map containing the following flags:

    - 0x01 - set if the element is explicitly or implicitly abstract
    - 0x02 - set if the element was declared to be 'const'
    - 0x04 - set if the element was declared to be 'final'
    - 0x08 - set if the element is a static member of a class or is a top-level function or field
    - 0x10 - set if the element is private
    - 0x20 - set if the element is deprecated
  parameters: String (optional)

    The parameter list for the element. If the element is not a method or function this field will not be defined. If the element doesn't have parameters (e.g. getter), this field will not be defined. If the element has zero parameters, this field will have a value of "()".

  returnType: String (optional)

    The return type of the element. If the element is not a method or function this field will not be defined. If the element does not have a declared return type, this field will contain an empty string.

  typeParameters: String (optional)

    The type parameter list for the element. If the element doesn't have type parameters, this field will not be defined.

  aliasedType: String (optional)

    If the element is a type alias, this field is the aliased type. Otherwise this field will not be defined.

  extendedType: String (optional)

    If the element is an extension, this field is the name of the type that is extended. This can be useful to show in UIs for unnamed extension, for example "extension on {extendedType}". This field might not be defined even for an extension in the case of invalid code.

ElementDeclaration: object

  A declaration - top-level (class, field, etc) or a class member (method, field, etc).

  name: String

    The name of the declaration.

  kind: ElementKind

    The kind of the element that corresponds to the declaration.

  fileIndex: int

    The index of the file (in the enclosing response).

  offset: int

    The offset of the declaration name in the file.

  line: int

    The one-based index of the line containing the declaration name.

  column: int

    The one-based index of the column containing the declaration name.

  codeOffset: int

    The offset of the first character of the declaration code in the file.

  codeLength: int

    The length of the declaration code in the file.

  className: String (optional)

    The name of the class enclosing this declaration. If the declaration is not a class member, this field will be absent.

  mixinName: String (optional)

    The name of the mixin enclosing this declaration. If the declaration is not a mixin member, this field will be absent.

  parameters: String (optional)

    The parameter list for the element. If the element is not a method or function this field will not be defined. If the element doesn't have parameters (e.g. getter), this field will not be defined. If the element has zero parameters, this field will have a value of "()". The value should not be treated as exact presentation of parameters, it is just approximation of parameters to give the user general idea.

ElementKind: String

  An enumeration of the kinds of elements.

  CLASS
  CLASS_TYPE_ALIAS
  COMPILATION_UNIT
  CONSTRUCTOR
  CONSTRUCTOR_INVOCATION
  ENUM
  ENUM_CONSTANT
  EXTENSION
  EXTENSION_TYPE
  FIELD
  FILE
  FUNCTION
  FUNCTION_INVOCATION
  FUNCTION_TYPE_ALIAS
  GETTER
  LABEL
  LIBRARY
  LOCAL_VARIABLE
  METHOD
  MIXIN
  PARAMETER
  PREFIX
  SETTER
  TOP_LEVEL_VARIABLE
  TYPE_ALIAS
  TYPE_PARAMETER
  UNIT_TEST_GROUP
  UNIT_TEST_TEST
  UNKNOWN
ExecutableFile: object

  A description of an executable file.

  file: FilePath

    The path of the executable file.

  kind: ExecutableKind

    The kind of the executable file.

ExecutableKind: String

  An enumeration of the kinds of executable files.

  CLIENT
  EITHER
  NOT_EXECUTABLE
  SERVER
ExecutionContextId: String

  The identifier for a execution context.

ExecutionService: String

  An enumeration of the services provided by the execution domain.

  LAUNCH_DATA
ExistingImport: object

  Information about an existing import, with elements that it provides.

  uri: int

    The URI of the imported library. It is an index in the `strings` field, in the enclosing `ExistingImports` and its `ImportedElementSet` object.

  elements: List<int>

    The list of indexes of elements, in the enclosing `ExistingImports` object.

ExistingImports: object

  Information about all existing imports in a library.

  elements: ImportedElementSet

    The set of all unique imported elements for all imports.

  imports: List<ExistingImport>

    The list of imports in the library.

FileKind: String

  An enumeration of the kinds of files.

  LIBRARY
  PART
FilePath: String

  The absolute, normalized path of a file.

  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 `INVALID_FILE_PATH_FORMAT` will be generated.

FixDescription: object

  The description of a registered fix.

  id: String

    The ID.

  message: String

    The message that is presented to the user, to carry out this fix.

  codes: List<String>

    The IDs of the diagnostic codes with which this fix was registered.

FlutterOutline: object

  An node in the Flutter specific outline structure of a file.

  kind: FlutterOutlineKind

    The kind of the node.

  offset: int

    The offset of the first character of the element. This is different than the offset in the Element, which is the offset of the name of the element. It can be used, for example, to map locations in the file back to an outline.

  length: int

    The length of the element.

  codeOffset: int

    The offset of the first character of the element code, which is neither documentation, nor annotation.

  codeLength: int

    The length of the element code.

  label: String (optional)

    The text label of the node children of the node. It is provided for any FlutterOutlineKind.GENERIC node, where better information is not available.

  dartElement: Element (optional)

    If this node is a Dart element, the description of it; omitted otherwise.

  attributes: List<FlutterOutlineAttribute> (optional)

    Additional attributes for this node, which might be interesting to display on the client. These attributes are usually arguments for the instance creation or the invocation that created the widget.

  className: String (optional)

    If the node creates a new class instance, or a reference to an instance, this field has the name of the class.

  parentAssociationLabel: String (optional)

    A short text description how this node is associated with the parent node. For example "appBar" or "body" in Scaffold.

  variableName: String (optional)

    If FlutterOutlineKind.VARIABLE, the name of the variable.

  children: List<FlutterOutline> (optional)

    The children of the node. The field will be omitted if the node has no children.

FlutterOutlineAttribute: object

  An attribute for a FlutterOutline.

  name: String

    The name of the attribute.

  label: String

    The label of the attribute value, usually the Dart code. It might be quite long, the client should abbreviate as needed.

  literalValueBoolean: bool (optional)

    The boolean literal value of the attribute. This field is absent if the value is not a boolean literal.

  literalValueInteger: int (optional)

    The integer literal value of the attribute. This field is absent if the value is not an integer literal.

  literalValueString: String (optional)

    The string literal value of the attribute. This field is absent if the value is not a string literal.

  nameLocation: Location (optional)

    If the attribute is a named argument, the location of the name, without the colon.

  valueLocation: Location (optional)

    The location of the value.

    This field is always available, but marked optional for backward compatibility between new clients with older servers.

FlutterOutlineKind: String

  An enumeration of the kinds of FlutterOutline elements. The list of kinds might be expanded with time, clients must be able to handle new kinds in some general way.

  DART_ELEMENT

    A dart element declaration.

  GENERIC

    A generic Flutter element, without additional information.

  NEW_INSTANCE

    A new instance creation.

  INVOCATION

    An invocation of a method, a top-level function, a function expression, etc.

  VARIABLE

    A reference to a local variable, or a field.

  PLACEHOLDER

    The parent node has a required Widget. The node works as a placeholder child to drop a new Widget to.

FlutterService: String

  An enumeration of the services provided by the flutter domain that are related to a specific list of files.

  OUTLINE
FlutterWidgetProperty: object

  A property of a Flutter widget.

  documentation: String (optional)

    The documentation of the property to show to the user. Omitted if the server does not know the documentation, e.g. because the corresponding field is not documented.

  expression: String (optional)

    If the value of this property is set, the Dart code of the expression of this property.

  id: int

    The unique identifier of the property, must be passed back to the server when updating the property value. Identifiers become invalid on any source code change.

  isRequired: bool

    True if the property is required, e.g. because it corresponds to a required parameter of a constructor.

  isSafeToUpdate: bool

    If the property expression is a concrete value (e.g. a literal, or an enum constant), then it is safe to replace the expression with another concrete value. In this case this field is true. Otherwise, for example when the expression is a reference to a field, so that its value is provided from outside, this field is false.

  name: String

    The name of the property to display to the user.

  children: List<FlutterWidgetProperty> (optional)

    The list of children properties, if any. For example any property of type `EdgeInsets` will have four children properties of type `double` - left / top / right / bottom.

  editor: FlutterWidgetPropertyEditor (optional)

    The editor that should be used by the client. This field is omitted if the server does not know the editor for this property, for example because it does not have one of the supported types.

  value: FlutterWidgetPropertyValue (optional)

    If the expression is set, and the server knows the value of the expression, this field is set.

FlutterWidgetPropertyEditor: object

  An editor for a property of a Flutter widget.

  kind: FlutterWidgetPropertyEditorKind
  enumItems: List<FlutterWidgetPropertyValueEnumItem> (optional)
FlutterWidgetPropertyEditorKind: String

  An enumeration of the kinds of property editors.

  BOOL

    The editor for a property of type `bool`.

  DOUBLE

    The editor for a property of the type `double`.

  ENUM

    The editor for choosing an item of an enumeration, see the `enumItems` field of `FlutterWidgetPropertyEditor`.

  ENUM_LIKE

    The editor for either choosing a pre-defined item from a list of provided static field references (like `ENUM`), or specifying a free-form expression.

  INT

    The editor for a property of type `int`.

  STRING

    The editor for a property of the type `String`.

FlutterWidgetPropertyValue: object

  A value of a property of a Flutter widget.

  boolValue: bool (optional)
  doubleValue: double (optional)
  intValue: int (optional)
  stringValue: String (optional)
  enumValue: FlutterWidgetPropertyValueEnumItem (optional)
  expression: String (optional)

    A free-form expression, which will be used as the value as is.

FlutterWidgetPropertyValueEnumItem: object

  An item of an enumeration in a general sense - actual `enum` value, or a static field in a class.

  libraryUri: String

    The URI of the library containing the `className`. When the enum item is passed back, this will allow the server to import the corresponding library if necessary.

  className: String

    The name of the class or enum.

  name: String

    The name of the field in the enumeration, or the static field in the class.

  documentation: String (optional)

    The documentation to show to the user. Omitted if the server does not know the documentation, e.g. because the corresponding field is not documented.

FoldingKind: String

  An enumeration of the kinds of folding regions.

  ANNOTATIONS
  BLOCK
  CLASS_BODY
  COMMENT
  DIRECTIVES
  DOCUMENTATION_COMMENT
  FILE_HEADER
  FUNCTION_BODY
  INVOCATION
  LITERAL
  PARAMETERS
FoldingRegion: object

  A description of a region that can be folded.

  kind: FoldingKind

    The kind of the region.

  offset: int

    The offset of the region to be folded.

  length: int

    The length of the region to be folded.

GeneralAnalysisService: String

  An enumeration of the services provided by the analysis domain that are general in nature (that is, are not specific to some list of files).

  ANALYZED_FILES
HighlightRegion: object

  A description of a region that could have special highlighting associated with it.

  type: HighlightRegionType

    The type of highlight associated with the region.

  offset: int

    The offset of the region to be highlighted.

  length: int

    The length of the region to be highlighted.

HighlightRegionType: String

  An enumeration of the kinds of highlighting that can be applied to files.

  ANNOTATION
  BUILT_IN

    Deprecated - no longer sent, KEYWORD used instead.

  CLASS
  COMMENT_BLOCK
  COMMENT_DOCUMENTATION
  COMMENT_END_OF_LINE
  CONSTRUCTOR
  CONSTRUCTOR_TEAR_OFF
  DIRECTIVE
  DYNAMIC_TYPE

    Deprecated - no longer sent.

  DYNAMIC_LOCAL_VARIABLE_DECLARATION
  DYNAMIC_LOCAL_VARIABLE_REFERENCE
  DYNAMIC_PARAMETER_DECLARATION
  DYNAMIC_PARAMETER_REFERENCE
  ENUM
  ENUM_CONSTANT
  EXTENSION
  EXTENSION_TYPE
  FIELD

    Deprecated - no longer sent.

  FIELD_STATIC

    Deprecated - no longer sent.

  FUNCTION

    Deprecated - no longer sent.

  FUNCTION_DECLARATION

    Deprecated - no longer sent.

  FUNCTION_TYPE_ALIAS
  GETTER_DECLARATION

    Deprecated - no longer sent.

  IDENTIFIER_DEFAULT
  IMPORT_PREFIX
  INSTANCE_FIELD_DECLARATION
  INSTANCE_FIELD_REFERENCE
  INSTANCE_GETTER_DECLARATION
  INSTANCE_GETTER_REFERENCE
  INSTANCE_METHOD_DECLARATION
  INSTANCE_METHOD_REFERENCE
  INSTANCE_METHOD_TEAR_OFF
  INSTANCE_SETTER_DECLARATION
  INSTANCE_SETTER_REFERENCE
  INVALID_STRING_ESCAPE
  KEYWORD
  LABEL
  LIBRARY_NAME
  LITERAL_BOOLEAN
  LITERAL_DOUBLE
  LITERAL_INTEGER
  LITERAL_LIST
  LITERAL_MAP
  LITERAL_RECORD
  LITERAL_STRING
  LOCAL_FUNCTION_DECLARATION
  LOCAL_FUNCTION_REFERENCE
  LOCAL_FUNCTION_TEAR_OFF
  LOCAL_VARIABLE

    Deprecated - no longer sent.

  LOCAL_VARIABLE_DECLARATION
  LOCAL_VARIABLE_REFERENCE
  METHOD

    Deprecated - no longer sent.

  METHOD_DECLARATION

    Deprecated - no longer sent.

  METHOD_DECLARATION_STATIC

    Deprecated - no longer sent.

  METHOD_STATIC

    Deprecated - no longer sent.

  MIXIN
  PARAMETER

    Deprecated - no longer sent.

  SETTER_DECLARATION

    Deprecated - no longer sent.

  TOP_LEVEL_VARIABLE

    Deprecated - no longer sent.

  PARAMETER_DECLARATION
  PARAMETER_REFERENCE
  STATIC_FIELD_DECLARATION
  STATIC_GETTER_DECLARATION
  STATIC_GETTER_REFERENCE
  STATIC_METHOD_DECLARATION
  STATIC_METHOD_REFERENCE
  STATIC_METHOD_TEAR_OFF
  STATIC_SETTER_DECLARATION
  STATIC_SETTER_REFERENCE
  TOP_LEVEL_FUNCTION_DECLARATION
  TOP_LEVEL_FUNCTION_REFERENCE
  TOP_LEVEL_FUNCTION_TEAR_OFF
  TOP_LEVEL_GETTER_DECLARATION
  TOP_LEVEL_GETTER_REFERENCE
  TOP_LEVEL_SETTER_DECLARATION
  TOP_LEVEL_SETTER_REFERENCE
  TOP_LEVEL_VARIABLE_DECLARATION
  TYPE_ALIAS
  TYPE_NAME_DYNAMIC
  TYPE_PARAMETER
  UNRESOLVED_INSTANCE_MEMBER_REFERENCE
  VALID_STRING_ESCAPE
HoverInformation: object

  The hover information associated with a specific location.

  offset: int

    The offset of the range of characters that encompasses the cursor position and has the same hover information as the cursor position.

  length: int

    The length of the range of characters that encompasses the cursor position and has the same hover information as the cursor position.

  containingLibraryPath: String (optional)

    The path to the defining compilation unit of the library in which the referenced element is declared. This data is omitted if there is no referenced element, or if the element is declared inside an HTML file.

  containingLibraryName: String (optional)

    The URI of the containing library, examples here include "dart:core", "package:.." and file uris represented by the path on disk, "/..". The data is omitted if the element is declared inside an HTML file.

  containingClassDescription: String (optional)

    A human-readable description of the class declaring the element being referenced. This data is omitted if there is no referenced element, or if the element is not a class member.

  dartdoc: String (optional)

    The dartdoc associated with the referenced element. Other than the removal of the comment delimiters, including leading asterisks in the case of a block comment, the dartdoc is unprocessed markdown. This data is omitted if there is no referenced element, or if the element has no dartdoc.

  elementDescription: String (optional)

    A human-readable description of the element being referenced. This data is omitted if there is no referenced element.

  elementKind: String (optional)

    A human-readable description of the kind of element being referenced (such as "class" or "function type alias"). This data is omitted if there is no referenced element.

  isDeprecated: bool (optional)

    True if the referenced element is deprecated.

  parameter: String (optional)

    A human-readable description of the parameter corresponding to the expression being hovered over. This data is omitted if the location is not in an argument to a function.

  propagatedType: String (optional)

    The name of the propagated type of the expression. This data is omitted if the location does not correspond to an expression or if there is no propagated type information.

  staticType: String (optional)

    The name of the static type of the expression. This data is omitted if the location does not correspond to an expression.

ImplementedClass: object

  A description of a class that is implemented or extended.

  offset: int

    The offset of the name of the implemented class.

  length: int

    The length of the name of the implemented class.

ImplementedMember: object

  A description of a class member that is implemented or overridden.

  offset: int

    The offset of the name of the implemented member.

  length: int

    The length of the name of the implemented member.

ImportedElementSet: object

  The set of top-level elements encoded as pairs of the defining library URI and the name, and stored in the parallel lists `elementUris` and `elementNames`.

  strings: List<String>

    The list of unique strings in this object.

  uris: List<int>

    The library URI part of the element. It is an index in the `strings` field.

  names: List<int>

    The name part of a the element. It is an index in the `strings` field.

ImportedElements: object

  A description of the elements that are referenced in a region of a file that come from a single imported library.

  path: FilePath

    The absolute and normalized path of the file containing the library.

  prefix: String

    The prefix that was used when importing the library into the original source.

  elements: List<String>

    The names of the elements imported from the library.

LibraryPathSet: object

  A list of associations between paths and the libraries that should be included for code completion when editing a file beneath that path.

  scope: FilePath

    The filepath for which this request's libraries should be active in completion suggestions. This object associates filesystem regions to libraries and library directories of interest to the client.

  libraryPaths: List<FilePath>

    The paths of the libraries of interest to the client for completion suggestions.

LinkedEditGroup: object

  A collection of positions that should be linked (edited simultaneously) for the purposes of updating code after a source change. For example, if a set of edits introduced a new variable name, the group would contain all of the positions of the variable name so that if the client wanted to let the user edit the variable name after the operation, all occurrences of the name could be edited simultaneously.

  Edit groups may have a length of 0 and function as tabstops where there is no default text, for example, an edit that inserts an `if` statement might provide an empty group between parens where a condition should be typed. For this reason, it's also valid for a group to contain only a single position that is not linked to others.

  positions: List<Position>

    The positions of the regions (after applying the relevant edits) that should be edited simultaneously.

  length: int

    The length of the regions that should be edited simultaneously.

  suggestions: List<LinkedEditSuggestion>

    Pre-computed suggestions for what every region might want to be changed to.

LinkedEditSuggestion: object

  A suggestion of a value that could be used to replace all of the linked edit regions in a LinkedEditGroup.

  value: String

    The value that could be used to replace all of the linked edit regions.

  kind: LinkedEditSuggestionKind

    The kind of value being proposed.

LinkedEditSuggestionKind: String

  An enumeration of the kind of values that can be suggested for a linked edit.

  METHOD
  PARAMETER
  TYPE
  VARIABLE
Location: object

  A location (character range) within a file.

  file: FilePath

    The file containing the range.

  offset: int

    The offset of the range.

  length: int

    The length of the range.

  startLine: int

    The one-based index of the line containing the first character of the range.

  startColumn: int

    The one-based index of the column containing the first character of the range.

  endLine: int (optional)

    The one-based index of the line containing the character immediately following the range.

  endColumn: int (optional)

    The one-based index of the column containing the character immediately following the range.

MessageAction: object

  An action associated with a message that the server is requesting the client to display to the user.

  label: String

    The label of the button to be displayed, and the value to be returned to the server if the button is clicked.

MessageType: String

  The type of a message that the server is requesting the client to display to the user. The type can be used by the client to control the way in which the message is displayed.

  ERROR

    The message is an error message.

  WARNING

    The message is a warning message.

  INFO

    The message is an informational message.

  LOG

    The message is a log message.

NavigationRegion: object

  A description of a region from which the user can navigate to the declaration of an element.

  offset: int

    The offset of the region from which the user can navigate.

  length: int

    The length of the region from which the user can navigate.

  targets: List<int>

    The indexes of the targets (in the enclosing navigation response) to which the given region is bound. By opening the target, clients can implement one form of navigation. This list cannot be empty.

NavigationTarget: object

  A description of a target to which the user can navigate.

  kind: ElementKind

    The kind of the element.

  fileIndex: int

    The index of the file (in the enclosing navigation response) to navigate to.

  offset: int

    The offset of the name of the target to which the user can navigate.

  length: int

    The length of the name of the target to which the user can navigate.

  startLine: int

    The one-based index of the line containing the first character of the name of the target.

  startColumn: int

    The one-based index of the column containing the first character of the name of the target.

  codeOffset: int (optional)

    The offset of the target code to which the user can navigate.

  codeLength: int (optional)

    The length of the target code to which the user can navigate.

Occurrences: object

  A description of the references to a single element within a single file.

  element: Element

    The element that was referenced.

  offsets: List<int>

    The offsets of the name of the referenced element within the file.

  length: int

    The length of the name of the referenced element.

Outline: object

  An node in the outline structure of a file.

  element: Element

    A description of the element represented by this node.

  offset: int

    The offset of the first character of the element. This is different than the offset in the Element, which is the offset of the name of the element. It can be used, for example, to map locations in the file back to an outline.

  length: int

    The length of the element.

  codeOffset: int

    The offset of the first character of the element code, which is neither documentation, nor annotation.

  codeLength: int

    The length of the element code.

  children: List<Outline> (optional)

    The children of the node. The field will be omitted if the node has no children. Children are sorted by offset.

OverriddenMember: object

  A description of a member that is being overridden.

  element: Element

    The element that is being overridden.

  className: String

    The name of the class in which the member is defined.

Override: object

  A description of a member that overrides an inherited member.

  offset: int

    The offset of the name of the overriding member.

  length: int

    The length of the name of the overriding member.

  superclassMember: OverriddenMember (optional)

    The member inherited from a superclass that is overridden by the overriding member. The field is omitted if there is no superclass member, in which case there must be at least one interface member.

  interfaceMembers: List<OverriddenMember> (optional)

    The members inherited from interfaces that are overridden by the overriding member. The field is omitted if there are no interface members, in which case there must be a superclass member.

PluginDetails: object

  The details of an active plugin.

  name: String

    The name of the plugin.

  lintRules: List<String>

    A list of the IDs of the analysis rules which have been registered as lint rules.

  warningRules: List<String>

    A list of the IDs of the analysis rules which have been registered as warning rules.

  assists: List<AssistDescription>

    A list of the descriptions of registered assists.

  fixes: List<FixDescription>

    A list of the descriptions of registered fixes.

PluginPrint: object

  A message printed from a plugin with 'print'.

  pluginName: String

    The name of the plugin which called 'print'.

  message: String

    The message which has been printed.

  timestamp: int

    The timestamp, in milliseconds since the epoch, of when the message was requested to be printed.

Position: object

  A position within a file.

  file: FilePath

    The file containing the position.

  offset: int

    The offset of the position.

PostfixTemplateDescriptor: object

  The description of a postfix completion template.

  name: String

    The template name, shown in the UI.

  key: String

    The unique template key, not shown in the UI.

  example: String

    A short example of the transformation performed when the template is applied.

PubStatus: object

  An indication of the current state of pub execution.

  isListingPackageDirs: bool

    True if the server is currently running pub to produce a list of package directories.

RefactoringFeedback: object

  An abstract superclass of all refactoring feedbacks.

RefactoringKind: String

  An enumeration of the kinds of refactorings that can be created.

  CONVERT_GETTER_TO_METHOD
  CONVERT_METHOD_TO_GETTER
  EXTRACT_LOCAL_VARIABLE
  EXTRACT_METHOD
  EXTRACT_WIDGET
  INLINE_LOCAL_VARIABLE
  INLINE_METHOD
  MOVE_FILE
  RENAME
RefactoringMethodParameter: object

  A description of a parameter in a method refactoring.

  id: String (optional)

    The unique identifier of the parameter. Clients may omit this field for the parameters they want to add.

  kind: RefactoringMethodParameterKind

    The kind of the parameter.

  type: String

    The type that should be given to the parameter, or the return type of the parameter's function type.

  name: String

    The name that should be given to the parameter.

  parameters: String (optional)

    The parameter list of the parameter's function type. If the parameter is not of a function type, this field will not be defined. If the function type has zero parameters, this field will have a value of '()'.

RefactoringMethodParameterKind: String

  An enumeration of the kinds of parameters.

  REQUIRED
  POSITIONAL
  NAMED
RefactoringOptions: object

  An abstract superclass of all refactoring options.

RefactoringProblem: object

  A description of a problem related to a refactoring.

  severity: RefactoringProblemSeverity

    The severity of the problem being represented.

  message: String

    A human-readable description of the problem being represented.

  location: Location (optional)

    The location of the problem being represented. This field is omitted unless there is a specific location associated with the problem (such as a location where an element being renamed will be shadowed).

RefactoringProblemSeverity: String

  An enumeration of the severities of problems that can be returned by the refactoring requests.

  INFO

    A minor code problem. No example, because it is not used yet.

  WARNING

    A minor code problem. For example names of local variables should be camel case and start with a lower case letter. Staring the name of a variable with an upper case is OK from the language point of view, but it is nice to warn the user.

  ERROR

    The refactoring technically can be performed, but there is a logical problem. For example the name of a local variable being extracted conflicts with another name in the scope, or duplicate parameter names in the method being extracted, or a conflict between a parameter name and a local variable, etc. In some cases the location of the problem is also provided, so the IDE can show user the location and the problem, and let the user decide whether they want to perform the refactoring. For example the name conflict might be expected, and the user wants to fix it afterwards.

  FATAL

    A fatal error, which prevents performing the refactoring. For example the name of a local variable being extracted is not a valid identifier, or selection is not a valid expression.

RemoveContentOverlay: object

  A directive to remove an existing file content overlay. After processing this directive, the file contents will once again be read from the file system.

  If this directive is used on a file that doesn't currently have a content overlay, it has no effect.

  type = "remove"
RequestError: object

  An indication of a problem with the execution of the server, typically in response to a request.

  code: RequestErrorCode

    A code that uniquely identifies the error that occurred.

  message: String

    A short description of the error.

  stackTrace: String (optional)

    The stack trace associated with processing the request, used for debugging the server.

RequestErrorCode: String

  An enumeration of the types of errors that can occur in the execution of the server.

  CONTENT_MODIFIED

    An "analysis.getErrors" or "analysis.getNavigation" request could not be satisfied because the content of the file changed before the requested results could be computed.

  DEBUG_PORT_COULD_NOT_BE_OPENED

    The server was unable to open a port for the diagnostic server.

  FILE_NOT_ANALYZED

    A request specified a FilePath which does not match a file in an analysis root, or the requested operation is not available for the file.

  FLUTTER_GET_WIDGET_DESCRIPTION_CONTENT_MODIFIED

    A file was change while widget descriptions were being computed.

  FLUTTER_GET_WIDGET_DESCRIPTION_NO_WIDGET

    The given location does not have a supported widget.

  FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_EXPRESSION

    The given property expression is invalid, e.g. has a syntax error.

  FLUTTER_SET_WIDGET_PROPERTY_VALUE_INVALID_ID

    The given property identifier is not valid. It might have never been valid, or a change to code invalidated it, or its TTL was exceeded.

  FLUTTER_SET_WIDGET_PROPERTY_VALUE_IS_REQUIRED

    The value of the property cannot be removed, for example because the corresponding constructor argument is required, and the server does not know what default value to use.

  FORMAT_INVALID_FILE

    An "edit.format" request specified a FilePath which does not match a Dart file in an analysis root.

  FORMAT_WITH_ERRORS

    An "edit.format" request specified a file that contains syntax errors.

  GET_ERRORS_INVALID_FILE

    An "analysis.getErrors" request specified a FilePath which does not match a file currently subject to analysis.

  GET_FIXES_INVALID_FILE

    An "edit.getFixes" request specified a FilePath which does not match a file currently subject to analysis.

  GET_IMPORTED_ELEMENTS_INVALID_FILE

    An "analysis.getImportedElements" request specified a FilePath that does not match a file currently subject to analysis.

  GET_NAVIGATION_INVALID_FILE

    An "analysis.getNavigation" request specified a FilePath which does not match a file currently subject to analysis.

  GET_REACHABLE_SOURCES_INVALID_FILE

    An "analysis.getReachableSources" request specified a FilePath which does not match a file currently subject to analysis.

  GET_SIGNATURE_INVALID_FILE

    An "analysis.getSignature" request specified a FilePath which does not match a file currently subject to analysis.

  GET_SIGNATURE_INVALID_OFFSET

    An "analysis.getSignature" request specified an offset which is not a valid location within for the contents of the file specified FilePath.

  GET_SIGNATURE_UNKNOWN_FUNCTION

    An "analysis.getSignature" request specified an offset that could not be matched to a function call.

  IMPORT_ELEMENTS_INVALID_FILE

    An "edit.importElements" request specified a FilePath that does not match a file currently subject to analysis.

  INVALID_ANALYSIS_ROOT

    A path passed as an argument to a request (such as analysis.reanalyze) is required to be an analysis root, but isn't.

  INVALID_EXECUTION_CONTEXT

    The context root used to create an execution context does not exist.

  INVALID_FILE_PATH_FORMAT

    The format of the given file path is invalid, e.g. is not absolute and normalized.

  INVALID_OVERLAY_CHANGE

    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.

  INVALID_PARAMETER

    One of the method parameters was invalid.

  INVALID_REQUEST

    A malformed request was received.

  ORGANIZE_DIRECTIVES_ERROR

    An "edit.organizeDirectives" request specified a Dart file that cannot be analyzed. The reason is described in the message.

  REFACTORING_REQUEST_CANCELLED

    Another refactoring request was received during processing of this one.

  SERVER_ALREADY_STARTED

    The analysis server has already been started (and hence won't accept new connections).

    This error is included for future expansion; at present the analysis server can only speak to one client at a time so this error will never occur.

  SERVER_ERROR

    An internal error occurred in the analysis server. Also see the server.error notification.

  SORT_MEMBERS_INVALID_FILE

    An "edit.sortMembers" request specified a FilePath which does not match a Dart file in an analysis root.

  SORT_MEMBERS_PARSE_ERRORS

    An "edit.sortMembers" request specified a Dart file that has scan or parse errors.

  UNKNOWN_REQUEST

    A request was received which the analysis server does not recognize, or cannot handle in its current configuration.

  UNSUPPORTED_FEATURE

    The analysis server was requested to perform an action which is not supported.

    This is a legacy error; it will be removed before the API reaches version 1.0.

RuntimeCompletionExpression: object

  An expression for which we want to know its runtime type. In expressions like 'a.b.c.where((e) => e.^)' we want to know the runtime type of 'a.b.c' to enforce it statically at the time when we compute completion suggestions, and get better type for 'e'.

  offset: int

    The offset of the expression in the code for completion.

  length: int

    The length of the expression in the code for completion.

  type: RuntimeCompletionExpressionType (optional)

    When the expression is sent from the server to the client, the type is omitted. The client should fill the type when it sends the request to the server again.

RuntimeCompletionExpressionType: object

  A type at runtime.

  libraryPath: FilePath (optional)

    The path of the library that has this type. Omitted if the type is not declared in any library, e.g. "dynamic", or "void".

  kind: RuntimeCompletionExpressionTypeKind

    The kind of the type.

  name: String (optional)

    The name of the type. Omitted if the type does not have a name, e.g. an inline function type.

  typeArguments: List<RuntimeCompletionExpressionType> (optional)

    The type arguments of the type. Omitted if the type does not have type parameters.

  returnType: RuntimeCompletionExpressionType (optional)

    If the type is a function type, the return type of the function. Omitted if the type is not a function type.

  parameterTypes: List<RuntimeCompletionExpressionType> (optional)

    If the type is a function type, the types of the function parameters of all kinds - required, optional positional, and optional named. Omitted if the type is not a function type.

  parameterNames: List<String> (optional)

    If the type is a function type, the names of the function parameters of all kinds - required, optional positional, and optional named. The names of positional parameters are empty strings. Omitted if the type is not a function type.

RuntimeCompletionExpressionTypeKind: String

  An enumeration of the kinds of runtime expression types.

  DYNAMIC
  FUNCTION
  INTERFACE
RuntimeCompletionVariable: object

  A variable in a runtime context.

  name: String

    The name of the variable. The name "this" has a special meaning and is used as an implicit target for runtime completion, and in explicit "this" references.

  type: RuntimeCompletionExpressionType

    The type of the variable.

SearchId: String

  An identifier used to associate search results with a search request.

SearchResult: object

  A single result from a search request.

  location: Location

    The location of the code that matched the search criteria.

  kind: SearchResultKind

    The kind of element that was found or the kind of reference that was found.

  isPotential: bool

    True if the result is a potential match but cannot be confirmed to be a match. For example, if all references to a method m defined in some class were requested, and a reference to a method m from an unknown class were found, it would be marked as being a potential match.

  path: List<Element>

    The elements that contain the result, starting with the most immediately enclosing ancestor and ending with the library.

SearchResultKind: String

  An enumeration of the kinds of search results returned by the search domain.

  DECLARATION

    The declaration of an element.

  INVOCATION

    The invocation of a function or method.

  READ

    A reference to a field, parameter or variable where it is being read.

  READ_WRITE

    A reference to a field, parameter or variable where it is being read and written.

  REFERENCE

    A reference to an element.

  UNKNOWN

    Some other kind of search result.

  WRITE

    A reference to a field, parameter or variable where it is being written.

ServerService: String

  An enumeration of the services provided by the server domain.

  LOG
  STATUS
SourceChange: object

  A description of a set of edits that implement a single conceptual change.

  message: String

    A human-readable description of the change to be applied.

    If this change includes multiple edits made for different reasons (such as during a bulk fix operation), the individual items in `edits` may contain more specific descriptions.

  edits: List<SourceFileEdit>

    A list of the edits used to effect the change, grouped by file.

  linkedEditGroups: List<LinkedEditGroup>

    A list of the linked editing groups used to customize the changes that were made.

  selection: Position (optional)

    The position that should be selected after the edits have been applied.

  selectionLength: int (optional)

    The length of the selection (starting at Position) that should be selected after the edits have been applied.

  id: String (optional)

    The optional identifier of the change kind. The identifier remains stable even if the message changes, or is parameterized.

SourceEdit: object

  A description of a single change to a single file.

  offset: int

    The offset of the region to be modified.

  length: int

    The length of the region to be modified.

  replacement: String

    The code that is to replace the specified region in the original code.

  id: String (optional)

    An identifier that uniquely identifies this source edit from other edits in the same response. This field is omitted unless a containing structure needs to be able to identify the edit for some reason.

    For example, some refactoring operations can produce edits that might not be appropriate (referred to as potential edits). Such edits will have an id so that they can be referenced. Edits in the same response that do not need to be referenced will not have an id.

  description: String (optional)

    A human readable description of the change made by this edit.

    This description should be short and suitable to use as a heading with changes grouped by it. For example, a change made as part of a quick-fix may use the message "Replace final with var", allowing multiple changes and multiple applications of the fix to be grouped together.

    This value may be more specific than any value in an enclosing `SourceChange.message` which could contain edits made for different reasons (such as during a bulk fix operation).

SourceFileEdit: object

  A description of a set of changes to a single file.

  file: FilePath

    The file containing the code to be modified.

  fileStamp: long

    The modification stamp of the file at the moment when the change was created, in milliseconds since the "Unix epoch". Will be -1 if the file did not exist and should be created. The client may use this field to make sure that the file was not changed since then, so it is safe to apply the change.

  edits: List<SourceEdit>

    A list of the edits used to effect the change.

TypeHierarchyItem: object

  A representation of a class in a type hierarchy.

  classElement: Element

    The class element represented by this item.

  displayName: String (optional)

    The name to be displayed for the class. This field will be omitted if the display name is the same as the name of the element. The display name is different if there is additional type information to be displayed, such as type arguments.

  memberElement: Element (optional)

    The member in the class corresponding to the member on which the hierarchy was requested. This field will be omitted if the hierarchy was not requested for a member or if the class does not have a corresponding member.

  superclass: int (optional)

    The index of the item representing the superclass of this class. This field will be omitted if this item represents the class Object.

  interfaces: List<int>

    The indexes of the items representing the interfaces implemented by this class. The list will be empty if there are no implemented interfaces.

  mixins: List<int>

    The indexes of the items representing the mixins referenced by this class. The list will be empty if there are no classes mixed into this class.

  subclasses: List<int>

    The indexes of the items representing the subtypes of this class. The list will be empty if there are no subtypes or if this item represents a supertype of the pivot type.

## Refactorings

This section contains additional information for each kind of refactoring. In addition to a brief description of the refactoring, there is a specification of the feedback that is provided when a refactoring is requested using the edit.getRefactoring request (designed to improve the UX) and the options that may be provided to edit.getRefactoring.

CONVERT_GETTER_TO_METHOD

  Convert a getter into a method by removing the keyword get and adding an empty parameter list.

  It is an error if the range contains anything other than all or part of the name of a single getter.

  #### Feedback:

  none

  #### Options:

  none

CONVERT_METHOD_TO_GETTER

  Convert a method into a getter by adding the keyword get and removing the parameter list.

  It is an error if the range contains anything other than all or part of the name of a single method or if the method has a non-empty parameter list.

  #### Feedback:

  none

  #### Options:

  none

EXTRACT_LOCAL_VARIABLE

  Create a local variable initialized by the expression that covers the specified selection.

  It is an error if the selection range is not covered by a complete expression.

  #### Feedback:

  coveringExpressionOffsets: List<int> (optional)

    The offsets of the expressions that cover the specified selection, from the down most to the up most.

  coveringExpressionLengths: List<int> (optional)

    The lengths of the expressions that cover the specified selection, from the down most to the up most.

  names: List<String>

    The proposed names for the local variable.

  offsets: List<int>

    The offsets of the expressions that would be replaced by a reference to the variable.

  lengths: List<int>

    The lengths of the expressions that would be replaced by a reference to the variable. The lengths correspond to the offsets. In other words, for a given expression, if the offset of that expression is `offsets[i]`, then the length of that expression is `lengths[i]`.

  #### Options:

  name: String

    The name that the local variable should be given.

  extractAll: bool

    True if all occurrences of the expression within the scope in which the variable will be defined should be replaced by a reference to the local variable. The expression used to initiate the refactoring will always be replaced.

EXTRACT_METHOD

  Create a method whose body is the specified expression or list of statements, possibly augmented with a return statement.

  It is an error if the range contains anything other than a complete expression (no partial expressions are allowed) or a complete sequence of statements.

  #### Feedback:

  offset: int

    The offset to the beginning of the expression or statements that will be extracted.

  length: int

    The length of the expression or statements that will be extracted.

  returnType: String

    The proposed return type for the method. If the returned element does not have a declared return type, this field will contain an empty string.

  names: List<String>

    The proposed names for the method.

  canCreateGetter: bool

    True if a getter could be created rather than a method.

  parameters: List<RefactoringMethodParameter>

    The proposed parameters for the method.

  offsets: List<int>

    The offsets of the expressions or statements that would be replaced by an invocation of the method.

  lengths: List<int>

    The lengths of the expressions or statements that would be replaced by an invocation of the method. The lengths correspond to the offsets. In other words, for a given expression (or block of statements), if the offset of that expression is `offsets[i]`, then the length of that expression is `lengths[i]`.

  #### Options:

  returnType: String

    The return type that should be defined for the method.

  createGetter: bool

    True if a getter should be created rather than a method. It is an error if this field is true and the list of parameters is non-empty.

  name: String

    The name that the method should be given.

  parameters: List<RefactoringMethodParameter>

    The parameters that should be defined for the method.

    It is an error if a REQUIRED or NAMED parameter follows a POSITIONAL parameter. It is an error if a REQUIRED or POSITIONAL parameter follows a NAMED parameter.

    - To change the order and/or update proposed parameters, add parameters with the same identifiers as proposed.
    - To add new parameters, omit their identifier.
    - To remove some parameters, omit them in this list.
  extractAll: bool

    True if all occurrences of the expression or statements should be replaced by an invocation of the method. The expression or statements used to initiate the refactoring will always be replaced.

EXTRACT_WIDGET

  Create a new class that extends StatelessWidget, whose build() method is the widget creation expression, or a method returning a Flutter widget, at the specified offset.

  #### Feedback:

  #### Options:

  name: String

    The name that the widget class should be given.

INLINE_LOCAL_VARIABLE

  Inline the initializer expression of a local variable in place of any references to that variable.

  It is an error if the range contains anything other than all or part of the name of a single local variable.

  #### Feedback:

  name: String

    The name of the variable being inlined.

  occurrences: int

    The number of times the variable occurs.

  #### Options:

  none

INLINE_METHOD

  Inline a method in place of one or all references to that method.

  It is an error if the range contains anything other than all or part of the name of a single method.

  #### Feedback:

  className: String (optional)

    The name of the class enclosing the method being inlined. If not a class member is being inlined, this field will be absent.

  methodName: String

    The name of the method (or function) being inlined.

  isDeclaration: bool

    True if the declaration of the method is selected. So all references should be inlined.

  #### Options:

  deleteSource: bool

    True if the method being inlined should be removed. It is an error if this field is true and inlineAll is false.

  inlineAll: bool

    True if all invocations of the method should be inlined, or false if only the invocation site used to create this refactoring should be inlined.

MOVE_FILE

  Move the given file or folder and update all of the references to and from it. The move operation is supported in general case - for renaming an item in the same folder, moving it to a different folder or both. Moving or renaming large folders may take time and clients should consider showing an indicator to the user with the ability to cancel the request (which can be done using `server.cancelRequest`).

  The refactoring must be activated before an actual file moving operation is performed.

  The "offset" and "length" fields from the request are ignored, but the file specified in the request specifies the file to be moved.

  #### Feedback:

  none

  #### Options:

  newFile: FilePath

    The new file path to which the given file is being moved.

RENAME

  Rename a given element and all of the references to that element.

  It is an error if the range contains anything other than all or part of the name of a single function (including methods, getters and setters), variable (including fields, parameters and local variables), class or function type.

  #### Feedback:

  offset: int

    The offset to the beginning of the name selected to be renamed, or -1 if the name does not exist yet.

  length: int

    The length of the name selected to be renamed.

  elementKindName: String

    The human-readable description of the kind of element being renamed (such as "class" or "function type alias").

  oldName: String

    The old name of the element before the refactoring.

  #### Options:

  newName: String

    The name that the element should have after the refactoring.

## Errors

This section contains a list of all of the errors that are produced by the server and the data that is returned with each.

TODO: TBD

## Index

### Domains

#### server (↑)

##### Requests

- getVersion
- shutdown
- setSubscriptions
- cancelRequest
- setClientCapabilities
- openUrlRequest
- showMessageRequest

##### Notifications

- connected
- error
- pluginError
- log
- status

#### analysis (↑)

##### Requests

- getErrors
- getHover
- getLibraryDependencies
- getNavigation
- getReachableSources
- reanalyze
- setAnalysisRoots
- setGeneralSubscriptions
- setPriorityFiles
- setSubscriptions
- updateContent
- updateOptions

##### Notifications

- analyzedFiles
- closingLabels
- errors
- flushResults
- folding
- highlights
- implemented
- invalidate
- navigation
- occurrences
- outline
- overrides

#### completion (↑)

##### Requests

- getSuggestions2
- registerLibraryPaths
- getSuggestionDetails2

##### Notifications

- existingImports

#### search (↑)

##### Requests

- findElementReferences
- findMemberDeclarations
- findMemberReferences
- findTopLevelDeclarations
- getTypeHierarchy

##### Notifications

- results

#### edit (↑)

##### Requests

- format
- getAssists
- getAvailableRefactorings
- getFixes
- getPostfixCompletion
- getRefactoring
- sortMembers
- organizeDirectives

#### execution (↑)

##### Requests

- createContext
- deleteContext
- getSuggestions
- mapUri
- setSubscriptions

##### Notifications

- launchData

#### diagnostic (↑)

##### Requests

- getDiagnostics
- getServerPort

#### flutter (↑)

##### Requests

- setSubscriptions

##### Notifications

- outline

### Types (↑)

- AddContentOverlay
- AnalysisError
- AnalysisErrorFixes
- AnalysisErrorSeverity
- AnalysisErrorType
- AnalysisOptions
- AnalysisService
- AnalysisStatus
- AssistDescription
- BulkFix
- BulkFixDetail
- ChangeContentOverlay
- ClosingLabel
- CompletionCaseMatchingMode
- CompletionMode
- CompletionSuggestion
- CompletionSuggestionKind
- ContextData
- DiagnosticMessage
- Element
- ElementDeclaration
- ElementKind
- ExecutableFile
- ExecutableKind
- ExecutionContextId
- ExecutionService
- ExistingImport
- ExistingImports
- FileKind
- FilePath
- FixDescription
- FlutterOutline
- FlutterOutlineAttribute
- FlutterOutlineKind
- FlutterService
- FlutterWidgetProperty
- FlutterWidgetPropertyEditor
- FlutterWidgetPropertyEditorKind
- FlutterWidgetPropertyValue
- FlutterWidgetPropertyValueEnumItem
- FoldingKind
- FoldingRegion
- GeneralAnalysisService
- HighlightRegion
- HighlightRegionType
- HoverInformation
- ImplementedClass
- ImplementedMember
- ImportedElementSet
- ImportedElements
- LibraryPathSet
- LinkedEditGroup
- LinkedEditSuggestion
- LinkedEditSuggestionKind
- Location
- MessageAction
- MessageType
- NavigationRegion
- NavigationTarget
- Occurrences
- Outline
- OverriddenMember
- Override
- PluginDetails
- PluginPrint
- Position
- PostfixTemplateDescriptor
- PubStatus
- RefactoringFeedback
- RefactoringKind
- RefactoringMethodParameter
- RefactoringMethodParameterKind
- RefactoringOptions
- RefactoringProblem
- RefactoringProblemSeverity
- RemoveContentOverlay
- RequestError
- RequestErrorCode
- RuntimeCompletionExpression
- RuntimeCompletionExpressionType
- RuntimeCompletionExpressionTypeKind
- RuntimeCompletionVariable
- SearchId
- SearchResult
- SearchResultKind
- ServerService
- SourceChange
- SourceEdit
- SourceFileEdit
- TypeHierarchyItem

### Refactorings (↑)

- CONVERT_GETTER_TO_METHOD
- CONVERT_METHOD_TO_GETTER
- EXTRACT_LOCAL_VARIABLE
- EXTRACT_METHOD
- EXTRACT_WIDGET
- INLINE_LOCAL_VARIABLE
- INLINE_METHOD
- MOVE_FILE
- RENAME