From 758306f81848d3bf3622b649f1e0c9ee51f236df Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Wed, 11 Dec 2024 14:00:14 -0500 Subject: [PATCH 1/3] Fix issues with busy spinner showing too many error messages (#607) --- src/LanguageServerManager.spec.ts | 33 +++++++++++++++++++++++++++++-- src/LanguageServerManager.ts | 17 ++++++++++------ 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/src/LanguageServerManager.spec.ts b/src/LanguageServerManager.spec.ts index 97060011..86b40ea2 100644 --- a/src/LanguageServerManager.spec.ts +++ b/src/LanguageServerManager.spec.ts @@ -4,9 +4,9 @@ import { LanguageServerManager } from './LanguageServerManager'; import { expect } from 'chai'; import { DefinitionRepository } from './DefinitionRepository'; import { DeclarationProvider } from './DeclarationProvider'; -import type { ExtensionContext } from 'vscode'; +import type { ExtensionContext, Disposable } from 'vscode'; import * as path from 'path'; -import { Deferred, standardizePath as s } from 'brighterscript'; +import { BusyStatus, Deferred, standardizePath as s } from 'brighterscript'; import * as fsExtra from 'fs-extra'; import URI from 'vscode-uri'; import { languageServerInfoCommand } from './commands/LanguageServerInfoCommand'; @@ -525,4 +525,33 @@ describe('LanguageServerManager', () => { `); }); }); + + describe('registerBusyStatusHandler', () => { + it('resets the timer anytime we get a new busy status', async () => { + languageServerManager['busyStatusWarningThreshold'] = 100; + + let handler: any; + const client = { + onNotification: (method, h) => { + handler = h; + return undefined as Disposable; + }, + outputChannel: { + appendLine: sinon.stub() + } + }; + languageServerManager['client'] = client as any; + + languageServerManager['registerBusyStatusHandler'](); + + handler({ status: BusyStatus.busy }); + handler({ status: BusyStatus.busy }); + handler({ status: BusyStatus.busy }); + handler({ status: BusyStatus.busy }); + + await util.sleep(200); + //we should only have 1 console print (for the final busy event we sent) + expect(client.outputChannel.appendLine.callCount).to.eql(1); + }); + }); }); diff --git a/src/LanguageServerManager.ts b/src/LanguageServerManager.ts index a9fcaf2c..c7cace8f 100644 --- a/src/LanguageServerManager.ts +++ b/src/LanguageServerManager.ts @@ -279,6 +279,11 @@ export class LanguageServerManager { return this.ready(); } + /** + * How many milliseconds to wait before showing a warning about the LSP being busy for too long + */ + private busyStatusWarningThreshold = 60_000; + private registerBusyStatusHandler() { let timeoutHandle: NodeJS.Timeout; @@ -287,19 +292,19 @@ export class LanguageServerManager { console.log(event); this.updateStatusbar(event.status === BusyStatus.busy, event.activeRuns); + //clear any existing timeout + if (timeoutHandle) { + clearTimeout(timeoutHandle); + } + //if the busy status takes too long, write a lsp log entry with details of what's still pending if (event.status === BusyStatus.busy) { timeoutHandle = setTimeout(() => { const delay = Date.now() - event.timestamp; this.client.outputChannel.appendLine(`${logger.formatTimestamp(new Date())} language server has been 'busy' for ${delay}ms. most recent busyStatus event: ${JSON.stringify(event, undefined, 4)}`); - }, 60_000); - - //clear any existing timeout - } else if (timeoutHandle) { - clearTimeout(timeoutHandle); + }, this.busyStatusWarningThreshold); } }); - } /** From 895f57a3392ee1c9fdf16d498bb1cb312f3bca8e Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Fri, 20 Dec 2024 16:31:32 -0500 Subject: [PATCH 2/3] Update changelog for v2.51.0 --- CHANGELOG.md | 28 ++++++++++ package-lock.json | 129 ++++++++++++++++------------------------------ package.json | 8 +-- 3 files changed, 75 insertions(+), 90 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c128b1f..d98dde6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +## [2.51.0](https://github.com/rokucommunity/vscode-brightscript-language/compare/v2.50.5...v2.51.0) - 2024-12-20 +### Added + - new remote commands ([#605](https://github.com/rokucommunity/vscode-brightscript-language/pull/605)) + - `AppManager` `AppMemoryMonitor` `AppMemoryMonitorEvent` coloring ([#602](https://github.com/rokucommunity/vscode-brightscript-language/pull/602)) +### Changed + - upgrade to [roku-deploy@3.12.3](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#3123---2024-12-06). Notable changes since 3.12.2: + - Fix issues with detecting "check for updates required" ([roku-deploy#181](https://github.com/rokucommunity/roku-deploy/pull/181)) + - Identify when a 577 error is thrown, send a new developer friendly message ([roku-deploy#180](https://github.com/rokucommunity/roku-deploy/pull/180)) + - upgrade to [roku-debug@0.21.13](https://github.com/rokucommunity/roku-debug/blob/master/CHANGELOG.md#02113---2024-12-20). Notable changes since 0.21.12: + - Check for two error types. Make sure we do not double display an error ([roku-debug#204](https://github.com/rokucommunity/roku-debug/pull/204)) + - Add `$children` virtual variables for `roSGNode` ([roku-debug#192](https://github.com/rokucommunity/roku-debug/pull/192)) + - Add the missing `Diagnostic` props to `BSDebugDiagnostic` ([roku-debug#203](https://github.com/rokucommunity/roku-debug/pull/203)) + - Upgrade dependencies ([roku-debug#202](https://github.com/rokucommunity/roku-debug/pull/202)) + - upgrade to [brighterscript@0.68.2](https://github.com/rokucommunity/brighterscript/blob/master/CHANGELOG.md#0682---2024-12-06). Notable changes since 0.67.8: + - Add more convenience exports from vscode-languageserver ([brighterscript#1359](https://github.com/rokucommunity/brighterscript/pull/1359)) + - Fix bug with ternary transpile for indexed set ([brighterscript#1357](https://github.com/rokucommunity/brighterscript/pull/1357)) + - Add Namespace Source Literals ([brighterscript#1353](https://github.com/rokucommunity/brighterscript/pull/1353)) + - Enhance lexer to support long numeric literals with type designators ([brighterscript#1351](https://github.com/rokucommunity/brighterscript/pull/1351)) + - Fix issues with the ast walkArray function ([brighterscript#1347](https://github.com/rokucommunity/brighterscript/pull/1347)) + - Optimize ternary transpilation for assignments ([brighterscript#1341](https://github.com/rokucommunity/brighterscript/pull/1341)) + - upgrade to [brighterscript-formatter@1.7.7](https://github.com/rokucommunity/brighterscript-formatter/blob/master/CHANGELOG.md#177---2024-12-20) +### Fixed + - issues with busy spinner showing too many error messages ([#607](https://github.com/rokucommunity/vscode-brightscript-language/pull/607)) + - syntax highlighting but for object functions ([#604](https://github.com/rokucommunity/vscode-brightscript-language/pull/604)) + - numeric literal colorization ([#603](https://github.com/rokucommunity/vscode-brightscript-language/pull/603)) + + + ## [2.50.5](https://github.com/rokucommunity/vscode-brightscript-language/compare/v2.50.4...v2.50.5) - 2024-11-06 ### Changed - Show multi-line lsp progress details ([#600](https://github.com/rokucommunity/vscode-brightscript-language/pull/600)) diff --git a/package-lock.json b/package-lock.json index 37cff692..e9ebd45a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,8 +15,8 @@ "@vscode/extension-telemetry": "^0.4.7", "array-sort": "^1.0.0", "backoff": "^2.5.0", - "brighterscript": "^0.67.8", - "brighterscript-formatter": "^1.7.6", + "brighterscript": "^0.68.2", + "brighterscript-formatter": "^1.7.7", "clone-deep": "^4.0.1", "debounce": "^1.2.0", "dotenv": "^6.2.0", @@ -37,8 +37,8 @@ "postman-request": "^2.88.1-postman.32", "pretty-bytes": "^5.6.0", "resolve": "^1.22.8", - "roku-debug": "^0.21.12", - "roku-deploy": "^3.12.2", + "roku-debug": "^0.21.13", + "roku-deploy": "^3.12.3", "roku-test-automation": "^2.0.10", "semver": "^7.1.3", "source-map": "^0.7.3", @@ -2111,6 +2111,22 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, + "node_modules/@vscode/debugadapter": { + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/@vscode/debugadapter/-/debugadapter-1.68.0.tgz", + "integrity": "sha512-D6gk5Fw2y4FV8oYmltoXpj+VAZexxJFopN/mcZ6YcgzQE9dgq2L45Aj3GLxScJOD6GeLILcxJIaA8l3v11esGg==", + "dependencies": { + "@vscode/debugprotocol": "1.68.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@vscode/debugprotocol": { + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/@vscode/debugprotocol/-/debugprotocol-1.68.0.tgz", + "integrity": "sha512-2J27dysaXmvnfuhFGhfeuxfHRXunqNPxtBoR3koiTOA9rdxWNDTa1zIFLCFMSHJ9MPTPKFcBeblsyaCJCIlQxg==" + }, "node_modules/@vscode/extension-telemetry": { "version": "0.4.10", "resolved": "https://registry.npmjs.org/@vscode/extension-telemetry/-/extension-telemetry-0.4.10.tgz", @@ -2810,9 +2826,9 @@ } }, "node_modules/brighterscript": { - "version": "0.67.8", - "resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.67.8.tgz", - "integrity": "sha512-2pQcPzW/NCEEofojLuHRDcLuQTmHssNpj1xW2oRiSFMo0YHR5cBIHrG/I71lpJwpyw/HzzK0vcEbthlOW4QVuw==", + "version": "0.68.2", + "resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.68.2.tgz", + "integrity": "sha512-KV7CcvpPRqFtlBBVNWYPR8dq7KmmKB6Ymkd6pTt1uztm1c3Fgm3DaqfT842I0yW2LZz3uIb2EKmoLDdnnjEQFQ==", "dependencies": { "@rokucommunity/bslib": "^0.1.1", "@rokucommunity/logger": "^0.3.9", @@ -2837,7 +2853,7 @@ "parse-ms": "^2.1.0", "readline": "^1.3.0", "require-relative": "^0.8.7", - "roku-deploy": "^3.12.2", + "roku-deploy": "^3.12.3", "serialize-error": "^7.0.1", "source-map": "^0.7.4", "vscode-languageserver": "^9.0.1", @@ -2853,11 +2869,11 @@ } }, "node_modules/brighterscript-formatter": { - "version": "1.7.6", - "resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.6.tgz", - "integrity": "sha512-a+VCZ/xK6Sgjfz0232MQlJ6yVXQ+YVQ+PfJbxtSprRq6mfJLDswaNnb163WmEbKAQXgbjFy+HSecPJjM8zhbbQ==", + "version": "1.7.7", + "resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.7.tgz", + "integrity": "sha512-G0Mz/MqjcLpmcOsc8MEC1AzoJEYj0YQORGO8HqFFTdOnyf5V7IUjfR/kmMh3u0QS/xbsdEx9O9QZSHgH66PA/Q==", "dependencies": { - "brighterscript": "^0.67.8", + "brighterscript": "^0.68.2", "glob-all": "^3.3.0", "jsonc-parser": "^3.0.0", "source-map": "^0.7.3", @@ -9287,13 +9303,15 @@ } }, "node_modules/roku-debug": { - "version": "0.21.12", - "resolved": "https://registry.npmjs.org/roku-debug/-/roku-debug-0.21.12.tgz", - "integrity": "sha512-DFsQYxD9mLEN89Opx+X3uXhkmCWROdG8NwQmoqZib8WDMBgVl7GwfaT9QrCfTRIidbMXbciPkhQ8zfoNNREzcw==", + "version": "0.21.13", + "resolved": "https://registry.npmjs.org/roku-debug/-/roku-debug-0.21.13.tgz", + "integrity": "sha512-GWt9EdUrGcHI2Vv+rRkKpj68Fl3FItHgUcrA6XhZMl36X3HQWUGoT6Mq4nHGTsAqHI9hUTAKsKdna8thkQ+lyA==", "dependencies": { "@rokucommunity/logger": "^0.3.9", "@types/request": "^2.48.8", - "brighterscript": "^0.67.8", + "@vscode/debugadapter": "^1.68.0", + "@vscode/debugprotocol": "^1.68.0", + "brighterscript": "^0.68.2", "dateformat": "^4.6.3", "debounce": "^1.2.1", "eol": "^0.9.1", @@ -9303,19 +9321,17 @@ "fs-extra": "^10.0.0", "natural-orderby": "^2.0.3", "portfinder": "^1.0.32", - "postman-request": "^2.88.1-postman.32", + "postman-request": "^2.88.1-postman.40", "replace-in-file": "^6.3.2", "replace-last": "^1.2.6", - "roku-deploy": "^3.12.2", + "roku-deploy": "^3.12.3", "semver": "^7.5.4", "serialize-error": "^8.1.0", "smart-buffer": "^4.2.0", "source-map": "^0.7.4", "telnet-client": "^1.4.9", - "vscode-debugadapter": "^1.49.0", - "vscode-debugprotocol": "^1.49.0", - "vscode-languageserver": "^6.1.1", - "xml2js": "^0.5.0" + "xml2js": "^0.5.0", + "yargs": "^16.2.0" }, "bin": { "roku-debug": "dist/cli.js" @@ -9358,44 +9374,12 @@ "node": ">= 10.0.0" } }, - "node_modules/roku-debug/node_modules/vscode-jsonrpc": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", - "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/roku-debug/node_modules/vscode-languageserver": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-6.1.1.tgz", - "integrity": "sha512-DueEpkUAkD5XTR4MLYNr6bQIp/UFR0/IPApgXU3YfCBCB08u2sm9hRCs6DxYZELkk++STPjpcjksR2H8qI3cDQ==", - "dependencies": { - "vscode-languageserver-protocol": "^3.15.3" - }, - "bin": { - "installServerIntoExtension": "bin/installServerIntoExtension" - } - }, - "node_modules/roku-debug/node_modules/vscode-languageserver-protocol": { - "version": "3.17.5", - "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", - "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", - "dependencies": { - "vscode-jsonrpc": "8.2.0", - "vscode-languageserver-types": "3.17.5" - } - }, - "node_modules/roku-debug/node_modules/vscode-languageserver-types": { - "version": "3.17.5", - "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", - "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" - }, "node_modules/roku-deploy": { - "version": "3.12.2", - "resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.12.2.tgz", - "integrity": "sha512-CePBiVk+6u4Pka/aq7WR4GnTW39BlAveEbhuDHQX2UfR9+4j3+YEvfXqxB0R69RU52eGfnk1ejI7H0HStEKa2Q==", + "version": "3.12.3", + "resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.12.3.tgz", + "integrity": "sha512-4gkNW/N4VeP4hKFMNUzMS9tCXm67OdLaJIPj9kBjf81Nqn7EPHfdYLVAa9sQbRV0tSNDUUM7qk5/bSLC1G653A==", "dependencies": { + "@types/request": "^2.47.0", "chalk": "^2.4.2", "dateformat": "^3.0.3", "dayjs": "^1.11.0", @@ -9408,7 +9392,7 @@ "micromatch": "^4.0.4", "moment": "^2.29.1", "parse-ms": "^2.1.0", - "postman-request": "^2.88.1-postman.32", + "postman-request": "^2.88.1-postman.40", "temp-dir": "^2.0.0", "xml2js": "^0.5.0" }, @@ -11090,33 +11074,6 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, - "node_modules/vscode-debugadapter": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/vscode-debugadapter/-/vscode-debugadapter-1.51.0.tgz", - "integrity": "sha512-mObaXD5/FH/z6aL2GDuyCLbnwLsYRCAJWgFid01vKW9Y5Si8OvINK+Tn+Yl/lRUbetjNuZW3j1euMEz6z8Yzqg==", - "deprecated": "This package has been renamed to @vscode/debugadapter, please update to the new name", - "dependencies": { - "mkdirp": "^1.0.4", - "vscode-debugprotocol": "1.51.0" - } - }, - "node_modules/vscode-debugadapter/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/vscode-debugprotocol": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.51.0.tgz", - "integrity": "sha512-dzKWTMMyebIMPF1VYMuuQj7gGFq7guR8AFya0mKacu+ayptJfaRuM0mdHCqiOth4FnRP8mPhEroFPx6Ift8wHA==", - "deprecated": "This package has been renamed to @vscode/debugprotocol, please update to the new name" - }, "node_modules/vscode-jsonrpc": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-6.0.0.tgz", diff --git a/package.json b/package.json index ad36dfc0..a70c5f9d 100644 --- a/package.json +++ b/package.json @@ -57,8 +57,8 @@ "@vscode/extension-telemetry": "^0.4.7", "array-sort": "^1.0.0", "backoff": "^2.5.0", - "brighterscript": "^0.67.8", - "brighterscript-formatter": "^1.7.6", + "brighterscript": "^0.68.2", + "brighterscript-formatter": "^1.7.7", "clone-deep": "^4.0.1", "debounce": "^1.2.0", "dotenv": "^6.2.0", @@ -79,8 +79,8 @@ "postman-request": "^2.88.1-postman.32", "pretty-bytes": "^5.6.0", "resolve": "^1.22.8", - "roku-debug": "^0.21.12", - "roku-deploy": "^3.12.2", + "roku-debug": "^0.21.13", + "roku-deploy": "^3.12.3", "roku-test-automation": "^2.0.10", "semver": "^7.1.3", "source-map": "^0.7.3", From 51d4f8349888295b84d2dbbebfc7c128d52b5a2f Mon Sep 17 00:00:00 2001 From: Bronley Plumb Date: Fri, 20 Dec 2024 16:33:04 -0500 Subject: [PATCH 3/3] 2.51.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e9ebd45a..fea500f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "brightscript", - "version": "2.50.5", + "version": "2.51.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "brightscript", - "version": "2.50.5", + "version": "2.51.0", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index a70c5f9d..841c9da0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "brightscript", "displayName": "BrightScript Language", - "version": "2.50.5", + "version": "2.51.0", "publisher": "RokuCommunity", "description": "Language support for Roku's BrightScript language.", "author": {