Java 类org.eclipse.lsp4j.TextDocumentSyncOptions 实例源码

项目:che    文件:LanguageServerReconcileStrategy.java   
@Inject
public LanguageServerReconcileStrategy(
    TextDocumentSynchronizeFactory synchronizeFactory,
    @Assisted ServerCapabilities serverCapabilities) {

  Either<TextDocumentSyncKind, TextDocumentSyncOptions> sync =
      serverCapabilities.getTextDocumentSync();
  TextDocumentSyncKind documentSync;
  if (sync.isLeft()) {
    documentSync = sync.getLeft();
  } else {
    documentSync = sync.getRight().getChange();
  }

  synchronize = synchronizeFactory.getSynchronize(documentSync);
}
项目:eclipse.jdt.ls    文件:InitHandlerTest.java   
@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());
}
项目:SOMns-vscode    文件:ServerCapabilities.java   
/**
 * Defines how text documents are synced. Is either a detailed structure defining each notification or
 * for backwards compatibility the TextDocumentSyncKind number.
 */
@Pure
public Either<TextDocumentSyncKind, TextDocumentSyncOptions> getTextDocumentSync() {
  return this.textDocumentSync;
}
项目:SOMns-vscode    文件:ServerCapabilities.java   
public void setTextDocumentSync(final TextDocumentSyncOptions textDocumentSync) {
  this.textDocumentSync = Either.forRight(textDocumentSync);
}
项目:lsp4j    文件:ServerCapabilities.java   
/**
 * Defines how text documents are synced. Is either a detailed structure defining each notification or
 * for backwards compatibility the TextDocumentSyncKind number.
 */
@Pure
public Either<TextDocumentSyncKind, TextDocumentSyncOptions> getTextDocumentSync() {
  return this.textDocumentSync;
}
项目:lsp4j    文件:ServerCapabilities.java   
public void setTextDocumentSync(final TextDocumentSyncOptions textDocumentSync) {
  this.textDocumentSync = Either.forRight(textDocumentSync);
}
项目:che    文件:ServerCapabilitiesOverlay.java   
public Either<TextDocumentSyncKind, TextDocumentSyncOptions> getTextDocumentSync() {
  return mergeTextDocumentSync(left.getTextDocumentSync(), right.getTextDocumentSync());
}
项目:che    文件:ServerCapabilitiesOverlay.java   
private Either<TextDocumentSyncKind, TextDocumentSyncOptions> mergeTextDocumentSync(
    Either<TextDocumentSyncKind, TextDocumentSyncOptions> left,
    Either<TextDocumentSyncKind, TextDocumentSyncOptions> right) {
  if (left == null) {
    return right;
  }
  if (right == null) {
    return left;
  }
  if (left.equals(right)) {
    return left;
  }

  if (left.isLeft() && left.getLeft() == TextDocumentSyncKind.Full) {
    return left;
  }

  if (left.isLeft() && left.getLeft() == TextDocumentSyncKind.Incremental) {
    if (right.isLeft() && right.getLeft() == TextDocumentSyncKind.Full) {
      return right;
    } else {
      return left;
    }
  }

  if (left.isRight() && right.isRight()) {
    TextDocumentSyncOptions leftRight = left.getRight();
    TextDocumentSyncOptions rightRight = right.getRight();
    if (leftRight.getChange() == TextDocumentSyncKind.Full) {
      return left;
    }

    if (leftRight.getChange() == TextDocumentSyncKind.Incremental) {
      if (rightRight.getChange() == TextDocumentSyncKind.Full) {
        return right;
      } else {
        return left;
      }
    }
  }

  if (left.isLeft() && right.isRight()) {
    return right;
  }

  if (left.isRight() && right.isLeft()) {
    return left;
  }
  return right;
}
项目:SOMns-vscode    文件:ServerCapabilities.java   
/**
 * Defines how text documents are synced. Is either a detailed structure defining each notification or
 * for backwards compatibility the TextDocumentSyncKind number.
 */
public void setTextDocumentSync(final Either<TextDocumentSyncKind, TextDocumentSyncOptions> textDocumentSync) {
  this.textDocumentSync = textDocumentSync;
}
项目:lsp4j    文件:ServerCapabilities.java   
/**
 * Defines how text documents are synced. Is either a detailed structure defining each notification or
 * for backwards compatibility the TextDocumentSyncKind number.
 */
public void setTextDocumentSync(final Either<TextDocumentSyncKind, TextDocumentSyncOptions> textDocumentSync) {
  this.textDocumentSync = textDocumentSync;
}