Skip to content

Commit 530a49e

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 0fd66a8 commit 530a49e

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

package-lock.json

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@
250250
"tslint": "^5.20.1",
251251
"typescript": "^3.5.1",
252252
"vscode": "^1.1.37",
253-
"vscode-tmgrammar-test": "^0.0.11",
254-
"which": "^2.0.2"
253+
"vscode-tmgrammar-test": "^0.0.11"
255254
},
256255
"husky": {
257256
"hooks": {
@@ -264,6 +263,7 @@
264263
]
265264
},
266265
"dependencies": {
267-
"vscode-languageclient": "^5.1.0"
266+
"vscode-languageclient": "^5.1.0",
267+
"which": "^2.0.2"
268268
}
269269
}

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)