Change:
Testing My extension's provider is not receiving the within the passed to its I think this's caused by this -

Discussion:
const blobSegment = repository?.state.HEAD?.name ? encodeURIComponentExceptSlashes(repository.state.HEAD?.name) : repository?.state.HEAD?.commit; const filepathSegment = encodeURIComponentExceptSlashes(item.resourceUri.path.substring(repository?.rootUri.path.length)); const rangeSegment = getRangeSegment(item); <del> return vscode.Uri.parse(`${this.getVscodeDevHost()}/${repo.owner}/${repo.repo}/blob/${blobSegment}${filepathSegment}${rangeSegment}${rangeSegment}`); </del> <ins> return vscode.Uri.parse(`${this.getVscodeDevHost()}/${repo.owner}/${repo.repo}/blob/${blobSegment}${filepathSegment}${rangeSegment}`); </ins> }

export interface IShareableItemDto { resourceUri: UriComponents; <del> range?: IRange; </del> <ins> selection?: IRange; </ins> } export interface ISignatureHelpProviderMetadataDto {

async $provideShare(handle: number, shareableItem: IShareableItemDto, token: CancellationToken): Promise<UriComponents | undefined> { const provider = this.providers.get(handle); <del> const result = await provider?.provideShare({ selection: Range.to(shareableItem.range), resourceUri: URI.revive(shareableItem.resourceUri) }, token); </del> <ins> const result = await provider?.provideShare({ selection: Range.to(shareableItem.selection), resourceUri: URI.revive(shareableItem.resourceUri) }, token); </ins> return result ?? undefined; }

import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IProgressService, ProgressLocation } from 'vs/platform/progress/common/progress'; <ins> import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; </ins> const targetMenus = [ MenuId.EditorContextShare,

const dialogService = accessor.get(IDialogService); const urlService = accessor.get(IOpenerService); const progressService = accessor.get(IProgressService); <ins> const selection = accessor.get(ICodeEditorService).getActiveCodeEditor()?.getSelection() ?? undefined; const uri = await progressService.withProgress({ location: ProgressLocation.Window, detail: localize('generating link', 'Generating link...') }, async () => shareService.provideShare({ resourceUri, selection }, new CancellationTokenSource().token)); </ins> <del> const uri = await shareService.provideShare({ resourceUri }, new CancellationTokenSource().token); </del> if (uri) { const uriText = uri.toString(); <del> await progressService.withProgress({ location: ProgressLocation.Window, detail: localize('generating link', 'Generating link...') }, () => clipboardService.writeText(uriText)); </del> <ins> await clipboardService.writeText(uriText); </ins> dialogService.prompt( {

import { CancellationToken } from 'vs/base/common/cancellation'; import { IDisposable } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; <ins> import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'; </ins> import { score } from 'vs/editor/common/languageSelector'; import { localize } from 'vs/nls'; import { ISubmenuItem } from 'vs/platform/actions/common/actions';

constructor( @IContextKeyService private contextKeyService: IContextKeyService, @ILabelService private readonly labelService: ILabelService, <del> @IQuickInputService private quickInputService: IQuickInputService </del> <ins> @IQuickInputService private quickInputService: IQuickInputService, @ICodeEditorService private readonly codeEditorService: ICodeEditorService, </ins> ) { this.providerCount = ShareProviderCountContext.bindTo(this.contextKeyService); }

} async provideShare(item: IShareableItem, token: CancellationToken): Promise<URI | undefined> { <ins> const language = this.codeEditorService.getActiveCodeEditor()?.getModel()?.getLanguageId() ?? ''; </ins> const providers = [...this._providers.values()] <del> .filter((p) => score(p.selector, item.resourceUri, '', true, undefined, undefined) > 0) </del> <ins> .filter((p) => score(p.selector, item.resourceUri, language, true, undefined, undefined) > 0) </ins> .sort((a, b) => a.priority - b.priority); if (providers.length === 0) {

import { CancellationToken } from 'vs/base/common/cancellation'; import { IDisposable } from 'vs/base/common/lifecycle'; <del> import { IRange } from 'vs/base/common/range'; </del> import { URI } from 'vs/base/common/uri'; <ins> import { Selection } from 'vs/editor/common/core/selection'; </ins> import { LanguageSelector } from 'vs/editor/common/languageSelector'; import { ISubmenuItem } from 'vs/platform/actions/common/actions'; import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; export interface IShareableItem { resourceUri: URI; <del> location?: IRange; </del> <ins> selection?: Selection; </ins> } export interface IShareProvider {