Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

* perf: optimize package monitoring in helpServer.R

### Other

* Remove the unused `r.workspaceViewer.showObjectSize` setting and obsolete object-size tooltip support

### Styling

* style: fix line length lint error in sess/R/rstudioapi.R
Expand Down
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1755,11 +1755,6 @@
"default": 8,
"markdownDescription": "Delay in milliseconds before sending each line to rterm. Requires `#r.bracketedPaste#` to be `false`."
},
"r.workspaceViewer.showObjectSize": {
"type": "boolean",
"default": false,
"markdownDescription": "Show object size when hovering over a workspace viewer item."
},
"r.workspaceViewer.removeHiddenItems": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -2052,4 +2047,4 @@
"extensionDependencies": [
"REditorSupport.r-syntax"
]
}
}
1 change: 0 additions & 1 deletion src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface GlobalEnv {
type: string;
length: number;
str: string;
size?: number;
dim?: number[],
names?: string[],
slots?: string[],
Expand Down
9 changes: 0 additions & 9 deletions src/test/testdata/session/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
],
"type": "character",
"length": 1,
"size": 112,
"str": "chr \"a\""
},
"b": {
Expand All @@ -43,7 +42,6 @@
],
"type": "integer",
"length": 1,
"size": 56,
"str": "int 1"
},
"c": {
Expand All @@ -52,7 +50,6 @@
],
"type": "double",
"length": 1,
"size": 56,
"str": "num 1.5"
},
"d": {
Expand All @@ -61,7 +58,6 @@
],
"type": "complex",
"length": 1,
"size": 64,
"str": "cplx 0+0i"
},
"e": {
Expand All @@ -70,7 +66,6 @@
],
"type": "logical",
"length": 1,
"size": 56,
"str": "logi TRUE"
},
"f": {
Expand All @@ -79,7 +74,6 @@
],
"type": "closure",
"length": 1,
"size": 1240,
"str": "function (x, ...)"
},
"g": {
Expand All @@ -88,7 +82,6 @@
],
"type": "environment",
"length": 11,
"size": 56,
"str": "<environment: R_GlobalEnv>",
"names": [
"a",
Expand All @@ -110,7 +103,6 @@
],
"type": "list",
"length": 2,
"size": 520,
"str": "List of 2\n $ a: num 1\n $ b: chr \"foo\"",
"names": [
"a",
Expand All @@ -123,7 +115,6 @@
],
"type": "list",
"length": 11,
"size": 7208,
"str": "'data.frame':\t32 obs. of 11 variables:\n $ mpg : num 21 21 ...\n $ cyl : num 6 6 ...\n $ disp: num 160 160 ...\n $ hp : num 110 110 ...\n $ drat: num 3.9 3.9 ...\n $ wt : num 2.62 ...\n $ qsec: num 16.5 ...\n $ vs : num 0 0 ...\n $ am : num 1 1 ...\n $ gear: num 4 4 ...\n $ carb: num 4 4 ...",
"names": [
"mpg",
Expand Down
21 changes: 2 additions & 19 deletions src/workspaceViewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ export class WorkspaceDataProvider implements TreeDataProvider<TreeItem> {
child.class,
child.str.replace(/\s+/g, ' ').trim(),
child.type,
0,
element.treeLevel + 1,
undefined,
child.has_children,
Expand Down Expand Up @@ -175,7 +174,6 @@ export class WorkspaceDataProvider implements TreeDataProvider<TreeItem> {
rClass: string,
str: string,
type: string,
size?: number,
dim?: number[],
hasChildren?: boolean
): GlobalEnvItem => {
Expand All @@ -184,7 +182,6 @@ export class WorkspaceDataProvider implements TreeDataProvider<TreeItem> {
rClass,
str,
type,
size,
TreeLevel.Parent,
dim,
hasChildren,
Expand All @@ -197,7 +194,6 @@ export class WorkspaceDataProvider implements TreeDataProvider<TreeItem> {
getFirstClass(globalenv[key].class),
globalenv[key].str,
globalenv[key].type,
globalenv[key].size,
globalenv[key].dim,
globalenv[key].has_children,
)) : [];
Expand Down Expand Up @@ -350,7 +346,6 @@ export class GlobalEnvItem extends TreeItem {
rClass: string,
str: string,
type: string,
size?: number,
treeLevel?: number,
dim?: number[],
hasChildren?: boolean,
Expand All @@ -372,7 +367,7 @@ export class GlobalEnvItem extends TreeItem {
rClass,
type
);
this.tooltip = this.getTooltip(label, rClass, size, treeLevel);
this.tooltip = this.getTooltip(label, rClass, treeLevel);
this.iconPath = this.getIcon(type, dim);
this.contextValue = treeLevel === 0 ? 'rootNode' : `childNode${this.treeLevel}`;
}
Expand All @@ -389,24 +384,12 @@ export class GlobalEnvItem extends TreeItem {
}
}

private getSizeString(bytes: number): string {
if (bytes < 1024) {
return `${bytes} bytes`;
} else {
const e = Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, e)).toFixed(0) + 'KMGTP'.charAt(e - 1) + 'b';
}
}

private getTooltip(
label: string,
rClass: string,
size?: number,
treeLevel?: number
): string {
if (size && treeLevel === TreeLevel.Parent) {
return `${label} (${rClass}, ${this.getSizeString(size)})`;
} else if (treeLevel === TreeLevel.Scalar) {
if (treeLevel === TreeLevel.Scalar) {
return '';
} else {
return `${label} (${rClass})`;
Expand Down
Loading