Hide default snippets from intellisense member suggestions

Answered

I'm using Rider 2022.2.4, with a Unity 2020.3 project.

When typing a period after a variable or class name the intellisense suggestion dropdown (I'm not sure what the specific term in Rider is) includes some non-member snippets, such as 'new', 'typeof' and 'var' here:

Which when selected will insert a relevant snippet for the given variable/class. eg. when I select 'var' this snippet is inserted: 

I personally don't find these snippets that useful, and don't find myself ever using them.

If I use the code completion shortcut for type-matching (default Ctrl+Alt+Space) after having typed the period, then these snippet suggestions are not shown:


Is there a way to control which of these options is visible when typing the period?

 

Specifically, is there a setting to not see the non-member snippets 'new', 'typeof', 'var', etc. when I type the period after a type or variable, without also then having to use Ctrl+Alt+Space?

I'm assuming such a setting could be located in Editor > General > Code Completion, but I'm missing it if such a setting exists there.

1 comment
Comment actions Permalink

Hello Jpeter,

Thank you for contacting Rider support.

This behavior is configurable, but, regrettably, there is no UI for that in Rider yet. We would appreciate it if you could upvote this issue to demonstrate your interest.

The following workaround would help you to remove the mentioned items from a completion list.

If you have ReSharper:

  • Open your project in Visual Studio with ReSharper enabled;
  • Disable the Show postfix templates in ReSharper | Options | Code Editing | Postfix Templates;
  • Press Save To and select any layer.
    • In case of Personal, you will see the {solution}.sln.DotSettings.user file next to .sln file. Now just open the project in Rider, the setting set should reflect Rider now. In this case, the setting set will only reflect the current solution.
    • In case of Team-shared, you will see the {solution}.sln.DotSettings file. Now just open the project in Rider, the setting set should reflect Rider now. In this case, the setting set will only reflect the current solution.
    • In case of This computer, the setting set will reflect the whole machine and will be working on any solution, however, you would need to do an extra step
    • In Rider enable the File | Settings | Tools | ReSharper | Synchronize machine-wide Rider and ReSharper settings option and restart Rider.

If you have no ReSharper:

  • Generate a personal of team-shared DotSettings file in a similar way: (if you have such a file in the solution folder or want to set the setting globally, skip this step)
    • Open any settings page with a layers icon, for example File | Settings | Editor | Code Style | C#;
    • Select Save To -> Personal or Team-shared;
  • To set this setting per solution, open the {Solution}.DotSettings* file generated next to sln;
  • To set this setting globally, open the GlobalSettingsStorage.DotSettings file (Help | Diagnostic Tools | Special Files and Folder | double click on the "R# global settings" | open the resharper-host folder);
  • Add the following line between the <wpf:ResourceDictionary> tags: 

<s:Boolean x:Key="/Default/Environment/PostfixTemplates/ShowPostfixItemsInCodeCompletion/@EntryValue">False</s:Boolean> So it would look like as below

<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
          {..other settings if relevant..}
    <s:Boolean x:Key="/Default/Environment/PostfixTemplates/ShowPostfixItemsInCodeCompletion/@EntryValue">False</s:Boolean>
          {..other settings if relevant..}</wpf:ResourceDictionary>
  • Save a file and restart Rider.

Hope it helps.
Should you have any other questions or difficulties, please let me know.
Have a nice day!

0

Please sign in to leave a comment.