Skip to content

Commit 4da11a2

Browse files
committed
Addresses review comments
1. Fixes conditional trigger for linting 2. Moves which as a dependency 3. Adds logging output for when parts of the extension are enabled
1 parent 521dcd5 commit 4da11a2

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

package-lock.json

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@
268268
]
269269
},
270270
"dependencies": {
271-
"vscode-languageclient": "^5.1.0"
271+
"vscode-languageclient": "^5.1.0",
272+
"which": "^2.0.2"
272273
}
273274
}

src/extension.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function activate(context: vscode.ExtensionContext) {
2525
let linter = new FortranLintingProvider(loggingService)
2626
linter.activate(context.subscriptions)
2727
vscode.languages.registerCodeActionsProvider(FORTRAN_DOCUMENT_SELECTOR, linter)
28+
loggingService.logInfo('Linter is enabled')
2829
} else {
2930
loggingService.logInfo('Linter is not enabled')
3031
}
@@ -36,6 +37,7 @@ export function activate(context: vscode.ExtensionContext) {
3637
new FortranFormattingProvider(loggingService)
3738
);
3839
context.subscriptions.push(disposable);
40+
loggingService.logInfo('Formatting is enabled')
3941
}
4042
else {
4143
loggingService.logInfo('Formatting is disabled')
@@ -54,6 +56,7 @@ export function activate(context: vscode.ExtensionContext) {
5456
if (extensionConfig.get('provideHover', true)) {
5557
let hoverProvider = new FortranHoverProvider(loggingService)
5658
vscode.languages.registerHoverProvider(FORTRAN_DOCUMENT_SELECTOR, hoverProvider)
59+
loggingService.logInfo('Hover Provider is enabled')
5760
} else {
5861
loggingService.logInfo('Hover Provider is not enabled')
5962
}
@@ -64,6 +67,7 @@ export function activate(context: vscode.ExtensionContext) {
6467
FORTRAN_DOCUMENT_SELECTOR,
6568
symbolProvider
6669
)
70+
loggingService.logInfo('Symbol Provider is enabled')
6771
} else {
6872
loggingService.logInfo('Symbol Provider is not enabled')
6973
}

src/features/linter-provider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ export default class FortranLintingProvider {
1818

1919
// Only lint Fortran (free, fixed) format files
2020
if (
21-
FORTRAN_DOCUMENT_SELECTOR.some((element) => { element.language !== textDocument.languageId }) ||
22-
FORTRAN_DOCUMENT_SELECTOR.some((element) => { element.scheme !== textDocument.uri.scheme })
21+
!FORTRAN_DOCUMENT_SELECTOR.some(e => e.scheme === textDocument.uri.scheme) ||
22+
!FORTRAN_DOCUMENT_SELECTOR.some(e => e.language === textDocument.languageId)
2323
) {
2424
return
2525
}
@@ -138,7 +138,7 @@ export default class FortranLintingProvider {
138138
private command: vscode.Disposable
139139

140140
public activate(subscriptions: vscode.Disposable[]) {
141-
this.diagnosticCollection = vscode.languages.createDiagnosticCollection()
141+
this.diagnosticCollection = vscode.languages.createDiagnosticCollection('Fortran')
142142

143143
vscode.workspace.onDidOpenTextDocument(
144144
this.doModernFortranLint,

0 commit comments

Comments
 (0)