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

Content of dockerfile gets out of sync with actual file after an edit #244

Closed
rchl opened this issue Jul 13, 2020 · 6 comments
Closed

Content of dockerfile gets out of sync with actual file after an edit #244

rchl opened this issue Jul 13, 2020 · 6 comments

Comments

@rchl
Copy link

rchl commented Jul 13, 2020

Editor sends a textDocument/didChange message with this payload:

{
  "contentChanges": [
    {
      "range": {
        "end": {
          "character": 21,
          "line": 48
        },
        "start": {
          "character": 21,
          "line": 48
        }
      },
      "rangeLength": 0,
      "text": "\n"
    },
    {
      "range": {
        "end": {
          "character": 0,
          "line": 49
        },
        "start": {
          "character": 0,
          "line": 49
        }
      },
      "rangeLength": 0,
      "text": "W"
    },
    {
      "range": {
        "end": {
          "character": 1,
          "line": 49
        },
        "start": {
          "character": 1,
          "line": 49
        }
      },
      "rangeLength": 0,
      "text": "O"
    },
    {
      "range": {
        "end": {
          "character": 2,
          "line": 49
        },
        "start": {
          "character": 2,
          "line": 49
        }
      },
      "rangeLength": 0,
      "text": "R"
    },
    {
      "range": {
        "end": {
          "character": 3,
          "line": 49
        },
        "start": {
          "character": 3,
          "line": 49
        }
      },
      "rangeLength": 0,
      "text": "K"
    }
  ],
  "textDocument": {
    "uri": "file:///Users/me/workspace/test/Dockerfile",
    "version": 5
  }
}

which triggers this error diagnostic through textDocument/publishDiagnostics notification:

{
  "diagnostics": [
    {
      "code": 38,
      "message": "Unknown instruction: WKRO",
      "range": {
        "end": {
          "character": 4,
          "line": 49
        },
        "start": {
          "character": 0,
          "line": 49
        }
      },
      "severity": 1,
      "source": "dockerfile-utils"
    }
  ],
  "uri": "file:///Users/me/workspace/test/Dockerfile"
}

So it appears that language server doesn't process changes correctly, resulting in content getting out of sync with actual file.

@rcjsuen
Copy link
Owner

rcjsuen commented Jul 13, 2020

@rchl Thank you for your bug report. Were you typing at the end of the Dockerfile?

@rchl
Copy link
Author

rchl commented Jul 13, 2020

No, roughly in the middle. It also reproduces in empty file if I just type "WORK".

I suppose other editors might report edits differently (maybe collapse all edits into one) so might need to trigger such payload manually to reproduce.

@rcjsuen
Copy link
Owner

rcjsuen commented Jul 13, 2020

No, roughly in the middle. It also reproduces in empty file if I just type "WORK".

@rchl OK, thanks. I can see it happening at the end of a file (which is the same as an empty file) and I've also been able to reproduce it in the middle of the file.

@rcjsuen
Copy link
Owner

rcjsuen commented Jul 14, 2020

@rchl I've released a 0.1.1 which should help with this...?

@rchl
Copy link
Author

rchl commented Jul 14, 2020

Yes, that fix looks good. Thanks.

@rcjsuen
Copy link
Owner

rcjsuen commented Jul 14, 2020

Yes, that fix looks good. Thanks.

@rchl Thanks for checking!

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

No branches or pull requests

2 participants