本文整理汇总了Java中org.eclipse.lsp4j.services.LanguageClient类的典型用法代码示例。如果您正苦于以下问题:Java LanguageClient类的具体用法?Java LanguageClient怎么用?Java LanguageClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LanguageClient类属于org.eclipse.lsp4j.services包,在下文中一共展示了LanguageClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
public static void main(final String[] args) {
try {
ServerModule _serverModule = new ServerModule();
final Injector injector = Guice.createInjector(_serverModule);
final LanguageServer languageServer = injector.<LanguageServer>getInstance(LanguageServer.class);
final ServerSocketChannel serverSocket = ServerSocketChannel.open();
InetSocketAddress _inetSocketAddress = new InetSocketAddress("localhost", 5007);
serverSocket.bind(_inetSocketAddress);
final SocketChannel socketChannel = serverSocket.accept();
InputStream _newInputStream = Channels.newInputStream(socketChannel);
OutputStream _newOutputStream = Channels.newOutputStream(socketChannel);
PrintWriter _printWriter = new PrintWriter(System.out);
final Launcher<LanguageClient> launcher = LSPLauncher.createServerLauncher(languageServer, _newInputStream, _newOutputStream, true, _printWriter);
launcher.startListening().get();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:SocketServerLauncher.java
示例2: setup
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Before public void setup() throws IOException {
PipedInputStream inClient = new PipedInputStream();
PipedOutputStream outClient = new PipedOutputStream();
PipedInputStream inServer = new PipedInputStream();
PipedOutputStream outServer = new PipedOutputStream();
inClient.connect(outServer);
outClient.connect(inServer);
server = new AssertingEndpoint();
serverLauncher = LSPLauncher.createServerLauncher(ServiceEndpoints.toServiceObject(server, LanguageServer.class), inServer, outServer);
serverListening = serverLauncher.startListening();
client = new AssertingEndpoint();
clientLauncher = LSPLauncher.createClientLauncher(ServiceEndpoints.toServiceObject(client, LanguageClient.class), inClient, outClient);
clientListening = clientLauncher.startListening();
}
开发者ID:eclipse,项目名称:lsp4j,代码行数:17,代码来源:LauncherTest.java
示例3: launch
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Override
public LanguageServer launch(String projectPath, LanguageClient client)
throws LanguageServerException {
try {
Socket socket = new Socket(host, port);
socket.setKeepAlive(true);
InputStream inputStream = socket.getInputStream();
OutputStream outputStream = socket.getOutputStream();
Launcher<LanguageServer> launcher =
Launcher.createLauncher(client, LanguageServer.class, inputStream, outputStream);
launcher.startListening();
return launcher.getRemoteProxy();
} catch (IOException e) {
throw new LanguageServerException(
"Can't launch language server for project: " + projectPath, e);
}
}
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:SocketLsLauncherProvider.java
示例4: PomReconciler
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
public PomReconciler(
MavenProjectManager mavenProjectManager,
EditorWorkingCopyManager editorWorkingCopyManager,
EventService eventService,
LanguageClient client) {
this.mavenProjectManager = mavenProjectManager;
this.editorWorkingCopyManager = editorWorkingCopyManager;
this.eventService = eventService;
this.client = client;
editorContentUpdateEventSubscriber =
new EventSubscriber<EditorWorkingCopyUpdatedEvent>() {
@Override
public void onEvent(EditorWorkingCopyUpdatedEvent event) {
onEditorContentUpdated(event);
}
};
eventService.subscribe(editorContentUpdateEventSubscriber);
}
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:PomReconciler.java
示例5: run
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
/**
* Listen for requests from the parent node process. Send replies asynchronously. When the
* request stream is closed, wait for 5s for all outstanding responses to compute, then return.
*/
public static void run(Socket connection) throws IOException {
JavaLanguageServer server = new JavaLanguageServer();
Launcher<LanguageClient> launcher =
LSPLauncher.createServerLauncher(
server, connection.getInputStream(), connection.getOutputStream());
server.installClient(launcher.getRemoteProxy());
launcher.startListening();
LOG.info(String.format("java.version is %s", System.getProperty("java.version")));
}
开发者ID:georgewfraser,项目名称:vscode-javac,代码行数:15,代码来源:Main.java
示例6: installClient
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
void installClient(LanguageClient client) {
this.client.complete(client);
Handler sendToClient =
new Handler() {
@Override
public void publish(LogRecord record) {
String message = record.getMessage();
if (record.getThrown() != null) {
StringWriter trace = new StringWriter();
record.getThrown().printStackTrace(new PrintWriter(trace));
message += "\n" + trace;
}
client.logMessage(
new MessageParams(
messageType(record.getLevel().intValue()), message));
}
private MessageType messageType(int level) {
if (level >= Level.SEVERE.intValue()) return MessageType.Error;
else if (level >= Level.WARNING.intValue()) return MessageType.Warning;
else if (level >= Level.INFO.intValue()) return MessageType.Info;
else return MessageType.Log;
}
@Override
public void flush() {}
@Override
public void close() throws SecurityException {}
};
Logger.getLogger("").addHandler(sendToClient);
}
开发者ID:georgewfraser,项目名称:vscode-javac,代码行数:38,代码来源:JavaLanguageServer.java
示例7: JavaWorkspaceService
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
JavaWorkspaceService(
CompletableFuture<LanguageClient> client,
JavaLanguageServer server,
JavaTextDocumentService textDocuments) {
this.client = client;
this.server = server;
this.textDocuments = textDocuments;
}
开发者ID:georgewfraser,项目名称:vscode-javac,代码行数:9,代码来源:JavaWorkspaceService.java
示例8: getJavaLanguageServer
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
private static JavaLanguageServer getJavaLanguageServer(
Path workspaceRoot, LanguageClient client) {
JavaLanguageServer server = new JavaLanguageServer();
InitializeParams init = new InitializeParams();
init.setRootPath(workspaceRoot.toString());
server.initialize(init);
server.installClient(client);
server.maxItems = 100;
return server;
}
开发者ID:georgewfraser,项目名称:vscode-javac,代码行数:15,代码来源:LanguageServerFixture.java
示例9: initialize
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Override
public void initialize(final ILanguageServerAccess access) {
this.access = access;
this.access.addBuildListener(this);
LanguageClient _languageClient = access.getLanguageClient();
this.client = ServiceEndpoints.<TestLangLSPExtension.CustomClient>toServiceObject(((Endpoint) _languageClient), TestLangLSPExtension.CustomClient.class);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:TestLangLSPExtension.java
示例10: initialize
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
public void initialize(final Iterable<? extends IResourceServiceProvider> allLanguages, final ClientCapabilities capabilities, final LanguageClient client) {
this.client = client;
this.registeredCommands = HashMultimap.<String, IExecutableCommandService>create();
Boolean _elvis = null;
WorkspaceClientCapabilities _workspace = capabilities.getWorkspace();
ExecuteCommandCapabilities _executeCommand = null;
if (_workspace!=null) {
_executeCommand=_workspace.getExecuteCommand();
}
Boolean _dynamicRegistration = null;
if (_executeCommand!=null) {
_dynamicRegistration=_executeCommand.getDynamicRegistration();
}
if (_dynamicRegistration != null) {
_elvis = _dynamicRegistration;
} else {
_elvis = Boolean.valueOf(false);
}
final boolean hasDynamicRegistration = (boolean) _elvis;
for (final IResourceServiceProvider lang : allLanguages) {
{
final IExecutableCommandService service = lang.<IExecutableCommandService>get(IExecutableCommandService.class);
if ((service != null)) {
final List<String> commands = service.initialize();
for (final String c : commands) {
this.registeredCommands.put(c, service);
}
if (hasDynamicRegistration) {
final Function1<String, IDisposable> _function = (String command) -> {
return this.register(command, service);
};
service.initializeDynamicRegistration(_function);
}
}
}
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:38,代码来源:ExecutableCommandRegistry.java
示例11: setup
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的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
示例12: launch
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Override
public final LanguageServer launch(String projectPath, LanguageClient client)
throws LanguageServerException {
Process languageServerProcess = startLanguageServerProcess(projectPath);
waitCheckProcess(languageServerProcess);
return connectToLanguageServer(languageServerProcess, client);
}
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:LanguageServerLauncherTemplate.java
示例13: connectToLanguageServer
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Override
protected LanguageServer connectToLanguageServer(
Process languageServerProcess, LanguageClient client) throws LanguageServerException {
Launcher<LanguageServer> launcher =
Launcher.createLauncher(
client,
LanguageServer.class,
languageServerProcess.getInputStream(),
languageServerProcess.getOutputStream());
launcher.startListening();
return launcher.getRemoteProxy();
}
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:LocalTestLSLauncher.java
示例14: testFindServer
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Test
public void testFindServer() throws Exception {
ServerCapabilities cap = registry.initialize(PREFIX + FILE_PATH);
assertNotNull(cap);
assertEquals(cap, serverCapabilities);
Mockito.verify(initializer)
.initialize(eq(languageServerLauncher), any(LanguageClient.class), eq(PROJECT_PATH));
}
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:LanguageServerRegistryImplTest.java
示例15: connectToLanguageServer
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Override
protected LanguageServer connectToLanguageServer(
final Process languageServerProcess, LanguageClient client) {
Launcher<LanguageServer> launcher =
Launcher.createLauncher(
client,
LanguageServer.class,
languageServerProcess.getInputStream(),
languageServerProcess.getOutputStream());
launcher.startListening();
return launcher.getRemoteProxy();
}
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:TSLSLauncher.java
示例16: connectToLanguageServer
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
protected LanguageServer connectToLanguageServer(
final Process languageServerProcess, LanguageClient client) {
Launcher<LanguageServer> launcher =
Launcher.createLauncher(
client,
LanguageServer.class,
languageServerProcess.getInputStream(),
languageServerProcess.getOutputStream());
launcher.startListening();
return launcher.getRemoteProxy();
}
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:TestLanguageServerLauncher.java
示例17: connectToLanguageServer
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
protected LanguageServer connectToLanguageServer(
final Process languageServerProcess, LanguageClient client) {
Launcher<LanguageServer> launcher =
Launcher.createLauncher(
client,
LanguageServer.class,
languageServerProcess.getInputStream(),
languageServerProcess.getOutputStream());
launcher.startListening();
setYamlLanguageServer(launcher.getRemoteProxy());
return launcher.getRemoteProxy();
}
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:YamlLanguageServerLauncher.java
示例18: main
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
public static void main(String[] args) {
CamelLanguageServer server = new CamelLanguageServer();
Launcher<LanguageClient> launcher = Launcher.createLauncher(server, LanguageClient.class, System.in, System.out);
server.connect(launcher.getRemoteProxy());
launcher.startListening();
}
开发者ID:lhein,项目名称:camel-language-server,代码行数:7,代码来源:Runner.java
示例19: connect
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
@Override
public void connect(LanguageClient client) {
this.client = client;
sendLogMessageNotification(MessageType.Info, "Connected to Language Server...");
}
开发者ID:lhein,项目名称:camel-language-server,代码行数:6,代码来源:CamelLanguageServer.java
示例20: JavaTextDocumentService
import org.eclipse.lsp4j.services.LanguageClient; //导入依赖的package包/类
JavaTextDocumentService(CompletableFuture<LanguageClient> client, JavaLanguageServer server) {
this.client = client;
this.server = server;
}
开发者ID:georgewfraser,项目名称:vscode-javac,代码行数:5,代码来源:JavaTextDocumentService.java
注:本文中的org.eclipse.lsp4j.services.LanguageClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论