Skip to content
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

Incorrect positioning of text in applyTextEdit #271

Closed
tittoassini opened this issue Jan 17, 2021 · 0 comments · Fixed by #292
Closed

Incorrect positioning of text in applyTextEdit #271

tittoassini opened this issue Jan 17, 2021 · 0 comments · Fixed by #292

Comments

@tittoassini
Copy link

tittoassini commented Jan 17, 2021

Presumably, a text insertion positioned beyond the end of the document should be appended to it (or, possibly more logically, enough white space and line returns should be added to locate the inserted text in the required position).

However, in Language.LSP.Types.WorkspaceEdit.applyTextEdit, it seems that the insert line is set to the maximum between the requested line and the max number of lines, but the column number is not changed.

Example, Position 20 3 is interpreted as Position 1 3:

>>> applyTextEdit (TextEdit (Range (Position 1 3) (Position 1 3)) "ZZZ") "aaaaa\nbbbbbb"
"aaaaa\nbbbZZZbbb"

>>> applyTextEdit (TextEdit (Range (Position 20 3) (Position 20 3)) "ZZZ") "aaaaa\nbbbbbb"
"aaaaa\nbbbZZZbbb"
michaelpj added a commit to michaelpj/lsp that referenced this issue Feb 26, 2021
A simple fix, the text gets appended. You could imagine being smarter
here, but at least it doesn't insert it into the existing text as it
would before.

Fixes haskell#271.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant