Microsoft/monaco-editor

[Bug] YAML keyword values affected by comments

Open

#3,030 建立於 2022年3月22日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)JavaScript (1,283 fork)batch import
buggrammarshelp wanted

倉庫指標

Star
 (14,836 star)
PR 合併指標
 (平均合併 6小時 26分鐘) (30 天內合併 15 個 PR)

描述

Reproducible in vscode.dev or in VS Code Desktop?

  • Not reproducible in vscode.dev or VS Code Desktop

Reproducible in the monaco editor playground?

Monaco Editor Playground Code

monaco.editor.create(document.getElementById('container'), {
	value: "keyword-control: null\nstring-control: string\n\nexample1: null #Highlights as string but evaluates null\nexample2: null#Highlights as keyword but evaluates as string\n",
	language: 'yaml'
});

Actual Behavior

Keywords (null, true, false, etc) are incorrectly highlighted as strings if a there is a comment on the same line as the keyword (example1). If the comment is touching the keyword, the highlighting is correct but the value is interpreted as a string when parsed (example2).

Expected Behavior

I would expect that in both examples, the null would highlight as a keyword and that the value would be evaluated as null, not a string.

Additional Context

No response

貢獻者指南