Skip to content

Commit 3683314

Browse files
author
Ives van Hoorne
committed
Add preference to disable ATA
1 parent 7f4d0fb commit 3683314

File tree

5 files changed

+15
-1
lines changed

5 files changed

+15
-1
lines changed

src/app/components/sandbox/CodeEditor/Monaco.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,9 @@ export default class CodeEditor extends React.PureComponent<Props, State> {
572572
};
573573

574574
fetchDependencyTypings = (dependencies: Object) => {
575-
this.typingsFetcherWorker.postMessage({ dependencies });
575+
if (this.props.preferences.autoDownloadTypes) {
576+
this.typingsFetcherWorker.postMessage({ dependencies });
577+
}
576578
};
577579

578580
addKeyCommands = () => {

src/app/containers/Preferences/EditorPageSettings/EditorSettings/Preferences.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ const Preferences = ({ preferences, preferencesActions }: Props) => {
4242
/>
4343
<Description>Use CodeMirror instead of Monaco editor.</Description>
4444
<Rule />
45+
<PaddedPreference
46+
title="Automatic Type Acquisition"
47+
type="boolean"
48+
{...bindValue('autoDownloadTypes')}
49+
/>
50+
<Description>
51+
Automatically download type definitions for dependencies.
52+
</Description>
53+
<Rule />
4554
<PaddedPreference
4655
title="Prettify on save"
4756
type="boolean"

src/app/store/preferences/keys.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ export const fontSize = 'settings.fontsize';
99
export const fontFamily = 'settings.fontfamily';
1010
export const clearConsoleEnabled = 'settings.clearconsole';
1111
export const codeMirror = 'settings.codemirror';
12+
export const autoDownloadTypes = 'settings.autoDownloadTypes';

src/app/store/preferences/reducer.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const initialState: Preferences = Object.keys(keys).reduce(
4444
clearConsoleEnabled: false,
4545
prettierConfig: DEFAULT_PRETTIER_CONFIG,
4646
codeMirror: false,
47+
autoDownloadTypes: true,
4748
},
4849
);
4950

src/common/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export type Preferences = {
141141
fontFamily: ?string,
142142
clearConsoleEnabled: ?boolean,
143143
prettierConfig: Object,
144+
autoDownloadTypes: ?boolean,
144145
};
145146

146147
export type NotificationButton = {

0 commit comments

Comments
 (0)