This is an automated email from the ASF dual-hosted git repository. neilcsmith pushed a commit to branch delivery in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/delivery by this push: new dec7836 Assure that the decorated ranges in editor do not disappear when editor visibility changes. new ce65373 Merge pull request #3261 from entlicher/DisappearanceOfShadedRanges dec7836 is described below commit dec783610dafdac91402ab0ac79bed2e2e6552c5 Author: Martin Entlicher <martin.entlic...@oracle.com> AuthorDate: Fri Oct 22 12:21:56 2021 +0200 Assure that the decorated ranges in editor do not disappear when editor visibility changes. --- java/java.lsp.server/vscode/src/extension.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/java/java.lsp.server/vscode/src/extension.ts b/java/java.lsp.server/vscode/src/extension.ts index b4d6e20..1775d38 100644 --- a/java/java.lsp.server/vscode/src/extension.ts +++ b/java/java.lsp.server/vscode/src/extension.ts @@ -42,6 +42,7 @@ import * as launcher from './nbcode'; import {NbTestAdapter} from './testAdapter'; import { asRanges, StatusMessageRequest, ShowStatusMessageParams, QuickPickRequest, InputBoxRequest, TestProgressNotification, DebugConnector, TextEditorDecorationCreateRequest, TextEditorDecorationSetNotification, TextEditorDecorationDisposeNotification, + SetTextEditorDecorationParams } from './protocol'; import * as launchConfigurations from './launchConfigurations'; @@ -603,6 +604,7 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex } }); let decorations = new Map<string, TextEditorDecorationType>(); + let decorationParamsByUri = new Map<vscode.Uri, SetTextEditorDecorationParams>(); c.onRequest(TextEditorDecorationCreateRequest.type, param => { let decorationType = vscode.window.createTextEditorDecorationType(param); decorations.set(decorationType.key, decorationType); @@ -616,13 +618,32 @@ function doActivateWithJDK(specifiedJDK: string | null, context: ExtensionContex ); if (editorsWithUri.length > 0) { editorsWithUri[0].setDecorations(decorationType, asRanges(param.ranges)); + decorationParamsByUri.set(editorsWithUri[0].document.uri, param); } } }); + let disposableListener = vscode.window.onDidChangeVisibleTextEditors(editors => { + editors.forEach(editor => { + let decorationParams = decorationParamsByUri.get(editor.document.uri); + if (decorationParams) { + let decorationType = decorations.get(decorationParams.key); + if (decorationType) { + editor.setDecorations(decorationType, asRanges(decorationParams.ranges)); + } + } + }); + }); + context.subscriptions.push(disposableListener); c.onNotification(TextEditorDecorationDisposeNotification.type, param => { let decorationType = decorations.get(param); if (decorationType) { + decorations.delete(param); decorationType.dispose(); + decorationParamsByUri.forEach((value, key, map) => { + if (value.key == param) { + map.delete(key); + } + }); } }); handleLog(log, 'Language Client: Ready'); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists