Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature Request: Custom sorting and filtering of suggestion menu #1077

Closed
trevorade opened this issue Sep 25, 2018 · 4 comments
Closed

Feature Request: Custom sorting and filtering of suggestion menu #1077

trevorade opened this issue Sep 25, 2018 · 4 comments
Assignees
Labels

Comments

@trevorade
Copy link

monaco-editor version: v0.14.3

Currently, when hitting Ctrl-Space in a blank part of a document, you get lots and lots of autocomplete suggestions. These are sorted alphabetically (unless sortText is used). It would be helpful to allow customizable ordering of all completion items.

Suggestions:

  • Custom user-provided function which takes the current list and returns a new list to use (could be a subset). This would be easiest and would allow support for all the below.
  • Group completion items by type and allow specifying which types to display at all and in what order.
  • Place a separate group at the top of symbols already referenced in the file with a divider following (this is similar to recentlyUsed except it's more than 1 item)
@ulrichb
Copy link
Contributor

ulrichb commented Sep 11, 2019

I also want to filter auto complete items based on the member's JSDoc (filter out members with /** @hideFromAutoComplete */).

@alexandrudima Any hint how to achieve this right now?

EDIT: I'm talking about members from the TypeScript language provider.

@ulrichb
Copy link
Contributor

ulrichb commented Sep 12, 2019

... I did this now by monkey-patching SuggestAdapter#provideCompletionItems():

import { SuggestAdapter } from 
    "monaco-editor/esm/vs/language/typescript/languageFeatures";

const originalProvideCompletionItems = SuggestAdapter.prototype.provideCompletionItems;

SuggestAdapter.prototype.provideCompletionItems = 
    async function provideCompletionItems(...args) {

    const result = await originalProvideCompletionItems.apply(this, args);

    // ... change result.suggestions ...

    return result;
};

@jrieken
Copy link
Member

jrieken commented Oct 9, 2019

no change planned

@jrieken jrieken closed this as completed Oct 9, 2019
@trevorade
Copy link
Author

@jrieken, specific to this issue, would you be open to a community PR which added a "custom user-provided function which takes the current list [of autocompletion suggestions] and returns a new list to use (could be a subset)."?

In general, while I appreciate that you are taking the time to clean out old feature requests, might I suggest that you provide some reasoning why feature requests are rejected rather than simply stating "no change planned"?

This particular feature would be greatly beneficial to the JavaScript editor I'm building for Google. 5 other Github members have thumbs-up'd this issue as well. I realize that's not a large number but feature request discovery is poor in Github.

I understand that Microsoft is primarily interested in Monaco for use in Visual Studio Code but I imagine your team understands the impact this standalone editor has made to many other projects with varying needs. For all these other projects, it would be really helpful if there was a better venue for us to collaboratively rate the importance of feature requests. If there was sufficient voice behind specific feature requests, I imagine these would more likely come to fruition either by Microsoft devs or the community.

Respectfully,

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 25, 2019
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants