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

[Bug] Hiding delay for hover is not impacting #4719

Open
websiddu opened this issue Oct 19, 2024 · 0 comments
Open

[Bug] Hiding delay for hover is not impacting #4719

websiddu opened this issue Oct 19, 2024 · 0 comments

Comments

@websiddu
Copy link

websiddu commented Oct 19, 2024

Reproducible in vscode.dev or in VS Code Desktop?

NA

Reproducible in the monaco editor playground?

Yes

Monaco Editor Playground Link

repro link

Monaco Editor Playground Code

monaco.languages.register({ id: "mySpecialLanguage" });

monaco.languages.registerHoverProvider("mySpecialLanguage", {
	provideHover: function (model, position) {
		return xhr("./playground.html").then(function (res) {
			return {
				range: new monaco.Range(
					1,
					1,
					model.getLineCount(),
					model.getLineMaxColumn(model.getLineCount())
				),
				contents: [
					{ value: "**SOURCE**" },
					{
						value:
							"```html\n" +
							res.responseText.substring(0, 200) +
							"\n```",
					},
				],
			};
		});
	},
});

monaco.editor.create(document.getElementById("container"), {
	value: "\n\nHover over this text",
	language: "mySpecialLanguage",
	hover: {
		sticky: true,
		hidingDelay: 40000
	}
});

function xhr(url) {
	var req = null;
	return new Promise(function (c, e) {
		req = new XMLHttpRequest();
		req.onreadystatechange = function () {
			if (req._canceled) {
				return;
			}

			if (req.readyState === 4) {
				if (
					(req.status >= 200 && req.status < 300) ||
					req.status === 1223
				) {
					c(req);
				} else {
					e(req);
				}
				req.onreadystatechange = function () {};
			}
		};

		req.open("GET", url, true);
		req.responseType = "";

		req.send(null);
	}).catch(function () {
		req._canceled = true;
		req.abort();
	});
}

Reproduction Steps

Set

	hover: {
		sticky: true,
		hidingDelay: 40000
	}

Actual (Problematic) Behavior

The delay is not impacting when moving out of the focus.

Expected Behavior

The hover widget should stay for 4s before it closes.

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant