Java 类org.eclipse.lsp4j.SymbolInformation 实例源码

项目:che    文件:WorkspaceServiceClient.java   
/**
 * GWT client implementation of {@link WorkspaceService#symbol(WorkspaceSymbolParams)}
 *
 * @param params
 * @return
 */
public Promise<List<SymbolInformation>> symbol(WorkspaceSymbolParams params) {
  return Promises.create(
      (resolve, reject) ->
          requestTransmitter
              .newRequest()
              .endpointId(WS_AGENT_JSON_RPC_ENDPOINT_ID)
              .methodName("workspace/symbol")
              .paramsAsDto(params)
              .sendAndReceiveResultAsListOfDto(SymbolInformation.class)
              .onSuccess(resolve::apply)
              .onFailure(error -> reject.apply(getPromiseError(error))));
}
项目:SOMns-vscode    文件:SomAdapter.java   
private void addAllSymbols(final ArrayList<SymbolInformation> results, final String query,
    final SomStructures probe, final String documentUri) {
  synchronized (probe) {
    Set<MixinDefinition> classes = probe.getClasses();
    for (MixinDefinition m : classes) {
      assert sameDocument(documentUri, m.getSourceSection());
      addSymbolInfo(m, query, results);
    }

    Set<SInvokable> methods = probe.getMethods();
    for (SInvokable m : methods) {
      assert sameDocument(documentUri, m.getSourceSection());

      if (matchQuery(query, m)) {
        results.add(getSymbolInfo(m));
      }
    }
  }
}
项目:SOMns-vscode    文件:SomAdapter.java   
private static void addSymbolInfo(final MixinDefinition m, final String query,
    final ArrayList<SymbolInformation> results) {
  if (matchQuery(query, m)) {
    results.add(getSymbolInfo(m));
  }

  // We add the slots here, because we have more context at this point
  for (Dispatchable d : m.getInstanceDispatchables().values()) {
    // needs to be exact test to avoid duplicate info
    if (d.getClass() == SlotDefinition.class) {
      if (matchQuery(query, (SlotDefinition) d)) {
        results.add(getSymbolInfo((SlotDefinition) d, m));
      }
    }
  }
}
项目:eclipse.jdt.ls    文件:WorkspaceSymbolHandlerTest.java   
@Test
public void testWorkspaceSearch() {
    String query = "Abstract";
    List<SymbolInformation> results = handler.search(query, monitor);
    assertNotNull(results);
    assertEquals("Found " + results.size() + " results", 33, results.size());
    Range defaultRange = JDTUtils.newRange();
    for (SymbolInformation symbol : results) {
        assertNotNull("Kind is missing", symbol.getKind());
        assertNotNull("ContainerName is missing", symbol.getContainerName());
        assertTrue(symbol.getName().startsWith(query));
        Location location = symbol.getLocation();
        assertEquals(defaultRange, location.getRange());
        //No class in the workspace project starts with Abstract, so everything comes from the JDK
        assertTrue("Unexpected uri "+ location.getUri(), location.getUri().startsWith("jdt://"));
    }
}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandlerTest.java   
@Test
public void testSyntheticMember() throws Exception {
    String className = "org.apache.commons.lang3.text.StrTokenizer";
    List<? extends SymbolInformation> symbols = getSymbols(className);
    boolean overloadedMethod1Found = false;
    boolean overloadedMethod2Found = false;
    String overloadedMethod1 = "getCSVInstance(String)";
    String overloadedMethod2 = "reset()";
    for (SymbolInformation symbol : symbols) {
        Location loc = symbol.getLocation();
        assertTrue("Class: " + className + ", Symbol:" + symbol.getName() + " - invalid location.",
                loc != null && isValid(loc.getRange()));
        assertFalse("Class: " + className + ", Symbol:" + symbol.getName() + " - invalid name",
                symbol.getName().startsWith("access$"));
        assertFalse("Class: " + className + ", Symbol:" + symbol.getName() + "- invalid name",
                symbol.getName().equals("<clinit>"));
        if (overloadedMethod1.equals(symbol.getName())) {
            overloadedMethod1Found = true;
        }
        if (overloadedMethod2.equals(symbol.getName())) {
            overloadedMethod2Found = true;
        }
    }
    assertTrue("The " + overloadedMethod1 + " method hasn't been found", overloadedMethod1Found);
    assertTrue("The " + overloadedMethod2 + " method hasn't been found", overloadedMethod2Found);
}
项目:xtext-core    文件:AbstractLanguageServerTest.java   
protected void testDocumentSymbol(final Procedure1<? super DocumentSymbolConfiguraiton> configurator) {
  try {
    @Extension
    final DocumentSymbolConfiguraiton configuration = new DocumentSymbolConfiguraiton();
    configuration.setFilePath(("MyModel." + this.fileExtension));
    configurator.apply(configuration);
    final String fileUri = this.initializeContext(configuration).getUri();
    TextDocumentIdentifier _textDocumentIdentifier = new TextDocumentIdentifier(fileUri);
    DocumentSymbolParams _documentSymbolParams = new DocumentSymbolParams(_textDocumentIdentifier);
    final CompletableFuture<List<? extends SymbolInformation>> symbolsFuture = this.languageServer.documentSymbol(_documentSymbolParams);
    final List<? extends SymbolInformation> symbols = symbolsFuture.get();
    Procedure1<? super List<? extends SymbolInformation>> _assertSymbols = configuration.getAssertSymbols();
    boolean _tripleNotEquals = (_assertSymbols != null);
    if (_tripleNotEquals) {
      configuration.getAssertSymbols().apply(symbols);
    } else {
      final String actualSymbols = this.toExpectation(symbols);
      this.assertEquals(configuration.getExpectedSymbols(), actualSymbols);
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:xtext-core    文件:AbstractLanguageServerTest.java   
protected void testSymbol(final Procedure1<? super WorkspaceSymbolConfiguraiton> configurator) {
  try {
    @Extension
    final WorkspaceSymbolConfiguraiton configuration = new WorkspaceSymbolConfiguraiton();
    configuration.setFilePath(("MyModel." + this.fileExtension));
    configurator.apply(configuration);
    this.initializeContext(configuration);
    String _query = configuration.getQuery();
    WorkspaceSymbolParams _workspaceSymbolParams = new WorkspaceSymbolParams(_query);
    final List<? extends SymbolInformation> symbols = this.languageServer.symbol(_workspaceSymbolParams).get();
    Procedure1<? super List<? extends SymbolInformation>> _assertSymbols = configuration.getAssertSymbols();
    boolean _tripleNotEquals = (_assertSymbols != null);
    if (_tripleNotEquals) {
      configuration.getAssertSymbols().apply(symbols);
    } else {
      final String actualSymbols = this.toExpectation(symbols);
      this.assertEquals(configuration.getExpectedSymbols(), actualSymbols);
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
项目:xtext-core    文件:LanguageServerImpl.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> documentSymbol(final DocumentSymbolParams params) {
  final Function1<CancelIndicator, List<? extends SymbolInformation>> _function = (CancelIndicator cancelIndicator) -> {
    final URI uri = this._uriExtensions.toUri(params.getTextDocument().getUri());
    final IResourceServiceProvider resourceServiceProvider = this.languagesRegistry.getResourceServiceProvider(uri);
    DocumentSymbolService _get = null;
    if (resourceServiceProvider!=null) {
      _get=resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
    }
    final DocumentSymbolService documentSymbolService = _get;
    if ((documentSymbolService == null)) {
      return CollectionLiterals.<SymbolInformation>emptyList();
    }
    final Function2<Document, XtextResource, List<? extends SymbolInformation>> _function_1 = (Document document, XtextResource resource) -> {
      return documentSymbolService.getSymbols(document, resource, params, cancelIndicator);
    };
    return this.workspaceManager.<List<? extends SymbolInformation>>doRead(uri, _function_1);
  };
  return this.requestManager.<List<? extends SymbolInformation>>runRead(_function);
}
项目:xtext-core    文件:WorkspaceSymbolService.java   
public List<? extends SymbolInformation> getSymbols(final String query, final IReferenceFinder.IResourceAccess resourceAccess, final IResourceDescriptions indexData, final CancelIndicator cancelIndicator) {
  final LinkedList<SymbolInformation> result = CollectionLiterals.<SymbolInformation>newLinkedList();
  Iterable<IResourceDescription> _allResourceDescriptions = indexData.getAllResourceDescriptions();
  for (final IResourceDescription resourceDescription : _allResourceDescriptions) {
    {
      this.operationCanceledManager.checkCanceled(cancelIndicator);
      final IResourceServiceProvider resourceServiceProvider = this._registry.getResourceServiceProvider(resourceDescription.getURI());
      DocumentSymbolService _get = null;
      if (resourceServiceProvider!=null) {
        _get=resourceServiceProvider.<DocumentSymbolService>get(DocumentSymbolService.class);
      }
      final DocumentSymbolService documentSymbolService = _get;
      if ((documentSymbolService != null)) {
        List<? extends SymbolInformation> _symbols = documentSymbolService.getSymbols(resourceDescription, query, resourceAccess, cancelIndicator);
        Iterables.<SymbolInformation>addAll(result, _symbols);
      }
    }
  }
  return result;
}
项目:xtext-core    文件:DocumentSymbolService.java   
public List<? extends SymbolInformation> getSymbols(final XtextResource resource, final CancelIndicator cancelIndicator) {
  final LinkedHashMap<EObject, SymbolInformation> symbols = CollectionLiterals.<EObject, SymbolInformation>newLinkedHashMap();
  final TreeIterator<Object> contents = EcoreUtil.<Object>getAllProperContents(resource, true);
  while (contents.hasNext()) {
    {
      this.operationCanceledManager.checkCanceled(cancelIndicator);
      Object _next = contents.next();
      final EObject obj = ((EObject) _next);
      final SymbolInformation symbol = this.createSymbol(obj);
      if ((symbol != null)) {
        symbols.put(obj, symbol);
        final EObject container = this.getContainer(obj);
        final SymbolInformation containerSymbol = symbols.get(container);
        String _name = null;
        if (containerSymbol!=null) {
          _name=containerSymbol.getName();
        }
        symbol.setContainerName(_name);
      }
    }
  }
  return IterableExtensions.<SymbolInformation>toList(symbols.values());
}
项目:xtext-core    文件:DocumentSymbolService.java   
protected SymbolInformation createSymbol(final EObject object) {
  final String name = this.getSymbolName(object);
  if ((name == null)) {
    return null;
  }
  final SymbolKind kind = this.getSymbolKind(object);
  if ((kind == null)) {
    return null;
  }
  final Location location = this.getSymbolLocation(object);
  if ((location == null)) {
    return null;
  }
  final SymbolInformation symbol = new SymbolInformation();
  symbol.setName(name);
  symbol.setKind(kind);
  symbol.setLocation(location);
  return symbol;
}
项目:xtext-core    文件:DocumentSymbolService.java   
public List<? extends SymbolInformation> getSymbols(final IResourceDescription resourceDescription, final String query, final IReferenceFinder.IResourceAccess resourceAccess, final CancelIndicator cancelIndicator) {
  final LinkedList<SymbolInformation> symbols = CollectionLiterals.<SymbolInformation>newLinkedList();
  Iterable<IEObjectDescription> _exportedObjects = resourceDescription.getExportedObjects();
  for (final IEObjectDescription description : _exportedObjects) {
    {
      this.operationCanceledManager.checkCanceled(cancelIndicator);
      boolean _filter = this.filter(description, query);
      if (_filter) {
        final Procedure1<SymbolInformation> _function = (SymbolInformation symbol) -> {
          symbols.add(symbol);
        };
        this.createSymbol(description, resourceAccess, _function);
      }
    }
  }
  return symbols;
}
项目:che    文件:FindSymbolAction.java   
private Promise<List<SymbolEntry>> searchSymbols(final String value) {
  ExtendedWorkspaceSymbolParams params =
      dtoFactory.createDto(ExtendedWorkspaceSymbolParams.class);
  params.setQuery(value);
  params.setFileUri(
      editorAgent.getActiveEditor().getEditorInput().getFile().getLocation().toString());
  return workspaceServiceClient
      .symbol(params)
      .then(
          new Function<List<SymbolInformation>, List<SymbolEntry>>() {
            @Override
            public List<SymbolEntry> apply(List<SymbolInformation> types)
                throws FunctionException {
              return toSymbolEntries(types, value);
            }
          });
}
项目:languagetool-languageserver    文件:NoOpWorkspaceService.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> symbol(WorkspaceSymbolParams params) {
    return null;
}
项目:SOMns-vscode    文件:SomLanguageServer.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> documentSymbol(
    final DocumentSymbolParams params) {
  List<? extends SymbolInformation> result =
      som.getSymbolInfo(params.getTextDocument().getUri());
  return CompletableFuture.completedFuture(result);
}
项目:SOMns-vscode    文件:SomAdapter.java   
public List<? extends SymbolInformation> getSymbolInfo(final String documentUri) {
  SomStructures probe = getProbe(documentUri);
  ArrayList<SymbolInformation> results = new ArrayList<>();
  if (probe == null) {
    return results;
  }

  addAllSymbols(results, null, probe, documentUri);
  return results;
}
项目:SOMns-vscode    文件:SomAdapter.java   
public List<? extends SymbolInformation> getAllSymbolInfo(final String query) {
  Collection<SomStructures> probes = getProbes();

  ArrayList<SymbolInformation> results = new ArrayList<>();

  for (SomStructures probe : probes) {
    addAllSymbols(results, query, probe, probe.getDocumentUri());
  }

  return results;
}
项目:SOMns-vscode    文件:SomAdapter.java   
private static SymbolInformation getSymbolInfo(final SInvokable m) {
  SymbolInformation sym = new SymbolInformation();
  sym.setName(m.getSignature().toString());
  sym.setKind(SymbolKind.Method);
  if (null != m.getSourceSection()) {
    sym.setLocation(getLocation(m.getSourceSection()));
  }
  if (m.getHolderUnsafe() != null) {
    sym.setContainerName(m.getHolder().getName().getString());
  }
  return sym;
}
项目:SOMns-vscode    文件:SomAdapter.java   
private static SymbolInformation getSymbolInfo(final SlotDefinition d,
    final MixinDefinition m) {
  SymbolInformation sym = new SymbolInformation();
  sym.setName(d.getName().getString());
  SymbolKind kind = m.isModule() ? SymbolKind.Constant
      : SymbolKind.Property;
  sym.setKind(kind);
  sym.setLocation(getLocation(d.getSourceSection()));
  sym.setContainerName(m.getName().getString());
  return sym;
}
项目:SOMns-vscode    文件:SomAdapter.java   
private static SymbolInformation getSymbolInfo(final MixinDefinition m) {
  SymbolInformation sym = new SymbolInformation();
  sym.setName(m.getName().getString());
  SymbolKind kind = m.isModule() ? SymbolKind.Module
      : SymbolKind.Class;
  sym.setKind(kind);
  sym.setLocation(getLocation(m.getSourceSection()));

  MixinDefinition outer = m.getOuterMixinDefinition();
  if (outer != null) {
    sym.setContainerName(outer.getName().getString());
  }
  return sym;
}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandler.java   
public List<? extends SymbolInformation> documentSymbol(DocumentSymbolParams params,
        IProgressMonitor monitor) {
    ITypeRoot unit = JDTUtils.resolveTypeRoot(params.getTextDocument().getUri());
    if (unit == null) {
        return Collections.emptyList();
    }
    SymbolInformation[] elements = this.getOutline(unit, monitor);
    return Arrays.asList(elements);
}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandler.java   
private SymbolInformation[] getOutline(ITypeRoot unit, IProgressMonitor monitor) {
    try {
        IJavaElement[] elements = unit.getChildren();
        ArrayList<SymbolInformation> symbols = new ArrayList<>(elements.length);
        collectChildren(unit, elements, symbols, monitor);
        return symbols.toArray(new SymbolInformation[symbols.size()]);
    } catch (JavaModelException e) {
        JavaLanguageServerPlugin.logException("Problem getting outline for" +  unit.getElementName(), e);
    }
    return new SymbolInformation[0];
}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandler.java   
private void collectChildren(ITypeRoot unit, IJavaElement[] elements, ArrayList<SymbolInformation> symbols,
        IProgressMonitor monitor)
        throws JavaModelException {
    for(IJavaElement element : elements ){
        if (monitor.isCanceled()) {
            return;
        }
        if(element instanceof IParent){
            collectChildren(unit, filter(((IParent) element).getChildren()), symbols, monitor);
        }
        int type = element.getElementType();
        if (type != IJavaElement.TYPE && type != IJavaElement.FIELD && type != IJavaElement.METHOD) {
            continue;
        }

        Location location = JDTUtils.toLocation(element);
        if (location != null) {
            SymbolInformation si = new SymbolInformation();
            String name = JavaElementLabels.getElementLabel(element, JavaElementLabels.ALL_DEFAULT);
            si.setName(name == null ? element.getElementName() : name);
            si.setKind(mapKind(element));
            if (element.getParent() != null) {
                si.setContainerName(element.getParent().getElementName());
            }
            location.setUri(ResourceUtils.toClientUri(location.getUri()));
            si.setLocation(location);
            if (!symbols.contains(si)) {
                symbols.add(si);
            }
        }
    }
}
项目:eclipse.jdt.ls    文件:JDTLanguageServer.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> symbol(WorkspaceSymbolParams params) {
    logInfo(">> workspace/symbol");
    WorkspaceSymbolHandler handler = new WorkspaceSymbolHandler();
    return computeAsync((cc) -> {
        return handler.search(params.getQuery(), toMonitor(cc));
    });
}
项目:eclipse.jdt.ls    文件:WorkspaceSymbolHandlerTest.java   
@Test
public void testSearchWithEmptyResults() {
    List<SymbolInformation> results = handler.search(null, monitor);
    assertNotNull(results);
    assertEquals(0, results.size());

    results = handler.search("  ", monitor);
    assertNotNull(results);
    assertEquals(0, results.size());

    results = handler.search("Abracadabra", monitor);
    assertNotNull(results);
    assertEquals(0, results.size());
}
项目:eclipse.jdt.ls    文件:WorkspaceSymbolHandlerTest.java   
@Test
public void testProjectSearch() {
    String query = "IFoo";
    List<SymbolInformation> results = handler.search(query, monitor);
    assertNotNull(results);
    assertEquals("Found "+ results.size() + " results", 1, results.size());
    SymbolInformation symbol = results.get(0);
    assertEquals(SymbolKind.Interface, symbol.getKind());
    assertEquals("java", symbol.getContainerName());
    assertEquals(query, symbol.getName());
    Location location = symbol.getLocation();
    assertEquals(JDTUtils.newRange(), location.getRange());
    assertTrue("Unexpected uri "+ location.getUri(), location.getUri().endsWith("Foo.java"));
}
项目:eclipse.jdt.ls    文件:WorkspaceSymbolHandlerTest.java   
@Test
public void testCamelCaseSearch() {
    List<SymbolInformation> results = handler.search("NPE", monitor);
    assertNotNull(results);
    assertEquals("NullPointerException", results.get(0).getName());

    results = handler.search("HaMa", monitor);
    String className = "HashMap";
    boolean foundClass = results.stream().filter(s -> className.equals(s.getName())).findFirst().isPresent();
    assertTrue("Did not find "+className, foundClass);
}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandlerTest.java   
@Test
public void testTypes() throws Exception {
    String className = "org.sample.Bar";
    List<? extends SymbolInformation> symbols = getSymbols(className);
    assertHasSymbol("Bar", "Bar.java", SymbolKind.Class, symbols);
    assertHasSymbol("main(String[])", "Bar", SymbolKind.Method, symbols);
    assertHasSymbol("MyInterface", "Bar", SymbolKind.Interface, symbols);
    assertHasSymbol("foo()", "MyInterface", SymbolKind.Method, symbols);
    assertHasSymbol("MyClass", "Bar", SymbolKind.Class, symbols);
    assertHasSymbol("bar()", "MyClass", SymbolKind.Method, symbols);

}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandlerTest.java   
private void assertHasSymbol(String expectedType, String expectedParent, SymbolKind expectedKind, Collection<? extends SymbolInformation> symbols) {
    Optional<? extends SymbolInformation> symbol = symbols.stream()
                                                         .filter(s -> expectedType.equals(s.getName()) && expectedParent.equals(s.getContainerName()))
                                                         .findFirst();
    assertTrue(expectedType + "(" + expectedParent + ")" + " is missing from " + symbols, symbol.isPresent());
    assertKind(expectedKind, symbol.get());
}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandlerTest.java   
private void testClass(String className)
        throws JavaModelException, UnsupportedEncodingException, InterruptedException, ExecutionException {
    List<? extends SymbolInformation> symbols = getSymbols(className);
    for (SymbolInformation symbol : symbols) {
        Location loc = symbol.getLocation();
        assertTrue("Class: " + className + ", Symbol:" + symbol.getName() + " - invalid location.",
                loc != null && isValid(loc.getRange()));
    }
}
项目:eclipse.jdt.ls    文件:DocumentSymbolHandlerTest.java   
private List<? extends SymbolInformation> getSymbols(String className)
        throws JavaModelException, UnsupportedEncodingException, InterruptedException, ExecutionException {
    String uri = ClassFileUtil.getURI(project, className);
    TextDocumentIdentifier identifier = new TextDocumentIdentifier(uri);
    DocumentSymbolParams params = new DocumentSymbolParams();
    params.setTextDocument(identifier);
    List<? extends SymbolInformation> symbols = handler.documentSymbol(params, monitor);
    assertTrue(symbols.size() > 0);
    return symbols;
}
项目:xtext-core    文件:AbstractLanguageServerTest.java   
protected String _toExpectation(final SymbolInformation it) {
  StringConcatenation _builder = new StringConcatenation();
  _builder.append("symbol \"");
  String _name = it.getName();
  _builder.append(_name);
  _builder.append("\" {");
  _builder.newLineIfNotEmpty();
  _builder.append("    ");
  _builder.append("kind: ");
  int _value = it.getKind().getValue();
  _builder.append(_value, "    ");
  _builder.newLineIfNotEmpty();
  _builder.append("    ");
  _builder.append("location: ");
  String _expectation = this.toExpectation(it.getLocation());
  _builder.append(_expectation, "    ");
  _builder.newLineIfNotEmpty();
  {
    boolean _isNullOrEmpty = StringExtensions.isNullOrEmpty(it.getContainerName());
    boolean _not = (!_isNullOrEmpty);
    if (_not) {
      _builder.append("    ");
      _builder.append("container: \"");
      String _containerName = it.getContainerName();
      _builder.append(_containerName, "    ");
      _builder.append("\"");
      _builder.newLineIfNotEmpty();
    }
  }
  _builder.append("}");
  _builder.newLine();
  return _builder.toString();
}
项目:xtext-core    文件:LanguageServerImpl.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> symbol(final WorkspaceSymbolParams params) {
  final Function1<CancelIndicator, List<? extends SymbolInformation>> _function = (CancelIndicator cancelIndicator) -> {
    final IResourceDescriptions indexData = this.workspaceManager.getIndex();
    return this.workspaceSymbolService.getSymbols(params.getQuery(), this.resourceAccess, indexData, cancelIndicator);
  };
  return this.requestManager.<List<? extends SymbolInformation>>runRead(_function);
}
项目:xtext-core    文件:DocumentSymbolService.java   
protected void createSymbol(final IEObjectDescription description, final IReferenceFinder.IResourceAccess resourceAccess, final Procedure1<? super SymbolInformation> acceptor) {
  final String name = this.getSymbolName(description);
  if ((name == null)) {
    return;
  }
  final SymbolKind kind = this.getSymbolKind(description);
  if ((kind == null)) {
    return;
  }
  final Procedure1<Location> _function = (Location location) -> {
    final SymbolInformation symbol = new SymbolInformation(name, kind, location);
    acceptor.apply(symbol);
  };
  this.getSymbolLocation(description, resourceAccess, _function);
}
项目:xtext-core    文件:DocumentSymbolService.java   
protected SymbolInformation createSymbol(final IEObjectDescription description) {
  final String symbolName = this.getSymbolName(description);
  if ((symbolName == null)) {
    return null;
  }
  final SymbolKind symbolKind = this.getSymbolKind(description);
  if ((symbolKind == null)) {
    return null;
  }
  final SymbolInformation symbol = new SymbolInformation();
  symbol.setName(symbolName);
  symbol.setKind(symbolKind);
  return symbol;
}
项目:che    文件:FindSymbolAction.java   
private List<SymbolEntry> toSymbolEntries(List<SymbolInformation> types, String value) {
  List<SymbolEntry> result = new ArrayList<>();
  for (SymbolInformation element : types) {
    if (!SUPPORTED_OPEN_TYPES.contains(symbolKindHelper.from(element.getKind()))) {
      continue;
    }
    List<Match> matches = fuzzyMatches.fuzzyMatch(value, element.getName());
    if (matches != null) {
      Location location = element.getLocation();
      if (location != null && location.getUri() != null) {
        String filePath = location.getUri();
        Range locationRange = location.getRange();

        TextRange range = null;
        if (locationRange != null) {
          range =
              new TextRange(
                  new TextPosition(
                      locationRange.getStart().getLine(),
                      locationRange.getStart().getCharacter()),
                  new TextPosition(
                      locationRange.getEnd().getLine(), locationRange.getEnd().getCharacter()));
        }
        result.add(
            new SymbolEntry(
                element.getName(),
                "",
                filePath,
                filePath,
                symbolKindHelper.from(element.getKind()),
                range,
                symbolKindHelper.getIcon(element.getKind()),
                editorHelper,
                matches));
      }
    }
  }
  // TODO add sorting
  return result;
}
项目:camel-language-server    文件:CamelTextDocumentService.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> documentSymbol(DocumentSymbolParams params) {
    LOGGER.info("documentSymbol: " + params.getTextDocument());
    return CompletableFuture.completedFuture(Collections.emptyList());
}
项目:camel-language-server    文件:CamelWorkspaceService.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> symbol(WorkspaceSymbolParams params) {
    LOGGER.info("SERVER: symbolQuery: " + params.getQuery());
    return CompletableFuture.completedFuture(Collections.emptyList());
}
项目:SOMns-vscode    文件:SomWorkspace.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> symbol(
    final WorkspaceSymbolParams params) {
  List<? extends SymbolInformation> result = som.getAllSymbolInfo(params.getQuery());
  return CompletableFuture.completedFuture(result);
}
项目:eclipse.jdt.ls    文件:JDTLanguageServer.java   
@Override
public CompletableFuture<List<? extends SymbolInformation>> documentSymbol(DocumentSymbolParams params) {
    logInfo(">> document/documentSymbol");
    DocumentSymbolHandler handler = new DocumentSymbolHandler();
    return computeAsync((cc) -> handler.documentSymbol(params, toMonitor(cc)));
}