Hide CodeLens if HTML preview is not available.
This commit is contained in:
parent
1bfc52efba
commit
fb89436091
|
@ -45,6 +45,12 @@ export default class Indicator implements vscode.Disposable {
|
|||
|
||||
private statusBarItem: vscode.StatusBarItem;
|
||||
|
||||
private gnuTexinfoAvailable = false;
|
||||
|
||||
get canDisplayPreview() {
|
||||
return this.gnuTexinfoAvailable;
|
||||
}
|
||||
|
||||
private refresh(editor?: vscode.TextEditor) {
|
||||
if (editor === undefined || editor.document.languageId != 'texinfo') {
|
||||
this.statusBarItem.hide();
|
||||
|
@ -65,9 +71,11 @@ export default class Indicator implements vscode.Disposable {
|
|||
} else {
|
||||
icon = '$(check)';
|
||||
}
|
||||
this.gnuTexinfoAvailable = true;
|
||||
} else {
|
||||
icon = '$(close)';
|
||||
tooltip = `GNU Texinfo (${Options.makeinfo}) is not correctly installed or configured.`;
|
||||
this.gnuTexinfoAvailable = false;
|
||||
}
|
||||
this.statusBarItem.text = `${icon} GNU Texinfo ${version}`;
|
||||
this.statusBarItem.tooltip = tooltip;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
import * as vscode from 'vscode';
|
||||
import ContextMapping from '../context_mapping';
|
||||
import Indicator from '../indicator';
|
||||
import Options from '../options';
|
||||
|
||||
/**
|
||||
|
@ -30,6 +31,7 @@ export default class CodeLensProvider implements vscode.CodeLensProvider {
|
|||
|
||||
provideCodeLenses(document: vscode.TextDocument) {
|
||||
if (!Options.enableCodeLens) return undefined;
|
||||
if (!Indicator.instance.canDisplayPreview) return undefined;
|
||||
return ContextMapping.getDocumentContext(document).foldingRange.nodeValues;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue