VScode API why can't I get the current line?
问题 I am using typescript to write a vs code extension and for some reason I am unable to get the current line. The function I am trying to make is: function makeFrame() { vscode.window.activeTextEditor.selection.active.line; } Which fails with error: Object is possibly undefined The import statement is: import {window, commands, Disposable, ExtensionContext, StatusBarAlignment, StatusBarItem, TextDocument} from 'vscode'; What am I doing wrong? (I am both new to TypeScript and writing extensions