-
-
Notifications
You must be signed in to change notification settings - Fork 942
Description
Thank you for the bug report
- I am using the latest version of
lsp-moderelated 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
Environment:
- Emacs Version: GNU Emacs 30.1
- Operating System: macOS Sequoia Version 15.5
lsp-modeversion: lsp-mode-20250531.74
Problem Description:
The clients/lsp-terraform.el file fails to byte-compile with recent versions of lsp-mode. This issue was not present in older versions of lsp-mode with the same lsp-terraform.el file.
Error Messages:
The compilation errors consistently follow a pattern where a hyphenated keyword is reported as "Unknown key," while the "Available keys" list suggests an underscored version of the same keyword is expected.
Examples of errors encountered:
-
In
construct-tf-module(around line 305 oflsp-terraform.el):
Error: Unknown key: :docs-link. Available keys: (:name :docs_link :version :source_type :dependent_modules)
(Initially, this also included errors for:source-typeand:dependent-moduleswith the same pattern, where "Available keys" showed the underscored versions like:source_type,:dependent_modulesif the pattern is consistent). -
In
lsp-terraform-ls--providers-to-tf-package(around line 313 oflsp-terraform.el, after fixing the above):
Error: Unknown key: :provider-requirements. Available keys: (:v :provider_requirements :installed_providers)
(And likely for:installed-providersbecoming:installed_providersif the pattern holds).
It appears this pattern (hyphenated keyword used, underscored keyword expected) applies to several multi-word keys within lsp-defun destructuring forms for &terraform-ls:* types.
Suspected Cause:
Given that lsp-terraform.el has been stable for a long time, these new compilation errors suggest a recent change in lsp-mode's core. This change likely affects how lsp-mode (particularly the lsp-defun macro or its underlying type validation system) keywordizes, parses, or expects multi-word keys from language server interactions or internal type definitions for terraform-ls. The system now seems to expect underscores for these specific keys instead of hyphens.
Impact:
lsp-terraform.elfails to compile.- LSP support for Terraform is unavailable.
- A non-compiling client file can also lead to broader
lsp-modeinstability (e.g., unrelated UI errors were observed that resolved once this client's loading was prevented by fixing these compilation issues locally).
Proposed Solution / Next Steps:
I have a local fix that involves systematically updating these hyphenated keywords in lsp-terraform.el (within lsp-defun parameter destructuring for &terraform-ls:* types) to their underscored versions, and also updating the corresponding local variable names. This resolves all observed compilation errors for lsp-terraform.el.
I will submit a Pull Request with these changes shortly to make lsp-terraform.el compatible with the current lsp-mode core.
Steps to reproduce
- Ensure you are using a recent version of
lsp-mode20250531.742 - Have the standard
lsp-modepackage installed, which includesclients/lsp-terraform.el. - Attempt to byte-compile
clients/lsp-terraform.el. This can be done by:- Navigating to the
lsp-modeinstallation directory (e.g.,~/.config/emacs/elpa/lsp-mode-[VERSION]/) and runningM-x byte-compile-fileonclients/lsp-terraform.el. - Or, observing the
*Compile-Log*buffer after a fresh installation or update oflsp-modewhich triggers automatic compilation.
- Navigating to the
- Check the
*Compile-Log*buffer for compilation errors related tolsp-terraform.el.
Expected behavior
- The
clients/lsp-terraform.elfile should compile successfully without any "Unknown key" errors. - If the
terraform-lslanguage server is installed and configured, LSP functionality for Terraform (.tf) files should be available and working correctly. - The
lsp-modepackage as a whole should load and operate stably, without issues caused by a non-compiling client file.
Which Language Server did you use?
This error This error affected the overall compilation of lsp-mode, although I do not actually use lsp-terraform.
OS
MacOS