Skip to content

Suspicious order of events #1228

Closed

Description

I encountered the following sequence of events when using the language client in vscode:

  • documentChange
  • codeAction - with a caret position which was valid before documentChange but became invalid after documentChange
  • cancelRequest for the previous code action

It looks to me that sending codeAction, after we sent documentChange event shouldn't happen. Is it a bug or is it a normal behavior? If it's normal behavior, it would be nice if we have a document version in the code action request.

What do you think? Is it normal or nor?

Activity

  1. changed the title [-]Incorrect order of events[/-] [+]Suspicious order of events[/+] on Apr 11, 2023
  2. tooltitude-support commented on Apr 11, 2023

    @tooltitude-support
    Author

    I investigated code.

    Main process: text document changes, are broadcast before the code action event

    Ext. host. When changes are received they are immediately broadcast/called.

    Language client. Here it's interesting.

    async.map could yield the main process to other activities, and as a result code action might be invoked after the text change was called.

    I don't know how to make a fix for it. I created a workaround in our language server, but it would be nice if a long term fix is created in the library.

  3. dbaeumer commented on Apr 12, 2023

    @dbaeumer
    Member

    Tooltitude Support (@tooltitude-support) very good find and analysis. Need to think about how to best fix this.

  4. dbaeumer commented on Apr 12, 2023

    @dbaeumer
    Member

    Discussed with the VS Code team and the best approach right now is to make the params conversion sync.

  5. added a commit that references this issue on Apr 12, 2023
    a4a644c
  6. added this to the milestone on Apr 12, 2023
  7. added a commit that references this issue on Apr 12, 2023
    04c7bf2
  8. tooltitude-support commented on Apr 12, 2023

    @tooltitude-support
    Author

    Dirk Bäumer (@dbaeumer) Thanks for fixing this so quickly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions