Skip to content

Add a client capability for optional magic indents in completion items. #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,15 @@ export interface TextDocumentClientCapabilities {
* capabilities.
*/
completionItem?: {
/**
* Client supports automatic indentation of multi-line insert text.
*
* A client that supports this provides the option for a multi-line insert text
* (either snippet or plaintext) to have the indentation of all lines from the second
* line onwards be adjusted relative the first line.
*/
relativeIndentationSupport?: boolean;

/**
* Client supports snippets as insert text.
*
Expand Down Expand Up @@ -1835,6 +1844,27 @@ interface CompletionItem {
* and the `newText` property of a provided `textEdit`.
*/
insertTextFormat?: InsertTextFormat;
/**
* Determines whether automatic relative indentation fixes are applied to a multi-line insert text.
* This option applies to both the `insertText` property and the `newText` property
* of a provided `textEdit`.
*
* Relative indentation fixes are applied as follows:
*
* If the insert text contains no line breaks, no fixes are applied.
*
* Otherwise, define the reference line as the line in document where the insert text
* is being applied.
*
* The reference indent is determined by taking all the whitespace
* characters from the front of the reference line upto either the first non-whitespace
* character; or the start position where the insert text is being applied. Whichever
* of these two yields the shortest string is taken as the reference indent.
*
* To adjust indentation, the reference indent is then inserted into the insert text right
* after every line break.
*/
disableRelativeIndent?: boolean
/**
* An edit which is applied to a document when selecting this completion. When an edit is provided the value of
* `insertText` is ignored.
Expand Down