Skip to content

Fix hover feature for YAML 1.1 boolean values#1156

Merged
datho7561 merged 2 commits intoredhat-developer:mainfrom
lawrencetroup:fix-boolean-hover
Dec 15, 2025
Merged

Fix hover feature for YAML 1.1 boolean values#1156
datho7561 merged 2 commits intoredhat-developer:mainfrom
lawrencetroup:fix-boolean-hover

Conversation

@lawrencetroup
Copy link
Contributor

What does this PR do?

The equals() function was using JSON.parse() to convert boolean source strings, which fails for YAML 1.1 booleans like 'True', 'False', 'yes', 'no', etc. This resulted in hovering in files containing YAML 1.1 boolean values to fail with:

Request textDocument/hover failed.
  Message: Request textDocument/hover failed with message: Unexpected token 'F', "False" is not valid JSON
  Code: -32603

This change uses the existing parseYamlBoolean() function instead to evaluate boolean equality.

This fixes a regression introduced by commit e6165e4 (and 4370b5c) which fixed #1078 and #1116 by changing getNodeValue() to return node.source for booleans, but the equals() function wasn't updated to handle all YAML 1.1 boolean string formats.

What issues does this PR fix or reference?

This fixes #1152.

Is it tested? How?

  • Added unit tests to cover the failing case (YAML 1.1 boolean syntax) and verified that these pass.
  • Manually built an updated version of the VSCode Yaml Extension with this change, and confirmed that the hover feature now works again.

Lawrence Troup added 2 commits December 9, 2025 06:34
   The equals() function was using JSON.parse() to convert boolean source
   strings, which fails for YAML 1.1 booleans like 'True', 'False', 'yes',
   'no', etc. This change uses the existing parseYamlBoolean() function
   instead.

   Fixes redhat-developer#1152

Signed-off-by: Lawrence Troup <ltroup@cisco.com>
@coveralls
Copy link

Coverage Status

coverage: 84.082% (+0.05%) from 84.036%
when pulling 76c55eb on lawrencetroup:fix-boolean-hover
into f3c0546 on redhat-developer:main.

Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and fixes the issue. Thanks @lawrencetroup !

@datho7561 datho7561 merged commit 0041fa6 into redhat-developer:main Dec 15, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants