Skip to content

Commit

Permalink
Support TS disable suggestions setting
Browse files Browse the repository at this point in the history
Fixes #47617
  • Loading branch information
mjbvz committed May 4, 2018
1 parent f8ced19 commit 7265881
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,25 @@ export default class FileConfigurationManager {
}

const config = workspace.getConfiguration(
isTypeScriptDocument(document) ? 'typescript' : 'javascript',
document.uri);

const preferences = config.workspace.getConfiguration(
isTypeScriptDocument(document) ? 'typescript.preferences' : 'javascript.preferences',
document.uri);

return {
quotePreference: getQuoteStylePreference(config),
importModuleSpecifierPreference: getImportModuleSpecifierPreference(config)
quotePreference: getQuoteStylePreference(preferences),
importModuleSpecifierPreference: getImportModuleSpecifierPreference(preferences),
disableSuggestions: disableSuggestionsPreference(config),
};
}
}

function disableSuggestionsPreference(config: WorkspaceConfiguration) {
return !config.get<boolean>('suggestionActions.enabled');
}

function getQuoteStylePreference(config: WorkspaceConfiguration) {
switch (config.get<string>('quoteStyle')) {
case 'single': return 'single';
Expand Down

0 comments on commit 7265881

Please sign in to comment.