From e7730e36a55e53125da6cf2fff9064a480604c57 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Tue, 24 Jan 2017 15:46:01 -0800 Subject: [PATCH] Scroll sync for list items and quotes fixes #19151 --- extensions/markdown/media/markdown.css | 4 ++++ extensions/markdown/package.json | 3 +-- extensions/markdown/src/markdownEngine.ts | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/extensions/markdown/media/markdown.css b/extensions/markdown/media/markdown.css index 2428e9fdf45..6eea22d4953 100644 --- a/extensions/markdown/media/markdown.css +++ b/extensions/markdown/media/markdown.css @@ -29,6 +29,10 @@ body.showEditorSelection .code-line:hover:before { height: 100%; } +body.showEditorSelection li.code-active-line:before, +body.showEditorSelection li.code-line:hover:before { + left: -30px; +} .vscode-light.showEditorSelection .code-active-line:before { border-left: 3px solid rgba(0, 0, 0, 0.15); diff --git a/extensions/markdown/package.json b/extensions/markdown/package.json index 50df9b1ffe2..91dd176ee50 100644 --- a/extensions/markdown/package.json +++ b/extensions/markdown/package.json @@ -16,8 +16,7 @@ "onLanguage:markdown", "onCommand:markdown.showPreview", "onCommand:markdown.showPreviewToSide", - "onCommand:markdown.showSource", - "onLanguage:markdown" + "onCommand:markdown.showSource" ], "contributes": { "languages": [ diff --git a/extensions/markdown/src/markdownEngine.ts b/extensions/markdown/src/markdownEngine.ts index fed949be469..84b3f15efad 100644 --- a/extensions/markdown/src/markdownEngine.ts +++ b/extensions/markdown/src/markdownEngine.ts @@ -50,6 +50,8 @@ export class MarkdownEngine { this.addLineNumberRenderer(this.md, 'heading_open'); this.addLineNumberRenderer(this.md, 'image'); this.addLineNumberRenderer(this.md, 'code_block'); + this.addLineNumberRenderer(this.md, 'blockquote_open'); + this.addLineNumberRenderer(this.md, 'list_item_open'); this.addLinkNormalizer(this.md); this.addLinkValidator(this.md); @@ -96,7 +98,7 @@ export class MarkdownEngine { const original = md.renderer.rules[ruleName]; md.renderer.rules[ruleName] = (tokens: any, idx: number, options: any, env: any, self: any) => { const token = tokens[idx]; - if (token.level === 0 && token.map && token.map.length) { + if ((token.level === 0 || token.type === 'list_item_open' && token.level === 1) && token.map && token.map.length) { token.attrSet('data-line', this.firstLine + token.map[0]); token.attrJoin('class', 'code-line'); } @@ -113,7 +115,7 @@ export class MarkdownEngine { md.normalizeLink = (link: string) => { try { let uri = vscode.Uri.parse(link); - if (!uri.scheme && !uri.fragment) { + if (!uri.scheme && uri.path && !uri.fragment) { // Assume it must be a file if (uri.path[0] === '/') { uri = vscode.Uri.file(path.join(vscode.workspace.rootPath, uri.path)); -- GitLab