mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-04-27 16:55:44 +08:00
Enable strict mode for many samples
This commit is contained in:
@ -17,7 +17,7 @@ export function activate(context: ExtensionContext) {
|
||||
context.subscriptions.push(workspace.onDidChangeWorkspaceFolders(e => updateStatus(status)));
|
||||
|
||||
// Update status bar item based on events for configuration
|
||||
context.subscriptions.push(workspace.onDidChangeConfiguration(e => this.updateStatus(status)));
|
||||
context.subscriptions.push(workspace.onDidChangeConfiguration(e => updateStatus(status)));
|
||||
|
||||
// Update status bar item based on events around the active editor
|
||||
context.subscriptions.push(window.onDidChangeActiveTextEditor(e => updateStatus(status)));
|
||||
@ -30,9 +30,9 @@ export function activate(context: ExtensionContext) {
|
||||
|
||||
function updateStatus(status: StatusBarItem): void {
|
||||
const info = getEditorInfo();
|
||||
status.text = info ? info.text : void 0;
|
||||
status.tooltip = info ? info.tooltip : void 0;
|
||||
status.color = info ? info.color : void 0;
|
||||
status.text = info ? info.text || '' : '';
|
||||
status.tooltip = info ? info.tooltip : undefined;
|
||||
status.color = info ? info.color : undefined;
|
||||
|
||||
if (info) {
|
||||
status.show();
|
||||
@ -41,7 +41,7 @@ function updateStatus(status: StatusBarItem): void {
|
||||
}
|
||||
}
|
||||
|
||||
function getEditorInfo(): { text: string; tooltip: string; color: string; } {
|
||||
function getEditorInfo(): { text?: string; tooltip?: string; color?: string; } | null {
|
||||
const editor = window.activeTextEditor;
|
||||
|
||||
// If no workspace is opened or just a single folder, we return without any status label
|
||||
@ -50,9 +50,9 @@ function getEditorInfo(): { text: string; tooltip: string; color: string; } {
|
||||
return null;
|
||||
}
|
||||
|
||||
let text: string;
|
||||
let tooltip: string;
|
||||
let color: string;
|
||||
let text: string | undefined;
|
||||
let tooltip: string | undefined;
|
||||
let color: string | undefined;
|
||||
|
||||
// If we have a file:// resource we resolve the WorkspaceFolder this file is from and update
|
||||
// the status accordingly.
|
||||
|
||||
@ -5,7 +5,8 @@
|
||||
"outDir": "out",
|
||||
"lib": ["es6"],
|
||||
"sourceMap": true,
|
||||
"rootDir": "."
|
||||
"rootDir": ".",
|
||||
"strict": true
|
||||
},
|
||||
"exclude": ["node_modules", ".vscode-test"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user