Skip to content

Commit 14505be

Browse files
authored
Merge pull request #1055 from fortran-lang/fix/formatting-update-args
fix(formatter): update vscode settings on change
2 parents e48ccb4 + d61757c commit 14505be

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
8080

8181
### Fixed
8282

83+
- Fixed bug where formatting arguments would not be updated from settings.json
84+
([[#1007](https://github.com/fortran-lang/vscode-fortran-support/issues/1007)])
8385
- Fixed bug where specifying `-ffree-line-length-X` and `-ffixed-line-length-X`
8486
as `linter.extraArgs` would be overridden by the default behaviour of `fortls`
8587
([#925](https://github.com/fortran-lang/vscode-fortran-support/issues/925))

src/format/provider.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,16 @@ import {
1616
} from '../util/tools';
1717

1818
export class FortranFormattingProvider implements vscode.DocumentFormattingEditProvider {
19-
private readonly workspace = vscode.workspace.getConfiguration(EXTENSION_ID);
19+
private workspace = vscode.workspace.getConfiguration(EXTENSION_ID);
2020
private formatter: string | undefined;
21-
constructor(private logger: Logger) {}
21+
constructor(private logger: Logger) {
22+
vscode.workspace.onDidChangeConfiguration(e => {
23+
if (e.affectsConfiguration(`${EXTENSION_ID}.formatting`)) {
24+
this.logger.debug('[format] Configuration changed, reloading formatter');
25+
this.workspace = vscode.workspace.getConfiguration(EXTENSION_ID);
26+
}
27+
});
28+
}
2229

2330
public async provideDocumentFormattingEdits(
2431
document: vscode.TextDocument,

0 commit comments

Comments
 (0)