microsoft / microsoft/language-server-protocol
Smart identation for `TextEdit`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13k
- Forks
- 1k
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 10
Description


I want to insert a extra line in textDocument/completion requests by additionalTextEdits.
However since I don't know the identation in this requests, I cannot choose the correct identation in TextEdit.
I know I can analyze context to guess the identation, but I hope this can be done by the client because the client knows the most correct indentation.
Currenty, if I set InsertTextFormat to Snippet, the \t in insertText can be smartly replaced to correct indentation.
So I hope TextEdit can support similar feature, for example:
interface TextEdit {
/**
* The range of the text document to be manipulated. To insert
* text into a document create a range where start === end.
*/
range: Range;
/**
* The string to be inserted. For delete operations use an
* empty string.
*/
newText: string;
/**
* + 1: as is
* + 2: replace `\t` with correct indentation
*/
textFormat?: 1 | 2;
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TextEdit and InsertTextFormat definitions in the LSP specification and compare them with the textDocument/completion request behavior described here. Determine whether client-side indentation for additionalTextEdits can be specified without ambiguity, and document the accepted protocol design and its completion semantics.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100