Source:
protected Control createDialogArea(Composite parent) { fFilteredTree = new FilteredTree(parent, SWT.BORDER, new PatternFilter(), true); TreeViewer viewer = fFilteredTree.getViewer(); viewer.setContentProvider(new SymbolsContentProvider()); IResource targetResource = LSPEclipseUtils.findResourceFor(this.fileURI.toString()); viewer.setLabelProvider(new SymbolsLabelProvider()); viewer.setUseHashlookup(true); viewer.addSelectionChangedListener(event -> { if (targetResource == null) { return; } IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (selection.isEmpty()) { return; } Object item = selection.getFirstElement(); IDocument targetDocument = FileBuffers.getTextFileBufferManager() .getTextFileBuffer(targetResource.getFullPath(), LocationKind.IFILE).getDocument(); Range range = null; if (item instanceof SymbolInformation) { range = ((SymbolInformation) item).getLocation().getRange(); } else if (item instanceof DocumentSymbol) { range = ((DocumentSymbol) item).getRange(); } else if (item instanceof Either<?, ?>) { Either<SymbolInformation, DocumentSymbol> either = (Either<SymbolInformation, DocumentSymbol>) item; if (either.isLeft()) { range = either.getLeft().getLocation().getRange(); } else if (either.isRight()) { range = either.getRight().getRange(); } } else if (item instanceof DocumentSymbolWithFile) { range = ((DocumentSymbolWithFile) item).symbol.getRange(); } if (targetDocument != null && range != null) { try { int offset = LSPEclipseUtils.toOffset(range.getStart(), targetDocument); int endOffset = LSPEclipseUtils.toOffset(range.getEnd(), targetDocument); fTextEditor.selectAndReveal(offset, endOffset - offset); } catch (BadLocationException e) { LanguageServerPlugin.logError(e); } } }); viewer.setInput(fSymbols); return fFilteredTree; }

Target:
protected Control createDialogArea(Composite parent) { fFilteredTree = new FilteredTree(parent, SWT.BORDER, new PatternFilter(), true); TreeViewer viewer = fFilteredTree.getViewer(); viewer.setContentProvider(new SymbolsContentProvider()); IResource targetResource = LSPEclipseUtils.findResourceFor(this.fileURI.toString()); viewer.setLabelProvider(new SymbolsLabelProvider()); viewer.setUseHashlookup(true); viewer.addSelectionChangedListener(event -> { if (targetResource == null) { return; } IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (selection.isEmpty()) { return; } Object item = selection.getFirstElement(); if (item instanceof Either<?, ?>) { item = ((Either<?, ?>) item).get(); } IDocument targetDocument = FileBuffers.getTextFileBufferManager() .getTextFileBuffer(targetResource.getFullPath(), LocationKind.IFILE).getDocument(); Range range = null; if (item instanceof SymbolInformation) { range = ((SymbolInformation) item).getLocation().getRange(); } else if (item instanceof DocumentSymbol) { range = ((DocumentSymbol) item).getRange(); } else if (item instanceof DocumentSymbolWithFile) { range = ((DocumentSymbolWithFile) item).symbol.getRange(); } if (targetDocument != null && range != null) { try { int offset = LSPEclipseUtils.toOffset(range.getStart(), targetDocument); int endOffset = LSPEclipseUtils.toOffset(range.getEnd(), targetDocument); fTextEditor.selectAndReveal(offset, endOffset - offset); } catch (BadLocationException e) { LanguageServerPlugin.logError(e); } } }); viewer.setInput(fSymbols); return fFilteredTree; }