Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 518631 - [lsp] Orion does not consider TextDocumentSyncOptions fr…
…om the server

When a document is modified by Orion, it should send
'textDocument/didChange' notifications to the server so that it knows
that the document has changed. However, depending on the server's
setting, Orion should choose to either a) not send any notifications
at all if TextDocumentSyncKind.None has been specified or b) send the
document in its entirety if the server only supports
TextDocumentSyncKind.Full.

Signed-off-by: Remy Suen <remy.suen@gmail.com>
  • Loading branch information
rcjsuen committed Jun 22, 2017
1 parent 40cd394 commit 83ed03c
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions bundles/org.eclipse.orion.client.ui/web/orion/editorView.js
Expand Up @@ -384,13 +384,27 @@ define([
return;
}
if (!evnt.start) return;
var change = {
range: Utils.getRange(editor, evnt.start, evnt.start),
rangeLength: evnt.removedCharCount,
text: evnt.text
};
var metaData = inputManager.getFileMetadata();
languageServer.didChange(metaData.Location, openedDocument.version++, [change]);

var textDocumentSync = languageServer.capabilities.textDocumentSync;
if (textDocumentSync) {
if (textDocumentSync === 1 || textDocumentSync.change === 1) {
// TextDocumentSyncKind.Full, send the entire document
var change = {
text: textView.getText()
};
var metaData = inputManager.getFileMetadata();
languageServer.didChange(metaData.Location, openedDocument.version++, [change]);
} else if (textDocumentSync === 2 || textDocumentSync.change === 2) {
// TextDocumentSyncKind.Incremental, only send what changed
var change = {
range: Utils.getRange(editor, evnt.start, evnt.start),
rangeLength: evnt.removedCharCount,
text: evnt.text
};
var metaData = inputManager.getFileMetadata();
languageServer.didChange(metaData.Location, openedDocument.version++, [change]);
}
}
});
return textView;
};
Expand Down

0 comments on commit 83ed03c

Please sign in to comment.