Skip to content

Commit bd16e44

Browse files
authored
Merge pull request #75 from DaGhostman/develop
Release 2.4.0
2 parents 768bace + 4f080e8 commit bd16e44

9 files changed

Lines changed: 76 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
_[BC]_ Stands for *B*reaking *C*hange
44

5+
## [2.4.0]
6+
7+
### Added
8+
9+
- [JS/TS] - Show default values for params
10+
11+
### Changes
12+
13+
- [PHP] - Fix nested arrays as default values output
14+
- [JAVA] - Add handling for arrays default value
15+
516
## [2.3.1]
617

718
### Changes

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ come from external library limitations/behavior and will be fixed/normalized ASA
2727
- Python
2828
- TypeScript
2929

30-
## Known issues
31-
32-
- Having 2 classes with the exact same name in the exact file but with different namespace will the second one to mirror the first one when the `namespacePosition` configuration is set to `none` (although it might be only applicable to PHP files, others langs might also be affected)
33-
3430
## Attributions
3531

3632
- Contributors:

assets/code-28px.svg

Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

package.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vs-treeview",
33
"displayName": "File Tree View",
44
"description": "Tree View extension providing an overview of the main file symbols",
5-
"version": "2.3.1",
5+
"version": "2.4.0",
66
"author": {
77
"name": "Dimitar Dimitrov",
88
"email": "daghostman.dd@gmail.com"
@@ -35,11 +35,25 @@
3535
],
3636
"main": "./out/extension",
3737
"contributes": {
38+
"keybindings": {
39+
"key": "ctrl+alt+t",
40+
"when": "editorTextFocus",
41+
"command": "workbench.view.extension.symbol-treeview"
42+
},
43+
"viewsContainers": {
44+
"activitybar": [
45+
{
46+
"id": "symbol-treeview",
47+
"title": "File Symbol Explorer",
48+
"icon": "assets/code-28px.svg"
49+
}
50+
]
51+
},
3852
"views": {
39-
"explorer": [
53+
"symbol-treeview": [
4054
{
4155
"id": "tree-outline",
42-
"name": "Tree"
56+
"name": "Symbols"
4357
}
4458
]
4559
},

src/provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export class Provider implements vscode.TreeDataProvider<TreeItem> {
5858
},
5959
interface: {
6060
private: vscode.Uri.file(__dirname + "/../assets/ic_interface_private_24px.svg"),
61+
protected: vscode.Uri.file(__dirname + "/../assets/ic_interface_protected_24px.svg"),
6162
public: vscode.Uri.file(__dirname + "/../assets/ic_interface_public_24px.svg"),
6263
},
6364
list: {

src/providers/java.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,7 @@ export class JavaProvider implements IBaseProvider<vscode.TreeItem> {
172172
return undefined;
173173
}).filter((po) => po instanceof vscode.Range).pop();
174174

175-
const value = p.fragments[0].initializer === null
176-
? "" : p.fragments[0].initializer.escapedValue ||
177-
("new" + p.fragments[0].initializer.type.name.identifier +
178-
"(" + p.fragments[0].initializer.arguments.map((a) => {
179-
return a.escapedValue;
180-
}).join(", ") + ")");
175+
const value = this.getValue(p);
181176

182177
return {
183178
name,
@@ -220,12 +215,7 @@ export class JavaProvider implements IBaseProvider<vscode.TreeItem> {
220215
return undefined;
221216
}).filter((po) => po instanceof vscode.Range).pop();
222217

223-
const value = p.fragments[0].initializer === null
224-
? "" : p.fragments[0].initializer.escapedValue ||
225-
("new" + p.fragments[0].initializer.type.name.identifier +
226-
"(" + p.fragments[0].initializer.arguments.map((a) => {
227-
return a.escapedValue;
228-
}).join(", ") + ")");
218+
const value = this.getValue(p);
229219

230220
return {
231221
name,
@@ -386,4 +376,22 @@ export class JavaProvider implements IBaseProvider<vscode.TreeItem> {
386376
public getChildren(element?: vscode.TreeItem): Thenable<vscode.TreeItem[]> {
387377
return Promise.resolve([]);
388378
}
379+
380+
private getValue(p): string {
381+
if (p.fragments[0].initializer === null) {
382+
return "";
383+
}
384+
385+
if (p.fragments[0].initializer.node === "ArrayInitializer") {
386+
const v = p.fragments[0].initializer.expressions.map((a) => a.escapedValue).join(", ");
387+
return `[${v.length > 32 ? v.substr(0, 32) : v}]`;
388+
389+
}
390+
391+
return p.fragments[0].initializer.escapedValue ||
392+
("new" + p.fragments[0].initializer.type.name.identifier +
393+
"(" + p.fragments[0].initializer.arguments.map((a) => {
394+
return a.escapedValue;
395+
}).join(", ") + ")");
396+
}
389397
}

src/providers/php.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export class PhpProvider implements IBaseProvider<token.BaseItem> {
397397
if (x.key === null) {
398398
arr.push(x.value.value);
399399
} else {
400-
arr.push(`${x.key.value}: ${this.normalizeType(x.value.value)}`);
400+
arr.push(`${x.key.value}: ${x.value.value}`);
401401
}
402402
}
403403

src/providers/typescript.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,28 @@ export class TypescriptProvider implements IBaseProvider<vscode.TreeItem> {
317317
tree.variables = [];
318318
}
319319

320+
let v: string = vscode.window.activeTextEditor.document.getText(
321+
new vscode.Range(
322+
this.offsetToPosition(dec.start),
323+
this.offsetToPosition(dec.end),
324+
),
325+
);
326+
327+
v = v.substr(v.indexOf("=") + 1)
328+
.replace(";", "")
329+
.trim();
330+
331+
v = v.length > 32 ? v.substr(0, 32) + ".." : v;
332+
if (v.length === 0) {
333+
// well, we need to unset it
334+
v = undefined;
335+
}
336+
320337
tree.variables.push({
321338
name: `${dec.name}`,
322339
position: this.generateRangeForSelection(dec.name, dec.start),
323340
type: dec.type === undefined ? "any" : dec.type,
341+
value: v,
324342
visibility: dec.isExported === true ? "public" : "protected",
325343
} as token.IVariableToken);
326344
}

0 commit comments

Comments
 (0)