Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix small issues with end insertion (#940)
* Remove extra space after end insertion This commit ensures there is no extra space added after the cursor when on type formatting inserts an `end` keyword. For some reason, if we try to insert the newline character and the `end` keyword via a single edit without the extra space, `applyEdit` [1] strips the indentation and the cursor ends up at the beginning of the middle line. Inserting the newline via a separate edit doesn't seem to have this problem. [1]: https://github.com/Shopify/vscode-ruby-lsp/blob/74e45e754aac281a22d5627c22a1a2a3e73d8b33/src/client.ts#L160 * Fix cusor position when breaking after keyword If the user breaks just after the keyword, this commit ensures the cursor is placed back where the break happened. This is currently broken in that the cursor will end up 1 character into the next line. There was some discussion [1] about whether the cursor should remain where it would normally be if the end insertion didn't happen, but it appears moving it back to where the break happened is the intended behavior. [1]: #462 (comment) * Add newline when breaking after keyword This commit ensures that when breaking after the keyword, the `end` is inserted with a newline, rather than replacing an existing empty line.
- Loading branch information