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

Hover message for glyph decorations are not displayed #292

Closed
akosyakov opened this issue Dec 16, 2016 · 7 comments
Closed

Hover message for glyph decorations are not displayed #292

akosyakov opened this issue Dec 16, 2016 · 7 comments
Assignees
Labels
editor-api feature-request Request for new features or functionality
Milestone

Comments

@akosyakov
Copy link

I have glyphMargin enabled and generally it looks good but hover messages are not displayed. You can easily reproduce it in the playground.

@alexdima
Copy link
Member

Hm, I could get it working:

image

https://microsoft.github.io/monaco-editor/playground.html#interacting-with-the-editor-rendering-glyphs-in-the-margin

var jsCode = [
	'"use strict";',
	'function Person(age) {',
	'	if (age) {',
	'		this.age = age;',
	'	}',
	'}',
	'Person.prototype.getAge = function () {',
	'	return this.age;',
	'};'
].join('\n');

var editor = monaco.editor.create(document.getElementById("container"), {
	value: jsCode,
	language: "javascript",
	glyphMargin: true
});

var decorations = editor.deltaDecorations([], [
	{
		range: new monaco.Range(3,1,3,10),
		options: {
			className: 'myContentClass',
			glyphMarginClassName: 'myGlyphMarginClass',
            glyphMarginHoverMessage: 'glyph margin hover message'
		}
	}
]);

@alexdima alexdima added the info-needed Issue requires more information from poster label Jan 13, 2017
@alexdima alexdima self-assigned this Jan 13, 2017
@alexdima alexdima added this to the Backlog milestone Jan 13, 2017
@akosyakov
Copy link
Author

There is no glyphMarginHoverMessage property in monaco.d.ts only hoverMessage: https://github.com/Microsoft/monaco-editor/blob/master/monaco.d.ts#L1547.

@alexdima
Copy link
Member

Indeed, looks like microsoft/vscode@51f2d53 didn't adopt MarkedString in glyphMarginHoverMessage

@alexdima alexdima added feature-request Request for new features or functionality editor-api and removed info-needed Issue requires more information from poster labels Jan 14, 2017
@alexdima alexdima modified the milestones: v0.8.x, Backlog Jan 14, 2017
@starpit
Copy link

starpit commented Apr 2, 2018

FYI i don't see the hover message after making the noted modification to the noted example. 0.11.1, on any of firefox 59.0.2, chrome 65.0.3325.181, or electron 1.8.4

@rcjsuen
Copy link
Contributor

rcjsuen commented Apr 2, 2018

@starpit The following code works for me.

var jsCode = [
	'"use strict";',
	'function Person(age) {',
	'	if (age) {',
	'		this.age = age;',
	'	}',
	'}',
	'Person.prototype.getAge = function () {',
	'	return this.age;',
	'};'
].join('\n');

var editor = monaco.editor.create(document.getElementById("container"), {
	value: jsCode,
	language: "javascript",
	glyphMargin: true
});

var decorations = editor.deltaDecorations([], [
	{
		range: new monaco.Range(3,1,3,1),
		options: {
			isWholeLine: true,
			className: 'myContentClass',
			glyphMarginClassName: 'myGlyphMarginClass',
			glyphMarginHoverMessage: { value: 'glyph margin hover message' }
		}
	}
]);

@starpit
Copy link

starpit commented Apr 2, 2018

ah, thank you @rcjsuen the key difference from the comments above is in

			glyphMarginHoverMessage: { value: 'glyph margin hover message' }

compared to the above

			glyphMarginHoverMessage: 'glyph margin hover message'

which does not work

@rcjsuen
Copy link
Contributor

rcjsuen commented Apr 2, 2018

@starpit Correct. The API has changed so you need to use IMarkdownString | IMarkdownString[].

https://github.com/Microsoft/monaco-editor/blob/6fa2a2ec0ee0809a855c1e88995b21145c43c22e/monaco.d.ts#L1167-L1170

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-api feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

4 participants