Skip to content

Commit 94cb28d

Browse files
committed
Merge branch 'master' into dev
2 parents 3756daa + e2df0d2 commit 94cb28d

File tree

5 files changed

+63
-35
lines changed

5 files changed

+63
-35
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
3131
- Adds native support for the fortran-language-server (`fortls`) making
3232
unnecessary the usage of Fortran Intellisense extension
3333
([#290](https://github.com/krvajal/vscode-fortran-support/issues/290))
34+
## [2.6.2]
35+
36+
### Added
37+
38+
- Adds Don't Show Again option when failing to spawn `fortls`, Fortran Intellisense
39+
pop-up has already been removed
40+
([#303](https://github.com/krvajal/vscode-fortran-support/issues/303))
3441

3542
## [2.6.1]
3643

@@ -361,7 +368,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
361368

362369
- Initial release
363370

364-
[unreleased]: https://github.com/krvajal/vscode-fortran-support/compare/v2.6.1...HEAD
371+
[unreleased]: https://github.com/krvajal/vscode-fortran-support/compare/v3.0....HEAD
372+
[3.0.0]: https://github.com/krvajal/vscode-fortran-support/compare/v2.6.2...v3.0.0
373+
[2.6.2]: https://github.com/krvajal/vscode-fortran-support/compare/v2.6.1...v2.6.2
365374
[2.6.1]: https://github.com/krvajal/vscode-fortran-support/compare/v2.6.0...v2.6.1
366375
[2.6.0]: https://github.com/krvajal/vscode-fortran-support/compare/v2.5.0...v2.6.0
367376
[2.5.0]: https://github.com/krvajal/vscode-fortran-support/compare/v2.4.3...v2.5.0

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,11 @@
278278
],
279279
"description": "Specify the word case to use when suggesting autocomplete options."
280280
},
281+
"fortran.ignoreWarning.fortls": {
282+
"type": "boolean",
283+
"default": false,
284+
"description": "Hide error message when the fortran-language-server is not detected"
285+
},
281286
"fortran.includePaths": {
282287
"deprecationMessage": "fortran.includePaths has been renamed to fortran.linter.includePaths."
283288
},

src/extension.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,30 @@ export async function activate(context: vscode.ExtensionContext) {
6666
// Not the most elegant solution but we need pip install to have finished
6767
// before the activate function is called so we do a little code duplication
6868
which(config.get<string>('fortls.path'), err => {
69-
if (err) {
70-
const msg = `It is highly recommended to use the fortran-language-server to
69+
if (!config.get('ignoreWarning.fortls')) {
70+
if (err) {
71+
const msg = `It is highly recommended to use the fortran-language-server to
7172
enable IDE features like hover, peeking, gotos and many more.
7273
For a full list of features the language server adds see:
7374
https://github.com/hansec/fortran-language-server`;
74-
promptForMissingTool(LANG_SERVER_TOOL_ID, msg, 'Python', loggingService).then(() => {
75+
promptForMissingTool(
76+
LANG_SERVER_TOOL_ID,
77+
msg,
78+
'Python',
79+
['Install', "Don't Show Again"],
80+
loggingService,
81+
() => {
82+
config.update('ignoreWarning.fortls', true);
83+
}
84+
).then(() => {
85+
const fortls = new FortranLanguageServer(loggingService);
86+
fortls.activate(context.subscriptions);
87+
});
88+
} else {
89+
// Spawn the fortran-language-server
7590
const fortls = new FortranLanguageServer(loggingService);
7691
fortls.activate(context.subscriptions);
77-
});
78-
} else {
79-
// Spawn the fortran-language-server
80-
const fortls = new FortranLanguageServer(loggingService);
81-
fortls.activate(context.subscriptions);
92+
}
8293
}
8394
});
8495
}

src/features/formatting-provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
5151
this.logger.logWarning(`Formatter: ${formatterName} not detected in your system.
5252
Attempting to install now.`);
5353
const msg = `Installing ${formatterName} through pip with --user option`;
54-
promptForMissingTool(formatterName, msg, 'Python');
54+
promptForMissingTool(formatterName, msg, 'Python', ['Install'], this.logger);
5555
}
5656

5757
const args: string[] = [document.fileName, ...this.getFormatterArgs()];
@@ -90,7 +90,7 @@ export class FortranFormattingProvider implements vscode.DocumentFormattingEditP
9090
this.logger.logWarning(`Formatter: ${formatterName} not detected in your system.
9191
Attempting to install now.`);
9292
const msg = `Installing ${formatterName} through pip with --user option`;
93-
promptForMissingTool(formatterName, msg, 'Python');
93+
promptForMissingTool(formatterName, msg, 'Python', ['Install'], this.logger);
9494
}
9595

9696
// Annoyingly findent only outputs to a file and not to a stream so

src/lib/tools.ts

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,40 +47,43 @@ export function FortranDocumentSelector(folder?: vscode.WorkspaceFolder) {
4747
* e.g 'hansec.fortran-ls'
4848
*
4949
* @param tool name of the tool e.g. fortran-language-server
50-
* @param msg optional message for installing said package
50+
* @param msg message for installing said package
5151
* @param toolType type of tool, supports `Python` (through pip) and 'VSExt'
52+
* @param opts options for the prompt. "Install" and "Don't Show Again" are coded
53+
* @param logger log channel output
54+
* @param action a void function for an action to perform when "Don't Show Again" is pressed
5255
*/
5356
export async function promptForMissingTool(
5457
tool: string,
5558
msg: string,
5659
toolType: string,
57-
logger?: LoggingService
60+
opts: string[],
61+
logger?: LoggingService,
62+
action?: () => void
5863
) {
5964
const items = ['Install'];
60-
return new Promise((resolve, reject) => {
61-
return resolve(
62-
vscode.window.showInformationMessage(msg, ...items).then(selected => {
63-
if (selected === 'Install') {
64-
switch (toolType) {
65-
case 'Python':
66-
installPythonTool(tool, logger);
67-
break;
65+
return vscode.window.showInformationMessage(msg, ...opts).then(selected => {
66+
if (selected === 'Install') {
67+
switch (toolType) {
68+
case 'Python':
69+
installPythonTool(tool, logger);
70+
break;
6871

69-
case 'VSExt':
70-
logger.logInfo(`Installing VS Marketplace Extension with id: ${tool}`);
71-
vscode.commands.executeCommand('extension.open', tool);
72-
vscode.commands.executeCommand('workbench.extensions.installExtension', tool);
73-
logger.logInfo(`Extension ${tool} successfully installed`);
74-
break;
72+
case 'VSExt':
73+
logger.logInfo(`Installing VS Marketplace Extension with id: ${tool}`);
74+
vscode.commands.executeCommand('extension.open', tool);
75+
vscode.commands.executeCommand('workbench.extensions.installExtension', tool);
76+
logger.logInfo(`Extension ${tool} successfully installed`);
77+
break;
7578

76-
default:
77-
logger.logError(`Failed to install tool: ${tool}`);
78-
vscode.window.showErrorMessage(`Failed to install tool: ${tool}`);
79-
break;
80-
}
81-
}
82-
})
83-
);
79+
default:
80+
logger.logError(`Failed to install tool: ${tool}`);
81+
vscode.window.showErrorMessage(`Failed to install tool: ${tool}`);
82+
break;
83+
}
84+
} else if (selected === "Don't Show Again") {
85+
action();
86+
}
8487
});
8588
}
8689

0 commit comments

Comments
 (0)