Theia: [editor] annoying auto-suggestion when writing comments

Created on 23 May 2019  路  11Comments  路  Source: eclipse-theia/theia

Description

There is an annoying auto-suggestion feature when writing comments.
I do not expect suggestions when writing comments as it is intrusive to the experience.

![bug](https://user-images.githubusercontent.com/40359487/58249466-f9884080-7d2c-11e9-854d-5380789611fc.gif)

In comparison, here's vscode:

![vscode](https://user-images.githubusercontent.com/40359487/58249560-3a805500-7d2d-11e9-8ac3-d56c08e4934c.gif)
bug editor help wanted monaco

Most helpful comment

I noticed this problem, it is caused by the configuration of monaco.

// type in monaco editor
quickSuggestions?: boolean | {
    other: boolean;
    comments: boolean;
    strings: boolean;
};
// editor preference
'editor.quickSuggestions': {
       'type': 'boolean',
       'default': true,
       'description': 'Enable quick suggestions (shadow suggestions)'
},

The value True means you will see suggestions anywhere.
We should not display suggestions by default in string and comment, just like vscode.

All 11 comments

Have been looking into this and from what I can see the problem is within packages/monaco/src/browser/monaco-snippet-suggest-provider.ts. I can intercept when the snippets are provided but I am having difficulty working out if it is within a comment block. The only feasible way I can see to do this is to the class name of the div what is being written... any other ideas?

@sauny I took a look at the hint you provided and saw that provideCompletionItems is the one that provides the snippets from the bug.

https://github.com/theia-ide/theia/blob/c8dc1398fe1c9427f2d28b3c16049eeab8f6cb80/packages/monaco/src/browser/monaco-snippet-suggest-provider.ts#L30

For test purposes updating the code to return [] fixed the bug. I'm not entirely sure what the method is used for, since without it I am still getting proper snippets.

@sauny I wonder if we can detect when we have a comment and not provide the snippet help.

@vince-fugnitto I thought that, the comments get registered in the grammar-contribution files but I see nowhere where they get used. If I can work out where theia decides to set the CSS for comments, I should be able to set something to say it is in comment mode... but I can't find a way to do it....

@vince-fugnitto I thought that, the comments get registered in the grammar-contribution files but I see nowhere where they get used. If I can work out where theia decides to set the CSS for comments, I should be able to set something to say it is in comment mode... but I can't find a way to do it....

I don't quite understand what you mean about the CSS suggestion.

I meant the Monaco editor sets the css for a comment (it goes green). But I can't work out where that happens.

I noticed this problem, it is caused by the configuration of monaco.

// type in monaco editor
quickSuggestions?: boolean | {
    other: boolean;
    comments: boolean;
    strings: boolean;
};
// editor preference
'editor.quickSuggestions': {
       'type': 'boolean',
       'default': true,
       'description': 'Enable quick suggestions (shadow suggestions)'
},

The value True means you will see suggestions anywhere.
We should not display suggestions by default in string and comment, just like vscode.

@BroKun can you handle it please? Please could you also reference a corresponding default configuration in VS Code, just to check that it is so.

@BroKun can you handle it please? Please could you also reference a corresponding default configuration in VS Code, just to check that it is so.

Yes, I am doing this.
And I found that there is another problem, we need to pass the object that can be rewritten to monaco, especially when updating the configuration, but now the preferrenceService provides read-only objects.
I will solve this problem first, but it is better if the preferenceService can support it. Maybe I should open another issue.

@vince-fugnitto This seems to have been resolved after #5931 and Monaco upgraded to 0.17.0.

@vince-fugnitto This seems to have been resolved after #5931 and Monaco upgraded to 0.17.0.

I forgot to close, thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vinokurig picture vinokurig  路  3Comments

vince-fugnitto picture vince-fugnitto  路  3Comments

cekvenich picture cekvenich  路  3Comments

marechal-p picture marechal-p  路  3Comments

dhananjayharel picture dhananjayharel  路  3Comments