提交 77fbceeb 编写于 作者: M Matt Bierner

Use selection active for initial line as well

上级 a765a1a2
...@@ -86,6 +86,7 @@ export function activate(context: vscode.ExtensionContext) { ...@@ -86,6 +86,7 @@ export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.window.onDidChangeTextEditorSelection(event => { context.subscriptions.push(vscode.window.onDidChangeTextEditorSelection(event => {
if (isMarkdownFile(event.textEditor.document)) { if (isMarkdownFile(event.textEditor.document)) {
console.log('event.selections[0].active.line');
vscode.commands.executeCommand('_workbench.htmlPreview.postMessage', vscode.commands.executeCommand('_workbench.htmlPreview.postMessage',
getMarkdownUri(event.textEditor.document.uri), getMarkdownUri(event.textEditor.document.uri),
{ {
...@@ -268,7 +269,7 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider { ...@@ -268,7 +269,7 @@ class MDDocumentContentProvider implements vscode.TextDocumentContentProvider {
let initialLine = 0; let initialLine = 0;
const editor = vscode.window.activeTextEditor; const editor = vscode.window.activeTextEditor;
if (editor && editor.document.uri.path === sourceUri.path) { if (editor && editor.document.uri.path === sourceUri.path) {
initialLine = editor.selection.start.line; initialLine = editor.selection.active.line;
} }
const body = this.engine.render(sourceUri, previewFrontMatter === 'hide', document.getText()); const body = this.engine.render(sourceUri, previewFrontMatter === 'hide', document.getText());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册