diff --git a/CHANGELOG.md b/CHANGELOG.md index f10de928..769ae935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -80,6 +80,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- Fixed bug where formatting arguments would not be updated from settings.json + ([[#1007](https://github.com/fortran-lang/vscode-fortran-support/issues/1007)]) - Fixed bug where specifying `-ffree-line-length-X` and `-ffixed-line-length-X` as `linter.extraArgs` would be overridden by the default behaviour of `fortls` ([#925](https://github.com/fortran-lang/vscode-fortran-support/issues/925)) diff --git a/src/format/provider.ts b/src/format/provider.ts index 88d4c1ad..e8bae6b6 100644 --- a/src/format/provider.ts +++ b/src/format/provider.ts @@ -16,9 +16,16 @@ import { } from '../util/tools'; export class FortranFormattingProvider implements vscode.DocumentFormattingEditProvider { - private readonly workspace = vscode.workspace.getConfiguration(EXTENSION_ID); + private workspace = vscode.workspace.getConfiguration(EXTENSION_ID); private formatter: string | undefined; - constructor(private logger: Logger) {} + constructor(private logger: Logger) { + vscode.workspace.onDidChangeConfiguration(e => { + if (e.affectsConfiguration(`${EXTENSION_ID}.formatting`)) { + this.logger.debug('[format] Configuration changed, reloading formatter'); + this.workspace = vscode.workspace.getConfiguration(EXTENSION_ID); + } + }); + } public async provideDocumentFormattingEdits( document: vscode.TextDocument,