Skip to content

Writes random jumble on save when an error exists #970

@karitham

Description

@karitham

Describe the bug
Sometimes, when saving, the lsp writes seemingly random stuff where there is an error,
The text is written before the lsp recognises that the error is fixed, so it creates and error and writes again.

To Reproduce
Steps to reproduce the behavior:
Have an error, spam save, (works on my end)

            <button class="btn-icon delete">
              <Icon data="{icons.trash}" />
            </button>

turns into

            <button class="btn-icon delete">
              <Icon data="{icons.rashtrrrrrr}" />
            </button>

Expected behavior
Not writing anything and/or waiting to complete analysis before doing so

Screenshots
example 1
example 2

After a few saves, the example 2 turns into
example 3

before saving
example before saving
after saving
example after saving

System (please complete the following information):

  • OS: Linux (5.11.16-arch1-1)
  • IDE: VSCode
  • Plugin/Package: "Svelte for VSCode" - v104.10.2

Additional context
The only way to work around this issue is to kill the lsp, write and save before it completly starts, and then it works fine until the bugs appears again.

I don't really understand how this works. With logging to verbose, the extension logs

[Trace - 10:12:53] Sending request 'textDocument/codeAction - (959)'.
Params: {
    "textDocument": {
        "uri": "file:///home/karitham/Projects/STM/Front/src/components/Table/Table.svelte"
    },
    "range": {
        "start": {
            "line": 79,
            "character": 44
        },
        "end": {
            "line": 79,
            "character": 44
        }
    },
    "context": {
        "diagnostics": []
    }
}

for the example 1 (the first picture)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions