Detailed changes
@@ -197,6 +197,8 @@
// "inline"
// 3. Place snippets at the bottom of the completion list:
// "bottom"
+ // 4. Do not show snippets in the completion list:
+ // "none"
"snippet_sort_order": "inline",
// How to highlight the current line in the editor.
//
@@ -1074,6 +1074,20 @@ impl CompletionsMenu {
.and_then(|q| q.chars().next())
.and_then(|c| c.to_lowercase().next());
+ if snippet_sort_order == SnippetSortOrder::None {
+ matches.retain(|string_match| {
+ let completion = &completions[string_match.candidate_id];
+
+ let is_snippet = matches!(
+ &completion.source,
+ CompletionSource::Lsp { lsp_completion, .. }
+ if lsp_completion.kind == Some(CompletionItemKind::SNIPPET)
+ );
+
+ !is_snippet
+ });
+ }
+
matches.sort_unstable_by_key(|string_match| {
let completion = &completions[string_match.candidate_id];
@@ -1112,6 +1126,7 @@ impl CompletionsMenu {
SnippetSortOrder::Top => Reverse(if is_snippet { 1 } else { 0 }),
SnippetSortOrder::Bottom => Reverse(if is_snippet { 0 } else { 1 }),
SnippetSortOrder::Inline => Reverse(0),
+ SnippetSortOrder::None => Reverse(0),
};
let sort_positions = string_match.positions.clone();
let sort_exact = Reverse(if Some(completion.label.filter_text()) == query {
@@ -395,6 +395,8 @@ pub enum SnippetSortOrder {
Inline,
/// Place snippets at the bottom of the completion list
Bottom,
+ /// Do not show snippets in the completion list
+ None,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema)]
@@ -639,6 +639,12 @@ List of `string` values
"snippet_sort_order": "bottom"
```
+4. Do not show snippets in the completion list at all:
+
+```json
+"snippet_sort_order": "none"
+```
+
## Editor Scrollbar
- Description: Whether or not to show the editor scrollbar and various elements in it.
@@ -317,7 +317,7 @@ TBD: Centered layout related settings
### Editor Completions, Snippets, Actions, Diagnostics {#editor-lsp}
```json
- "snippet_sort_order": "inline", // Snippets completions: top, inline, bottom
+ "snippet_sort_order": "inline", // Snippets completions: top, inline, bottom, none
"show_completions_on_input": true, // Show completions while typing
"show_completion_documentation": true, // Show documentation in completions
"auto_signature_help": false, // Show method signatures inside parentheses