mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
[json] Inconsistency between files.insertFinalNewline and Format Document. Fixes #17359
This commit is contained in:
parent
d132d93aeb
commit
ec13471816
|
@ -71,6 +71,9 @@ namespace SettingIds {
|
|||
export const enableFormatter = 'json.format.enable';
|
||||
export const enableSchemaDownload = 'json.schemaDownload.enable';
|
||||
export const maxItemsComputed = 'json.maxItemsComputed';
|
||||
}
|
||||
|
||||
namespace StorageIds {
|
||||
export const maxItemsExceededInformation = 'json.maxItemsExceededInformation';
|
||||
}
|
||||
|
||||
|
@ -300,14 +303,14 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
|
|||
}));
|
||||
|
||||
client.onNotification(ResultLimitReachedNotification.type, async message => {
|
||||
const shouldPrompt = workspace.getConfiguration().get<boolean>(SettingIds.maxItemsExceededInformation) !== false;
|
||||
const shouldPrompt = context.globalState.get<boolean>(StorageIds.maxItemsExceededInformation) !== false;
|
||||
if (shouldPrompt) {
|
||||
const ok = localize('ok', "Ok");
|
||||
const openSettings = localize('goToSetting', 'Open Settings');
|
||||
const neverAgain = localize('yes never again', "Don't Show Again");
|
||||
const pick = await window.showInformationMessage(`${message}\n${localize('configureLimit', 'Use setting \'{0}\' to configure the limit.', SettingIds.maxItemsComputed)}`, ok, openSettings, neverAgain);
|
||||
if (pick === neverAgain) {
|
||||
await workspace.getConfiguration().update(SettingIds.maxItemsExceededInformation, false, true);
|
||||
await context.globalState.update(StorageIds.maxItemsExceededInformation, false);
|
||||
} else if (pick === openSettings) {
|
||||
await commands.executeCommand('workbench.action.openSettings', SettingIds.maxItemsComputed);
|
||||
}
|
||||
|
@ -327,6 +330,8 @@ export function startClient(context: ExtensionContext, newLanguageClient: Langua
|
|||
range: client.code2ProtocolConverter.asRange(range),
|
||||
options: client.code2ProtocolConverter.asFormattingOptions(options)
|
||||
};
|
||||
params.options.insertFinalNewline = workspace.getConfiguration('files', document).get('insertFinalNewline');
|
||||
|
||||
return client.sendRequest(DocumentRangeFormattingRequest.type, params, token).then(
|
||||
client.protocol2CodeConverter.asTextEdits,
|
||||
(error) => {
|
||||
|
|
|
@ -97,11 +97,6 @@
|
|||
"default": 5000,
|
||||
"description": "%json.maxItemsComputed.desc%"
|
||||
},
|
||||
"json.maxItemsExceededInformation": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"description": "%json.maxItemsExceededInformation.desc%"
|
||||
},
|
||||
"json.schemaDownload.enable": {
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
|
|
Loading…
Reference in a new issue