当前位置: 首页>>代码示例>>Java>>正文


Java ServiceEndpoints.getSupportedMethods方法代码示例

本文整理汇总了Java中org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints.getSupportedMethods方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceEndpoints.getSupportedMethods方法的具体用法?Java ServiceEndpoints.getSupportedMethods怎么用?Java ServiceEndpoints.getSupportedMethods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints的用法示例。


在下文中一共展示了ServiceEndpoints.getSupportedMethods方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNullResponse

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Test public void testNullResponse() throws InterruptedException, ExecutionException {
	Endpoint endpoint = ServiceEndpoints.toEndpoint(this);
	Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(LanguageServer.class);
	MessageJsonHandler handler = new MessageJsonHandler(methods);
	List<Message> msgs = new ArrayList<>();
	MessageConsumer consumer = (message) -> {
		msgs.add(message);
	};
	RemoteEndpoint re = new RemoteEndpoint(consumer, endpoint);
	
	RequestMessage request = new RequestMessage();
	request.setId("1");
	request.setMethod("shutdown");
	re.consume(request);
	Assert.assertEquals("{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"result\":null}", handler.serialize(msgs.get(0)));
	msgs.clear();
	shutdownReturn = new Object();
	re.consume(request);
	Assert.assertEquals("{\"jsonrpc\":\"2.0\",\"id\":\"1\",\"result\":{}}", handler.serialize(msgs.get(0)));
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:21,代码来源:NullResponseTest.java

示例2: testRpcMethods_02

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Test public void testRpcMethods_02() {
	Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(Bar.class);
	
	final JsonRpcMethod requestMethod = methods.get("bar/doStuff");
	assertEquals("bar/doStuff", requestMethod.getMethodName());
	assertEquals(2, requestMethod.getParameterTypes().length);
	assertEquals(String.class, requestMethod.getParameterTypes()[0]);
	assertEquals(Integer.class, requestMethod.getParameterTypes()[1]);
	assertFalse(requestMethod.isNotification());
	
	final JsonRpcMethod notificationMethod = methods.get("bar/myNotification");
	assertEquals("bar/myNotification", notificationMethod.getMethodName());
	assertEquals(2, notificationMethod.getParameterTypes().length);
	assertEquals(String.class, notificationMethod.getParameterTypes()[0]);
	assertEquals(Integer.class, notificationMethod.getParameterTypes()[1]);
	assertTrue(notificationMethod.isNotification());
	
	final JsonRpcMethod delegateMethod = methods.get("hubba");
	assertEquals("hubba", delegateMethod.getMethodName());
	assertEquals(2, delegateMethod.getParameterTypes().length);
	assertEquals(String.class, delegateMethod.getParameterTypes()[0]);
	assertEquals(Integer.class, delegateMethod.getParameterTypes()[1]);
	assertTrue(delegateMethod.isNotification());
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:25,代码来源:EndpointsTest.java

示例3: setup

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Before
public void setup() {
  final Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(LanguageServer.class);
  this.jsonHandler = new MessageJsonHandler(methods) {
    @Override
    public GsonBuilder getDefaultGsonBuilder() {
      return super.getDefaultGsonBuilder().setPrettyPrinting();
    }
  };
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:11,代码来源:JsonSerializeTest.java

示例4: setup

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Before
public void setup() {
  final Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(LanguageServer.class);
  final Map<String, JsonRpcMethod> clientMethods = ServiceEndpoints.getSupportedMethods(LanguageClient.class);
  final HashMap<String, JsonRpcMethod> all = new HashMap<String, JsonRpcMethod>();
  all.putAll(methods);
  all.putAll(clientMethods);
  MessageJsonHandler _messageJsonHandler = new MessageJsonHandler(all);
  this.jsonHandler = _messageJsonHandler;
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:11,代码来源:JsonParseTest.java

示例5: testRpcMethods_01

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Test public void testRpcMethods_01() {
	Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(Foo.class);
	
	assertEquals("foo/doStuff", methods.get("foo/doStuff").getMethodName());
	assertEquals(String.class, methods.get("foo/doStuff").getParameterTypes()[0]);
	assertFalse(methods.get("foo/doStuff").isNotification());
	
	assertEquals("foo/myNotification", methods.get("foo/myNotification").getMethodName());
	assertEquals(String.class, methods.get("foo/myNotification").getParameterTypes()[0]);
	assertTrue(methods.get("foo/myNotification").isNotification());
	
	assertEquals("hubba", methods.get("hubba").getMethodName());
	assertEquals(String.class, methods.get("hubba").getParameterTypes()[0]);
	assertTrue(methods.get("hubba").isNotification());
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:16,代码来源:EndpointsTest.java

示例6: testIssue107

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Test public void testIssue107() {
	Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(StringConsumer.class);
	final JsonRpcMethod method = methods.get("consumer/accept");
	assertEquals("consumer/accept", method.getMethodName());
	assertEquals(1, method.getParameterTypes().length);
	assertEquals(String.class, method.getParameterTypes()[0]);
	assertTrue(method.isNotification());
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:9,代码来源:EndpointsTest.java

示例7: testDocumentSymbol

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Test public void testDocumentSymbol() {
	Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(TextDocumentService.class);
	JsonRpcMethod jsonRpcMethod = methods.get("textDocument/documentSymbol");
	Assert.assertNotNull(jsonRpcMethod);
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:6,代码来源:RpcMethodTest.java

示例8: testCodelensResolve

import org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints; //导入方法依赖的package包/类
@Test public void testCodelensResolve() {
	Map<String, JsonRpcMethod> methods = ServiceEndpoints.getSupportedMethods(TextDocumentService.class);
	Assert.assertNotNull(methods.get("codeLens/resolve"));
	Assert.assertNotNull(methods.get("completionItem/resolve"));
}
 
开发者ID:eclipse,项目名称:lsp4j,代码行数:6,代码来源:RpcMethodTest.java


注:本文中的org.eclipse.lsp4j.jsonrpc.services.ServiceEndpoints.getSupportedMethods方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。