-
Notifications
You must be signed in to change notification settings - Fork 99
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
LineNumber property #35
Comments
Currently, C# LineNumbers property is just a string, but it can be a function as well in JavaScript. I'll figure out a way to achieve the same thing in C# and publish a new version of BlazorMonaco this weekend. |
Any news on this subject? |
Sorry. I couldn't find time for this yet. But I see this as a priority item for this repo. I'll solve it asap. |
I've added support for this in v2.1.0. Just set the LineNumbersLambda property of the construction options to a lambda and it will be called by the editor when needed. |
Hi @serdarciplak and thanks for the attention. I was testing, and when using the the new property LineNumbersLambda when the page loads the components, it throws the following: My project runs on blazor-server-side, this functionality should be supported in this model? |
I haven't tested it on a server-side app. I'll check it out. |
Did you manage to take the test? |
Any news about this? I'm still seeing it running in server-side mode |
How to customize line numbers using Blazor serverTried to patch BlazorMonacoOk, I first tried to simply setup a callback using Blazor Server, but it didn't work throwing an exception saying that the InvokeMethod must be invokeMethodAsync https://github.com/serdarciplak/BlazorMonaco/blob/master/BlazorMonaco/wwwroot/jsInterop.js#L112 So I tried to fork and patch my own version modifying the code to do invokeMethodAsync. Well, it creates a promise so you can wait it or do a "then" and then see your callback code in C# being invoked... but it is impossible to return the value to the callback because it doesn't allow any form of async code (you can put a "then" and log the result and see it works, but it is not possible to return it). Of course, the invokeMethod is good for webassembly, but won't work in Blazor server. I wasn't able to figure out a solution this way, even checked the Monaco code but making this "lineNumbers" callback async would imply tons of changes afaik. Workaround using some Javascript codeBasically, pass an array of strings or whatever to javascript and set the callback there. On my EditorOnDidInit I invoked this code:
where 'resultEditor' is the Id of my component:
Then I added this javascript code in my page:
Actually my code is different because I pass a list of deleted lines, but you get the idea. Hope it helps. |
I finally had time to have a look at this and I think I have a fix. Here is an explanation of the new flow;
@psantosl It would be great if you can review the PR #147 as you already know the context here. |
Hi, i'm trying to "bind" two editors together, this just means that the last "line number" of the first editor will become the first linenumber of the second editor, just to allow me to have a "read only" area on the "editor"
should this work? knowing that most of this will run as "interop"
a code very "similiar" will run on the "playground" without issues.
looking at the "create" function used in the JsInterop File, maybe that the function is being set as a "string".
am i doing something wrong?
The text was updated successfully, but these errors were encountered: