Closed alexgoaga closed 7 months ago
You'll need to hack plenty of stuff to achieve exactly what you describe, I'm not sure it's even doable but it's sure it's very hard
Your best chance is to put the whole file in the editor, but just hiding the part you don't want to display
I looked into hiding some of the code, but I couldn't find anything in monaco. Any suggestions will be appreciated.
The only way is by hacking the folding feature, you can have a look at https://github.com/CodinGame/monaco-editor-wrapper/blob/main/src/tools.ts
you can use the hideCodeWithoutDecoration function:
editor.createDecorationsCollection().set([{
range: <the visible range>,
options: {
className: 'displayed',
isWholeLine: true
}
}])
hideCodeWithoutDecoration(
editor,
(decoration) => decoration.options.className === 'displayed'
)
Checking.
Thanks.
@alexgoaga I am closing this, because it is not an issue. If you have a new question don't hesitate to open a discussion. Thanks.
Hi,
I would like to be able to write a a C# expression in a monaco editor and prepend, append the corresponding code.
Instead of writing all these code in a monaco editor:
using System;
namespace MyApp { class Program { static void Main(string[] args) { var str = "abcdef"; str = str.Replace("/", "").Replace("&", "") } } }
I would like to write only
str.Replace("/", "").Replace("&", "")
then intercept the message going to LSP and prepend, append the corresponding code above.(provide the context for the expression)
Is there a way to intercept and adjust the messages?
Thanks, Alex.