Fix starting scroll for URIs with fragment (#111126)
This commit is contained in:
parent
98ec233c77
commit
7b317afd93
3 changed files with 7 additions and 3 deletions
|
@ -91,7 +91,7 @@ class StartingScrollLine {
|
|||
) { }
|
||||
}
|
||||
|
||||
class StartingScrollFragment {
|
||||
export class StartingScrollFragment {
|
||||
public readonly type = 'fragment';
|
||||
|
||||
constructor(
|
||||
|
|
|
@ -65,6 +65,7 @@ export class MarkdownContentProvider {
|
|||
const config = previewConfigurations.loadAndCacheConfiguration(sourceUri);
|
||||
const initialData = {
|
||||
source: sourceUri.toString(),
|
||||
fragment: state?.fragment || markdownDocument.uri.fragment || undefined,
|
||||
line: initialLine,
|
||||
lineCount: markdownDocument.lineCount,
|
||||
scrollPreviewWithEditor: config.scrollPreviewWithEditor,
|
||||
|
|
|
@ -9,7 +9,7 @@ import { MarkdownEngine } from '../markdownEngine';
|
|||
import { MarkdownContributionProvider } from '../markdownExtensions';
|
||||
import { Disposable, disposeAll } from '../util/dispose';
|
||||
import { TopmostLineMonitor } from '../util/topmostLineMonitor';
|
||||
import { DynamicMarkdownPreview, ManagedMarkdownPreview, StaticMarkdownPreview } from './preview';
|
||||
import { DynamicMarkdownPreview, ManagedMarkdownPreview, StartingScrollFragment, StaticMarkdownPreview } from './preview';
|
||||
import { MarkdownPreviewConfigurationManager } from './previewConfig';
|
||||
import { MarkdownContentProvider } from './previewContentProvider';
|
||||
|
||||
|
@ -106,7 +106,10 @@ export class MarkdownPreviewManager extends Disposable implements vscode.Webview
|
|||
preview = this.createNewDynamicPreview(resource, settings);
|
||||
}
|
||||
|
||||
preview.update(resource);
|
||||
preview.update(
|
||||
resource,
|
||||
resource.fragment ? new StartingScrollFragment(resource.fragment) : undefined
|
||||
);
|
||||
}
|
||||
|
||||
public get activePreviewResource() {
|
||||
|
|
Loading…
Reference in a new issue