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

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

源代码1 项目: eclipse.jdt.ls   文件: InitHandlerTest.java
@Test
public void testRegisterDelayedCapability() throws Exception {
	ClientPreferences mockCapabilies = mock(ClientPreferences.class);
	when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
	when(mockCapabilies.isDocumentSymbolDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isWorkspaceSymbolDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isDocumentSymbolDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isCodeActionDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isDefinitionDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isHoverDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isReferencesDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isDocumentHighlightDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isFoldgingRangeDynamicRegistered()).thenReturn(Boolean.TRUE);
	when(mockCapabilies.isCompletionDynamicRegistered()).thenReturn(Boolean.TRUE);
	InitializeResult result = initialize(true);
	assertNull(result.getCapabilities().getDocumentSymbolProvider());
	server.initialized(new InitializedParams());
	verify(client, times(9)).registerCapability(any());
}
 
源代码2 项目: n4js   文件: N4jscCompiler.java
private void performCompile() {
	if (options.isClean()) {
		performClean();
		callback.resetCounters();
	}
	Stopwatch compilationTime = Stopwatch.createStarted();
	try (Measurement m = N4JSDataCollectors.dcBuild.getMeasurement()) {
		languageServer.initialized(new InitializedParams());
		languageServer.joinServerRequests();
	}
	printCompileResults(compilationTime.stop());
}
 
源代码3 项目: MSPaintIDE   文件: DefaultLanguageServerWrapper.java
@Override
public CompletableFuture<Void> start(File rootPath) {
    setStatus(STARTING);
    this.client = new LSPClient(this.startupLogic);

    this.rootPath = rootPath;

    try {
        var processedArgs = this.argumentPreprocessor.apply(this, new ArrayList<>(this.lspArgs));

        var streamConnectionProvider = new LSPProvider(
                () -> requestManager,
                processedArgs,
                serverPath.get());
        streamConnectionProvider.start();

        Launcher<LanguageServer> launcher =
                Launcher.createLauncher(client, LanguageServer.class, streamConnectionProvider.getInputStream(), streamConnectionProvider.getOutputStream());

        languageServer = launcher.getRemoteProxy();
        client.connect(languageServer);
        launcherFuture = launcher.startListening();

        return (startingFuture = languageServer.initialize(getInitParams()).thenApply(res -> {
            LOGGER.info("Started LSP");

            requestManager = new DefaultRequestManager(this, languageServer, client, res.getCapabilities());
            setStatus(STARTED);
            requestManager.initialized(new InitializedParams());
            setStatus(INITIALIZED);
            return res;
        }).thenRun(() -> LOGGER.info("Done starting LSP!")));

    } catch (Exception e) {
        LOGGER.error("Can't launch language server for project", e);
    }

    return CompletableFuture.runAsync(() -> {});
}
 
@Override
public void initialized(InitializedParams params)
{
    boolean canRegisterDidChangeWatchedFiles = false;
    try
    {
        canRegisterDidChangeWatchedFiles = actionScriptServices.getClientCapabilities().getWorkspace().getDidChangeWatchedFiles().getDynamicRegistration();
    }
    catch(NullPointerException e)
    {
        canRegisterDidChangeWatchedFiles = false;
    }
    if(canRegisterDidChangeWatchedFiles)
    {
        List<FileSystemWatcher> watchers = new ArrayList<>();
        //ideally, we'd only check .as, .mxml, asconfig.json, and directories
        //but there's no way to target directories without *
        watchers.add(new FileSystemWatcher("**/*"));

        String id = "as3mxml-language-server-" + Math.random();
        DidChangeWatchedFilesRegistrationOptions options = new DidChangeWatchedFilesRegistrationOptions(watchers);
        Registration registration = new Registration(id, "workspace/didChangeWatchedFiles", options);
        List<Registration> registrations = new ArrayList<>();
        registrations.add(registration);

        RegistrationParams registrationParams = new RegistrationParams(registrations);
        languageClient.registerCapability(registrationParams);
    }

    //we can't notify the client about problems until we receive this
    //initialized notification. this is the first time that we'll start
    //checking for errors.
    actionScriptServices.setInitialized();
}
 
源代码5 项目: lemminx   文件: XMLLanguageServer.java
@Override
public void initialized(InitializedParams params) {
	capabilityManager.initializeCapabilities();
}
 
源代码6 项目: n4js   文件: XLanguageServerImpl.java
@Override
public void initialized(InitializedParams params) {
	lspBuilder.initialBuild();
	clientInitialized.complete(params);
}
 
源代码7 项目: xtext-core   文件: LanguageServerImpl.java
@Override
public void initialized(InitializedParams params) {
	initialized.complete(params);
}
 
源代码8 项目: lsp4j   文件: LanguageServer.java
/**
 * The initialized notification is sent from the client to the server after
 * the client received the result of the initialize request but before the
 * client is sending any other request or notification to the server. The
 * server can use the initialized notification for example to dynamically
 * register capabilities.
 */
@JsonNotification
default void initialized(InitializedParams params) {
	initialized();
}
 
 类所在包
 类方法
 同包方法