Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight code line in monaco editor #204

Closed
coatless opened this issue May 19, 2024 · 0 comments · Fixed by #216
Closed

Highlight code line in monaco editor #204

coatless opened this issue May 19, 2024 · 0 comments · Fixed by #216
Labels
p: low Address issue when time permits t: feature-request Request the addition of a new feature

Comments

@coatless
Copy link
Owner

demo

Screenshot 2024-05-18 at 11 16 37 PM
var rCode = [
	"hello_world <- function(age) {",
	"   if (age > 30) {",
	"       print('You are old')",
	"	} else { ",
	"       print('You are young!')",
	"   }",
	"}",
	"hello_age(22)",
].join("\n");

var editor = monaco.editor.create(document.getElementById("container"), {
	value: rCode,
	language: "r",
});

var decorations = editor.createDecorationsCollection([
	{
		range: new monaco.Range(2, 1, 4, 1),
		options: {
			isWholeLine: true,
			linesDecorationsClassName: "myLineDecoration",
		},
	},
]);
hello_world <- function(age) {
   if (age > 30) {
       print('You are old')
	} else { 
       print('You are young!')
   }
}
hello_age(22)
@coatless coatless added t: feature-request Request the addition of a new feature p: low Address issue when time permits labels May 19, 2024
@coatless coatless added this to the 0.4.3 (planning) milestone May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: low Address issue when time permits t: feature-request Request the addition of a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant