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

Allow (ignore) duplicate document versions sent by client in didChange #310

Closed
radeksimko opened this issue Nov 19, 2020 · 1 comment · Fixed by #940
Closed

Allow (ignore) duplicate document versions sent by client in didChange #310

radeksimko opened this issue Nov 19, 2020 · 1 comment · Fixed by #940
Assignees
Labels
bug Something isn't working text-synchronization https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocum

Comments

@radeksimko
Copy link
Member

We initially set more restrictive rules to better understand the reality of how clients behave.

It has emerged that some clients (Sublime Text LSP 1.1.0 in particular), can send duplicate didChange requests. Below is a snippet of a log demonstrating that.

Server Version

0.9.0

Terraform Version

0.13.0

Client Version

Sublime Text LSP plugin 1.1.0

Terraform Configuration Files

terraform {
  required_providers {
    # 0.12
    # random  = "3.0.0"
    # null    = "3.0.0"
    # grafana = "1.6.0"
    # vault   = "2.15.0"

    # 0.13+
    random = {
      source  = "hashicorp/random"
      version = "3.0.0"
    }
    null = {
      source  = "hashicorp/null"
      version = "3.0.0"
    }
    grafana = {
      source  = "grafana/grafana"
      version = "1.6.0"
    }
    vault = {
      source  = "hashicorp/vault"
      version = "2.15.0"
    }
  }
}

module "ref" {
  source = "./sub"
  count  = 1
}

provider "vault" {
  auth_login {
    namespace = "value"
  }
}

provider "grafana" {
  alias = "value"
  auth  = "value"
}

provider "random" {
}

resource "vault_auth_backend" "blah" {

}

provider "azurestack" {
  arm_endpoint = "value"
}

Log Output

terraform: 2020/11/19 10:19:15 server.go:265: Checking request for "textDocument/didChange": {"textDocument":{"version":58,"uri":"file:///private/var/workspace/tf-test/github/main.tf"},"contentChanges":[{"text":"terraform {\n  required_providers {\n    # 0.12\n    # random  = \"3.0.0\"\n    # null    = \"3.0.0\"\n    # grafana = \"1.6.0\"\n    # vault   = \"2.15.0\"\n\n    # 0.13+\n    random = {\n      source  = \"hashicorp/random\"\n      version = \"3.0.0\"\n    }\n    null = {\n      source  = \"hashicorp/null\"\n      version = \"3.0.0\"\n    }\n    grafana = {\n      source  = \"grafana/grafana\"\n      version = \"1.6.0\"\n    }\n    vault = {\n      source  = \"hashicorp/vault\"\n      version = \"2.15.0\"\n    }\n  }\n}\n\nmodule \"ref\" {\n  source = \"./sub\"\n  count  = 1\n}\n\nprovider \"vault\" {\n  auth_login {\n    namespace = \"value\"\n  }\n}\n\nprovider \"grafana\" {\n  alias = \"value\"\n  auth  = \"value\"\n}\n\nprovider \"random\" {\n}\n\nresource \"vault_auth_backend\" \"blah\" {\n\n}\n\nprovider \"azurestack\" {\n  arm_endpoint = \"value\"\n}\n"}]}

...

terraform: 2020/11/19 10:19:15 server.go:265: Checking request for "textDocument/didChange": {"textDocument":{"version":58,"uri":"file:///private/var/workspace/tf-test/github/main.tf"},"contentChanges":[{"text":"terraform {\n  required_providers {\n    # 0.12\n    # random  = \"3.0.0\"\n    # null    = \"3.0.0\"\n    # grafana = \"1.6.0\"\n    # vault   = \"2.15.0\"\n\n    # 0.13+\n    random = {\n      source  = \"hashicorp/random\"\n      version = \"3.0.0\"\n    }\n    null = {\n      source  = \"hashicorp/null\"\n      version = \"3.0.0\"\n    }\n    grafana = {\n      source  = \"grafana/grafana\"\n      version = \"1.6.0\"\n    }\n    vault = {\n      source  = \"hashicorp/vault\"\n      version = \"2.15.0\"\n    }\n  }\n}\n\nmodule \"ref\" {\n  source = \"./sub\"\n  count  = 1\n}\n\nprovider \"vault\" {\n  auth_login {\n    namespace = \"value\"\n  }\n}\n\nprovider \"grafana\" {\n  alias = \"value\"\n  auth  = \"value\"\n}\n\nprovider \"random\" {\n}\n\nresource \"vault_auth_backend\" \"blah\" {\n\n}\n\nprovider \"azurestack\" {\n  arm_endpoint = \"value\"\n}\n"}]}

...

terraform: 2020/11/19 10:19:15 server.go:342: Discarding error from notification to "textDocument/didChange": Old version (58) received, current version is 58. Unable to update file:///private/var/workspace/tf-test/github/main.tf. This is likely a bug, please report it.

Expected Behavior

didChange should not have returned error when the version and content match exactly, but it should probably still log this event.

Actual Behavior

didChange returned error.

@radeksimko radeksimko added the bug Something isn't working label Nov 19, 2020
@radeksimko radeksimko changed the title Allow (ignore) duplicate document versions send by client in didChange Allow (ignore) duplicate document versions sent by client in didChange Nov 19, 2020
@radeksimko radeksimko added text-synchronization https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocum and removed workspace labels Jun 7, 2022
@radeksimko radeksimko self-assigned this Jun 7, 2022
@github-actions
Copy link

github-actions bot commented Jul 8, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working text-synchronization https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocum
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant