Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix every child of a long array being highlighted when expanded #202893

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export interface INotebookScope {

export interface INotebookVariableElement {
type: 'variable';
readonly id: number;
readonly id: string;
readonly extHostId: number;
readonly name: string;
readonly value: string;
readonly indexedChildrenCount: number;
Expand Down Expand Up @@ -46,7 +47,7 @@ export class NotebookVariableDataSource implements IAsyncDataSource<INotebookSco

let children: INotebookVariableElement[] = [];
if (parent.hasNamedChildren) {
const variables = selectedKernel.provideVariables(parent.notebook.uri, parent.id, 'named', 0, CancellationToken.None);
const variables = selectedKernel.provideVariables(parent.notebook.uri, parent.extHostId, 'named', 0, CancellationToken.None);
const childNodes = await variables
.map(variable => { return this.createVariableElement(variable, parent.notebook); })
.toPromise();
Expand Down Expand Up @@ -75,7 +76,8 @@ export class NotebookVariableDataSource implements IAsyncDataSource<INotebookSco
childNodes.push({
type: 'variable',
notebook: parent.notebook,
id: parent.id,
id: parent.id + `${start}`,
extHostId: parent.extHostId,
name: `[${start}..${end - 1}]`,
value: '',
indexedChildrenCount: end - start,
Expand All @@ -85,7 +87,7 @@ export class NotebookVariableDataSource implements IAsyncDataSource<INotebookSco
}
}
else if (parent.indexedChildrenCount > 0) {
const variables = kernel.provideVariables(parent.notebook.uri, parent.id, 'indexed', parent.indexStart ?? 0, CancellationToken.None);
const variables = kernel.provideVariables(parent.notebook.uri, parent.extHostId, 'indexed', parent.indexStart ?? 0, CancellationToken.None);

for await (const variable of variables) {
childNodes.push(this.createVariableElement(variable, parent.notebook));
Expand All @@ -112,9 +114,11 @@ export class NotebookVariableDataSource implements IAsyncDataSource<INotebookSco

private createVariableElement(variable: VariablesResult, notebook: NotebookTextModel): INotebookVariableElement {
return {
...variable,
type: 'variable',
notebook,
...variable
extHostId: variable.id,
id: `${variable.id}`
};
}
}