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
Hi, thanks for the port It's awesome.
I want to get the code selection from the provideCompletionItems delegate, like the javascript example on the Monaco playground:
monaco.languages.registerCompletionItemProvider("json", {
provideCompletionItems: function (model, position) {
var word = model.getWordUntilPosition(position); <-- this
var range = {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: word.startColumn,
endColumn: word.endColumn,
};
return {
suggestions: createDependencyProposals(range),
};
},
});
But the wrapper sends a "modelUri" not the model itself, how can I convert this string to the real object? I tried using
BlazorMonaco.Editor.Global.GetModel(JsRuntime, modelUri); or also _editor.GetSelection() but there are not allowed async operations.
Thanks!
The text was updated successfully, but these errors were encountered:
I have no idea also, but it seems you have to do something like this:
await Global.RegisterCompletionItemProvider(JsRuntime,"sql",(model,position,context)=>{ ArgumentNullException.ThrowIfNull(_editor);vartext= _editor.GetModel().Result;varpos= _editor.GetPosition().Result;varword= text.GetWordUntilPosition(pos).Result.Word;if(word is not null&& word.Trim().EndsWith("FROM", StringComparison.InvariantCultureIgnoreCase)){// return your list }}
In blazor this doesn't work because you can't call .Result on async methods so I'm trying to figure that out now...
Hi, thanks for the port It's awesome.
I want to get the code selection from the provideCompletionItems delegate, like the javascript example on the Monaco playground:
But the wrapper sends a "modelUri" not the model itself, how can I convert this string to the real object? I tried using
BlazorMonaco.Editor.Global.GetModel(JsRuntime, modelUri); or also _editor.GetSelection() but there are not allowed async operations.
Thanks!
The text was updated successfully, but these errors were encountered: