diff --git a/CHANGELOG.md b/CHANGELOG.md index 89c38ab053d4f..919029e59c84e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - [terminal] update terminalQuickFixProvider proposed API according to vscode 1.85 version [#13240](https://github.com/eclipse-theia/theia/pull/13240) - contributed on behalf of STMicroelectronics - [core] added preference 'workbench.tree.indent' to control the indentation in the tree widget [#13179](https://github.com/eclipse-theia/theia/pull/13179) - contributed on behalf of STMicroelectronics - [remote] upport specifying the port of a remote SSH connection [#13296](https://github.com/eclipse-theia/theia/pull/13296) - contributed on behalf of STMicroelectronics +- [monaco] add document URI as context to getDefaultFormatter [#13280](https://github.com/eclipse-theia/theia/pull/13280) - contributed on behalf of STMicroelectronics [Breaking Changes:](#breaking_changes_not_yet_released) diff --git a/packages/monaco/src/browser/monaco-formatting-conflicts.ts b/packages/monaco/src/browser/monaco-formatting-conflicts.ts index 361db7e5350cd..b3eb98faf823f 100644 --- a/packages/monaco/src/browser/monaco-formatting-conflicts.ts +++ b/packages/monaco/src/browser/monaco-formatting-conflicts.ts @@ -59,13 +59,13 @@ export class MonacoFormattingConflictsContribution implements FrontendApplicatio await this.preferenceService.set(name, formatter); } - private getDefaultFormatter(language: string): string | undefined { + private getDefaultFormatter(language: string, resourceURI: string): string | undefined { const name = this.preferenceSchema.overridePreferenceName({ preferenceName: PREFERENCE_NAME, overrideIdentifier: language }); - return this.preferenceService.get(name); + return this.preferenceService.get(name, undefined, resourceURI); } private async selectFormatter( @@ -85,7 +85,7 @@ export class MonacoFormattingConflictsContribution implements FrontendApplicatio } const languageId = currentEditor.editor.document.languageId; - const defaultFormatterId = this.getDefaultFormatter(languageId); + const defaultFormatterId = this.getDefaultFormatter(languageId, document.uri.toString()); if (defaultFormatterId) { const formatter = formatters.find(f => f.extensionId && f.extensionId.value === defaultFormatterId);