类org.eclipse.lsp4j.TypeDefinitionParams源码实例Demo

下面列出了怎么用org.eclipse.lsp4j.TypeDefinitionParams的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: lemminx   文件: XMLTextDocumentService.java
@Override
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(
		TypeDefinitionParams params) {
	return computeDOMAsync(params.getTextDocument(), (cancelChecker, xmlDocument) -> {
		if (typeDefinitionLinkSupport) {
			return Either.forRight(
					getXMLLanguageService().findTypeDefinition(xmlDocument, params.getPosition(), cancelChecker));
		}
		List<? extends Location> locations = getXMLLanguageService()
				.findTypeDefinition(xmlDocument, params.getPosition(), cancelChecker) //
				.stream() //
				.map(locationLink -> XMLPositionUtility.toLocation(locationLink)) //
				.collect(Collectors.toList());
		return Either.forLeft(locations);
	});
}
 
源代码2 项目: eclipse.jdt.ls   文件: JDTLanguageServer.java
@Override
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TypeDefinitionParams position) {
	logInfo(">> document/typeDefinition");
	NavigateToTypeDefinitionHandler handler = new NavigateToTypeDefinitionHandler();
	return computeAsync((monitor) -> {
		waitForLifecycleJobs(monitor);
		return Either.forLeft((handler.typeDefinition(position, monitor)));
	});
}
 
源代码3 项目: eclipse.jdt.ls   文件: SyntaxLanguageServer.java
@Override
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TypeDefinitionParams position) {
	logInfo(">> document/typeDefinition");
	NavigateToTypeDefinitionHandler handler = new NavigateToTypeDefinitionHandler();
	return computeAsync((monitor) -> {
		waitForLifecycleJobs(monitor);
		List<? extends Location> locations = handler.typeDefinition(position, monitor);
		for (Location location : locations) {
			location.setUri(JDTUtils.replaceUriFragment(location.getUri(), SYNTAX_SERVER_ID));
		}
		return Either.forLeft(locations);
	});
}
 
源代码4 项目: eclipse.jdt.ls   文件: SyntaxServerTest.java
@Test
public void testTypeDefinition() throws Exception {
	URI fileURI = openFile("maven/salut4", "src/main/java/java/Foo.java");
	TextDocumentIdentifier identifier = new TextDocumentIdentifier(fileURI.toString());
	TypeDefinitionParams params = new TypeDefinitionParams(identifier, new Position(11, 24));
	Either<List<? extends Location>, List<? extends LocationLink>> result = server.typeDefinition(params).join();
	assertTrue(result.isLeft());
	assertNotNull(result.getLeft());
	assertEquals(1, result.getLeft().size());
	String targetUri = result.getLeft().get(0).getUri();
	assertNotNull(targetUri);
	assertEquals(ResourceUtils.toClientUri(getFileUri("maven/salut4", "src/main/java/java/Bar.java")), targetUri);
}
 
源代码5 项目: vscode-as3mxml   文件: ActionScriptServices.java
/**
 * Finds where the type of the definition referenced at the current position
 * in a text document is defined.
 */
@Override
public CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TypeDefinitionParams params)
{
    return CompletableFutures.computeAsync(compilerWorkspace.getExecutorService(), cancelToken ->
    {
        cancelToken.checkCanceled();

        //make sure that the latest changes have been passed to
        //workspace.fileChanged() before proceeding
        if(realTimeProblemsChecker != null)
        {
            realTimeProblemsChecker.updateNow();
        }

        compilerWorkspace.startBuilding();
        try
        {
            TypeDefinitionProvider provider = new TypeDefinitionProvider(workspaceFolderManager, fileTracker);
            return provider.typeDefinition(params, cancelToken);
        }
        finally
        {
            compilerWorkspace.doneBuilding();
        }
    });
}
 
源代码6 项目: lsp4j   文件: TextDocumentService.java
/**
 * The goto type definition request is sent from the client to the server to resolve
 * the type definition location of a symbol at a given text document position.
 * 
 * Registration Options: TextDocumentRegistrationOptions
 * 
 * Since version 3.6.0
 */
@JsonRequest
@ResponseJsonAdapter(LocationLinkListAdapter.class)
default CompletableFuture<Either<List<? extends Location>, List<? extends LocationLink>>> typeDefinition(TypeDefinitionParams params) {
	throw new UnsupportedOperationException();
}
 
 类所在包
 类方法
 同包方法