We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to call web service in provideCompletionItems to return not-hardcoded/dynamic provideCompletetionItems?
monaco.languages.registerCompletionItemProvider('mySpecialLanguage', { provideCompletionItems: () => { return [ { label: 'simpleText', kind: monaco.languages.CompletionItemKind.Text }, { label: 'testing', kind: monaco.languages.CompletionItemKind.Keyword, insertText:'testing({{condition}})' }, { label: 'ifelse', kind: monaco.languages.CompletionItemKind.Snippet, insertText: [ 'if ({{condition}}) {', '\t{{}}', '} else {', '\t', '}' ].join('\n'), documentation: 'If-Else Statement' } ] } }); https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages
The text was updated successfully, but these errors were encountered:
The API supports returning a promise, inside of which you can perform your lookup.
return new Promise(succ => { ajax.then(jsonList => { succ(jsonList) }); });
instead of returning your array directly.
Sorry, something went wrong.
@alrod I have created a sample (it uses a hover provider, but the idea is the same, exactly as @stofte commented):
https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-hover-provider-example
@alexandrudima , @stofte thanks guys! it works!
alexdima
No branches or pull requests
Is it possible to call web service in provideCompletionItems to return not-hardcoded/dynamic provideCompletetionItems?
monaco.languages.registerCompletionItemProvider('mySpecialLanguage', {
provideCompletionItems: () => {
return [
{
label: 'simpleText',
kind: monaco.languages.CompletionItemKind.Text
}, {
label: 'testing',
kind: monaco.languages.CompletionItemKind.Keyword,
insertText:'testing({{condition}})'
},
{
label: 'ifelse',
kind: monaco.languages.CompletionItemKind.Snippet,
insertText: [
'if ({{condition}}) {',
'\t{{}}',
'} else {',
'\t',
'}'
].join('\n'),
documentation: 'If-Else Statement'
}
]
}
});
https://microsoft.github.io/monaco-editor/playground.html#extending-language-services-custom-languages
The text was updated successfully, but these errors were encountered: