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

[Feature Request] Can we have a predicate to decide if a completion popup should be displayed? #4497

Open
2 tasks done
lonely-lockley opened this issue May 6, 2024 · 0 comments
Labels
feature-request Request for new features or functionality

Comments

@lonely-lockley
Copy link

Context

  • This issue is not a bug report. (please use a different template for reporting a bug)
  • This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

When we develop our own code completion implementing the CompletionItemProvider interface we are bound to a set of trigger characters that make the popup to be shown. This in some cases is not really convenient as the popup shows in the wrong context. For example I'm interested in displaying autocompletion in case of identifier usage and not to show it when declaring one. While searching the internet I was able to find some "dirty" suggestions like sending events. See #1764.

Anyway, can we have a predicate function instead or in addition to the triggerCharacters array? It could look like this:

    triggerPopup(model, position, context): boolean

Then we can have an access to model to do some parsing and make a decision based on last token. We have a context to find out which event triggered the function and we know a cursor position. Probably, a delay to call this predicate should be set in the editor configuration, so it won't be called too often.

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

@lonely-lockley lonely-lockley added the feature-request Request for new features or functionality label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

1 participant