Skip to content

[markdown-language-features]: Fix starting scroll for URIs with fragment - #111126

Merged
Matt Bierner (mjbvz) merged 1 commit into
microsoft:masterfrom
dsanders11:markdown-show-preview-url-fragment
Jan 23, 2021
Merged

Matt Bierner (mjbvz) merged 1 commit into
microsoft:masterfrom
dsanders11:markdown-show-preview-url-fragment

Conversation

@dsanders11

Copy link
Copy Markdown
Member

I don't expect this PR will be merged as-is, but it does fix the issue. I expect a maintainer more familiar with markdown-language-features may want to tweak the implementation. In particular, there's fragment in multiple places when passed to the preview UI, and the index.ts file there is looking for fragment on settings, but it wasn't wired up there, so it would never be found. It's being passed in state, but I'm not sure how/why one is used over the other.

This PR fixes previewing URIs with a fragment, by having the starting scroll respect the fragment location. Currently links with a URL fragment work as expected within the markdown preview, but when a link jumps to another file, the fragment isn't used. Same with executing the markdown.showPreview command with a fragment on the URI.

Matt Bierner (@mjbvz) Megan Rogge (@meganrogge)

}

preview.update(resource);
preview.update(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling update here will force the preview to be re-rendered right away. Can the fragment be passed to the two calls above instead?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't preview.update already being called here? The PR just adds a second argument. Or are you saying including the second argument forces a re-render which wouldn't otherwise happen?

I didn't quite follow "the two calls above", could you clarify which lines you're referring to?

@mjbvz
Matt Bierner (mjbvz) merged commit 7b317af into microsoft:master Jan 23, 2021
@mjbvz

Copy link
Copy Markdown
Contributor

Thanks! Will be in the next VS Code insiders

@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants