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

Formatting Feature #8

Open DotJoshJohnson opened 8 years ago

DotJoshJohnson commented 8 years ago

Document Formatting

The document formatting request is sent from the server to the client to format a whole document.

Request

interface DocumentFormattingParams {
    /**
     * The document to format.
     */
    textDocument: TextDocumentIdentifier;

    /**
     * The format options
     */
    options: FormattingOptions;
}
/**
 * Value-object describing what options formatting should use.
 */
interface FormattingOptions {
    /**
     * Size of a tab in spaces.
     */
    tabSize: number;

    /**
     * Prefer spaces over tabs.
     */
    insertSpaces: boolean;

    /**
     * Signature for further properties.
     */
    [key: string]: boolean | number | string;
}

Response

The document range formatting request is sent from the client to the server to format a given range in a document.

Request

interface DocumentRangeFormattingParams {
    /**
     * The document to format.
     */
    textDocument: TextDocumentIdentifier;

    /**
     * The range to format
     */
    range: Range;

    /**
     * The format options
     */
    options: FormattingOptions;
}

Response

The document on type formatting request is sent from the client to the server to format parts of the document during typing.

Request

interface DocumentOnTypeFormattingParams {
    /**
     * The document to format.
     */
    textDocument: TextDocumentIdentifier;

    /**
     * The position at which this request was send.
     */
    position: Position;

    /**
     * The character that has been typed.
     */
    ch: string;

    /**
     * The format options.
     */
    options: FormattingOptions;
}

Response