Skip to content

Commit

Permalink
Merge pull request #1445 from 1c-syntax/feature/text-document-sync-op…
Browse files Browse the repository at this point in the history
…tions

Использование более актуального TextDocumentSyncOptions в initialize
  • Loading branch information
nixel2007 authored Nov 13, 2020
2 parents 648dba9 + 726b5e5 commit 6a68976
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
import org.eclipse.lsp4j.DocumentLinkOptions;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.InitializeResult;
import org.eclipse.lsp4j.SaveOptions;
import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.lsp4j.ServerInfo;
import org.eclipse.lsp4j.TextDocumentSyncKind;
import org.eclipse.lsp4j.TextDocumentSyncOptions;
import org.eclipse.lsp4j.services.LanguageServer;
import org.eclipse.lsp4j.services.TextDocumentService;
import org.eclipse.lsp4j.services.WorkspaceService;
Expand Down Expand Up @@ -66,7 +68,7 @@ public CompletableFuture<InitializeResult> initialize(InitializeParams params) {
CompletableFuture.runAsync(context::populateContext);

ServerCapabilities capabilities = new ServerCapabilities();
capabilities.setTextDocumentSync(TextDocumentSyncKind.Full);
capabilities.setTextDocumentSync(getTextDocumentSyncOptions());
capabilities.setDocumentRangeFormattingProvider(Boolean.TRUE);
capabilities.setDocumentFormattingProvider(Boolean.TRUE);
capabilities.setFoldingRangeProvider(Boolean.TRUE);
Expand Down Expand Up @@ -134,4 +136,19 @@ public WorkspaceService getWorkspaceService() {
return workspaceService;
}

private static TextDocumentSyncOptions getTextDocumentSyncOptions() {
TextDocumentSyncOptions textDocumentSync = new TextDocumentSyncOptions();

textDocumentSync.setOpenClose(Boolean.TRUE);
textDocumentSync.setChange(TextDocumentSyncKind.Full);
textDocumentSync.setWillSave(Boolean.FALSE);
textDocumentSync.setWillSaveWaitUntil(Boolean.FALSE);

SaveOptions save = new SaveOptions();
save.setIncludeText(Boolean.FALSE);

textDocumentSync.setSave(save);

return textDocumentSync;
}
}

0 comments on commit 6a68976

Please sign in to comment.