Skip to content
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

trigger auto-complete (suggestions) programmatically #74

Closed
jefflevinson opened this issue Jul 19, 2016 · 10 comments
Closed

trigger auto-complete (suggestions) programmatically #74

jefflevinson opened this issue Jul 19, 2016 · 10 comments
Assignees
Labels
feature-request Request for new features or functionality suggest
Milestone

Comments

@jefflevinson
Copy link

I have a suggestion as follows:
insertText: 'sum({{}})'
When the text is inserted the cursor is within the parenthesis appropriately. However, as soon as the text is inserted, I want to pop up the suggestions for what should go there without the user taking an action. I could not figure out how to accomplish this with a suggestion trigger which seems to have to be typed in by the user.

Thanks.

@alexdima
Copy link
Member

editor.trigger('source - use any string you like', 'editor.action.triggerSuggest', {});

@alexdima alexdima added this to the Backlog milestone Aug 16, 2016
@alexdima alexdima self-assigned this Aug 16, 2016
@jefflevinson
Copy link
Author

I tried the above and it doesn't seem to trigger the suggestion. In addition, it's a strange construct. The text matching matches the line to the current point (supposedly) but it actually returns "sum()" instead of "sum(" which I would have expected since the cursor is in-between the parenthesis. But even when I change the match to "sum()" it still doesn't actually show the auto-complete even though I'm returning a list.

@alexdima
Copy link
Member

@jrieken This touches on the support to execute something/a command (that just happens to be to pop up suggestions again) when a completion item is accepted. Maybe you keep this request also in mind when designing it?

@alexdima alexdima added feature-request Request for new features or functionality and removed question labels Aug 22, 2016
@aoto
Copy link

aoto commented Jun 16, 2017

@alexandrudima how to send suggest items when do the triggerSuggest?

@aoto
Copy link

aoto commented Jun 19, 2017

My case is when I input the ., it tips the table column list, and the language is SQL.

editor.onDidChangeModelContent(e => {
  if (e.text === '.') {
    monaco.languages.registerCompletionItemProvider('sql', {
      provideCompletionItems: () => {
        return [
          {
            label: 'column1',
            kind: monaco.languages.CompletionItemKind.Text
          },
          {
            label: 'column2',
            kind: monaco.languages.CompletionItemKind.Text
          }
        ]
      }
    });
    editor.trigger('source - use any string you like', 'editor.action.triggerSuggest', {});
  }
})

if i use registerCompletionItemProvider, it should input col... then completion show, bug I want auto show the column1, column2 completetion.

I have researsh this case for about two days, i need some tip. Thanks!
@alexandrudima

@aoto
Copy link

aoto commented Jul 10, 2017

@alexandrudima Some response?

@lidermanrony
Copy link

Any update on this feature? I would love to have the possibility to re-open suggestion dialog once user accepts a previous completion item.

any other workaround to know when suggestion was accepted?

@jrieken
Copy link
Member

jrieken commented Jan 12, 2018

I would love to have the possibility to re-open suggestion dialog once user accepts a previous completion item

We can do that, set editor.action.triggerSuggest as command on a suggestion.

@Hamund
Copy link

Hamund commented Feb 7, 2018

Is this fixed by this: microsoft/vscode#34565 ? If so, any chance monaco-editor-core version could be bumped?

@jrieken
Copy link
Member

jrieken commented Feb 28, 2018

A new release will come eventually (not sure yet). Closing this issue because the underlying issue is fixed

@jrieken jrieken closed this as completed Feb 28, 2018
@alexdima alexdima modified the milestones: Backlog, February 2018 Feb 28, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality suggest
Projects
None yet
Development

No branches or pull requests

6 participants