Skip to content

Commit

Permalink
Merge pull request #1055 from fortran-lang/fix/formatting-update-args
Browse files Browse the repository at this point in the history
fix(formatter): update vscode settings on change
  • Loading branch information
gnikit committed Feb 9, 2024
2 parents e48ccb4 + d61757c commit 14505be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
11 changes: 9 additions & 2 deletions src/format/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 14505be

Please sign in to comment.