microsoft / microsoft/language-server-protocol
client-server requst: onEnter
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13k
- Forks
- 1k
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 10
Description
On Enter
Server Capability: { "onEnter": boolean }
This request is send from client to server to handle Enter keypress.
Method: experimental/onEnter
Request:: TextDocumentPositionParams
Response:: SnippetTextEdit[]
Example
fn main() {
// Some /*cursor here*/ docs
let x = 92;
}
experimental/onEnter returns the following snippet
fn main() {
// Some
// $0 docs
let x = 92;
}
The primary goal of onEnter is to handle automatic indentation when opening a new line.
This is not yet implemented.
The secondary goal is to handle fixing up syntax, like continuing doc strings and comments, and escaping \n in string literals.
As proper cursor positioning is raison-d'etat for onEnter, it uses SnippetTextEdit.
Unresolved Question
- How to deal with synchronicity of the request?
One option is to require the client to block until the server returns the response.
Another option is to do a OT-style merging of edits from client and server.
A third option is to do a record-replay: client applies heuristic on enter immediatelly, then applies all user's keypresses.
When the server is ready with the response, the client rollbacks all the changes and applies the recorded actions on top of the correct response. - How to deal with multiple carets?
- Should we extend this to arbitrary typed events and not just
onEnter? - The name seems wrong.
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 experimental/onEnter request proposal and its unresolved questions about synchronicity, multiple carets, scope, and naming. No implementation files or tests are identified in the issue. Done would require settling the protocol design and specifying the request behavior before implementation can begin.
Written by the indexing model from the issue text.
Assessment
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100