DotJoshJohnson / vscode-dotnet

A Visual Studio Code language server implementation for .NET/.NET Core.
http://dotjoshjohnson.github.io/vscode-dotnet/api-docs
MIT License
8 stars 3 forks source link

Code Lens Feature #7

Open DotJoshJohnson opened 8 years ago

DotJoshJohnson commented 8 years ago

Code Lens

The code lens request is sent from the client to the server to compute code lenses for a given text document.

Changed: in 2.0 the request uses CodeLensParams instead of a single uri.

Request

export interface CodeLensParams {
    /**
     * The document to request code lens for.
     */
    textDocument: TextDocumentIdentifier;
}

Response

/**
 * A code lens represents a command that should be shown along with
 * source text, like the number of references, a way to run tests, etc.
 *
 * A code lens is _unresolved_ when no command is associated to it. For performance
 * reasons the creation of a code lens and resolving should be done to two stages.
 */
export interface CodeLens {
    /**
     * The range in which this code lens is valid. Should only span a single line.
     */
    range: Range;

    /**
     * The command this code lens represents.
     */
    command?: Command;

    /**
     * An data entry field that is preserved on a code lens item between
     * a code lens and a code lens resolve request.
     */
    data?: any
}

The code lens resolve request is sent from the client to the server to resolve the command for a given code lens item.

Request

Response