Skip to content

Commit cb5deb0

Browse files
committed
Create a text file to not show Release notes
Release Notes should only be shown at the very first installation and activation of a new version of the extension. If you want to view the Release Notes any other time then you will have to call the Command Pallete
1 parent 246f8e3 commit cb5deb0

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/extension.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
// src/extension.ts
1+
'use strict';
2+
23
import * as vscode from 'vscode';
34
import * as pkg from '../package.json';
5+
import * as path from 'path';
6+
import * as fs from 'fs';
7+
48
import { FortranCompletionProvider } from './features/completion-provider';
59
import { FortranDocumentSymbolProvider } from './features/document-symbol-provider';
610
import { FortranFormattingProvider } from './features/formatting-provider';
@@ -9,6 +13,7 @@ import { FortranHoverProvider } from './features/hover-provider';
913
import { FortranLintingProvider } from './features/linter-provider';
1014
import { EXTENSION_ID, FortranDocumentSelector } from './lib/tools';
1115
import { LoggingService } from './services/logging-service';
16+
import { WhatsNew } from './features/commands';
1217

1318
// Make it global to catch errors when activation fails
1419
const loggingService = new LoggingService();
@@ -87,6 +92,14 @@ export async function activate(context: vscode.ExtensionContext) {
8792
},
8893
})
8994
);
95+
96+
context.subscriptions.push(vscode.commands.registerCommand(WhatsNew, showWhatsNew));
97+
// Upon the very first initialisation create a file to indicate that the release
98+
// notes have been shown and not show them again.
99+
if (!fs.existsSync(path.join(__dirname, 'displayReleaseNotes.txt'))) {
100+
await showWhatsNew();
101+
fs.writeFileSync(path.join(__dirname, 'displayReleaseNotes.txt'), 'false');
102+
}
90103
return context;
91104
}
92105

@@ -142,3 +155,8 @@ function detectDeprecatedOptions() {
142155
Please Disable/Uninstall extension: fortran.`);
143156
}
144157
}
158+
159+
async function showWhatsNew() {
160+
const uri = vscode.Uri.file(path.join(__dirname, '../updates/RELEASE_NOTES-v3.0.md'));
161+
vscode.commands.executeCommand('markdown.showPreview', uri);
162+
}

0 commit comments

Comments
 (0)