You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am implementing my hoover tool to see the description of my TOKENs using monaco.languages.registerHoverProvider, it works very well for me when they are default languages in monaco editor but if I use a custom language the content of the hoover panel is not painted with it color of my token assigned when creating my theme.
// Registrar el Hover Provider para el lenguaje 'ppl'
monaco.languages.registerHoverProvider('ppl', {
provideHover: function (model, position) {
const word = model.getWordAtPosition(position);
if (!word) {
return null; // Si no hay ninguna palabra bajo el cursor, no mostramos nada.
}
// Aquí puedes personalizar las palabras clave que quieres que tengan un hover especial
if (word.word === 'FOR') {
return {
range: new monaco.Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn),
contents: [
{ value: '**FOR**: Esta es una declaración de bucle en PPL.' },
{ value: '---' }, // Esto crea una línea horizontal (separador)
{ value: 'Sintaxis: `FOR variable := 1 TO max DO`' },
{ value: '---' }, // Esto crea una línea horizontal (separador)
{ value: '**Documentación**: Permite iterar sobre un rango de valores.' }
]
};
}
// Si no se encuentra una palabra clave, devolvemos null
return null;
}
});
In theory it should use the colors that were assigned in my monaco.editor.defineTheme('ppl-theme-light', { and it doesn't, I don't know how to activate it if there is an option to do that.
For example, in VSCode, when you implement a custom language and add hoover, the color of your custom language is automatically assigned.
Well I hope someone can help me achieve my goal, I leave you my code in Monaco editor Custom Code
Monaco Editor Playground Code
Reproduction Steps
No response
Actual (Problematic) Behavior
No response
Expected Behavior
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Link
Hello, I am implementing my hoover tool to see the description of my TOKENs using
monaco.languages.registerHoverProvider
, it works very well for me when they are default languages inmonaco editor
but if I use a custom language the content of the hoover panel is not painted with it color of my token assigned when creating my theme.In theory it should use the colors that were assigned in my
monaco.editor.defineTheme('ppl-theme-light', {
and it doesn't, I don't know how to activate it if there is an option to do that.For example, in VSCode, when you implement a custom language and add hoover, the color of your custom language is automatically assigned.
Well I hope someone can help me achieve my goal, I leave you my code in Monaco editor Custom Code
Monaco Editor Playground Code
Reproduction Steps
No response
Actual (Problematic) Behavior
No response
Expected Behavior
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: