Skip to content

Commit bc5b8c3

Browse files
committed
Enable crate autocomplete on use in Rust 2021
1 parent c41ddf7 commit bc5b8c3

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

ui/frontend/AdvancedEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
22
import { connect } from 'react-redux';
3-
import { aceResizeKey } from './selectors';
3+
import { aceResizeKey, offerCrateAutocompleteOnUse } from './selectors';
44

55
import State from './state';
6-
import { AceResizeKey, CommonEditorProps, Crate, Edition, PairCharacters, Position, Selection } from './types';
6+
import { AceResizeKey, CommonEditorProps, Crate, PairCharacters, Position, Selection } from './types';
77

88
import styles from './Editor.module.css';
99

@@ -478,7 +478,7 @@ const mapStateToProps = (state: State) => {
478478
pairCharacters,
479479
keybinding: keybinding === 'ace' ? null : keybinding,
480480
resizeKey: aceResizeKey(state),
481-
autocompleteOnUse: state.configuration.edition === Edition.Rust2018,
481+
autocompleteOnUse: offerCrateAutocompleteOnUse(state),
482482
};
483483
};
484484

ui/frontend/selectors/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,8 @@ export const aceResizeKey = createSelector(
303303
ratioGeneration,
304304
(focus, ratioGeneration): AceResizeKey => [focus, ratioGeneration],
305305
)
306+
307+
export const offerCrateAutocompleteOnUse = createSelector(
308+
editionSelector,
309+
(edition) => edition !== Edition.Rust2015,
310+
);

0 commit comments

Comments
 (0)