redhat-developer / redhat-developer/vscode-yaml

Single dot shows as a float while it's a string

Open
#1,039 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Describe the bug

When a single dot is a value in key/value map, it is shown as a float while YAML parses it as a string

Expected Behavior

The dot has highlight as a string

Current Behavior

The dot has highlight as a float

Steps to Reproduce

paths:
  etc: /etc
  pwd: .
  number: 3
  up: ./..
Screenshot 2024-07-11 at 7 37 30

. should be highlighted as a string, not as a number. Because YAML will parse it as a string. This parsed as a JSON is:

{
  "paths": {
    "etc": "/etc",
    "pwd": ".",
    "number": 3,
    "up": "./.."
  }
}

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in VS Code with the YAML snippet from the report and inspect how syntax highlighting classifies the single dot. Trace the relevant YAML highlighting entry point, then verify that . is highlighted as a string while 3 remains a number and ./.. remains a string.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.