From 6efd93014aad0d15402f50f10f1da94e284194d2 Mon Sep 17 00:00:00 2001 From: nevada_scout Date: Mon, 20 Mar 2017 19:39:04 +0000 Subject: [PATCH 1/3] Update Files class to use standard URI encoding/decoding --- client/phpTest/demo/baseInclude.php | 1 + server/src/util/Files.ts | 33 +++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/client/phpTest/demo/baseInclude.php b/client/phpTest/demo/baseInclude.php index d4a7fc3..aa00bc2 100644 --- a/client/phpTest/demo/baseInclude.php +++ b/client/phpTest/demo/baseInclude.php @@ -4,3 +4,4 @@ $dbh = new ConnectionDB(); $dbh->openDbConnection(); + diff --git a/server/src/util/Files.ts b/server/src/util/Files.ts index 71f8595..76cac36 100644 --- a/server/src/util/Files.ts +++ b/server/src/util/Files.ts @@ -10,39 +10,36 @@ export class Files { public static getPathFromUri(uri: string) : string { - var path = uri; - path = path.replace("file:///", ""); - path = path.replace("%3A", ":"); + uri = uri.replace("file:///", ""); + + var decoded = decodeURIComponent(uri); - // Handle Windows and Unix paths switch (process.platform) { case 'darwin': case 'linux': - path = "/" + path; - break; + return "/" + decoded; + case 'win32': - path = path.replace(/\//g, "\\"); - break; + decoded = decoded.replace(/\//g, "\\"); + return decoded; } - - return path; } public static getUriFromPath(path: string) : string { - path = path.replace(":", "%3A"); let pathStart = "file://"; // Handle Windows paths with backslashes - switch (process.platform) { - case 'win32': - path = path.replace(/\\/g, "\/"); - pathStart = "file:///"; - break; + if (process.platform == "win32") { + path = path.replace(/\\/g, "\/"); + pathStart = "file:///"; } - path = pathStart + path; + let encoded = encodeURI(path); + + // Handle colons specially as encodeURI does not encode them + encoded = encoded.replace(":", "%3A"); - return path; + return pathStart + encoded; } } From 6bd05751834b626f408195d1518e9d1d9b45febf Mon Sep 17 00:00:00 2001 From: nevada_scout Date: Mon, 20 Mar 2017 20:03:43 +0000 Subject: [PATCH 2/3] Use a cache to optimise the suggestion builder --- server/src/suggestionBuilder.ts | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/server/src/suggestionBuilder.ts b/server/src/suggestionBuilder.ts index 9bcf0a8..2c40bc8 100644 --- a/server/src/suggestionBuilder.ts +++ b/server/src/suggestionBuilder.ts @@ -246,22 +246,14 @@ export class SuggestionBuilder // Remove duplicated (overwritten) items var filtered = []; + var cache = {}; for (var i = 0, l = toReturn.length; i < l; i++) { var item = toReturn[i]; - var found = false; - - for (var j = 0, sl = filtered.length; j < sl; j++) { - var subItem = filtered[j]; - - if (subItem.label == item.label) { - found = true; - } - } - - if (!found) { + if (!(item.label in cache)) { filtered.push(item); + cache[item.label] = true; } } @@ -996,20 +988,14 @@ export class SuggestionBuilder // Remove duplicated (overwritten) items var filtered = []; - for (var i = 0, l:number = toReturn.length; i < l; i++) { - let item = toReturn[i]; + var cache = {}; - var found = false; - for (var j = 0, sl:number = filtered.length; j < sl; j++) { - let subItem = filtered[j]; - - if (subItem.label == item.label) { - found = true; - } - } + for (var i = 0, l = toReturn.length; i < l; i++) { + var item = toReturn[i]; - if (!found) { + if (!(item.label in cache)) { filtered.push(item); + cache[item.label] = true; } } From 87967441d2fe13ad343ac1e939416862a9a4b049 Mon Sep 17 00:00:00 2001 From: nevada_scout Date: Mon, 20 Mar 2017 20:12:16 +0000 Subject: [PATCH 3/3] Update version numbers and changelog --- README.md | 5 ++++- client/CHANGELOG.md | 5 ++++- client/README.md | 5 ++++- client/package.json | 2 +- server/package.json | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7fe5a10..d82b76b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,10 @@ You can also set `php.suggest.basic` to `false` to disable VS Code's built-in ph --- -## What's new in v0.3.3 (latest release) +## What's new in v0.3.4 (latest release) +- Significant performance improvements when requesting suggestions *(up to 7,500% faster)* + +## What's new in v0.3.3 - Document symbol provider - view top level symbols in the current file - Workspace symbol provider - view top level symbols throughout the workspace - Performance improvements diff --git a/client/CHANGELOG.md b/client/CHANGELOG.md index 8c9331e..461ae5c 100644 --- a/client/CHANGELOG.md +++ b/client/CHANGELOG.md @@ -1,4 +1,7 @@ -# v0.3.3 (latest release) +# v0.3.4 (latest release) +- Significant performance improvements when requesting suggestions *(up to 7,500% faster)* + +# v0.3.3 - Document symbol provider - view top level symbols in the current file - Workspace symbol provider - view top level symbols throughout the workspace - Performance improvements diff --git a/client/README.md b/client/README.md index 7fe5a10..d82b76b 100644 --- a/client/README.md +++ b/client/README.md @@ -24,7 +24,10 @@ You can also set `php.suggest.basic` to `false` to disable VS Code's built-in ph --- -## What's new in v0.3.3 (latest release) +## What's new in v0.3.4 (latest release) +- Significant performance improvements when requesting suggestions *(up to 7,500% faster)* + +## What's new in v0.3.3 - Document symbol provider - view top level symbols in the current file - Workspace symbol provider - view top level symbols throughout the workspace - Performance improvements diff --git a/client/package.json b/client/package.json index 4514ba9..99bacab 100644 --- a/client/package.json +++ b/client/package.json @@ -9,7 +9,7 @@ }, "icon": "images/php-256.png", "license": "MIT", - "version": "0.3.3", + "version": "0.3.4", "publisher": "HvyIndustries", "engines": { "vscode": "^1.8.0" diff --git a/server/package.json b/server/package.json index f74e836..052cd51 100644 --- a/server/package.json +++ b/server/package.json @@ -1,7 +1,7 @@ { "name": "crane-lang-server", "description": "The language server for Crane", - "version": "1.1.3", + "version": "1.1.4", "author": "HVY Industries", "license": "MIT", "engines": {