Skip to content

[Feature Request] Is it possible to update auto completion suggestions when re-render editor component? #3794

Answered by mpcaddy
ranlix asked this question in Q&A
Discussion options

You must be logged in to vote

You need to use the dispose returned when you register the completion item otherwise you are just adding an additional provider that is returning an empty set of suggestions.

Something like this:

  useEffect(() => {
    let disposable = null;
    // or make sure that it exists by other ways
    if (monaco) {

      disposable = monaco?.languages.registerCompletionItemProvider("sql", {
        provideCompletionItems: (
          model: monaco.editor.ITextModel,
          position: monaco.Position
        ) => {
          const word = model.getWordUntilPosition(position);
          const range = {
            startLineNumber: position.lineNumber,
            endLineNumber: position.lineNumber,

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by hediet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
feature-request Request for new features or functionality
2 participants
Converted from issue

This discussion was converted from issue #3145 on March 10, 2023 15:46.