eclipselabs/eclipse-language-service

Use TextDocumentSyncKind to sync editor content with server.

Closed this issue · 3 comments

@mickaelistria pay attention with my PR #30

It seems that some language server like JSON, CSS doesn't support incremental synch (it's stange, with my test it worked).

In other words we need to sync the full document for JSON, CSS because the server returns TextDocumentSyncKind#Full:

/**
 * Defines how the host (editor) should sync
 * document changes to the language server.
 */
export declare enum TextDocumentSyncKind {
    /**
     * Documents should not be synced at all.
     */
    None = 0,
    /**
     * Documents are synced by always sending the full content
     * of the document.
     */
    Full = 1,
    /**
     * Documents are synced by sending the full content on open.
     * After that only incremental updates to the document are
     * send.
     */
    Incremental = 2,
}

We need to check the return of getServerCapabilities().getTextDocumentSync() to know if sync must be done with incremental mean (my PR) or full mean (the old code).

Sorry for my mistake -(

If you have not time, I will try to do a PR.

Well, the previous behavior didn't check the Kind either. However, for the moment, I only have examples of language server that allow incremental sync and error report, so I don't consider it as a big bug right now.

@mickaelistria please see my PR #36

Fixed with PR #36 , thanks!