Search in sources :

Example 1 with TextDocumentSyncKind

use of org.eclipse.lsp4j.TextDocumentSyncKind in project eclipse.jdt.ls by eclipse.

the class InitHandlerTest method testWillSaveAndWillSaveWaitUntilCapabilities.

@Test
public void testWillSaveAndWillSaveWaitUntilCapabilities() throws Exception {
    ClientPreferences mockCapabilies = mock(ClientPreferences.class);
    when(mockCapabilies.isExecuteCommandDynamicRegistrationSupported()).thenReturn(Boolean.TRUE);
    when(preferenceManager.getClientPreferences()).thenReturn(mockCapabilies);
    when(mockCapabilies.isWillSaveRegistered()).thenReturn(Boolean.TRUE);
    when(mockCapabilies.isWillSaveWaitUntilRegistered()).thenReturn(Boolean.TRUE);
    InitializeResult result = initialize(true);
    Either<TextDocumentSyncKind, TextDocumentSyncOptions> o = result.getCapabilities().getTextDocumentSync();
    assertTrue(o.isRight());
    assertTrue(o.getRight().getWillSave());
    assertTrue(o.getRight().getWillSaveWaitUntil());
}
Also used : InitializeResult(org.eclipse.lsp4j.InitializeResult) ClientPreferences(org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences) TextDocumentSyncKind(org.eclipse.lsp4j.TextDocumentSyncKind) TextDocumentSyncOptions(org.eclipse.lsp4j.TextDocumentSyncOptions) AbstractProjectsManagerBasedTest(org.eclipse.jdt.ls.core.internal.managers.AbstractProjectsManagerBasedTest) Test(org.junit.Test)

Aggregations

AbstractProjectsManagerBasedTest (org.eclipse.jdt.ls.core.internal.managers.AbstractProjectsManagerBasedTest)1 ClientPreferences (org.eclipse.jdt.ls.core.internal.preferences.ClientPreferences)1 InitializeResult (org.eclipse.lsp4j.InitializeResult)1 TextDocumentSyncKind (org.eclipse.lsp4j.TextDocumentSyncKind)1 TextDocumentSyncOptions (org.eclipse.lsp4j.TextDocumentSyncOptions)1 Test (org.junit.Test)1