Skip to content

Completion re-inserts prefix in terraform completion (terraform-ls) #4823

@phuhl

Description

@phuhl

Thank you for the bug report

  • I am using the latest version of lsp-mode related packages.
  • I checked FAQ and Troubleshooting sections
  • You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain

Bug description

When asking for a completion in terraform files the existing stub I want to complete is printed again (if it ends in a .) which then brakes completion.

Example:

resource "aws_route53_record" "google-auth-record" {
  zone_id = data.aws_route53_zone.zone.zone_id
  name    = var.    // <- completing with cursor after .
  type    = "TXT"
  ttl     = 300

  records = [var.google_site_verification]
}
resource "aws_route53_record" "google-auth-record" {
  zone_id = data.aws_route53_zone.zone.zone_id
  name    = var.var.    // <- after completion
  type    = "TXT"
  ttl     = 300

  records = [var.google_site_verification]
}

This only happens when lsp-mode is enabled. It does not seem to be an issue with the language server as seen in the json logs:

Here is an example from the logs where the server returns correct suggestions, but the completion interface did not show them and instead var. was inserted.

[Trace - 11:15:39 AM] Sending request 'textDocument/completion - (271)'.
Params: {
  "textDocument": {
    "uri": "file:///home/philipp/git/email-scripts/terraform/production/domain.tf"
  },
  "position": {
    "line": 8,
    "character": 16
  },
  "context": {
    "triggerKind": 1
  }
}


[Trace - 11:15:39 AM] Received response 'textDocument/completion - (271)' in 12ms.
Result: {
  "isIncomplete": null,
  "items": [
    {
      "label": "var.alt_domain_name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.alt_domain_name"
      }
    },
    {
      "label": "var.aws_region",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.aws_region"
      }
    },
    {
      "label": "var.base_domain_name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.base_domain_name"
      }
    },
    {
      "label": "var.domain_name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.domain_name"
      }
    },
    {
      "label": "var.google_site_verification",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.google_site_verification"
      }
    },
    {
      "label": "var.name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.name"
      }
    },
    {
      "label": "var.production",
      "kind": 6,
      "detail": "bool",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.production"
      }
    }
  ]
}


[Trace - 11:15:39 AM] Sending notification 'textDocument/didChange'.
Params: {
  "textDocument": {
    "uri": "file:///home/philipp/git/email-scripts/terraform/production/domain.tf",
    "version": 111
  },
  "contentChanges": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 16
        },
        "end": {
          "line": 8,
          "character": 16
        }
      },
      "rangeLength": 0,
      "text": "var."
    }
  ]
}

Sometimes the buffer is changed before the completion is requested. Then the logs show this:

[Trace - 11:24:51 AM] Sending notification 'textDocument/didChange'.
Params: {
  "textDocument": {
    "uri": "file:///home/philipp/git/email-scripts/terraform/production/domain.tf",
    "version": 119
  },
  "contentChanges": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 16
        },
        "end": {
          "line": 8,
          "character": 16
        }
      },
      "rangeLength": 0,
      "text": "var."
    }
  ]
}


[Trace - 11:24:51 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/philipp/git/email-scripts/terraform/production/domain.tf",
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 20
        },
        "end": {
          "line": 9,
          "character": 0
        }
      },
      "severity": 1,
      "source": "Terraform",
      "message": "Invalid attribute name: An attribute name is required after a dot."
    }
  ]
}
// no textDocument/completion request after this is in the logs.

Steps to reproduce

  1. Open terraform file like this in terraform-mode.el:
variable "base_domain_name" {
  description = "Base Domain (not a sub domain)"
  type        = string
  default     = "abc.com"
}

variable "domain_name" {
  description = "Domain"
  type        = string
  default     = "def.com"
}


resource "aws_route53_record" "google-auth-record" {
  zone_id = data.aws_route53_zone.zone.zone_id
  name    = var. 
  type    = "TXT"
  ttl     = 300

  records = [var.google_site_verification]
}
  1. Put cursor after var.
  2. Press tab or call M-x completion-at-point

Expected behavior

Correct completion.

Which Language Server did you use?

tfmls (terraform-ls)

OS

Linux

Error callstack

No error

Lsp-log:

Command "terraform-ls serve" is present on the path.
Command "terraform-lsp" is not present on the path.
Command "semgrep lsp" is not present on the path.
Command "terraform-ls serve" is present on the path.
Command "terraform-lsp" is not present on the path.
Command "semgrep lsp" is not present on the path.
Found the following clients for /home/***/terraform/production/domain.tf: (server-id tfmls, priority 1)
The following clients were selected based on priority: (server-id tfmls, priority 1)
Creating watchers for following 235 folders:
/// .. truncated
Command "semgrep lsp" is not present on the path.
Command "semgrep lsp" is not present on the path.
Command "terraform-ls serve" is present on the path.
Command "semgrep lsp" is not present on the path.
Command "terraform-ls serve" is present on the path.
Command "semgrep lsp" is not present on the path.
Found the following clients for /home/***/terraform/production/domain.tf: (server-id tfmls, priority 1)
The following clients were selected based on priority: (server-id tfmls, priority 1)
Command "terraform-ls serve" is present on the path.
Command "semgrep lsp" is not present on the path.
Command "terraform-ls serve" is present on the path.
Command "semgrep lsp" is not present on the path.
Found the following clients for /home/***/terraform/production/variables.tf: (server-id tfmls, priority 1)
The following clients were selected based on priority: (server-id tfmls, priority 1)
Full lsp workspace log:
[Trace - 11:42:32 AM] Sending request 'initialize - (1)'.
Params: {
  "processId": 345884,
  "rootPath": "/home/***",
  "clientInfo": {
    "name": "emacs",
    "version": "GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49, cairo version 1.18.4)"
  },
  "rootUri": "file:///home/***",
  "capabilities": {
    "general": {
      "positionEncodings": [
        "utf-32",
        "utf-16"
      ]
    },
    "workspace": {
      "workspaceEdit": {
        "documentChanges": true,
        "resourceOperations": [
          "create",
          "rename",
          "delete"
        ]
      },
      "applyEdit": true,
      "symbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        }
      },
      "executeCommand": {
        "dynamicRegistration": false
      },
      "didChangeWatchedFiles": {
        "dynamicRegistration": true
      },
      "workspaceFolders": true,
      "configuration": true,
      "codeLens": {
        "refreshSupport": true
      },
      "diagnostics": {
        "refreshSupport": false
      },
      "fileOperations": {
        "didCreate": false,
        "willCreate": false,
        "didRename": true,
        "willRename": true,
        "didDelete": false,
        "willDelete": false
      }
    },
    "textDocument": {
      "declaration": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "definition": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "references": {
        "dynamicRegistration": true
      },
      "implementation": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "typeDefinition": {
        "dynamicRegistration": true,
        "linkSupport": true
      },
      "synchronization": {
        "willSave": true,
        "didSave": true,
        "willSaveWaitUntil": true
      },
      "documentSymbol": {
        "symbolKind": {
          "valueSet": [
            1,
            2,
            3,
            4,
            5,
            6,
            7,
            8,
            9,
            10,
            11,
            12,
            13,
            14,
            15,
            16,
            17,
            18,
            19,
            20,
            21,
            22,
            23,
            24,
            25,
            26
          ]
        },
        "hierarchicalDocumentSymbolSupport": true
      },
      "formatting": {
        "dynamicRegistration": true
      },
      "rangeFormatting": {
        "dynamicRegistration": true
      },
      "onTypeFormatting": {
        "dynamicRegistration": true
      },
      "rename": {
        "dynamicRegistration": true,
        "prepareSupport": true
      },
      "codeAction": {
        "dynamicRegistration": true,
        "isPreferredSupport": true,
        "codeActionLiteralSupport": {
          "codeActionKind": {
            "valueSet": [
              "",
              "quickfix",
              "refactor",
              "refactor.extract",
              "refactor.inline",
              "refactor.rewrite",
              "source",
              "source.organizeImports"
            ]
          }
        },
        "resolveSupport": {
          "properties": [
            "edit",
            "command"
          ]
        },
        "dataSupport": true
      },
      "completion": {
        "completionItem": {
          "snippetSupport": true,
          "documentationFormat": [
            "markdown",
            "plaintext"
          ],
          "resolveAdditionalTextEditsSupport": true,
          "insertReplaceSupport": true,
          "deprecatedSupport": true,
          "resolveSupport": {
            "properties": [
              "documentation",
              "detail",
              "additionalTextEdits",
              "command"
            ]
          },
          "insertTextModeSupport": {
            "valueSet": [
              1,
              2
            ]
          },
          "labelDetailsSupport": true
        },
        "contextSupport": true,
        "dynamicRegistration": true
      },
      "signatureHelp": {
        "signatureInformation": {
          "parameterInformation": {
            "labelOffsetSupport": true
          },
          "activeParameterSupport": true
        },
        "dynamicRegistration": true
      },
      "documentLink": {
        "dynamicRegistration": true,
        "tooltipSupport": true
      },
      "hover": {
        "contentFormat": [
          "markdown",
          "plaintext"
        ],
        "dynamicRegistration": true
      },
      "foldingRange": {
        "dynamicRegistration": true
      },
      "selectionRange": {
        "dynamicRegistration": true
      },
      "callHierarchy": {
        "dynamicRegistration": false
      },
      "typeHierarchy": {
        "dynamicRegistration": true
      },
      "publishDiagnostics": {
        "relatedInformation": true,
        "tagSupport": {
          "valueSet": [
            1,
            2
          ]
        },
        "versionSupport": true
      },
      "diagnostic": {
        "dynamicRegistration": false,
        "relatedDocumentSupport": false
      },
      "linkedEditingRange": {
        "dynamicRegistration": true
      },
      "inlineCompletion": null
    },
    "window": {
      "workDoneProgress": true,
      "showDocument": {
        "support": true
      }
    }
  },
  "initializationOptions": {
    "experimentalFeatures": {
      "validateOnSave": false,
      "prefillRequiredFields": false
    }
  },
  "workDoneToken": "1"
}


[Trace - 11:42:32 AM] Received response 'initialize - (1)' in 106ms.
Result: {
  "capabilities": {
    "textDocumentSync": {
      "openClose": true,
      "change": 2,
      "save": {}
    },
    "completionProvider": {
      "triggerCharacters": [
        ".",
        "["
      ],
      "resolveProvider": true
    },
    "hoverProvider": true,
    "signatureHelpProvider": {
      "triggerCharacters": [
        "(",
        ","
      ]
    },
    "declarationProvider": true,
    "definitionProvider": true,
    "referencesProvider": true,
    "documentSymbolProvider": true,
    "codeActionProvider": {
      "codeActionKinds": [
        "source.formatAll.terraform"
      ]
    },
    "codeLensProvider": {},
    "documentLinkProvider": {},
    "workspaceSymbolProvider": true,
    "documentFormattingProvider": true,
    "executeCommandProvider": {
      "commands": [
        "terraform-ls.module.callers",
        "terraform-ls.module.calls",
        "terraform-ls.module.providers",
        "terraform-ls.module.terraform",
        "terraform-ls.rootmodules",
        "terraform-ls.terraform.init",
        "terraform-ls.terraform.validate"
      ],
      "workDoneProgress": true
    },
    "semanticTokensProvider": {
      "legend": {
        "tokenTypes": [],
        "tokenModifiers": []
      }
    },
    "workspace": {
      "workspaceFolders": {
        "supported": true,
        "changeNotifications": "workspace/didChangeWorkspaceFolders"
      },
      "fileOperations": {}
    },
    "experimental": {
      "referenceCountCodeLens": null,
      "refreshModuleProviders": null,
      "refreshModuleCalls": null,
      "refreshTerraformVersion": null
    }
  },
  "serverInfo": {
    "name": "terraform-ls",
    "version": "0.36.5"
  }
}


[Trace - 11:42:32 AM] Sending notification 'initialized'.
Params: {}


[Trace - 11:42:32 AM] Sending notification 'textDocument/didOpen'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf",
    "languageId": "terraform",
    "version": 0,
    "text": "\ndata \"aws_route53_zone\" \"zone\" {\n  name         = var.base_domain_name\n  private_zone = false\n}\n\nresource \"aws_route53_record\" \"google-auth-record\" {\n  zone_id = data.aws_route53_zone.zone.zone_id\n  name    = var.domain_name\n  type    = \"TXT\"\n  ttl     = 300\n\n  records = [var.google_site_verification]\n}\n\n\n\n\n"
  }
}


[Trace - 11:42:32 AM] Sending request 'textDocument/codeLens - (2)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  }
}


[Trace - 11:42:32 AM] Sending request 'textDocument/codeAction - (3)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  },
  "range": {
    "start": {
      "line": 0,
      "character": 0
    },
    "end": {
      "line": 0,
      "character": 0
    }
  },
  "context": {
    "diagnostics": []
  }
}


[Trace - 11:42:32 AM] Sending request 'textDocument/documentLink - (4)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  }
}


[Trace - 11:42:32 AM] Sending notification '$/cancelRequest'.
Params: {
  "id": 2
}


[Trace - 11:42:32 AM] Sending request 'textDocument/codeLens - (5)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  }
}


[Trace - 11:42:32 AM] Sending notification '$/cancelRequest'.
Params: {
  "id": 5
}


[Trace - 11:42:32 AM] Sending request 'textDocument/codeLens - (6)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  }
}


[Trace - 11:42:32 AM] Received request 'client/registerCapability - (1).
Params: {
  "registrations": [
    {
      "id": "235f2186-fd5a-15e6-d01b-d7b1371843aa",
      "method": "workspace/didChangeWatchedFiles",
      "registerOptions": {
        "watchers": [
          {
            "globPattern": "**/.terraform",
            "kind": 3
          },
          {
            "globPattern": "**/.terraform/modules/modules.json"
          },
          {
            "globPattern": "**/.terraform.lock.hcl"
          },
          {
            "globPattern": "**/.terraform/plugins/selections.json"
          },
          {
            "globPattern": "**/.terraform/plugins/linux_amd64/lock.json"
          }
        ]
      }
    }
  ]
}


[Trace - 11:42:32 AM] Sending response 'client/registerCapability - (1)'. Processing request took 37ms
Params: {
  "jsonrpc": "2.0",
  "id": 1,
  "result": null
}


[Trace - 11:42:32 AM] Received response 'textDocument/codeAction - (3)' in 51ms.
Result: null


[Trace - 11:42:32 AM] Received response 'nil - (2)' in 0ms.
Result: {
  "code": -32097,
  "message": "context canceled"
}


[Trace - 11:42:32 AM] Received response 'nil - (5)' in 0ms.
Result: {
  "code": -32800,
  "message": "error code -32800: %!s(<nil>)"
}


[Trace - 11:42:33 AM] Received response 'textDocument/documentLink - (4)' in 1065ms.
Result: []


[Trace - 11:42:33 AM] Received response 'textDocument/codeLens - (6)' in 1026ms.
Result: []


[Trace - 11:42:34 AM] Sending notification 'textDocument/didChange'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf",
    "version": 1
  },
  "contentChanges": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 23
        },
        "end": {
          "line": 8,
          "character": 27
        }
      },
      "rangeLength": 4,
      "text": ""
    }
  ]
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/providers.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/domain.tf",
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 12
        },
        "end": {
          "line": 8,
          "character": 23
        }
      },
      "severity": 1,
      "source": "Terraform",
      "message": "No declaration found for \"var.domain_\""
    }
  ]
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/moved.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/taskRunner.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/backend.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/taskBuilder.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/main.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/outputs.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/variables.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/frontend.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/landingpage.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Sending notification 'textDocument/didChange'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf",
    "version": 2
  },
  "contentChanges": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 16
        },
        "end": {
          "line": 8,
          "character": 23
        }
      },
      "rangeLength": 7,
      "text": ""
    }
  ]
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/domain.tf",
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 16
        },
        "end": {
          "line": 9,
          "character": 0
        }
      },
      "severity": 1,
      "source": "Terraform",
      "message": "Invalid attribute name: An attribute name is required after a dot."
    }
  ]
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/variables.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/taskBuilder.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/backend.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/main.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/moved.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/outputs.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/landingpage.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/providers.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/taskRunner.tf",
  "diagnostics": []
}


[Trace - 11:42:34 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/frontend.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Sending request 'textDocument/completion - (7)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  },
  "position": {
    "line": 8,
    "character": 16
  },
  "context": {
    "triggerKind": 1
  }
}


[Trace - 11:42:35 AM] Received response 'textDocument/completion - (7)' in 16ms.
Result: {
  "isIncomplete": null,
  "items": [
    {
      "label": "var.alt_domain_name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.alt_domain_name"
      }
    },
    {
      "label": "var.aws_region",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.aws_region"
      }
    },
    {
      "label": "var.base_domain_name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.base_domain_name"
      }
    },
    {
      "label": "var.domain_name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.domain_name"
      }
    },
    {
      "label": "var.google_site_verification",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.google_site_verification"
      }
    },
    {
      "label": "var.name",
      "kind": 6,
      "detail": "string",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.name"
      }
    },
    {
      "label": "var.production",
      "kind": 6,
      "detail": "bool",
      "insertTextFormat": 2,
      "textEdit": {
        "range": {
          "start": {
            "line": 8,
            "character": 12
          },
          "end": {
            "line": 8,
            "character": 16
          }
        },
        "newText": "var.production"
      }
    }
  ]
}


[Trace - 11:42:35 AM] Sending notification 'textDocument/didChange'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf",
    "version": 3
  },
  "contentChanges": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 16
        },
        "end": {
          "line": 8,
          "character": 16
        }
      },
      "rangeLength": 0,
      "text": "var."
    }
  ]
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/taskBuilder.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/main.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/providers.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/domain.tf",
  "diagnostics": [
    {
      "range": {
        "start": {
          "line": 8,
          "character": 20
        },
        "end": {
          "line": 9,
          "character": 0
        }
      },
      "severity": 1,
      "source": "Terraform",
      "message": "Invalid attribute name: An attribute name is required after a dot."
    }
  ]
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/variables.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/backend.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/frontend.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/outputs.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/landingpage.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/moved.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
  "uri": "file:///home/***/terraform/production/taskRunner.tf",
  "diagnostics": []
}


[Trace - 11:42:35 AM] Sending request 'textDocument/codeAction - (8)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  },
  "range": {
    "start": {
      "line": 8,
      "character": 20
    },
    "end": {
      "line": 8,
      "character": 20
    }
  },
  "context": {
    "diagnostics": [
      {
        "range": {
          "start": {
            "line": 8,
            "character": 20
          },
          "end": {
            "line": 9,
            "character": 0
          }
        },
        "severity": 1,
        "source": "Terraform",
        "message": "Invalid attribute name: An attribute name is required after a dot."
      }
    ]
  }
}


[Trace - 11:42:35 AM] Sending request 'textDocument/documentLink - (9)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  }
}


[Trace - 11:42:35 AM] Sending request 'textDocument/codeLens - (10)'.
Params: {
  "textDocument": {
    "uri": "file:///home/***/terraform/production/domain.tf"
  }
}


[Trace - 11:42:35 AM] Received response 'textDocument/codeAction - (8)' in 8ms.
Result: null


[Trace - 11:42:35 AM] Received response 'textDocument/documentLink - (9)' in 25ms.
Result: []


[Trace - 11:42:35 AM] Received response 'textDocument/codeLens - (10)' in 20ms.
Result: []

Anything else?

For some reason, this only happens if I try to complete on a trailing .. If I prefill the first letter of a completion (i.e. complete on var.d I get valid completion results as expected.

The contents of my completion-at-point-functions is:
(tags-completion-at-point-function lsp-completion-at-point). I tried without the tags-completion-at-point-function and it still happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions