Skip to content

Clarify magic indentation fixes applied to multi-line text edits in CompletionItem #83

Closed
@kdvolder

Description

@kdvolder

It looks like when I create a completion item which contains newlines, so expands to more than one line of actual text... vscode applies some kind of magic indentation fixes to my edit (rather than taking my edit at face value and replacing my text exactly as given).

This is disturbing really because my 'newText' already contains exactly the needed spaces to get the desired/correct indentation. I'm seeing that in vscode additional spaces are added on top of that which actually messes things up.

E.g my language server sends a completion like this:

  {
       "label":"services",
       "kind":5,
       "sortText":"00014",
       "filterText":"services",
       "textEdit": {
            "range":{
                  "start":{"line":2,"character":4},
                  "end":{"line":2,"character":4}
       },
      "newText":"services:\n      - "
 }

There are precisely 4 spaces between the \n and the -.

However, when the completion is invoked it looks like 8 spaces get added into the document instead.

Really, I'd prefer if 'newText' doesn't get subjected to this kind of magic stuff. But if there is indeed magic stuff happening, then we probably should have clear descriptions in the LS spec to explain exactly what magics to expect.

PS: This is somewhat related to #82 (both issues concern a different kind of undocumented 'magic interpretation' applied to the contents of the TextEdit'snewText field).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions