mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Variable reference fixes (#208841)
Remove variable reference hover additions Because the resource label does this by default and it's fine And fix navigating to range on variable reference with a Location
This commit is contained in:
parent
f368107e70
commit
6bf0f76775
|
@ -25,7 +25,7 @@ import { ResourceMap } from 'vs/base/common/map';
|
||||||
import { FileAccess, Schemas, matchesSomeScheme } from 'vs/base/common/network';
|
import { FileAccess, Schemas, matchesSomeScheme } from 'vs/base/common/network';
|
||||||
import { clamp } from 'vs/base/common/numbers';
|
import { clamp } from 'vs/base/common/numbers';
|
||||||
import { basename } from 'vs/base/common/path';
|
import { basename } from 'vs/base/common/path';
|
||||||
import { basenameOrAuthority, dirname } from 'vs/base/common/resources';
|
import { basenameOrAuthority } from 'vs/base/common/resources';
|
||||||
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
import { equalsIgnoreCase } from 'vs/base/common/strings';
|
||||||
import { ThemeIcon } from 'vs/base/common/themables';
|
import { ThemeIcon } from 'vs/base/common/themables';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
|
@ -42,7 +42,6 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||||
import { FileKind, FileType } from 'vs/platform/files/common/files';
|
import { FileKind, FileType } from 'vs/platform/files/common/files';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||||
import { ILabelService } from 'vs/platform/label/common/label';
|
|
||||||
import { WorkbenchCompressibleAsyncDataTree, WorkbenchList } from 'vs/platform/list/browser/listService';
|
import { WorkbenchCompressibleAsyncDataTree, WorkbenchList } from 'vs/platform/list/browser/listService';
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
|
@ -815,7 +814,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
|
||||||
editorOptions: {
|
editorOptions: {
|
||||||
...e.editorOptions,
|
...e.editorOptions,
|
||||||
...{
|
...{
|
||||||
selection: 'range' in e.element.reference ? e.element.reference.range : undefined
|
selection: uriOrLocation && 'range' in uriOrLocation ? uriOrLocation.range : undefined
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1225,7 +1224,6 @@ class ContentReferencesListRenderer implements IListRenderer<IChatContentReferen
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private labels: ResourceLabels,
|
private labels: ResourceLabels,
|
||||||
@ILabelService private readonly labelService: ILabelService,
|
|
||||||
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
|
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
@ -1239,19 +1237,17 @@ class ContentReferencesListRenderer implements IListRenderer<IChatContentReferen
|
||||||
const reference = data.reference;
|
const reference = data.reference;
|
||||||
templateData.label.element.style.display = 'flex';
|
templateData.label.element.style.display = 'flex';
|
||||||
if ('variableName' in reference) {
|
if ('variableName' in reference) {
|
||||||
const variable = this.chatVariablesService.getVariable(reference.variableName);
|
|
||||||
if (reference.value) {
|
if (reference.value) {
|
||||||
const uri = URI.isUri(reference.value) ? reference.value : reference.value.uri;
|
const uri = URI.isUri(reference.value) ? reference.value : reference.value.uri;
|
||||||
const title = this.labelService.getUriLabel(dirname(uri), { relative: true });
|
|
||||||
templateData.label.setResource(
|
templateData.label.setResource(
|
||||||
{
|
{
|
||||||
resource: uri,
|
resource: uri,
|
||||||
name: basenameOrAuthority(uri),
|
name: basenameOrAuthority(uri),
|
||||||
description: `#${reference.variableName}`,
|
description: `#${reference.variableName}`,
|
||||||
range: 'range' in reference.value ? reference.value.range : undefined
|
range: 'range' in reference.value ? reference.value.range : undefined
|
||||||
},
|
});
|
||||||
{ title, descriptionTitle: variable?.description });
|
|
||||||
} else {
|
} else {
|
||||||
|
const variable = this.chatVariablesService.getVariable(reference.variableName);
|
||||||
templateData.label.setLabel(`#${reference.variableName}`, undefined, { title: variable?.description });
|
templateData.label.setLabel(`#${reference.variableName}`, undefined, { title: variable?.description });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue