From 358f19b8b07b59e24528c76ac3477d516a95923f Mon Sep 17 00:00:00 2001 From: Niklas Rentz Date: Tue, 23 Jul 2024 15:44:53 +0200 Subject: [PATCH] lsp: remove temporary trace region provider fix. The NPE issue fixed by this own implementation has been fixed directly in Sprotty already since its release v0.4.1, see https://github.com/theia-ide/sprotty/commit/f547be16dfeecb1e6271982788af75a079351f7c --- .../klighd/lsp/KGraphDiagramModule.xtend | 8 +--- .../lsp/utils/SimpleTraceRegionProvider.xtend | 41 ------------------- 2 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/SimpleTraceRegionProvider.xtend diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphDiagramModule.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphDiagramModule.xtend index b3065defd..e89c8a1a3 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphDiagramModule.xtend +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/KGraphDiagramModule.xtend @@ -3,7 +3,7 @@ * * http://rtsys.informatik.uni-kiel.de/kieler * - * Copyright 2018-2021 by + * Copyright 2018-2024 by * + Kiel University * + Department of Computer Science * + Real-Time and Embedded Systems Group @@ -19,12 +19,10 @@ package de.cau.cs.kieler.klighd.lsp import com.google.inject.Module import de.cau.cs.kieler.klighd.lsp.utils.KeithDiagramSelectionListener import de.cau.cs.kieler.klighd.lsp.utils.LazyTraceProvider -import de.cau.cs.kieler.klighd.lsp.utils.SimpleTraceRegionProvider import org.eclipse.sprotty.IDiagramSelectionListener import org.eclipse.sprotty.xtext.DefaultDiagramModule import org.eclipse.sprotty.xtext.IDiagramGenerator import org.eclipse.sprotty.xtext.ls.DiagramUpdater -import org.eclipse.sprotty.xtext.tracing.TextRegionProvider import org.eclipse.xtext.ide.server.WorkspaceManager import org.eclipse.xtext.naming.IQualifiedNameProvider import org.eclipse.xtext.naming.SimpleNameProvider @@ -53,10 +51,6 @@ class KGraphDiagramModule extends DefaultDiagramModule { KGraphDiagramServer } - def Class bindTraceRegionProvider() { - SimpleTraceRegionProvider - } - override bindTraceProvider() { LazyTraceProvider } diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/SimpleTraceRegionProvider.xtend b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/SimpleTraceRegionProvider.xtend deleted file mode 100644 index 175b4f0b8..000000000 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/utils/SimpleTraceRegionProvider.xtend +++ /dev/null @@ -1,41 +0,0 @@ -/* - * KIELER - Kiel Integrated Environment for Layout Eclipse RichClient - * - * http://rtsys.informatik.uni-kiel.de/kieler - * - * Copyright 2018,2019 by - * + Kiel University - * + Department of Computer Science - * + Real-Time and Embedded Systems Group - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * SPDX-License-Identifier: EPL-2.0 - */ -package de.cau.cs.kieler.klighd.lsp.utils - -import org.eclipse.emf.ecore.EObject -import org.eclipse.sprotty.xtext.tracing.TextRegionProvider -import org.eclipse.xtext.nodemodel.util.NodeModelUtils -import org.eclipse.xtext.util.TextRegion - -/** - * If Sprotty's text region provider does not find any significant region, this will instead try to highlight the text - * for the entire element that was clicked, not just its most significant part. - * - * @author nre - */ -class SimpleTraceRegionProvider extends TextRegionProvider { - /** - * Returns the text region of the entire definition of this {@link EObject}, if no more specific region is found. - */ - override TextRegion getSignificantRegion(EObject element) { - val significantRegion = super.getSignificantRegion(element) - if (significantRegion !== null) { - return significantRegion - } - return NodeModelUtils.findActualNodeFor(element).toTextRegion - } -} \ No newline at end of file