本文整理汇总了Java中org.eclipse.lsp4j.InitializeParams类的典型用法代码示例。如果您正苦于以下问题:Java InitializeParams类的具体用法?Java InitializeParams怎么用?Java InitializeParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InitializeParams类属于org.eclipse.lsp4j包,在下文中一共展示了InitializeParams类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
sendLogMessageNotification(MessageType.Info, "Initializing capabilities of the server...");
Integer processId = params.getProcessId();
if(processId != null) {
setParentProcessId(processId.longValue());
} else {
sendLogMessageNotification(MessageType.Info, "Missing Parent process ID!!");
setParentProcessId(0);
}
InitializeResult result = new InitializeResult();
ServerCapabilities capabilities = new ServerCapabilities();
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
capabilities.setCompletionProvider(new CompletionOptions(Boolean.TRUE, Arrays.asList(".","?","&", "\"", "=")));
capabilities.setHoverProvider(Boolean.TRUE);
result.setCapabilities(capabilities);
return CompletableFuture.completedFuture(result);
}
开发者ID:lhein,项目名称:camel-language-server,代码行数:22,代码来源:CamelLanguageServer.java
示例2: initializeLanguageServer
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
protected CamelLanguageServer initializeLanguageServer(String text)
throws URISyntaxException, InterruptedException, ExecutionException {
InitializeParams params = new InitializeParams();
params.setProcessId(new Random().nextInt());
params.setRootUri(getTestResource("/workspace/").toURI().toString());
CamelLanguageServer camelLanguageServer = new CamelLanguageServer();
camelLanguageServer.connect(new DummyLanguageClient());
CompletableFuture<InitializeResult> initialize = camelLanguageServer.initialize(params);
assertThat(initialize).isCompleted();
assertThat(initialize.get().getCapabilities().getCompletionProvider().getResolveProvider()).isTrue();
camelLanguageServer.getTextDocumentService().didOpen(new DidOpenTextDocumentParams(createTestTextDocument(text)));
return camelLanguageServer;
}
开发者ID:lhein,项目名称:camel-language-server,代码行数:17,代码来源:AbstractCamelLanguageServerTest.java
示例3: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
private InitializeResult initialize(boolean dynamicRegistration) throws InterruptedException, ExecutionException {
InitializeParams params = new InitializeParams();
ClientCapabilities capabilities = new ClientCapabilities();
WorkspaceClientCapabilities workspaceCapabilities = new WorkspaceClientCapabilities();
workspaceCapabilities.setDidChangeConfiguration(new DidChangeConfigurationCapabilities(dynamicRegistration));
ExecuteCommandCapabilities executeCommand = new ExecuteCommandCapabilities(dynamicRegistration);
workspaceCapabilities.setExecuteCommand(executeCommand);
capabilities.setWorkspace(workspaceCapabilities);
TextDocumentClientCapabilities textDocument = new TextDocumentClientCapabilities();
SynchronizationCapabilities synchronizationCapabilities = new SynchronizationCapabilities();
synchronizationCapabilities.setWillSave(Boolean.TRUE);
synchronizationCapabilities.setWillSaveWaitUntil(Boolean.TRUE);
capabilities.setTextDocument(textDocument);
params.setCapabilities(capabilities);
CompletableFuture<InitializeResult> result = server.initialize(params);
return result.get();
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:18,代码来源:InitHandlerTest.java
示例4: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
protected InitializeResult initialize(final Procedure1<? super InitializeParams> initializer) {
try {
InitializeParams _initializeParams = new InitializeParams();
final Procedure1<InitializeParams> _function = (InitializeParams it) -> {
it.setProcessId(Integer.valueOf(1));
it.setRootUri(this._uriExtensions.toUriString(this.root.toURI().normalize()));
};
final InitializeParams params = ObjectExtensions.<InitializeParams>operator_doubleArrow(_initializeParams, _function);
if (initializer!=null) {
initializer.apply(params);
}
return this.languageServer.initialize(params).get();
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:AbstractLanguageServerTest.java
示例5: deprecatedToBaseDir
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@Deprecated
private URI deprecatedToBaseDir(final InitializeParams params) {
String _rootPath = params.getRootPath();
boolean _tripleNotEquals = (_rootPath != null);
if (_tripleNotEquals) {
return this._uriExtensions.toUri(this._uriExtensions.toUriString(URI.createFileURI(params.getRootPath())));
}
return null;
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:10,代码来源:LanguageServerImpl.java
示例6: initializerShouldNotifyObservers
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@Test
public void initializerShouldNotifyObservers() throws Exception {
when(languageDescription.getLanguageId()).thenReturn("languageId");
when(server.initialize(any(InitializeParams.class))).thenReturn(completableFuture);
when(launcher.launch(anyString(), any())).thenReturn(server);
when(launcher.getDescription()).thenReturn(serverDescription);
when(serverDescription.getId()).thenReturn("launcherId");
doNothing().when(initializer).registerCallbacks(any(), any());
initializer.addObserver(observer);
Pair<LanguageServer, InitializeResult> initResult =
initializer.initialize(launcher, null, "/path").get();
assertEquals(server, initResult.first);
verify(observer, timeout(2000))
.onServerInitialized(eq(launcher), eq(server), any(ServerCapabilities.class), eq("/path"));
}
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:ServerInitializerImplTest.java
示例7: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@Override
public CompletableFuture<InitializeResult> initialize(final InitializeParams params) {
InitializeResult result = new InitializeResult();
ServerCapabilities cap = new ServerCapabilities();
cap.setTextDocumentSync(TextDocumentSyncKind.Full);
cap.setDocumentSymbolProvider(true);
cap.setWorkspaceSymbolProvider(true);
cap.setDefinitionProvider(true);
cap.setCodeLensProvider(new CodeLensOptions(true));
cap.setExecuteCommandProvider(
new ExecuteCommandOptions(Lists.newArrayList(SomMinitest.COMMAND)));
CompletionOptions completion = new CompletionOptions();
List<String> autoComplTrigger = new ArrayList<>();
autoComplTrigger.add("#"); // Smalltalk symbols
autoComplTrigger.add(":"); // end of keywords, to complete arguments
autoComplTrigger.add("="); // right-hand side of assignments
completion.setTriggerCharacters(autoComplTrigger);
completion.setResolveProvider(false); // TODO: look into that
cap.setCompletionProvider(completion);
result.setCapabilities(cap);
loadWorkspace(params);
return CompletableFuture.completedFuture(result);
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:29,代码来源:SomLanguageServer.java
示例8: loadWorkspace
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
private void loadWorkspace(final InitializeParams params) {
try {
som.loadWorkspace(params.getRootUri());
} catch (URISyntaxException e) {
MessageParams msg = new MessageParams();
msg.setType(MessageType.Error);
msg.setMessage("Workspace root URI invalid: " + params.getRootUri());
client.logMessage(msg);
ServerLauncher.logErr(msg.getMessage());
}
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:14,代码来源:SomLanguageServer.java
示例9: getInitializationOptions
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
private Map<?, ?> getInitializationOptions(InitializeParams params) {
Object initializationOptions = params.getInitializationOptions();
if (initializationOptions instanceof Map<?, ?>) {
return (Map<?, ?>) initializationOptions;
}
return null;
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:8,代码来源:InitHandler.java
示例10: getBaseDir
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
protected URI getBaseDir(final InitializeParams params) {
String _rootUri = params.getRootUri();
boolean _tripleNotEquals = (_rootUri != null);
if (_tripleNotEquals) {
return this._uriExtensions.toUri(params.getRootUri());
}
return this.deprecatedToBaseDir(params);
}
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:LanguageServerImpl.java
示例11: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
logInfo(">> initialize");
InitHandler handler = new InitHandler(pm, preferenceManager, client);
return CompletableFuture.completedFuture(handler.initialize(params));
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:7,代码来源:JDTLanguageServer.java
示例12: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
throw new UnsupportedOperationException();
}
开发者ID:eclipse,项目名称:lsp4j,代码行数:5,代码来源:MockLanguageServer.java
示例13: setUp
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {
this.serverCapabilities = new ServerCapabilities();
serverDescription =
new LanguageServerDescription(
"foo", Collections.singletonList("id"), Collections.emptyList());
initializeResult = new InitializeResult(serverCapabilities);
completableFuture = completedFuture(initializeResult);
when(languageServerLauncher.isAbleToLaunch()).thenReturn(true);
when(languageServerLauncher.getDescription()).thenReturn(serverDescription);
when(languageServerLauncher.isLocal()).thenReturn(true);
when(languageDescription.getLanguageId()).thenReturn("id");
when(languageDescription.getFileExtensions()).thenReturn(Collections.singletonList("txt"));
when(languageDescription.getMimeType()).thenReturn("plain/text");
when(languageServer.getTextDocumentService()).thenReturn(mock(TextDocumentService.class));
when(languageServer.initialize(any(InitializeParams.class))).thenReturn(completableFuture);
when(languageRecognizer.recognizeByPath(anyString())).thenReturn(languageDescription);
when(languageRecognizer.recognizeById(anyString())).thenReturn(languageDescription);
when(pmp.get()).thenReturn(pm);
when(clientFactory.create(anyString())).thenReturn(languageClient);
when(httpJsonRequestFactory.fromUrl(any(String.class))).thenReturn(httpJsonRequest);
when(httpJsonRequest.useGetMethod()).thenReturn(httpJsonRequest);
when(httpJsonRequest.request()).thenReturn(httpJsonResponse);
when(httpJsonResponse.asDto(any())).thenReturn(workspace);
registry =
spy(
new LanguageServerRegistryImpl(
"",
"",
httpJsonRequestFactory,
new HashSet<>(),
Collections.singleton(languageServerLauncher),
Collections.singleton(languageDescription),
pmp,
initializer,
null,
clientFactory,
languageRecognizer) {
@Override
protected String extractProjectPath(String filePath) throws LanguageServerException {
return PROJECT_PATH;
}
});
when(initializer.initialize(
any(LanguageServerLauncher.class), any(LanguageClient.class), anyString()))
.thenAnswer(invocation -> completedFuture(Pair.of(languageServer, initializeResult)));
}
开发者ID:eclipse,项目名称:che,代码行数:58,代码来源:LanguageServerRegistryImplTest.java
示例14: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
@Override
public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
ServerCapabilities capabilities = new ServerCapabilities();
capabilities.setTextDocumentSync(TextDocumentSyncKind.Incremental);
return CompletableFuture.completedFuture(new InitializeResult(capabilities));
}
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:MavenLanguageServer.java
示例15: initialize
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
/**
* The initialize request is sent as the first request from the client to
* the server.
*
* If the server receives request or notification before the initialize request it should act as follows:
* - for a request the respond should be errored with code: -32001. The message can be picked by the server.
* - notifications should be dropped, except for the exit notification. This will allow the exit a server without an initialize request.
*
* Until the server has responded to the initialize request with an InitializeResult
* the client must not sent any additional requests or notifications to the server.
*
* During the initialize request the server is allowed to sent the notifications window/showMessage,
* window/logMessage and telemetry/event as well as the window/showMessageRequest request to the client.
*/
@JsonRequest
CompletableFuture<InitializeResult> initialize(InitializeParams params);
开发者ID:eclipse,项目名称:lsp4j,代码行数:17,代码来源:LanguageServer.java
示例16: contribute
import org.eclipse.lsp4j.InitializeParams; //导入依赖的package包/类
/**
* Allows an individual language to contribute to and overwrite properties in the server's capabilities.
*/
public abstract ServerCapabilities contribute(final ServerCapabilities capabilities, final InitializeParams params);
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:ICapabilitiesContributor.java
注:本文中的org.eclipse.lsp4j.InitializeParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论